MCPcopy
hub / github.com/hoothin/UserScripts / verifyElement

Method verifyElement

Pagetual/pagetual.user.js:6196–6223  ·  view source on GitHub ↗
(ele)

Source from the content-addressed store, hash-verified

6194 }
6195
6196 verifyElement(ele) {
6197 let verifyHandler = e => {
6198 if (e.nodeType == 9) return true;
6199 if (e.style.display === "none" || e.getAttribute("aria-disabled") === "true") {
6200 return false;
6201 }
6202 if (/\bbanner|slick|slide|carousel/i.test(e.id)) return false;
6203 if (e.className) {
6204 if (!/page/i.test(e.className) && /\bbanner|slick|slide|carousel|disabled\s*$/i.test(e.className)) {
6205 return false;
6206 } else if (e.classList) {
6207 if (e.classList.contains('disabled') || e.classList.contains('active')) {
6208 return false;
6209 }
6210 }
6211 }
6212 let ariaLabel = e.getAttribute("aria-label");
6213 if (ariaLabel && /\bbanner|slick|slide|carousel/i.test(ariaLabel)) return false;
6214 return true;
6215 };
6216 if (!ele) return false;
6217 let i = 0;
6218 while (ele && i++ < 6) {
6219 if (!verifyHandler(ele)) return false;
6220 ele = ele.parentNode;
6221 }
6222 return true;
6223 }
6224
6225 async getPage(doc, exist) {
6226 let body = getBody(doc);

Callers 1

getPageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected