StumbleOut

Breaks the original link out of StumbleUpon frames.

当前为 2014-05-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name StumbleOut
  3. // @version 1.4
  4. // @author raina
  5. // @description Breaks the original link out of StumbleUpon frames.
  6. // @license http://www.gnu.org/licenses/gpl-3.0.txt
  7. // @namespace http://userscripts.org/users/315152
  8. // @include http://www.stumbleupon.com/su/*
  9. // @run-at document-start
  10. // @grant none
  11. // ==/UserScript==
  12. (function() {
  13. "use strict";
  14.  
  15. var link, iframe, digger = function() {
  16. if (iframe === undefined) {
  17. iframe = document.getElementById('tb-stumble-frame');
  18. if (iframe !== undefined) {
  19. window.location.href = iframe.src;
  20. }
  21. }
  22. };
  23.  
  24. if (window.self === window.top) {
  25. link = window.location.href.replace(/www\.stumbleupon\.com\/su\/[^\/]*(\/:[^\/]*)?\//, '').replace(/\/#?$/, '');
  26. if (window.location.href !== link) {
  27. window.location.href = link;
  28. } else {
  29. document.addEventListener('readystatechange', digger, false);
  30. }
  31. }
  32. }());