您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
fetch pollyfill using GM_xmlhttpRequest
此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.icu/scripts/421384/1134973/GM_fetch.js
function GM_fetch(url, opt={}){ return new Promise((resolve, reject)=>{ // https://www.tampermonkey.net/documentation.php?ext=dhdg#GM_xmlhttpRequest // https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest opt.url = url opt.data = opt.body opt.responseType = "blob" opt.onload = resp=>{ resolve(new Response(resp.response, {status: resp.status, // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#examples headers: Object.fromEntries(resp.responseHeaders.trim().split(/[\r\n]+/).map(line=>{parts=line.split(': ');return [parts.shift(), parts.join(': ')]})) })) } opt.ontimeout = ()=>reject("fetch timeout") opt.onerror = error=>reject(error) opt.onabort = ()=>reject("fetch abort") GM_xmlhttpRequest(opt) }) }