静默请求
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/373955/642317/secretlyRequest.js
// ==UserScript==
// @name secretlyRequest
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 静默请求
// @author You
// @grant none
// ==/UserScript==
(function () {
const requset = (url) => {
return new Promise((resolve, reject) => {
const img = new Image;
img.onload = () => {
resolve(0);
};
img.onerror = (err) => {
resolve(1);
};
img.src = url;
});
};
window.H = window.H || {};
window.H.secretlyRequest = requset;
})();