MCPcopy Index your code
hub / github.com/XIU2/UserScript / checkURL

Function checkURL

Autopage.user.js:2249–2269  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

2247
2248 // 检查 URL
2249 function checkURL(func) {
2250 if (!curSite.pager.nextL) return
2251 if (typeof curSite.pager.nextL == 'function') {
2252 let tempUrl = curSite.pager.nextL();
2253 if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
2254 curSite.pageUrl = tempUrl;
2255 func(curSite.pageUrl);
2256 } else if (curSite.pager.nextL.search(/^js;/i) === 0) { // 自定义翻页规则中执行 JavaScript 代码的
2257 try {
2258 let tempUrl = new Function('fun', curSite.pager.nextL.slice(3))(window.autoPage);
2259 if (!tempUrl || tempUrl === curSite.pageUrl || tempUrl.slice(0,4) !== 'http') return
2260 curSite.pageUrl = tempUrl;
2261 func(curSite.pageUrl);
2262 } catch (e) {
2263 console.error('[自动无缝翻页] - 当前网页规则 "nextL" 内 JS 代码有误,请检查:\n', curSite.pager.nextL + '\n\n', e);
2264 }
2265 } else if (getNextE_()) {
2266 func(curSite.pageUrl);
2267 }
2268 //console.log(curSite.pageUrl);
2269 }
2270 // 替换元素
2271 function replaceElems(pageE, o = curSite.pager.replaceE, r = curSite.pager.replaceE) {
2272 let oE,rE;

Callers 1

pageLoadingFunction · 0.85

Calls 1

getNextE_Function · 0.85

Tested by

no test coverage detected