Greasy Fork is available in English.

ajaxhook

ajaxhook123

Dette scriptet burde ikke installeres direkte. Det er et bibliotek for andre script å inkludere med det nye metadirektivet // @require https://update.greatest.deepsurf.us/scripts/482252/1295986/ajaxhook.js

  1. // ==UserScript==
  2. // @name ajaxhook
  3. // @namespace http://tampermonkey.net/
  4. // @version 2023-12-15
  5. // @description ajaxhook123
  6. // @author 123
  7. // @connect *
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. !function (t, e) {
  14. for (var r in e) t[r] = e[r]
  15. }(window, function (t) {
  16. function e(n) {
  17. if (r[n]) return r[n].exports;
  18. var o = r[n] = {i: n, l: !1, exports: {}};
  19. return t[n].call(o.exports, o, o.exports, e), o.l = !0, o.exports
  20. }
  21.  
  22. var r = {};
  23. return e.m = t, e.c = r, e.i = function (t) {
  24. return t
  25. }, e.d = function (t, r, n) {
  26. e.o(t, r) || Object.defineProperty(t, r, {configurable: !1, enumerable: !0, get: n})
  27. }, e.n = function (t) {
  28. var r = t && t.__esModule ? function () {
  29. return t.default
  30. } : function () {
  31. return t
  32. };
  33. return e.d(r, "a", r), r
  34. }, e.o = function (t, e) {
  35. return Object.prototype.hasOwnProperty.call(t, e)
  36. }, e.p = "", e(e.s = 3)
  37. }([function (t, e, r) {
  38. "use strict";
  39.  
  40. function n(t, e) {
  41. var r = {};
  42. for (var n in t) r[n] = t[n];
  43. return r.target = r.currentTarget = e, r
  44. }
  45.  
  46. function o(t, e) {
  47. function r(e) {
  48. return function () {
  49. var r = this[u][e];
  50. if (v) {
  51. var n = this.hasOwnProperty(e + "_") ? this[e + "_"] : r, o = (t[e] || {}).getter;
  52. return o && o(n, this) || n
  53. }
  54. return r
  55. }
  56. }
  57.  
  58. function o(e) {
  59. return function (r) {
  60. var o = this[u];
  61. if (v) {
  62. var i = this, s = t[e];
  63. if ("on" === e.substring(0, 2)) i[e + "_"] = r, o[e] = function (s) {
  64. s = n(s, i), t[e] && t[e].call(i, o, s) || r.call(i, s)
  65. }; else {
  66. var a = (s || {}).setter;
  67. r = a && a(r, i) || r, this[e + "_"] = r;
  68. try {
  69. o[e] = r
  70. } catch (t) {
  71. }
  72. }
  73. } else o[e] = r
  74. }
  75. }
  76.  
  77. function a(e) {
  78. return function () {
  79. var r = [].slice.call(arguments);
  80. if (t[e] && v) {
  81. var n = t[e].call(this, r, this[u]);
  82. if (n) return n
  83. }
  84. return this[u][e].apply(this[u], r)
  85. }
  86. }
  87.  
  88. function c() {
  89. v = !1, e.XMLHttpRequest === h && (e.XMLHttpRequest = f, h.prototype.constructor = f, f = void 0)
  90. }
  91.  
  92. e = e || window;
  93. var f = e.XMLHttpRequest, v = !0, h = function () {
  94. for (var t = new f, e = 0; e < s.length; ++e) {
  95. var n = "on" + s[e];
  96. void 0 === t[n] && (t[n] = null)
  97. }
  98. for (var c in t) {
  99. var v = "";
  100. try {
  101. v = i(t[c])
  102. } catch (t) {
  103. }
  104. "function" === v ? this[c] = a(c) : c !== u && Object.defineProperty(this, c, {
  105. get: r(c),
  106. set: o(c),
  107. enumerable: !0
  108. })
  109. }
  110. var h = this;
  111. t.getProxy = function () {
  112. return h
  113. }, this[u] = t
  114. };
  115. return h.prototype = f.prototype, h.prototype.constructor = h, e.XMLHttpRequest = h, Object.assign(e.XMLHttpRequest, {
  116. UNSENT: 0,
  117. OPENED: 1,
  118. HEADERS_RECEIVED: 2,
  119. LOADING: 3,
  120. DONE: 4
  121. }), {originXhr: f, unHook: c}
  122. }
  123.  
  124. Object.defineProperty(e, "__esModule", {value: !0});
  125. var i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) {
  126. return typeof t
  127. } : function (t) {
  128. return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
  129. };
  130. e.configEvent = n, e.hook = o;
  131. var s = e.events = ["load", "loadend", "timeout", "error", "readystatechange", "abort"], u = "__origin_xhr"
  132. }, function (t, e, r) {
  133. "use strict";
  134.  
  135. function n(t, e) {
  136. return e = e || window, c(t, e)
  137. }
  138.  
  139. function o(t) {
  140. return t.replace(/^\s+|\s+$/g, "")
  141. }
  142.  
  143. function i(t) {
  144. return t.watcher || (t.watcher = document.createElement("a"))
  145. }
  146.  
  147. function s(t, e) {
  148. var r = t.getProxy(), n = "on" + e + "_", o = (0, f.configEvent)({type: e}, r);
  149. r[n] && r[n](o);
  150. var s;
  151. "function" == typeof Event ? s = new Event(e, {bubbles: !1}) : (s = document.createEvent("Event"), s.initEvent(e, !1, !0)), i(t).dispatchEvent(s)
  152. }
  153.  
  154. function u(t) {
  155. this.xhr = t, this.xhrProxy = t.getProxy()
  156. }
  157.  
  158. function a(t) {
  159. function e(t) {
  160. u.call(this, t)
  161. }
  162.  
  163. return e[x] = Object.create(u[x]), e[x].next = t, e
  164. }
  165.  
  166. function c(t, e) {
  167. function r(t) {
  168. var e = t.responseType;
  169. if (!e || "text" === e) return t.responseText;
  170. var r = t.response;
  171. if ("json" === e && !r) try {
  172. return JSON.parse(t.responseText)
  173. } catch (t) {
  174. console.warn(t)
  175. }
  176. return r
  177. }
  178.  
  179. function n(t, e) {
  180. var n = new b(t), i = {
  181. response: r(e),
  182. status: e.status,
  183. statusText: e.statusText,
  184. config: t.config,
  185. headers: t.resHeader || t.getAllResponseHeaders().split("\r\n").reduce(function (t, e) {
  186. if ("" === e) return t;
  187. var r = e.split(":");
  188. return t[r.shift()] = o(r.join(":")), t
  189. }, {})
  190. };
  191. if (!x) return n.resolve(i);
  192. x(i, n)
  193. }
  194.  
  195. function u(t, e, r, n) {
  196. var o = new w(t);
  197. r = {config: t.config, error: r, type: n}, E ? E(r, o) : o.next(r)
  198. }
  199.  
  200. function a() {
  201. return !0
  202. }
  203.  
  204. function c(t) {
  205. return function (e, r) {
  206. return u(e, this, r, t), !0
  207. }
  208. }
  209.  
  210. function v(t, e) {
  211. return 4 === t.readyState && 0 !== t.status ? n(t, e) : 4 !== t.readyState && s(t, l), !0
  212. }
  213.  
  214. var h = t.onRequest, x = t.onResponse, E = t.onError, m = (0, f.hook)({
  215. onload: a,
  216. onloadend: a,
  217. onerror: c(d),
  218. ontimeout: c(p),
  219. onabort: c(y),
  220. onreadystatechange: function (t) {
  221. return v(t, this)
  222. },
  223. open: function (t, e) {
  224. var r = this, n = e.config = {headers: {}};
  225. n.method = t[0], n.url = t[1], n.async = t[2], n.user = t[3], n.password = t[4], n.xhr = e;
  226. var o = "on" + l;
  227. if (e[o] || (e[o] = function () {
  228. return v(e, r)
  229. }), h) return !0
  230. },
  231. send: function (t, e) {
  232. var r = e.config;
  233. if (r.withCredentials = e.withCredentials, r.body = t[0], h) {
  234. var n = function () {
  235. h(r, new g(e))
  236. };
  237. return !1 === r.async ? n() : setTimeout(n), !0
  238. }
  239. },
  240. setRequestHeader: function (t, e) {
  241. if (e.config.headers[t[0].toLowerCase()] = t[1], h) return !0
  242. },
  243. addEventListener: function (t, e) {
  244. var r = this;
  245. if (-1 !== f.events.indexOf(t[0])) {
  246. var n = t[1];
  247. return i(e).addEventListener(t[0], function (e) {
  248. var o = (0, f.configEvent)(e, r);
  249. o.type = t[0], o.isTrusted = !0, n.call(r, o)
  250. }), !0
  251. }
  252. },
  253. getAllResponseHeaders: function (t, e) {
  254. var r = e.resHeader;
  255. if (r) {
  256. var n = "";
  257. for (var o in r) n += o + ": " + r[o] + "\r\n";
  258. return n
  259. }
  260. },
  261. getResponseHeader: function (t, e) {
  262. var r = e.resHeader;
  263. if (r) return r[(t[0] || "").toLowerCase()]
  264. }
  265. }, e);
  266. return {originXhr: m.originXhr, unProxy: m.unHook}
  267. }
  268.  
  269. Object.defineProperty(e, "__esModule", {value: !0}), e.proxy = n;
  270. var f = r(0), v = f.events[0], h = f.events[1], p = f.events[2], d = f.events[3], l = f.events[4], y = f.events[5],
  271. x = "prototype";
  272. u[x] = Object.create({
  273. resolve: function (t) {
  274. var e = this.xhrProxy, r = this.xhr;
  275. e.readyState = 4, r.resHeader = t.headers, e.response = e.responseText = t.response, e.statusText = t.statusText, e.status = t.status, s(r, l), s(r, v), s(r, h)
  276. }, reject: function (t) {
  277. this.xhrProxy.status = 0, s(this.xhr, t.type), s(this.xhr, h)
  278. }
  279. });
  280. var g = a(function (t) {
  281. var e = this.xhr;
  282. t = t || e.config, e.withCredentials = t.withCredentials, e.open(t.method, t.url, !1 !== t.async, t.user, t.password);
  283. for (var r in t.headers) e.setRequestHeader(r, t.headers[r]);
  284. e.send(t.body)
  285. }), b = a(function (t) {
  286. this.resolve(t)
  287. }), w = a(function (t) {
  288. this.reject(t)
  289. })
  290. }, , function (t, e, r) {
  291. "use strict";
  292. Object.defineProperty(e, "__esModule", {value: !0}), e.ah = void 0;
  293. var n = r(0), o = r(1);
  294. e.ah = {proxy: o.proxy, hook: n.hook}
  295. }]));
  296. //# sourceMappingURL=ajaxhook.min.js.map
  297. })();