// ==UserScript== // @name NGA Agent // @namespace https://greasyfork.org/users/263018 // @version 1.0.0 // @author snyssss // @description 非常时期的非常手段 // @license MIT // @match *://bbs.nga.cn/* // @match *://ngabbs.com/* // @match *://nga.178.com/* // @noframes // @downloadURL none // ==/UserScript== // !function(t,r){for(var n in r)t[n]=r[n]}(window,function(t){function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n={};return r.m=t,r.c=n,r.i=function(t){return t},r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:e})},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=2)}([function(t,r,n){"use strict";function e(t,r){var n={};for(var e in t)n[e]=t[e];return n.target=n.currentTarget=r,n}function o(t,r){function n(r){return function(){var n=this.hasOwnProperty(r+"_")?this[r+"_"]:this.xhr[r],e=(t[r]||{}).getter;return e&&e(n,this)||n}}function o(r){return function(n){var o=this.xhr,i=this,u=t[r];if("on"===r.substring(0,2))i[r+"_"]=n,o[r]=function(u){u=e(u,i),t[r]&&t[r].call(i,o,u)||n.call(i,u)};else{var c=(u||{}).setter;n=c&&c(n,i)||n,this[r+"_"]=n;try{o[r]=n}catch(t){}}}}function i(r){return function(){var n=[].slice.call(arguments);if(t[r]){var e=t[r].call(this,n,this.xhr);if(e)return e}return this.xhr[r].apply(this.xhr,n)}}return r=r||window,r[c]=r[c]||r.XMLHttpRequest,r.XMLHttpRequest=function(){for(var t=new r[c],e=0;e { // User Agent const USER_AGENT = "Nga_Official/80024(Android12)"; // Temp solution if (!ui) { fetch(location.href, { headers: { "X-User-Agent": USER_AGENT, }, }) .then((res) => res.blob()) .then((blob) => { const reader = new FileReader(); reader.onload = () => { document.open(); document.write(reader.result); document.close(); }; reader.readAsText(blob, "GBK"); }); return; } // Hook ah.hook( { send: (_, xhr) => { xhr.setRequestHeader("X-User-Agent", USER_AGENT); return false; }, }, ui._w ); // Clear body event (() => { const temp = document.createElement("DIV"); temp.append(...document.body.childNodes); document.body.outerHTML = document.body.outerHTML; document.body.innerHTML = ""; document.body.append(...temp.childNodes); })(); // Reload lib __SCRIPTS.syncLoad("forum", "loaderRead", () => { // Reload page if (_LOADERREAD) { _LOADERREAD.init(); ui.htmlLoader.go(5, { url: location.href, }); } }); })(unsafeWindow);