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

Method getInsert

Pagetual/pagetual.user.js:7241–7276  ·  view source on GitHub ↗
(refresh)

Source from the content-addressed store, hash-verified

7239 }
7240
7241 getInsert(refresh) {
7242 if (refresh) {
7243 this.docPageElement = null;
7244 this.insert = null;
7245 }
7246 if (this.insert && this.insert.parentNode && document.documentElement.contains(this.insert)) {
7247 return this.insert;
7248 }
7249 if (this.curSiteRule.insert) {
7250 let insertSel = this.curSiteRule.insert;
7251 if (Array && Array.isArray && Array.isArray(insertSel)) {
7252 insertSel = insertSel[nextIndex < insertSel.length ? nextIndex : 0];
7253 }
7254 this.insert = getElement(insertSel, document, null, true);
7255 } else {
7256 if (this.docPageElement && this.docPageElement.length && !document.documentElement.contains(this.docPageElement[0])) {
7257 this.docPageElement = null;
7258 }
7259 let pageElement = this.getPageElement(document, _unsafeWindow);
7260 if (this.curSiteRule.smart && this.nextLinkHref == "#" && this.curSiteRule.pageElement === 'body') {
7261 debug("Stop as jsNext & whole body");
7262 isPause = true;
7263 return null;
7264 }
7265 if (pageElement && pageElement.length > 0) {
7266 let pEIndex = pageElement.length - 1;
7267 let pELast = pageElement[pEIndex];
7268 while(pELast && compareNodeName(pELast, ["link", "meta", "style", "script", "title"])) {
7269 pEIndex--;
7270 pELast = pageElement[pEIndex];
7271 }
7272 this.insert = pELast.nextSibling ? pELast.nextSibling : pELast.parentNode.appendChild(document.createTextNode(' '));
7273 }
7274 }
7275 return this.insert;
7276 }
7277
7278 pageInit(doc, eles) {
7279 let code = this.curSiteRule.pageInit;

Callers 8

getPageElementMethod · 0.95
insertElementMethod · 0.95
insertPageMethod · 0.95
requestDocFunction · 0.80
createPageBarFunction · 0.80
checkIframeFunction · 0.80
forceIframeFunction · 0.80
nextPageFunction · 0.80

Calls 5

getPageElementMethod · 0.95
getElementFunction · 0.85
debugFunction · 0.85
compareNodeNameFunction · 0.85
containsMethod · 0.80

Tested by

no test coverage detected