自用工具库,命名空间mscststs
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/38220/249261/MSCSTSTS-TOOLS.js
(function(global, factory) {
if (typeof define === 'function' && define.amd)
define(function() { return factory(global) })
else
factory(global)
}(this, function(window) {
var mscststs = (function() {
mscststs.sleep = function(milisecondes){
return new Promise(resolve=>{
setTimeout(()=>{resolve();},miliseconds);
});
};
mscststs._Step = async function(selector,callback){
while(document.querySelector(selector)===null){
await mscststs.sleep(100);
}
callback(selector);
}
mscststs.wait=function(selector){
return new Promise(resolve=>{
mscststs._Step(selector,function(selector){resolve(document.querySelector(selector));});
});
}
})(mscststs)
return mscststs
}))