MCPcopy Index your code
hub / github.com/hoothin/UserScripts / hookUrl

Method hookUrl

Pagetual/pagetual.user.js:7650–7674  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

7648 }
7649
7650 async hookUrl(doc) {
7651 let sel = this.curSiteRule.hookUrl;
7652 if (!sel) return;
7653 let self = this;
7654 if (!this.initHook) {
7655 this.initHook = true;
7656 Object.defineProperty(doc.defaultView, 'open', {
7657 get: function () {
7658 return (s) => {
7659 self.catchedUrl = s;
7660 var e = new CustomEvent('pagetual_openUrl');
7661 window.dispatchEvent(e);
7662 }
7663 }
7664 });
7665 }
7666 let eles = getAllElements(sel, doc);
7667 for (let i = 0; i < eles.length; i++) {
7668 await sleep(1);
7669 let ele = eles[i];
7670 if (!ele.dataset.url) {
7671 await this.hookUrlSetEle(ele, doc);
7672 }
7673 }
7674 }
7675
7676 beginLoading() {
7677 isLoading = true;

Callers 2

checkIframeFunction · 0.80
checkPageFunction · 0.80

Calls 3

hookUrlSetEleMethod · 0.95
getAllElementsFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected