// ==UserScript== // @name NGA Agent // @namespace https://greasyfork.org/users/263018 // @version 1.2.3 // @author snyssss // @description 非常时期的非常手段 // @license MIT // @match *://bbs.nga.cn/* // @match *://ngabbs.com/* // @match *://nga.178.com/* // @noframes // @downloadURL none // ==/UserScript== (({ commonui: ui }) => { !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 { const params = new URLSearchParams(location.search); return params.get("redirectUri"); })(); // Skip if (!document.title) { return; } // Hook const hooked = (() => { if (location.pathname === '/') { ah.hook( { open: (args, xhr) => { xhr._url = args[1]; return false; }, send: (_, xhr) => { const url = xhr._url || ''; if (url.indexOf(location.host) >= 0) { xhr.setRequestHeader("X-User-Agent", USER_AGENT); } return false; }, }, ui._w ); const f = __NUKE.doRequest; __NUKE.doRequest = (args) => { if (args.u.a) { return f(args); } return f({ ...args, xr: 1, u: { u: args.u } }) }; return true; } return false; })(); // Redirect if (!hooked && redirectUri === null) { location.href = `/?redirectUri=${encodeURIComponent(location.href)}`; return; } // 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", () => { if (_LOADERREAD) { _LOADERREAD.init(); // Reload page if (redirectUri) { ui.htmlLoader.go(33, { url: redirectUri, }); } } }); })(window);