TM_request

Tampermonkey http request 库

Version vom 11.12.2020. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/418102/879419/TM_request.js

"use strict";function asyncGeneratorStep(t,e,n,r,o,u,a){try{var i=t[u](a);var s=i.value}catch(t){n(t);return}if(i.done){e(s)}else{Promise.resolve(s).then(r,o)}}function _asyncToGenerator(i){return function(){var t=this,a=arguments;return new Promise(function(e,n){var r=i.apply(t,a);function o(t){asyncGeneratorStep(r,e,n,o,u,"next",t)}function u(t){asyncGeneratorStep(r,e,n,o,u,"throw",t)}o(undefined)})}}window.TM_request=function r(o){var t;var u=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;o.retry=(t=o.retry)!==null&&t!==void 0?t:0;return new Promise(function(e,t){o.onload=o.onload||function(t){t.requestOptions=o;t.tmStatusText="Load";e(t)};o.ontimeout=o.ontimeout||function(t){t.requestOptions=o;t.tmStatusText="Timeout";e(t)};o.onerror=o.onerror||function(t){t.requestOptions=o;t.tmStatusText="Error";e(t)};o.onabort=o.onabort||function(t){t.requestOptions=o;t.tmStatusText="Abort";e(t)};GM_xmlhttpRequest(o)}).then(function(t){return t})["catch"](function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function t(n){return regeneratorRuntime.wrap(function t(e){while(1){switch(e.prev=e.next){case 0:if(!(u>=o.retry)){e.next=5;break}console.error(n);throw n;case 5:e.next=7;return r(o,++u);case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}},t)}));return function(t){return e.apply(this,arguments)}}())};