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

Function getNextUP

Autopage.user.js:2214–2235  ·  view source on GitHub ↗
(pf, reg, lp = location.pathname, initP = '2', endP)

Source from the content-addressed store, hash-verified

2212 }
2213 // 通用型获取下一页地址(从 URL 中获取页码,并页码+1,URL 替换 page= 参数,后三个参数可以省略)
2214 function getNextUP(pf, reg, lp = location.pathname, initP = '2', endP) {
2215 let nextNum = getSearch(pf.replace('=','')); // 获取参数中的 page= 值
2216 if (nextNum) { // 如果参数中存在 page=
2217 nextNum = String(parseInt(nextNum)+1); // 下一页页码就是当前页码参数值 +1
2218 if (endP && (parseInt(nextNum) > parseInt(endP))) return '' // 如果 endP 为真且 下一页页码 大于 endP(页码最大值)则终止
2219 } else { // 如果参数中不存在 page=
2220 nextNum = initP; // 因为不存在,所以一般都代表当前是位于第 1 页,那么下一页页码就设置为初始页码(默认 2)
2221 if (endP && (parseInt(nextNum) > parseInt(endP))) return '' // 如果 endP 为真且 下一页页码 大于 endP(页码最大值)则终止
2222 }
2223 let url = '';
2224 if (location.search) {
2225 if (indexOF(pf, 's')) {
2226 url = location.search.replace(reg, pf + nextNum);
2227 } else {
2228 url = location.search + '&' + pf + nextNum;
2229 }
2230 } else {
2231 url = '?' + pf + nextNum;
2232 }
2233 url = location.origin + lp + url;
2234 return url
2235 }
2236 // 通用型获取下一页地址(从 form input 中获取,返回 GET URL)
2237 function getNextF(css) {
2238 let form = getOne(css), value = '';

Callers

nothing calls this directly

Calls 2

getSearchFunction · 0.85
indexOFFunction · 0.85

Tested by

no test coverage detected