Greasy Fork镜像 支持简体中文。

uso-mirror

redirects userscripts.org to userscripts-mirror.org

  1. // ==UserScript==
  2. // @name uso-mirror
  3. // @namespace trespassersW
  4. // @description redirects userscripts.org to userscripts-mirror.org
  5. // @include *
  6. // @exclude http*://www.google.com/reader/*
  7. // @version 1.1.11
  8. // @created 2014-06-07
  9. // @updated 2014-06-08
  10. // @run-at document-start
  11. // @grant GM_none
  12. // ==/UserScript==
  13.  
  14. (function () { "use strict";
  15. var W = window;
  16. function _log(s){
  17. //console.log(s);
  18. }
  19. function toObj(s) {
  20. var r = {}, c = s.split('&'), t;
  21. for(var i = 0; i < c.length; i++) {
  22. t = c[i].split('=');
  23. r[decodeURIComponent(t[0])] = decodeURIComponent(t[1]);
  24. }
  25. return r;
  26. }
  27. function anchorMatch(a) {
  28. for(var k=0; a && k< 5; k++,a=a.parentNode) if(a.localName == 'a') return a;
  29. return null;
  30. }
  31. var re= /^(http)s?\:\/\/(.*?)\buserscripts\.org(\:8080)?\/(.*)/;
  32. function onDown(e) {
  33. var h,m, a = anchorMatch(e.target);
  34. if(a && a.localName == "a"){
  35. h=a.getAttribute("href");
  36. if(location.host.indexOf("google")>-1){
  37. m=a.getAttribute("onmousedown");
  38. if(m && m.indexOf("return") === 0) { //
  39. a.removeAttribute("onmousedown");
  40. }
  41. if(h) {
  42. if(h.indexOf("http://") === 0) h = h.substr(h.indexOf("/", 7));
  43. else if(h.indexOf("https://") === 0) h = h.substr(h.indexOf("/", 8));
  44. if(h.indexOf("/url?") === 0) {
  45. _log('spoil '+h);
  46. h = toObj(h.substr(5));
  47. a.setAttribute('href', decodeURIComponent(h.url || h.q));
  48. }
  49. }
  50. }
  51. h=a.getAttribute("href");
  52. if(!( h && (h=h.match(re)) && h.length==5 )) return;
  53. h = h[1]+"://userscripts-mirror.org/"+h[4];
  54. a.setAttribute('href', h);
  55. _log('USOmirror: '+a.href);
  56. }
  57. }
  58. W.addEventListener("mousedown", onDown, true);
  59. _log('uso-mirror');
  60. })();

QingJ © 2025

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