Skip to content

Commit 17e4a71

Browse files
committed
新增 [WindowsLatest]、[Winhelponline] 支持
1 parent f79af41 commit 17e4a71

1 file changed

Lines changed: 41 additions & 7 deletions

File tree

Autopage.user.js

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 2.1.5
3+
// @version 2.1.6
44
// @author X.I.U
55
// @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条、360、微信、贴吧、豆瓣、微博、NGA、V2EX、起点小说、煎蛋网、超能网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、小霸王其乐无穷、CS.RIN.RU、FitGirl、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、片库、音范丝、BT之家、爱恋动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、小众软件、极简插件、异次元软件、异星软件空间、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork(以上仅一部分,更多的写不下了...
66
// @match *://*/*
@@ -329,10 +329,12 @@
329329
baidu_tieba: {
330330
SiteTypeID: 0,
331331
host: 'tieba.baidu.com',
332-
functionStart: function() {if (location.pathname === '/f') { // 帖子列表
332+
functionStart: function() {if (location.pathname === '/f') {
333333
baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题)
334334
curSite = DBSite.baidu_tieba; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}'; // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距
335-
} else if (location.pathname === '/f/search/res') { // 吧内搜索/全吧搜索
335+
//} else if (location.pathname.indexOf('/p/') > -1) {
336+
//curSite = DBSite.baidu_tieba_post;
337+
} else if (location.pathname === '/f/search/res') {
336338
curSite = DBSite.baidu_tieba_search;
337339
}},
338340
pager: {
@@ -365,9 +367,10 @@
365367
pager: {
366368
type: 1,
367369
nextLink: '//a[@class="next"][@href]',
368-
pageElement: 'css;.s_post_list > .s_post',
369-
insertPosition: ['css;.s_post_list', 3],
370+
pageElement: 'css;#j_p_postlist > *',
371+
insertPosition: ['css;#j_p_postlist', 3],
370372
replaceE: 'css;.pager.pager-search',
373+
scriptType: 1,
371374
scrollDelta: 1000
372375
}
373376
}, // 百度贴吧 - 搜索页
@@ -1648,6 +1651,31 @@
16481651
before: lrepacks_functionBefore
16491652
}
16501653
},
1654+
windowslatest: {
1655+
SiteTypeID: 0,
1656+
host: 'www.windowslatest.com',
1657+
pager: {
1658+
type: 1,
1659+
nextLink: '//div[contains(@class, "page-nav")]/a/i[@class="td-icon-menu-right"]/parent::a',
1660+
pageElement: 'css;.td-ss-main-content > div:not(.td-block-title-wrap):not(.page-nav)',
1661+
insertPosition: ['css;.page-nav', 1],
1662+
replaceE: 'css;.page-nav',
1663+
scrollDelta: 2000
1664+
}
1665+
},
1666+
winhelponline: {
1667+
SiteTypeID: 0,
1668+
host: 'www.winhelponline.com',
1669+
functionStart: function() {if (location.pathname === '/blog/') {curSite = DBSite.winhelponline;}},
1670+
pager: {
1671+
type: 1,
1672+
nextLink: 'css;span.prev > a[href]',
1673+
pageElement: 'css;#main > article',
1674+
insertPosition: ['css;nav.paging-navigation', 1],
1675+
replaceE: 'css;nav.paging-navigation',
1676+
scrollDelta: 2000
1677+
}
1678+
},
16511679
thewindowsclub: {
16521680
SiteTypeID: 0,
16531681
host: 'www.thewindowsclub.com',
@@ -3275,7 +3303,7 @@
32753303
var newBody = ShowPager.createDocumentByString(response.responseText);
32763304
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
32773305
toElement = getAllElements(curSite.pager.insertPosition[0])[0];
3278-
//console.log(curSite.pager.pageElement, pageElems)
3306+
//console.log(curSite.pager.pageElement, pageElems, curSite.pager.insertPosition, toElement)
32793307

32803308
if (pageElems.length >= 0) {
32813309
// 如果有插入前函数就执行函数
@@ -3301,7 +3329,13 @@
33013329
let scriptText = '';
33023330
if (curSite.pager.scriptType === 1) { // 下一页的所有 <script> 标签
33033331
const scriptElems = getAllElements('//script', newBody, newBody);
3304-
scriptElems.forEach(function (one) {scriptText += ';' + one.textContent;});
3332+
scriptElems.forEach(function (one) {
3333+
if (one.src) {
3334+
toElement.appendChild(document.createElement('script')).src = one.src;
3335+
} else {
3336+
scriptText += ';' + one.textContent;
3337+
}
3338+
});
33053339
toElement.appendChild(document.createElement('script')).textContent = scriptText;
33063340
} else if (curSite.pager.scriptType === 2) { // 下一页主体元素同级 <script> 标签
33073341
pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT') {scriptText += ';' + one.textContent;}});

0 commit comments

Comments
 (0)