PLITT

allow visiting search result without the redirection overhead

当前为 2014-07-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PLITT
  3. // @version 1.0
  4. // @namespace ryenus.toys
  5. // @include http://www.google.tld/*
  6. // @include https://www.google.tld/*
  7. // @include http://www.google.co.tld/*
  8. // @include https://www.google.co.tld/*
  9. // @include http://www.google.com.tld/*
  10. // @include https://www.google.com.tld/*
  11. // @description allow visiting search result without the redirection overhead
  12. // ==/UserScript==
  13.  
  14. (function(d, t) {
  15. if (! (d.forms[0] && d.forms[0].action.match(/search/))) return;
  16. d.addEventListener('DOMSubtreeModified', function() {
  17. if (t == 0) t = setTimeout(function() {
  18. var r = d.getElementsByClassName('r'), n = r.length;
  19. if (n > d.getElementsByClassName('plitt').length) {
  20. while(n--) {
  21. var l = r[n].lastChild;
  22. l.insertAdjacentHTML("beforebegin",
  23. "<a href='" + l.href + "' target='_blank' class='plitt'>[#]</a> ");
  24. }
  25. }
  26. t = 0;
  27. }, 500);
  28. }, false);
  29. })(document, 0);