新增 [WindowsLatest]、[Winhelponline] 支持

This commit is contained in:
xiu2
2021-09-05 08:34:58 +08:00
parent f79af41674
commit 17e4a71dad
+41 -7
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 自动无缝翻页
// @version 2.1.5
// @version 2.1.6
// @author X.I.U
// @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(以上仅一部分,更多的写不下了...
// @match *://*/*
@@ -329,10 +329,12 @@
baidu_tieba: {
SiteTypeID: 0,
host: 'tieba.baidu.com',
functionStart: function() {if (location.pathname === '/f') { // 帖子列表
functionStart: function() {if (location.pathname === '/f') {
baidu_tieba_1(); // 右侧悬浮发帖按钮点击事件(解决自动翻页导致无法发帖的问题)
curSite = DBSite.baidu_tieba; document.lastElementChild.appendChild(document.createElement('style')).textContent = 'img.j_retract {margin-top: 0 !important;margin-bottom: 0 !important;}'; // 修复帖子列表中预览图片,在切换下一个/上一个图片时,多出来的图片上下边距
} else if (location.pathname === '/f/search/res') { // 吧内搜索/全吧搜索
//} else if (location.pathname.indexOf('/p/') > -1) {
//curSite = DBSite.baidu_tieba_post;
} else if (location.pathname === '/f/search/res') {
curSite = DBSite.baidu_tieba_search;
}},
pager: {
@@ -365,9 +367,10 @@
pager: {
type: 1,
nextLink: '//a[@class="next"][@href]',
pageElement: 'css;.s_post_list > .s_post',
insertPosition: ['css;.s_post_list', 3],
pageElement: 'css;#j_p_postlist > *',
insertPosition: ['css;#j_p_postlist', 3],
replaceE: 'css;.pager.pager-search',
scriptType: 1,
scrollDelta: 1000
}
}, // 百度贴吧 - 搜索页
@@ -1648,6 +1651,31 @@
before: lrepacks_functionBefore
}
},
windowslatest: {
SiteTypeID: 0,
host: 'www.windowslatest.com',
pager: {
type: 1,
nextLink: '//div[contains(@class, "page-nav")]/a/i[@class="td-icon-menu-right"]/parent::a',
pageElement: 'css;.td-ss-main-content > div:not(.td-block-title-wrap):not(.page-nav)',
insertPosition: ['css;.page-nav', 1],
replaceE: 'css;.page-nav',
scrollDelta: 2000
}
},
winhelponline: {
SiteTypeID: 0,
host: 'www.winhelponline.com',
functionStart: function() {if (location.pathname === '/blog/') {curSite = DBSite.winhelponline;}},
pager: {
type: 1,
nextLink: 'css;span.prev > a[href]',
pageElement: 'css;#main > article',
insertPosition: ['css;nav.paging-navigation', 1],
replaceE: 'css;nav.paging-navigation',
scrollDelta: 2000
}
},
thewindowsclub: {
SiteTypeID: 0,
host: 'www.thewindowsclub.com',
@@ -3275,7 +3303,7 @@
var newBody = ShowPager.createDocumentByString(response.responseText);
let pageElems = getAllElements(curSite.pager.pageElement, newBody, newBody),
toElement = getAllElements(curSite.pager.insertPosition[0])[0];
//console.log(curSite.pager.pageElement, pageElems)
//console.log(curSite.pager.pageElement, pageElems, curSite.pager.insertPosition, toElement)
if (pageElems.length >= 0) {
// 如果有插入前函数就执行函数
@@ -3301,7 +3329,13 @@
let scriptText = '';
if (curSite.pager.scriptType === 1) { // 下一页的所有 <script> 标签
const scriptElems = getAllElements('//script', newBody, newBody);
scriptElems.forEach(function (one) {scriptText += ';' + one.textContent;});
scriptElems.forEach(function (one) {
if (one.src) {
toElement.appendChild(document.createElement('script')).src = one.src;
} else {
scriptText += ';' + one.textContent;
}
});
toElement.appendChild(document.createElement('script')).textContent = scriptText;
} else if (curSite.pager.scriptType === 2) { // 下一页主体元素同级 <script> 标签
pageElems.forEach(function (one) {if (one.tagName === 'SCRIPT') {scriptText += ';' + one.textContent;}});