From f0c08a64d2906595e3229d498abccd8bbc0aa207 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 30 Sep 2021 14:33:04 +0800 Subject: [PATCH 0001/1784] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E6=99=9A?= =?UTF-8?q?=E4=B8=8A=E8=87=AA=E5=8A=A8=E5=88=87=E6=8D=A2=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?]=20=E5=8A=9F=E8=83=BD;=20=E4=BC=98=E5=8C=96=20[=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=88=87=E6=8D=A2=E6=A8=A1=E5=BC=8F]=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=88=E4=B8=8D=E5=86=8D=E5=88=B7=E6=96=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DarkMode.user.js | 58 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/DarkMode.user.js b/DarkMode.user.js index 6f9cf7647..a57ebca4f 100644 --- a/DarkMode.user.js +++ b/DarkMode.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 护眼模式 -// @version 1.2.8 +// @version 1.2.9 // @author X.I.U // @description 简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式) // @match *://*/* @@ -30,7 +30,8 @@ ['menu_autoRecognition', '智能排除自带暗黑模式的网页 (beta)', '智能排除自带暗黑模式的网页 (beta)', true], ['menu_forcedToEnable', '✅ 已强制当前网站启用护眼模式 (👆)', '❌ 未强制当前网站启用护眼模式 (👆)', []], ['menu_darkModeType', '点击切换模式', '点击切换模式', 2], - ['menu_customMode', '自定义当前模式', '自定义当前模式', true], ['menu_customMode1',,,'80|70'], ['menu_customMode2',,,'80|20|70|30'], ['menu_customMode3',,,'80'] + ['menu_customMode', '自定义当前模式', '自定义当前模式', true], ['menu_customMode1',,,'80|70'], ['menu_customMode2',,,'80|20|70|30'], ['menu_customMode3',,,'80'], + ['menu_autoSwitch', '晚上自动切换模式', '晚上自动切换模式', ''], ], menu_ID = []; for (let i=0;i 6 && hours < 19) { // 白天 + darkModeType = GM_getValue('menu_autoSwitch').split('|')[0]; + } else { // 晚上 + darkModeType = GM_getValue('menu_autoSwitch').split('|')[1]; + } + } + return parseInt(darkModeType) + } + + // 自定义当前模式 function menu_customMode() { let newMods, tip, defaults, name; - switch(menu_value('menu_darkModeType')) { + switch(getAutoSwitch()) { case 1: tip = '自定义 [模式 1],修改后立即生效 (部分网页可能需要刷新)~\n格式:亮度 (白天)|亮度 (晚上)\n默认:80|70(均为百分比 1~100,不需要 % 符号)'; defaults = '80|70'; @@ -227,7 +265,12 @@ menu_status += 1; } GM_setValue(`${Name}`, menu_status); - location.reload(); // 刷新网页 + registerMenuCommand(); // 重新注册脚本菜单 + if (document.getElementById('XIU2DarkMode')) { + document.getElementById('XIU2DarkMode').remove(); // 即时修改样式 + addStyle(); + } + //location.reload(); // 刷新网页 }; @@ -296,7 +339,10 @@ } } - switch(menu_value('menu_darkModeType')) { + + let darkModeType = getAutoSwitch(); + + switch(darkModeType) { case 1: style += style_12; break; From 2360de45d8ef59c5183c439a8f6361b7c79217c6 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 1 Oct 2021 15:51:27 +0800 Subject: [PATCH 0002/1784] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E8=8F=9C?= =?UTF-8?q?=E9=B8=9F=E6=95=99=E7=A8=8B]=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 93 +++++++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 221cea6f2..9cf477a1d 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 2.6.1 +// @version 2.6.2 // @author X.I.U // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、龙的天空、起点小说、煎蛋网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、FitGirl、片库、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork、Github、StackOverflow(以上仅一部分,更多的写不下了... // @match *://*/* @@ -186,7 +186,7 @@ }, // Discuz! - 淘帖页 flarum: { SiteTypeID: 0, - functionStart: function() {locationchange = true;console.log(location.pathname.indexOf('/d/'));if (location.pathname.indexOf('/d/') === -1) {console.log(111);curSite = DBSite.flarum;}}, + functionStart: function() {locationchange = true;if (location.pathname.indexOf('/d/') === -1) {curSite = DBSite.flarum;}}, pager: { type: 2, nextLink: '.DiscussionList-loadMore > button[title]', @@ -3199,6 +3199,39 @@ scrollDelta: 1000 } }, // 如意了教育 - 试卷 + runoob: { + SiteTypeID: 0, + host: 'www.runoob.com', + functionStart: function() {if (location.pathname.split('/').length > 2) { + curSite = DBSite.runoob; document.body.appendChild(document.createElement('style')).textContent = '#comments, #postcomments, #respond, #footer {display: none !important;} .article-intro h1:not(:nth-of-type(1)) {margin: 30px 0 10px 0;}'; + }}, + pager: { + type: 1, + nextLink: function() { // 过滤部分非本页的参考手册 + let next = document.querySelector('#leftcolumn > a[style]~a') + if (next.href.split('/').length === location.href.split('/').length && next.href.split('/')[3] === location.href.split('/')[3]) { + if (curSite.pager.forceHTTPS && location.protocol === 'https:') {return next.href.replace(/^http:/,'https:');} // 替换为 https:// 链接 + return next.href; + } + next.href = location.href; curSite = {SiteTypeID: 0}; // 禁用翻页 + return '' + }, + pageElement: 'css;#content > *', + insertPosition: ['css;#content', 3], + replaceE: 'css;.previous-next-links, #leftcolumn, head > title', + history: true, + forceHTTPS: true, + scrollDelta: 1000 + }, + function: { + after: function() { // 左侧栏高亮当前页面标题 + let title = document.title.split(' | '); + if (title.length > 1) { + title = title[0]; document.querySelectorAll('#leftcolumn > a').forEach(function(e){if (e.innerText === title) {e.style = 'background-color: rgb(150, 185, 125); font-weight: bold; color: rgb(255, 255, 255);';}}) + } + } + } + }, // 菜鸟教程 netbian: { SiteTypeID: 0, host: 'pic.netbian.com', @@ -3661,7 +3694,7 @@ if (now) { let downloadCount = now.querySelector('.downloadcount > span.flex-label'); if (downloadCount) { - console.log(now.dataset.gameId, now.dataset.modId) + //console.log(now.dataset.gameId, now.dataset.modId) if (GlobalModStats[now.dataset.gameId] && GlobalModStats[now.dataset.gameId][now.dataset.modId]) { downloadCount.textContent = shortFormat(parseInt(GlobalModStats[now.dataset.gameId][now.dataset.modId].total)); } @@ -4281,7 +4314,7 @@ function pageLoading() { if (curSite.SiteTypeID > 0) { windowScroll(function (direction, e) { - if (direction === 'down' && pausePage === true) { // 下滑/没有暂停翻页时,才准备翻页 + if (direction === 'down' && pausePage === true && curSite.SiteTypeID > 0) { // 下滑 且 未暂停翻页 且 SiteTypeID > 0 时,才准备翻页 let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop, scrollHeight = window.innerHeight || document.documentElement.clientHeight, scrollDelta = curSite.pager.scrollDelta; @@ -4295,38 +4328,34 @@ } else { if (document.documentElement.scrollHeight <= scrollHeight + scrollTop + scrollDelta) { if (curSite.pager.type === 2) { // <<<<< 翻页类型 2(网站自带了自动无缝翻页功能,只需要点击下一页按钮即可)>>>>> - if (curSite.SiteTypeID > 0) { // 如果指定了间隔时间,那么就依靠这个判断时间到了没有~ - let autopbn = document.querySelector(curSite.pager.nextLink); - if (autopbn) { // 寻找下一页链接 - // 避免重复点击翻页按钮 - if (curSite.pager.nextText) { // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页 - if (autopbn.innerText === curSite.pager.nextText) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 - } else if (curSite.pager.nextTextOf) { // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页 - if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 - } else if (curSite.pager.nextHTML) { // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页 - if (autopbn.innerHTML === curSite.pager.nextHTML) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 - } else { // 如果没有指定按钮文字就直接点击 - autopbn.click(); pageNum.now = pageNum._now + 1; // 当前页码 + 1 - // 对于没有按钮文字变化的按钮,可以指定间隔时间(默认 300ms) - if (!curSite.pager.intervals) {curSite.pager.intervals = 300;} - let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0; - setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) - } + let autopbn = document.querySelector(curSite.pager.nextLink); + if (autopbn) { // 寻找下一页链接 + // 避免重复点击翻页按钮 + if (curSite.pager.nextText) { // 按钮文本,当按钮文本 = 该文本时,才会点击按钮加载下一页 + if (autopbn.innerText === curSite.pager.nextText) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 + } else if (curSite.pager.nextTextOf) { // 按钮文本的一部分,当按钮文本包含该文本时,才会点击按钮加载下一页 + if (autopbn.innerText.indexOf(curSite.pager.nextTextOf) > -1) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 + } else if (curSite.pager.nextHTML) { // 按钮内元素,当按钮内元素 = 该元素内容时,才会点击按钮加载下一页 + if (autopbn.innerHTML === curSite.pager.nextHTML) {autopbn.click(); pageNum.now = pageNum._now + 1;} // 当前页码 + 1 + } else { // 如果没有指定按钮文字就直接点击 + autopbn.click(); pageNum.now = pageNum._now + 1; // 当前页码 + 1 + // 对于没有按钮文字变化的按钮,可以指定间隔时间(默认 300ms) + if (!curSite.pager.intervals) {curSite.pager.intervals = 300;} + let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0; + setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) } } } else if (curSite.pager.type === 1) { // <<<<< 翻页类型 1(由脚本实现自动无缝翻页)>>>>> - if (curSite.SiteTypeID > 0) ShowPager.loadMorePage(); + ShowPager.loadMorePage(); } else if (curSite.pager.type === 4) { // <<<<< 翻页类型 4(部分简单的动态加载类网站)>>>>> - if (curSite.SiteTypeID > 0) { - // 为百度贴吧的发帖考虑... - if (!(document.documentElement.scrollHeight <= scrollHeight + scrollTop + 200 && curSite.SiteTypeID === SiteType.BAIDU_TIEBA)) { - curSite.pager.nextLink(); - } - if (curSite.pager.intervals) { - let _SiteTypeID = curSite.SiteTypeID; - curSite.SiteTypeID = 0; - setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) - } + // 为百度贴吧的发帖考虑... + if (!(document.documentElement.scrollHeight <= scrollHeight + scrollTop + 200 && curSite.SiteTypeID === SiteType.BAIDU_TIEBA)) { + curSite.pager.nextLink(); + } + if (curSite.pager.intervals) { + let _SiteTypeID = curSite.SiteTypeID; + curSite.SiteTypeID = 0; + setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.intervals) } } } From 2e8321dacaada41f02f7cda1cc246c31d016a89f Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:00:12 +0800 Subject: [PATCH 0003/1784] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 9cf477a1d..80b27055f 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -3209,12 +3209,8 @@ type: 1, nextLink: function() { // 过滤部分非本页的参考手册 let next = document.querySelector('#leftcolumn > a[style]~a') - if (next.href.split('/').length === location.href.split('/').length && next.href.split('/')[3] === location.href.split('/')[3]) { - if (curSite.pager.forceHTTPS && location.protocol === 'https:') {return next.href.replace(/^http:/,'https:');} // 替换为 https:// 链接 - return next.href; - } - next.href = location.href; curSite = {SiteTypeID: 0}; // 禁用翻页 - return '' + if (next.href.split('/').length === location.href.split('/').length && next.href.split('/')[3] === location.href.split('/')[3]) return next.href; + next.href = location.href; curSite = {SiteTypeID: 0}; return '' }, pageElement: 'css;#content > *', insertPosition: ['css;#content', 3], @@ -3225,10 +3221,7 @@ }, function: { after: function() { // 左侧栏高亮当前页面标题 - let title = document.title.split(' | '); - if (title.length > 1) { - title = title[0]; document.querySelectorAll('#leftcolumn > a').forEach(function(e){if (e.innerText === title) {e.style = 'background-color: rgb(150, 185, 125); font-weight: bold; color: rgb(255, 255, 255);';}}) - } + let title = document.title.split(' | '); if (title.length > 1) {title = title[0]; document.querySelectorAll('#leftcolumn > a').forEach(function(e){if (e.innerText === title) {e.style = 'background-color: rgb(150, 185, 125); font-weight: bold; color: rgb(255, 255, 255);';}})} } } }, // 菜鸟教程 @@ -4630,10 +4623,7 @@ // 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader var ShowPager = { getFullHref: function (e) { - if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') { - if (curSite.pager.forceHTTPS && location.protocol === 'https:') {return e.href.replace(/^http:/,'https:');} - return e.href; - } + if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href; return ''; }, createDocumentByString: function (e) { @@ -4671,6 +4661,7 @@ } //console.log(url, curSite.pageUrl); if (url === '') return; + if (curSite.pager.forceHTTPS && location.protocol === 'https:') {url = url.replace(/^http:/,'https:');} if (curSite.pageUrl === url) return;// 避免重复加载相同的页面 curSite.pageUrl = url; let mimeType = ''; From c304f54bb7e8d97782b71e7783f7e07a467cd21e Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 1 Oct 2021 17:36:09 +0800 Subject: [PATCH 0004/1784] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[nastol=E3=80=81?= =?UTF-8?q?HDQwalls]=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 80b27055f..22b1f59d1 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 2.6.2 +// @version 2.6.3 // @author X.I.U // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、龙的天空、起点小说、煎蛋网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、FitGirl、片库、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork、Github、StackOverflow(以上仅一部分,更多的写不下了... // @match *://*/* @@ -3255,6 +3255,31 @@ before: ioliu_functionBefore } }, // 必应壁纸 + nastol: { + SiteTypeID: 0, + host: 'www.nastol.com.ua', + pager: { + type: 1, + nextLink: '//a[./span[@class="nav-next"]]', + pageElement: 'css;#dle-content > div', + insertPosition: ['css;#dle-content > noindex', 1], + replaceE: 'css;.navigation', + mimeType: 'text/html; charset=windows-1251', + scrollDelta: 1000 + } + }, // 壁纸 + hdqwalls: { + SiteTypeID: 0, + host: 'hdqwalls.com', + pager: { + type: 1, + nextLink: 'css;a#next', + pageElement: 'css;.wallpapers_container > div.wall-resp', + insertPosition: ['css;div.pagination_container, .wallpapers_container > div.wall-resp+div:not(.wall-resp)', 1], + replaceE: 'css;ul.pagination', + scrollDelta: 1000 + } + }, // 壁纸 zhutix: { SiteTypeID: 0, host: 'zhutix.com', @@ -4697,7 +4722,13 @@ let addTo1 = addTo(curSite.pager.insertPosition[1]); // 插入新页面元素 - pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);}); + if (addTo1 === 'afterend') { // 插入到目标本身后面,需要合并后一起插入 + let afterend = ''; + pageElems.forEach(function (one) {afterend += one.outerHTML;}); + toElement.insertAdjacentHTML(addTo1, afterend); + } else { + pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo1, one);}); + } // 当前页码 + 1 pageNum.now = pageNum._now + 1 @@ -4749,6 +4780,7 @@ console.log(e); } } + // 如果有插入后函数就执行函数 if (curSite.function && curSite.function.after) { if (curSite.function.parameter) { // 如果指定了参数 From 421a8fa9beec9b7010f5e53d50078ed0a15779b8 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Sat, 2 Oct 2021 11:15:27 +0800 Subject: [PATCH 0005/1784] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[=E6=BC=AB?= =?UTF-8?q?=E7=94=BB=E6=98=9F=E7=90=83=E3=80=81=E6=97=A0=E9=94=99=E5=B0=8F?= =?UTF-8?q?=E8=AF=B4=E7=BD=91]=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 123 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 119 insertions(+), 4 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 22b1f59d1..328b6cbc0 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 自动无缝翻页 -// @version 2.6.3 +// @version 2.6.4 // @author X.I.U // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、龙的天空、起点小说、煎蛋网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、FitGirl、片库、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork、Github、StackOverflow(以上仅一部分,更多的写不下了... // @match *://*/* @@ -91,6 +91,7 @@ 2 = 插入该元素当中,第一个子元素前面; 3 = 插入该元素当中,最后一个子元素后面; 4 = 插入该元素本身的后面; + 5 = 插入该元素末尾(针对文本) mimeType: 网站编码 scriptType: 单独插入