MCPcopy Create free account
hub / github.com/hoothin/UserScripts / pageInit

Method pageInit

Pagetual/pagetual.user.js:7278–7302  ·  view source on GitHub ↗
(doc, eles)

Source from the content-addressed store, hash-verified

7276 }
7277
7278 pageInit(doc, eles) {
7279 let code = this.curSiteRule.pageInit;
7280 if (code) {
7281 let initFunc = ((typeof code == 'function') ? code : Function("doc", "eles", '"use strict";' + code));
7282 let checkInit = (resolve) => {
7283 try {
7284 if (initFunc(doc, eles) === false) {
7285 setTimeout(() => {
7286 checkInit(resolve);
7287 }, 100);
7288 } else {
7289 resolve(true);
7290 }
7291 } catch(e) {
7292 resolve(false);
7293 debug(e);
7294 }
7295 };
7296 return new Promise((resolve) => {
7297 checkInit(function(e) {
7298 resolve(e)
7299 });
7300 })
7301 }
7302 }
7303
7304 pageAction(doc, eles) {
7305 let code = this.curSiteRule.pageAction;

Callers 1

insertPageMethod · 0.95

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected