Greasy Fork is available in English.

NGA User Script Loader

NGA User Script Loader 实现两个功能:1.在页面未加载 jQuery 时加载 jQuery ;2.在点击“加载上一页/下一页”按钮后重新运行用户脚本(需脚本自身配合)。

Ovu skriptu ne treba izravno instalirati. To je biblioteka za druge skripte koje se uključuju u meta direktivu // @require https://update.greatest.deepsurf.us/scripts/39014/809809/NGA%20User%20Script%20Loader.js

  1. // ==UserScript==
  2. // @name NGA User Script Loader
  3. // @namespace https://greatest.deepsurf.us/zh-CN/scripts/39014-nga-user-script-loader
  4. // @version 0.1.0.20200528
  5. // @icon http://bbs.nga.cn/favicon.ico
  6. // @description NGA User Script Loader 实现两个功能:1.在页面未加载 jQuery 时加载 jQuery ;2.在点击“加载上一页/下一页”按钮后重新运行用户脚本(需脚本自身配合)。
  7. // @author AgLandy
  8. // @include /^https?:\/\/(bbs\.ngacn\.cc|nga\.178\.com|bbs\.nga\.cn)/
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function(){
  13.  
  14. if(!window.commonui)
  15. commonui = {};
  16.  
  17. setTimeout(function(){
  18.  
  19. try{
  20. if(commonui.userScriptLoader.$)
  21. return;
  22. }
  23. catch(e){
  24. let init = function($){
  25. let usl = commonui.userScriptLoader = {
  26. $: $,
  27. userScriptData: {},
  28. f:function(){
  29. $.each(usl.userScriptData, function(k, v){
  30. v();
  31. });
  32. },
  33. mo: new MutationObserver(function(){
  34. setTimeout(usl.f, 500);
  35. usl.moDC();
  36. }),
  37. moOB: function(e){
  38. if(e.target.nodeName != 'A')
  39. return;
  40. usl.mo.observe($('div#mc')[0], {
  41. childList: true,
  42. subtree: true,
  43. });
  44. },
  45. moDC: function(){
  46. usl.mo.disconnect();
  47. },
  48. lS: (function(s){
  49. if(!!s){
  50. try{
  51. s.testkey = 'testvalue';
  52. s.removeItem('testkey');
  53. return true;
  54. }
  55. catch(e){
  56. return false;
  57. }
  58. }
  59. else
  60. return false;
  61. })(window.localStorage)
  62. };
  63. setTimeout(function(){
  64. if(commonui.htmlLoader)
  65. commonui.htmlLoader.runScript = function(ss, i, f){
  66. if(!i)
  67. i = 0;
  68. for(; i < ss.length; i++){
  69. if(__SCRIPTS.loading){
  70. console.log('wait load ' + __SCRIPTS.loading)
  71. var alto = setTimeout(function(){
  72. var z = '';
  73. for(var k in __SCRIPTS.lg)
  74. if(__SCRIPTS.lg[k] && k == 'https://bdtj.tagtic.cn/bi-sdk.1.2.1.js')
  75. z += k + '\n';
  76. if(z){
  77. z += '加载缓慢 可尝试检查网络连接或关闭广告屏蔽';
  78. console.log(z);
  79. commonui.errorAlert(z);
  80. }
  81. }, 5000);
  82. return __SCRIPTS.wload(function(){
  83. console.log('wait load ok');
  84. clearTimeout(alto);
  85. commonui.htmlLoader.runScript(ss, i, f);
  86. });
  87. }
  88. commonui.eval.call(window, ss[i]);
  89. }
  90. if(f)
  91. f();
  92. usl.f();
  93. };
  94. else
  95. document.addEventListener('click', usl.moOB, true);
  96. }, 1000);
  97. };
  98. if(document.getElementById('ngaUSL'))
  99. return;
  100. if(typeof jQuery == 'undefined'){
  101. let s = document.createElement('script');
  102. s.type = 'text/javascript';
  103. s.src = 'https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js';
  104. s.id = 'ngaUSL';
  105. s.onload = s.onreadystatechange = function(){
  106. if(!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState){
  107. init(jQuery.noConflict());
  108. this.onload = this.onreadystatechange = null;
  109. }
  110. };
  111. document.head.appendChild(s);
  112. }
  113. else
  114. init(jQuery);
  115. }
  116.  
  117. }, Math.floor(Math.random() * 1000));
  118.  
  119. })();