StumbleOut

Breaks the original link out of StumbleUpon frames. Now with mutation observers!

当前为 2016-09-15 提交的版本,查看 最新版本

// ==UserScript==
// @name        StumbleOut
// @version     2.1
// @author      raina
// @namespace   raina
// @description Breaks the original link out of StumbleUpon frames. Now with mutation observers!
// @license     http://www.gnu.org/licenses/gpl-3.0.txt
// @include     http://www.stumbleupon.com/su/*
// @run-at      document-start
// @grant       none
// ==/UserScript==
(function() {
	"use strict";


	var ready = function() {
		if ("complete" === document.readyState) {
			observe();
		}
	};


	var observe = function() {
		var observer = new MutationObserver(function(mutations) {
			mutations.forEach(function(mutation) {
				if ("class" === mutation.attributeName) {
					if ("undefined" === typeof iframe || !iframe) {
						iframe = document.querySelector('.stumble-frame');
					}
					if ("undefined" !== typeof iframe && iframe) {
						window.location.href = iframe.src;
						observer.disconnect();
					}
				}
			});
		});
		var config = {attributes: true};
		observer.observe(document.body, config);
	};


	if (window.self === window.top) {
		var iframe;
		document.addEventListener("readystatechange", ready, false);
	}
}());

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址