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

Function nexusmods_nextL

Autopage.user.js:1415–1453  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1413
1414 // [NexusMods] 获取下一页地址
1415 function nexusmods_nextL() {
1416 if (getCSS('.nexus-ui-blocker') || !getCSS('.pagination a.page-selected')) return
1417 let modList;
1418 if (indexOF('/news')) {modList = RH_NewsTabContent;} else if (indexOF('/users/') && indexOF('tab=user+files','s')) {modList = RH_UserModsTab;} else if (indexOF('/mods/') && indexOF('tab=posts','s')) {modList = RH_CommentContainer;} else {modList = RH_ModList;}
1419 if (!modList) return
1420 let out_items = JSON.stringify(modList.out_items).replace(/{|}|"/g,''),
1421 nextNum = getXpath('//div[contains(@class, "pagination")][1]//a[contains(@class, "page-selected")]/../following-sibling::li[1]/a');
1422 var url = '';
1423 if (nextNum && nextNum.innerText) {
1424 nextNum = nextNum.innerText;
1425 if (out_items.indexOf('page:') > -1) {out_items = out_items.replace(/page:\d+/, `page:${nextNum}`);} else {out_items += `,page:${nextNum}`;}
1426 if (!indexOF(/\/(mods|users)\/\d+/)) { // MOD 页/用户页 不需要这些
1427 let categories = modList.out_items.categories, tags_yes = modList.out_items.tags_yes, search = modList.out_items.search, out_items_sub = '';
1428 if (categories && categories != []) { // 分类页
1429 if (modList.out_items.categories instanceof Array) {// 单独使用时为数组
1430 for (let i = 0; i < categories.length; i++) {out_items_sub += `categories[]:${categories[i]},`;}
1431 } else {
1432 for (let key in modList.out_items.categories) {out_items_sub += `categories[${key}]:${modList.out_items.categories[key]},`;}
1433 }
1434 if (out_items.indexOf('categories:') > -1) out_items = out_items.replace('categories:', out_items_sub)
1435 }; out_items_sub='';
1436 if (tags_yes && tags_yes != []) { // 标签页
1437 if (modList.out_items.tags_yes instanceof Array) {// 单独使用时为数组
1438 for (let i = 0; i < tags_yes.length; i++) {out_items_sub += `tags_yes[]:${tags_yes[i]},`;}
1439 } else {
1440 for (let key in modList.out_items.tags_yes) {out_items_sub += `tags_yes[${key}]:${modList.out_items.tags_yes[key]},`;}
1441 }
1442 if (out_items.indexOf('tags_yes:') > -1) out_items = out_items.replace('tags_yes:', out_items_sub)
1443 }; out_items_sub='';
1444 if (search && search.length != 0) { // 搜索页
1445 for (let key in modList.out_items.search) {out_items_sub += `search[${key}]:${modList.out_items.search[key]},`;}
1446 if (out_items.indexOf('search:') > -1) out_items = out_items.replace('search:',out_items_sub)
1447 }; out_items_sub='';
1448 }
1449 //console.log(`https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`)
1450 return `https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`
1451 }
1452 return ''
1453 }
1454 // [NexusMods] 的插入前函数(隐藏底部元素)
1455 function nexusmods_bF(pageE) {
1456 pageE.forEach(function (one) {

Callers

nothing calls this directly

Calls 3

getCSSFunction · 0.85
indexOFFunction · 0.85
getXpathFunction · 0.70

Tested by

no test coverage detected