Skip to content

Commit e04adaf

Browse files
committed
优化 [nexusmods] 规则
1 parent 96cd36b commit e04adaf

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

Autopage.user.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -831,19 +831,28 @@ function: {
831831
}, // NexusPHP 论坛
832832
nexusmods: {
833833
host: 'www.nexusmods.com',
834-
url: ()=> {urlC = true; if (indexOF(/\/(mods|users)\/\d+/)) {if (indexOF('tab=posts','s') || indexOF('tab=user+files','s')){curSite = DBSite.nexusmods;}} else if (lp !== '/' && getCSS('.pagination a.page-selected')) {curSite = DBSite.nexusmods;}},
834+
url: ()=> {urlC = true; if (indexOF(/\/(mods|users)\/\d+/)) {if (indexOF('tab=posts','s')){curSite = DBSite.nexusmods_posts;} else if (indexOF('tab=user+files','s')){curSite = DBSite.nexusmods;}} else if (lp !== '/' && getCSS('.pagination a.page-selected')) {curSite = DBSite.nexusmods;}},
835835
blank: 1,
836836
history: false,
837837
pager: {
838838
nextL: nexusmods_nextL,
839-
pageE: 'ul.tiles>li,#comment-container>ol>li.comment:not(.comment-sticky)',
839+
pageE: 'ul.tiles>li',
840840
replaceE: '.pagination',
841841
scrollD: 3500
842842
},
843843
function: {
844844
bF: nexusmods_bF
845845
}
846846
}, // NexusMods
847+
nexusmods_posts: {
848+
history: false,
849+
pager: {
850+
nextL: nexusmods_nextL,
851+
pageE: '#comment-container>ol>li.comment:not(.comment-sticky)',
852+
replaceE: '.pagination',
853+
scrollD: 3500
854+
}
855+
}, // NexusMods posts
847856
bilibili_search: {
848857
host: 'search.bilibili.com',
849858
url: ()=> {
@@ -1374,25 +1383,25 @@ function: {
13741383
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;}
13751384
if (!modList) return
13761385
let out_items = JSON.stringify(modList.out_items).replace(/{|}|"/g,''),
1377-
nextNum = getXpath('//div[contains(@class, "pagination")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li[1]/a'),
1378-
categories = modList.out_items.categories, categoriesUrl = '',
1379-
tags_yes = modList.out_items.tags_yes, tags_yesUrl = '',
1380-
search = modList.out_items.search, searchUrl = '';
1386+
nextNum = getXpath('//div[contains(@class, "pagination")][1]//a[contains(@class, "page-selected")]/parent::li/following-sibling::li[1]/a');
13811387
var url = '';
13821388
if (nextNum && nextNum.innerText) {
13831389
nextNum = nextNum.innerText;
13841390
if (out_items.indexOf('page:') > -1) {out_items = out_items.replace(/page:\d+/, `page:${nextNum}`);} else {out_items += `,page:${nextNum}`;}
1385-
if (categories && categories != []) {
1386-
for (let i = 0; i < categories.length; i++) {categoriesUrl += `,categories[]:${categories[i]}`;}
1387-
if (out_items.indexOf('categories:') > -1) out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl.replace(/,/,''))
1388-
}
1389-
if (tags_yes && tags_yes != []) {
1390-
for (let i = 0; i < tags_yes.length; i++) {tags_yesUrl += `,tags_yes[]:${tags_yes[i]}`;}
1391-
if (out_items.indexOf('tags_yes:') > -1) out_items = out_items.replace(/tags_yes:\[.*\]/, tags_yesUrl.replace(/,/,''))
1392-
}
1393-
if (search && search.length != 0) {
1394-
for (let key in modList.out_items.search) {searchUrl += `search[${key}]:${modList.out_items.search[key]},`;}
1395-
if (out_items.indexOf('search:') > -1) out_items = out_items.replace('search:',searchUrl)
1391+
if (!indexOF(/\/(mods|users)\/\d+/)) { // MOD 页/用户页 不需要这些
1392+
let categories = modList.out_items.categories, categoriesUrl = '', tags_yes = modList.out_items.tags_yes, tags_yesUrl = '', search = modList.out_items.search, searchUrl = '';
1393+
if (categories && categories != []) { // 分类页
1394+
for (let i = 0; i < categories.length; i++) {categoriesUrl += `,categories[]:${categories[i]}`;}
1395+
if (out_items.indexOf('categories:') > -1) out_items = out_items.replace(/categories:\[.*\]/, categoriesUrl.replace(/,/,''))
1396+
}
1397+
if (tags_yes && tags_yes != []) { // 标签页
1398+
for (let i = 0; i < tags_yes.length; i++) {tags_yesUrl += `,tags_yes[]:${tags_yes[i]}`;}
1399+
if (out_items.indexOf('tags_yes:') > -1) out_items = out_items.replace(/tags_yes:\[.*\]/, tags_yesUrl.replace(/,/,''))
1400+
}
1401+
if (search && search.length != 0) { // 搜索页
1402+
for (let key in modList.out_items.search) {searchUrl += `search[${key}]:${modList.out_items.search[key]},`;}
1403+
if (out_items.indexOf('search:') > -1) out_items = out_items.replace('search:',searchUrl)
1404+
}
13961405
}
13971406
//console.log(`https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`)
13981407
return `https://www.nexusmods.com${modList.uri}?RH_${modList.id}=${out_items}`

0 commit comments

Comments
 (0)