From 70b40912d5ba4482dbf8da0c7ab24723f54d5927 Mon Sep 17 00:00:00 2001
From: xiu2 <54703944+XIU2@users.noreply.github.com>
Date: Fri, 19 Nov 2021 22:07:45 +0800
Subject: [PATCH 0001/1657] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20[Raw=20=E5=BF=AB?=
=?UTF-8?q?=E6=8D=B7=E4=B8=8B=E8=BD=BD(=E2=98=81)]=20=E5=8A=9F=E8=83=BD=20?=
=?UTF-8?q?(Github=20=E6=9B=B4=E6=96=B0=E4=BA=86=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
GithubEnhanced-High-Speed-Download.user.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/GithubEnhanced-High-Speed-Download.user.js b/GithubEnhanced-High-Speed-Download.user.js
index 70e68fd49..5c852943c 100644
--- a/GithubEnhanced-High-Speed-Download.user.js
+++ b/GithubEnhanced-High-Speed-Download.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Github 增强 - 高速下载
-// @version 1.6.7
+// @version 1.6.8
// @author X.I.U
// @description 高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件、项目列表单文件快捷下载 (☁)
// @match *://github.com/*
@@ -245,7 +245,7 @@
var mouseOverHandler = function(evt) {
let elem = evt.currentTarget,
aElm_new = elem.querySelectorAll('.fileDownLink'),
- aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary');
+ aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
aElm_new.forEach(el=>{el.style.cssText = 'display: inline'});
aElm_now.forEach(el=>{el.style.cssText = 'display: none'});
};
@@ -254,7 +254,7 @@
var mouseOutHandler = function(evt) {
let elem = evt.currentTarget,
aElm_new = elem.querySelectorAll('.fileDownLink'),
- aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary');
+ aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
aElm_new.forEach(el=>{el.style.cssText = 'display: none'});
aElm_now.forEach(el=>{el.style.cssText = 'display: inline'});
};
@@ -263,7 +263,7 @@
files.forEach(function(fileElm, i) {
let trElm = fileElm.parentNode.parentNode,
cntElm_a = trElm.querySelector('.css-truncate.css-truncate-target.d-block.width-fit a'),
- cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file.color-icon-tertiary'),
+ cntElm_svg = trElm.querySelector('.mr-3.flex-shrink-0 svg.octicon.octicon-file'),
Name = cntElm_a.innerText,
href = cntElm_a.attributes.href.nodeValue.replace(`https://${location.host}`,'');
let href2 = href.replace('/blob/','/'), url, url_name, url_tip = '';
@@ -307,7 +307,7 @@
var mouseOverHandler = function(evt) {
let elem = evt.currentTarget,
aElm_new = elem.querySelectorAll('.fileDownLink'),
- aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary');
+ aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
aElm_new.forEach(el=>{el.style.cssText = 'display: inline'});
aElm_now.forEach(el=>{el.style.cssText = 'display: none'});
};
@@ -316,7 +316,7 @@
var mouseOutHandler = function(evt) {
let elem = evt.currentTarget,
aElm_new = elem.querySelectorAll('.fileDownLink'),
- aElm_now = elem.querySelectorAll('svg.octicon.octicon-file.color-icon-tertiary');
+ aElm_now = elem.querySelectorAll('svg.octicon.octicon-file');
aElm_new.forEach(el=>{el.style.cssText = 'display: none'});
aElm_now.forEach(el=>{el.style.cssText = 'display: inline'});
};
From a21badca2b62e2d7ae92d827e301cf31fc720315 Mon Sep 17 00:00:00 2001
From: xiu2 <54703944+XIU2@users.noreply.github.com>
Date: Fri, 19 Nov 2021 22:08:02 +0800
Subject: [PATCH 0002/1657] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20[X-MOL=20-=20?=
=?UTF-8?q?=E5=88=86=E7=B1=BB=E9=A1=B5]=20=E6=94=AF=E6=8C=81;=20=E8=A1=A5?=
=?UTF-8?q?=E5=85=85=20[=E6=BC=AB=E7=94=BB=E6=98=9F=E7=90=83]=20=E5=85=B6?=
=?UTF-8?q?=E4=BB=96=E5=9F=9F=E5=90=8D;=20=E4=BC=98=E5=8C=96=20=E5=A4=A7?=
=?UTF-8?q?=E9=87=8F=E8=A7=84=E5=88=99;=20=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 | 866 +++++++++++++++--------------------------------
1 file changed, 271 insertions(+), 595 deletions(-)
diff --git a/Autopage.user.js b/Autopage.user.js
index 490d946db..98b2b3c61 100644
--- a/Autopage.user.js
+++ b/Autopage.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 自动无缝翻页
-// @version 3.5.1
+// @version 3.5.2
// @author X.I.U
// @description 无缝拼接下一页内容(瀑布流),目前支持:[所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、DUX/XIU/D8/Begin(WP主题)」网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、B 站(Bilibili)、蓝奏云、煎蛋网、糗事百科、龙的天空、起点小说、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、片库、茶杯狐、NO视频、低端影视、奈菲影视、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画 DB、动漫之家、拷贝漫画、包子漫画、古风漫画网、Mangabz、PubMed、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了...
// @match *://*/*
@@ -97,6 +97,8 @@
scrollD: = 基准元素 - 可视区域底部
4 = 动态加载类网站(只能实现简单的)
insertE: 插入元素的函数
+ 5 = 插入 iframe 方式来加载下一页
+ insStyle: 加载 iframe 前要插入的 CSS Style 样式
nextL: 下一页链接所在元素
pageE: 要获取的主体内容
insertP: 主体内容插入的位置
@@ -475,7 +477,7 @@
},
}, // DuckDuckGo 搜索
startpage: {
- host: 'www.startpage.com',
+ host: ['startpage.com', 'www.startpage.com'],
functionStart: function() {if (location.pathname.indexOf('/search') > -1) {curSite = DBSite.startpage;}},
pager: {
type: 1,
@@ -577,15 +579,17 @@
scrollD: 2000
},
function: {
- bF: baidu_tieba_bF
+ bF: src_bF,
+ pF: [0, 'img[data-original]', 'data-original']
}
}, // 百度贴吧 - 帖子列表
baidu_tieba_post: {
insStyle: '.d_sign_split, img.j_user_sign, .d_author .d_pb_icons, .save_face_bg, .save_face_bg_2, li.d_name a.icon_tbworld, .lzl_cnt a.icon_tbworld {display: none !important;} a.p_author_face.j_frame_guide {background: none repeat scroll 0 0 #FFF !important;border: 1px solid #CCC !important;padding: inherit !important;} .red_text, .red-text, .vip_red, .vip-red, .vip_red:hover, .vip-red:hover, .vip_red:visited, .vip-red:visited {color: #2d64b3 !important;}', // 签名、印记、头像边框、VIP 元素
hiddenPN: true,
pager: {
- type: 4,
- nextL: baidu_tieba_post_nextL,
+ type: 5,
+ nextL: '//li[contains(@class,"pb_list_pager")]/a[contains(text(),"下一页")]',
+ insStyle: '.topic_list_box, ul.tbui_aside_float_bar, .core_title_wrap_bright.tbui_follow_fixed.core_title_absolute_bright {display: none !important;}',
scrollD: 1500
}
}, // 百度贴吧 - 帖子内
@@ -742,7 +746,7 @@
scrollD: 1000
},
function: {
- aF: nga_thread_aF
+ aF: function() {document.body.appendChild(document.createElement('script')).textContent = 'commonui.topicArg.loadAll();';}
}
}, // NGA - 各版块帖子列表
nga_read: {
@@ -758,20 +762,20 @@
}, // NGA - 帖子内
v2ex_recent: {
host: ['v2ex.com', 'www.v2ex.com'],
- functionStart: function() {if (location.pathname === '/') { // 首页
+ functionStart: function() {if (location.pathname === '/') {
v2ex_aF('#Main a.topic-link:not([target])');
- } else if (location.pathname === '/recent') { // 最近主题页
+ } else if (location.pathname === '/recent') {
curSite = DBSite.v2ex_recent;
v2ex_aF('#Main a.topic-link:not([target])');
- } else if (location.pathname === '/notifications') { // 提醒消息页
+ } else if (location.pathname === '/notifications') {
curSite = DBSite.v2ex_notifications;
v2ex_aF('#Main a[href^="/t/"]:not([target])');
- } else if (location.pathname === '/balance') { // 账户余额页
+ } else if (location.pathname === '/balance') {
curSite = DBSite.v2ex_balance;
- } else if (location.pathname.indexOf('/go/') > -1) { // 分类主题页
+ } else if (location.pathname.indexOf('/go/') > -1) {
curSite = DBSite.v2ex_go;
v2ex_aF('#Main a.topic-link:not([target])');
- } else if (location.pathname.indexOf('/replies') > -1) { // 用户回复页
+ } else if (location.pathname.indexOf('/replies') > -1) {
curSite = DBSite.v2ex_replies;
v2ex_aF('#Main a[href^="/t/"]:not([target])');
}},
@@ -1575,7 +1579,7 @@
host: 'mod.3dmgame.com',
pager: {
type: 1,
- nextL: _3dmgame_mod_nextL,
+ nextL: function() {return getPage_nextL('//li[@class="page-list active"]/following-sibling::li[contains(@class, "page-list")]/a', 'Page=', /Page=\d+/)},
pageE: '//div[contains(@class, "game-mod-list") or contains(@class, "search-mod-list")] | //script[not(@src or @type)][contains(text(), ".game-mod-page") or contains(text(), ".search-mod-page")]',
insertP: ['//div[contains(@class, "game-mod-wrap") or contains(@class, "search-mod ")]', 3],
scriptT: 2,
@@ -2385,10 +2389,11 @@
functionStart: function() {if (location.pathname != '/') {curSite = DBSite.assrt;};},
pager: {
type: 1,
- nextL: assrt_nextL,
- pageE: 'css;.resultcard > div:not(#top-banner):not(#bottom-banner)',
+ nextL: function() {return getPage_nextL('css;#pl-current+a', 'page=', /page=\d+/);},
+ pageE: 'css;.resultcard > div:not(#top-banner):not(#bottom-banner):not(.pagelinkcard)',
insertP: ['css;.pagelinkcard', 1],
replaceE: 'css;.pagelinkcard',
+ history: true,
scrollD: 1000
}
}, // 射手网(字幕)
@@ -2666,7 +2671,7 @@
document.cookie='display_mode=1; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/'; // 写入 Cookie 开启 [上下滚动阅读] 模式
location.reload(); // 刷新网页
}
- setTimeout(dmzj_init, 100);
+ setTimeout(function() {dmzj_init('.comic_wraCon > a > img')}, 100);
curSite = DBSite.dmzj;
} else if (location.pathname.indexOf('/category') > -1 || location.pathname.indexOf('/update') > -1) {
curSite = DBSite.dmzj_list;
@@ -2676,7 +2681,7 @@
insStyle: 'p.mh_curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} .comic_wraCon > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}', // 隐藏中间的页数信息
pager: {
type: 4,
- nextL: dmzj_nextL,
+ nextL: 'css;span.next > a',
insertP: ['css;.comic_wraCon', 3],
insertE: dmzj_insertE,
replaceE: 'css;.wrap_last_mid, .wrap_last_head, title',
@@ -2711,7 +2716,7 @@
functionStart: function() {if (/\/\d+\.shtml/.test(location.pathname)) {
let chapterScroll = getCSS('#qiehuan_txt') // 强制为 [上下滚动阅读] 模式
if (chapterScroll && chapterScroll.textContent === '切换到上下滚动阅读') {chapterScroll.click();}
- setTimeout(dmzj_manhua_init, 100);
+ setTimeout(function() {dmzj_init('#center_box > .inner_img img[src]')}, 100);
curSite = DBSite.dmzj_manhua;
} else if (location.pathname.indexOf('/update') > -1) {
curSite = DBSite.dmzj_manhua_update;
@@ -2719,7 +2724,7 @@
insStyle: 'p.curr_page, .btmBtnBox, .float_code, #floatCode {display: none !important;} #center_box > img {display: block !important;margin: 0 auto !important; border: none !important; padding: 0 !important; max-width: 99% !important; height: auto !important;}', // 隐藏中间的页数信息
pager: {
type: 4,
- nextL: dmzj_manhua_nextL,
+ nextL: 'css;#next_chapter',
insertP: ['css;#center_box', 3],
insertE: dmzj_manhua_insertE,
replaceE: 'css;.display_graybg, title',
@@ -2748,8 +2753,9 @@
hiddenPN: true,
insStyle: '.upMember, .comicContainerAds, .footer {display: none !important;} body, html {height: auto !important;}',
pager: {
- type: 4,
- nextL: copymanga_nextL,
+ type: 5,
+ nextL: 'css;.comicContent-next > a',
+ insStyle: 'h4.header, h4.header +div[style*="fixed"] {display: none !important;}',
history: true,
scrollD: 3000
}
@@ -2769,7 +2775,7 @@
}
}, // 拷贝漫画 - 分类页
mhxqiu: {
- host: 'www.mhxqiu.com',
+ host: /\.mhxqiu/,
functionStart: function() {if (/\/\d+\.html/.test(location.pathname)) { // 阅读页
curSite = DBSite.mhxqiu;
} else if (/\/\d+\/$/.test(location.pathname)) { // 目录页
@@ -2780,7 +2786,7 @@
insStyle: '.imgFloat_1, .imgFloat_2, .main_control, span.comic-ft {display: none !important;} html, body, #mainView {height: auto !important;} body.view .main ul.comic-contain li{margin:0 auto !important;} .comic-contain .loaded{box-shadow: none !important;}',
pager: {
type: 4,
- nextL: mhxqiu_nextL,
+ nextL: 'css;#mainControlNext',
insertP: ['css;#comicContain', 3],
insertE: mhxqiu_insertE,
replaceE: 'css;.main_control, h1.chaptername_title, span.title-comicHeading, title',
@@ -2801,10 +2807,10 @@
fffdm: {
host: 'manhua.fffdm.com',
functionStart: function() {if (location.pathname.split('/').length === 4) {curSite = DBSite.fffdm;}},
- insStyle: '#footer, #header {display: none !important;}',
+ insStyle: '#footer, #header {display: none !important;} #mhimg0 img {display: block !important;margin: 0 auto !important;}',
pager: {
type: 4,
- nextL: fffdm_nextL,
+ nextL: '//a[contains(text(), "下一页") or contains(text(), "下一頁") or contains(text(), "下一话") or contains(text(), "下一話")]',
insertP: ['css;#mhimg0', 3],
insertE: fffdm_insertE,
replaceE: 'css;.navigation, #weizhi, h1, title',
@@ -2843,7 +2849,7 @@
insStyle: '.mh_select, .mh_comicpic > p, mh_headpager {display: none !important;} .mh_comicpic > img{width: 100% !important; height: auto !important;}',
pager: {
type: 4,
- nextL: leyuman_nextL,
+ nextL: 'css;#xurl',
insertP: ['css;.mh_comicpic', 3],
insertE: leyuman_insertE,
replaceE: 'css;.mh_headpager, .mh_readtitle, title',
@@ -2916,7 +2922,8 @@
scrollD: 2000
},
function: {
- bF: szcdmj_bF
+ bF: src_bF,
+ pF: [0, 'img[data-original]', 'data-original']
}
}, // 砂之船动漫家
szcdmj_list: {
@@ -2932,7 +2939,7 @@
mangabz: {
host: ['mangabz.com', 'www.mangabz.com'],
functionStart: function() {if (/\/m\d+/.test(location.pathname)) {
- setTimeout(mangabz_init, 500);
+ setTimeout(mangabz_init, 1500);
curSite = DBSite.mangabz;
} else if (/\/\d+bz\//.test(location.pathname)) {
if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
@@ -2947,7 +2954,7 @@
insertE: mangabz_insertE,
replaceE: 'css;p.top-title, body > .container > div:not([id]), title',
interval: 500,
- scrollD: 1000
+ scrollD: 2000
}
}, // Mangabz 漫画
mangabz_list: {
@@ -2963,7 +2970,7 @@
xmanhua: {
host: ['xmanhua.com', 'www.xmanhua.com'],
functionStart: function() {if (/\/m\d+/.test(location.pathname)) {
- setTimeout(mangabz_init, 500);
+ setTimeout(mangabz_init, 1500);
curSite = DBSite.xmanhua;
} else if (/\/\d+xm\//.test(location.pathname)) {
if (getCSS('.detail-list-form-more')) getCSS('.detail-list-form-more').click();
@@ -2979,7 +2986,7 @@
insertE: xmanhua_insertE,
replaceE: 'css;.reader-title, body > .container > div:not([id]), title',
interval: 500,
- scrollD: 1500
+ scrollD: 2500
}
}, // Xmanhua 漫画
xmanhua_list: {
@@ -3008,10 +3015,10 @@
} else if (location.pathname === '/search') {
curSite = DBSite.cocomanga_search;
}},
- insStyle: '.mh_readend, .mh_footpager, .mh_readmode {display: none !important;} .mh_comicpic img {cursor: unset !important;}',
+ insStyle: '.mh_readend, .mh_footpager, .mh_readmode {display: none !important;} .mh_comicpic img {cursor: unset !important;} .mh_comicpic img {min-height: 150px;}',
pager: {
type: 4,
- nextL: cocomanga_nextL,
+ nextL: '//a[contains(@class, "read_page_link") and contains(string(), "下一章")][not(contains(@href, "javascript"))]',
insertP: ['css;#mangalist', 3],
insertE: cocomanga_insertE,
replaceE: 'css;.mh_readtitle, .mh_headpager > a.mh_prevbook, .mh_readend, head > title',
@@ -3022,7 +3029,7 @@
cocomanga_list: {
pager: {
type: 1,
- nextL: cocomanga_list_nextL,
+ nextL: function() {return getPage_nextL('css;.fed-page-info a.fed-btns-green+a[onclick]', 'page=', /page=\d+/)},
pageE: 'css;ul.fed-list-info > li',
insertP: ['css;ul.fed-list-info', 3],
replaceE: 'css;.fed-page-info',
@@ -3036,7 +3043,7 @@
cocomanga_search: {
pager: {
type: 1,
- nextL: cocomanga_list_nextL,
+ nextL: function() {return getPage_nextL('css;.fed-page-info a.fed-btns-green+a[onclick]', 'page=', /page=\d+/)},
pageE: 'css;dl.fed-deta-info',
insertP: ['css;.fed-page-info', 1],
replaceE: 'css;.fed-page-info',
@@ -4146,12 +4153,12 @@
}, // 学术
x_mol: {
host: 'www.x-mol.com',
- functionStart: function() {if (location.pathname.indexOf('/search/q') > -1) {curSite = DBSite.x_mol;}},
+ functionStart: function() {if (location.pathname.indexOf('/search/q') > -1 || location.pathname.indexOf('/paper/') > -1) {curSite = DBSite.x_mol;}},
pager: {
type: 1,
- nextL: x_mol_mod_nextL,
- pageE: 'css;.magazine-senior-search-results-list > ul > li',
- insertP: ['css;.magazine-senior-search-results-list > ul', 3],
+ nextL: function() {return getPage_nextL('css;.pagination li.active+li > a', 'pageIndex=', /pageIndex=\d+/)},
+ pageE: 'css;.magazine-senior-search-results-list > ul > li, .magazine-model-content-new > ul > li',
+ insertP: ['css;.magazine-senior-search-results-list > ul, .magazine-model-content-new > ul', 3],
replaceE: 'css;.pagination',
history: true,
scrollD: 2000
@@ -4853,6 +4860,7 @@
//console.log(curSite);
pageLoading(); // 自动无缝翻页
+ // --------------------------------------------------------
// [Discuz! 论坛] 判断各版块帖子列表类型
function discuzForum() {
@@ -4921,48 +4929,33 @@
}
- // 插入 Style 样式
- function insStyle(style) {
- document.lastElementChild.appendChild(document.createElement('style')).textContent = style;
- }
-
-
- // 通用型插入前函数(加载图片)
- function src_bF(pageElems, css) {
- pageElems.forEach(function (one) {
- if (css[0] == 0) { // src 图片
- one.querySelectorAll(css[1]).forEach(function (now) {
- now.src = now.getAttribute(css[2]);
- });
- } else if (css[0] == 1) { // 背景图片
- one.querySelectorAll(css[1]).forEach(function (now) {
- now.style.backgroundImage = 'url("' + now.getAttribute(css[2]) + '")';
- });
- }
- });
- return pageElems
- }
-
-
// [头条搜索] 的插入前函数(过滤相关搜索)
function toutiao_bF(pageElems) {
- for (let i = 0; i < pageElems.length; i++) {
- let now = pageElems[i].querySelector('div[class*="-header"]')
- if (now && now.textContent === '相关搜索') {
- pageElems.splice(i,1)
- }
- }
+ if (getXpath('//div[contains(@class,"-header") and string()="相关搜索"]', pageElems[pageElems.length - 1])) pageElems[pageElems.length - 1].style.display = 'none';
return pageElems
}
// [Startpage] 获取下一页地址
function startpage_nextL() {
- let form = getXpath('//div[contains(@class, "pagination ")]/form[./button[@class="pagination__next-prev-button next"]]');
+ let form = getXpath('//div[contains(@class, "pagination ")]/form[./button[@class="pagination__next-prev-button next"]]'), value;
if (form) {
- let action = form.action, value = ''; // 获取提交表单 URL
form.querySelectorAll('input[name]').forEach(function(input) {value += input.name + '=' + input.value + '&';}) // 生成表单参数
- value = encodeURI(value.replace(/&$/,'')); // 清理最后一个 & 符号,并替换页码
+ value = encodeURI(value.replace(/&$/,'')); // 清理最后一个 & 符号
+ if (form.action && value) return (form.action + '?' + value)
+ }
+ return '';
+ }
+
+
+ // [SkrBT] 获取下一页地址
+ function skrbt_nextL() {
+ let page = getCSS('a[onclick][aria-label="Next"]');
+ if (page) {page = /(?<=\()\d+(?=\))/.exec(page.onclick)[0];} else {return '';} // 获取下一页页码
+ if (page) {
+ let action = getCSS('#search-form').action, value = ''; // 获取提交表单 URL
+ getAllCSS('#search-form input[name]').forEach(function(input) {value += input.name + '=' + input.value + '&';}) // 生成表单参数
+ value = encodeURI(value.replace(/&$/,'').replace(/p=\d+/,'p=' + page)); // 清理最后一个 & 符号,并替换页码
if (action && value) return (action + '?' + value)
}
return '';
@@ -4979,26 +4972,12 @@
if (button) {
button.onclick = function(){
let button2 = getCSS('div.edui-btn.edui-btn-fullscreen.edui-btn-name-portrait');
- if (button2) {
- button2.click();
- } else {
- alert('提示:登录后才能发帖!');
- }
+ if (button2) {button2.click();} else {alert('提示:登录后才能发帖!');}
return false;
}
}
}
}
- // [百度贴吧] 的插入前函数(加载图片)
- function baidu_tieba_bF(pageElems) {
- pageElems.forEach(function (one) {
- one.querySelectorAll('img.threadlist_pic[data-original]').forEach(function (now) {
- now.src = now.dataset.original;
- now.style.display = 'inline';
- })
- });
- return pageElems
- }
// [百度贴吧] 获取下一页地址
function baidu_tieba_nextL() {
let next = getCSS('a.next.pagination-item');
@@ -5024,7 +5003,7 @@
// 字符串格式化并转为 Element 元素
var temp_baidu_tieba = document.createElement('div'); temp_baidu_tieba.innerHTML = JSON.parse(scriptText).content;
// 插入前执行函数
- pageElems = curSite.function.bF(getAll(curSite.pager.pageE, temp_baidu_tieba, temp_baidu_tieba));
+ pageElems = curSite.function.bF(getAll(curSite.pager.pageE, temp_baidu_tieba, temp_baidu_tieba), curSite.function.pF);
// 插入元素
pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo, one);});
// 当前页码 + 1
@@ -5041,12 +5020,6 @@
}
- // [NGA(玩家社区)] 的插入后函数(加载各版块帖子列表样式)
- function nga_thread_aF() {
- document.body.appendChild(document.createElement('script')).textContent = 'commonui.topicArg.loadAll();';
- }
-
-
// [V2EX] 的插入后函数(新标签页打开链接)
function v2ex_aF(css) {
let links = getAllCSS(css);if (!links) return
@@ -5060,10 +5033,6 @@
if (next && next.getAttribute('aria-disabled') === 'false') {
page = getCSS('li.ant-pagination-item-active[title]');
if (page && page.title) {
- if (curSite.pager.interval) {
- let _SiteTypeID = curSite.SiteTypeID; curSite.SiteTypeID = 0;
- setTimeout(function(){curSite.SiteTypeID = _SiteTypeID;}, curSite.pager.interval)
- }
return (location.origin + location.pathname + '?page=' + ++page.title);
}
}
@@ -5071,53 +5040,9 @@
}
- // [3DM MOD] 获取下一页地址
- function _3dmgame_mod_nextL() {
- let nextNum = getXpath('//li[@class="page-list active"]/following-sibling::li[contains(@class, "page-list")]/a');
- var url = '';
- if (nextNum && nextNum.textContent) {
- nextNum = 'Page=' + nextNum.textContent;
- if (location.search) {
- let search = location.search.replace(/(&)?Page=\d+(&)?/, '');
- if (search === '?') {
- url += location.origin + location.pathname + search + nextNum;
- } else {
- url += location.origin + location.pathname + search + '&' + nextNum;
- }
- } else {
- url += location.origin + location.pathname + '?' + nextNum;
- }
- }
- //console.log(url)
- return url
- }
-
-
- // [X-MOL] 获取下一页地址
- function x_mol_mod_nextL() {
- let nextNum = getCSS('.pagination li.active+li > a');
- var url;
- if (nextNum && nextNum.textContent) {
- if (location.search) {
- let search;
- if (location.search.indexOf('pageIndex=') > -1) {
- search = location.search.replace(/pageIndex=\d+/, 'pageIndex=' + nextNum.textContent);
- } else {
- search = location.search + '&pageIndex=' + nextNum.textContent;
- }
- url = location.origin + location.pathname + search;
- }
- }
- //console.log(url)
- return url
- }
-
-
// [游民星空-攻略] 的插入前函数(移除下一页底部的 "更多相关内容请关注:xxx" 文字)
function gamersky_gl_bF(pageElems) {
- pageElems.forEach(function (one) {
- if (one.tagName === 'P' && one.textContent.indexOf('更多相关内容请关注') > -1) {one.style.display = 'none';}
- });
+ pageElems.forEach(function (one) {if (one.tagName === 'P' && one.textContent.indexOf('更多相关内容请关注') > -1) {one.style.display = 'none';}});
return pageElems
}
@@ -5236,31 +5161,14 @@
if (next && next.className.indexOf('disabled') === -1) {
let oldList = getCSS('tbody.row-hover').innerHTML;
if (oldList) {
- // 点击下一页
next.click();
- // 当前页码 + 1
- pageNum.now = pageNum._now + 1
- // 插入到列表头部
- getCSS('tbody.row-hover').insertAdjacentHTML('afterbegin', oldList);
+ pageNum.now = pageNum._now + 1;
+ getCSS('tbody.row-hover').insertAdjacentHTML('afterbegin', oldList); // 插入到列表头部
}
}
}
- // [SkrBT] 获取下一页地址
- function skrbt_nextL() {
- let page = getCSS('a[onclick][aria-label="Next"]');
- if (page) {page = /(?<=\()\d+(?=\))/.exec(page.onclick)[0];} else {return '';} // 获取下一页页码
- if (page) {
- let action = getCSS('#search-form').action, value = ''; // 获取提交表单 URL
- getAllCSS('#search-form input[name]').forEach(function(input) {value += input.name + '=' + input.value + '&';}) // 生成表单参数
- value = encodeURI(value.replace(/&$/,'').replace(/p=\d+/,'p=' + page)); // 清理最后一个 & 符号,并替换页码
- if (action && value) return (action + '?' + value)
- }
- return '';
- }
-
-
// [BTHaha] 的插入前函数(隐藏底部元素)
function bthaha_bF(pageElems) {
pageElems.forEach(function (one) {
@@ -5271,20 +5179,6 @@
}
- // [射手网] 获取下一页地址
- function assrt_nextL() {
- let nextXPAHT = '//a[@id="pl-nav"][contains(text(), ">")]'
- let url = getXpath(nextXPAHT);
- if (url) {
- url = /(?<=\()\d+(?=,)/.exec(url.href)[0]
- if (url) {
- return (location.origin + location.pathname + location.search.replace(/(&)?page=\d+$/,'') + '&page=' + url);
- }
- }
- return '';
- }
-
-
// [LRepacks] 的插入前函数(调整 class)
function lrepacks_bF(pageElems) {
pageElems.forEach(function (one) {
@@ -5299,12 +5193,10 @@
// [漫画狂] 获取下一页地址
function cartoonmad_nextL() {
- let nextXPAHT = '//a[@class="pages"][contains(text(),"下一頁")]',
- nextPXPATH = '//a[@class="pages"][contains(string(),"下一話")]'
- let url = getXpath(nextXPAHT);
+ let url = getXpath('//a[@class="pages"][contains(text(),"下一頁")]');
if (url) {
if (url.getAttribute('href') === 'thend.asp') {
- url = getXpath(nextPXPATH)
+ url = getXpath('//a[@class="pages"][contains(string(),"下一話")]')
if (url) return url.href;
pausePage = false;
GM_notification({text: `注意:该网站早期漫画(如海贼王、柯南)因为网站自身问题而无法翻至下一话(仅限于显示为 [第 X 卷]/[下一卷] 的)。\n因此需要手动去 [目录页] 进入下一卷!`, timeout: 10000});
@@ -5319,11 +5211,8 @@
// [漫画猫] 初始化(显示本话所以图片)
function manhuacat_init() {
let _img = '';
- for (let now of img_data_arr) {
- _img += ``;
- }
- getCSS('.img-content > img').remove();
- getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
+ for (let now of img_data_arr) {_img += `
`;}
+ getOne(curSite.pager.insertP[0]).innerHTML = _img;
}
// [漫画猫] 获取下一页地址
@@ -5347,27 +5236,14 @@
if (type === 'url') { // 获取下一页链接
manhuacat_nextL(pageElems, type); return
}
-
- // 添加历史记录
- window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
-
- // 替换元素
- let oriE = getAllCSS(curSite.pager.replaceE.replace('css;', '')),
- repE = getAll(curSite.pager.replaceE, pageElems, pageElems);
- if (oriE.length === repE.length) {
- for (let i = 0; i < oriE.length; i++) {
- oriE[i].outerHTML = repE[i].outerHTML;
- }
- }
+ addHistory(pageElems);
+ replaceElement(pageElems);
// 插入图片
let _img = '', _img_arr = LZString.decompressFromBase64(getXpath('//body/script[not(@src)][contains(text(), "img_data")]').textContent.split('"')[1]).split(','), vg_r_data = getCSS('.vg-r-data');;
- for (let now of _img_arr) {
- _img += `
`;
- }
+ for (let now of _img_arr) {_img += `
`;}
if (_img) {
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
- // 当前页码 + 1
pageNum.now = pageNum._now + 1
}
}
@@ -5383,9 +5259,7 @@
//console.log(imgPath, window['imgDate'])
if (!(window['imgDate']) || !(imgPath)) return
// 遍历图片文件名数组,组合为 img 标签
- for (let i = 0; i < window['imgDate'].files.length; i++) {
- _img += `
`
- }
+ for (let i = 0; i < window['imgDate'].files.length; i++) {_img += `
`;}
// 插入并覆盖原来的一个图片
getOne(curSite.pager.insertP[0]).innerHTML = _img;
pausePage = true;
@@ -5407,39 +5281,29 @@
//console.log(imgPath, window['imgDate'])
if (!(window['imgDate']) || !(imgPath)) return
// 遍历图片文件名数组,组合为 img 标签
- for (let i = 0; i < window['imgDate'].files.length; i++) {
- _img += `
`
- }
- // 将 img 标签插入到网页中
+ for (let i = 0; i < window['imgDate'].files.length; i++) {_img += `
`;}
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
- // 添加历史记录
- window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
- document.title = pageElems.querySelector('title').textContent;
- // 当前页码 + 1
+ addHistory(pageElems);
pageNum.now = pageNum._now + 1
}
- // [漫画DB] 初始化(将本话其余图片插入网页中)
+ // [漫画 DB] 初始化(将本话其余图片插入网页中)
function manhuadb_init() {
- let _img = '',
- data = getCSS('.vg-r-data'), imgDate;
+ let _img = '', data = getCSS('.vg-r-data'), imgDate;
if (!data) return
getAllCSS(curSite.pager.pageE.replace('css;', '')).forEach(function (one) {
if (one.tagName === 'SCRIPT' && one.textContent.indexOf('var img_data =') > -1) {
let json = JSON.parse(window.atob(one.textContent.split("'")[1]));
if (json) {
let _img = '';
- for (let i = 0; i < json.length; i++) { // 遍历图片文件名数组,组合为 img 标签
- let src = data.dataset.host + data.dataset.img_pre + json[i].img;
- _img += `
`
- }
+ for (let i = 0; i < json.length; i++) {_img += `
`;}
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
}
}
})
}
- // [漫画DB] 获取下一页地址
+ // [漫画 DB] 获取下一页地址
function manhuadb_nextL() {
let nextArr = getAllCSS('a.fixed-a-es'), next;
var url = '';
@@ -5454,16 +5318,11 @@
curSite.pageUrl = url
getPageElems(curSite.pageUrl);
}
- // [漫画DB] 插入数据
+ // [漫画 DB] 插入数据
function manhuadb_insertE(pageElems, type) {
if (!pageElems) return
- let oriE = getAllCSS(curSite.pager.pageE.replace('css;', '')),
- repE = getAll(curSite.pager.pageE, pageElems, pageElems);
- if (oriE.length === repE.length) {
- for (let i = 0; i < oriE.length; i++) {
- oriE[i].outerHTML = repE[i].outerHTML;
- }
- // 当前页码 + 1
+ if (replaceElement(pageElems, curSite.pager.pageE, curSite.pager.pageE)) {
+ addHistory(pageElems);
pageNum.now = pageNum._now + 1
manhuadb_init(); // 将刚刚替换的图片插入网页中
}
@@ -5499,10 +5358,9 @@
getCSS('.next_chapter').id = 'None';
getCSS('.next_chapter').classList.add('end');
}
+ curSite.pageUrl =`https://www.hicomic.net/chapters/${pageElems.results.chapter.uuid}/contents`
getCSS('.chapter_name').textContent = pageElems.results.chapter.name; // 修改漫画标题
- let title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageElems.results.chapter.name}) - HiComic`)
- window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title, curSite.pageUrl); // 添加历史记录
- window.document.title = title; // 修改当前网页标题为下一话的标题
+ addHistory(pageElems, window.document.title.replace(/(\(第.+\))? - HiComic/, `(${pageElems.results.chapter.name}) - HiComic`));
let _img = '';
for (let i = 0; i < pageElems.results.chapter.contents.length; i++) { // 遍历图片文件名数组,组合为 img 标签
let src = pageElems.results.chapter.contents[i].url;
@@ -5510,30 +5368,15 @@
_img += `
`
}
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
- // 当前页码 + 1
pageNum.now = pageNum._now + 1
}
// [动漫之家] 初始化(调整本话其余图片)
- function dmzj_init() {
+ function dmzj_init(css) {
let _img = '';
- getAllCSS('.comic_wraCon > a > img').forEach(function (one) {
- _img += `
`;
- one.parentElement.remove();
- })
- getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
-
- }
- // [动漫之家] 获取下一页地址
- function dmzj_nextL() {
- let next;
- next = getCSS('span.next > a')
- if (next) {
- if (next.href === curSite.pageUrl) return
- curSite.pageUrl = next.href;
- getPageElems(curSite.pageUrl);
- }
+ getAllCSS(css).forEach(function (one) {_img += `
`;})
+ getOne(curSite.pager.insertP[0]).innerHTML = _img;
}
// [动漫之家] 插入数据
function dmzj_insertE(pageElems, type) {
@@ -5553,42 +5396,8 @@
}
if (_img) {
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
-
- // 添加历史记录
- window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
-
- // 替换元素
- let oriE = getAllCSS(curSite.pager.replaceE.replace('css;', '')),
- repE = getAll(curSite.pager.replaceE, pageElems, pageElems);
- if (oriE.length === repE.length) {
- for (let i = 0; i < oriE.length; i++) {
- oriE[i].outerHTML = repE[i].outerHTML;
- }
- // 当前页码 + 1
- pageNum.now = pageNum._now + 1
- }
- }
- }
-
-
- // [动漫之家-漫画] 初始化(调整本话其余图片)
- function dmzj_manhua_init() {
- let _img = '';
- getAllCSS('#center_box > .inner_img img[src]').forEach(function (one) {
- _img += `
`;
- one.parentElement.parentElement.remove();
- })
- getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
-
- }
- // [动漫之家-漫画] 获取下一页地址
- function dmzj_manhua_nextL() {
- let next;
- next = getCSS('#next_chapter')
- if (next) {
- if (next.href === curSite.pageUrl) return
- curSite.pageUrl = next.href;
- getPageElems(curSite.pageUrl);
+ addHistory(pageElems);
+ if (replaceElement(pageElems)) pageNum.now = pageNum._now + 1
}
}
// [动漫之家-漫画] 插入数据
@@ -5604,103 +5413,12 @@
}
if (_img) {
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
-
- // 添加历史记录
- window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
-
- // 替换元素
- let oriE = getAllCSS(curSite.pager.replaceE.replace('css;', '')),
- repE = getAll(curSite.pager.replaceE, pageElems, pageElems);
- if (oriE.length === repE.length) {
- for (let i = 0; i < oriE.length; i++) {
- oriE[i].outerHTML = repE[i].outerHTML;
- }
- // 当前页码 + 1
- pageNum.now = pageNum._now + 1
- }
- }
- }
-
-
- // [百度贴吧 - 帖子内] 加载下一页
- function baidu_tieba_post_nextL() {
- let next;
- next = getXpath('//li[contains(@class,"pb_list_pager")]/a[contains(text(),"下一页")]')
- if (next) {
- if (next.href === curSite.pageUrl) return
- curSite.pageUrl = next.href;
- insStyle('topic_list_box, ul.tbui_aside_float_bar, .core_title_wrap_bright.tbui_follow_fixed.core_title_absolute_bright {display: none !important;}');
- insIframe(curSite.pageUrl);
- }
- }
-
-
- // [拷贝漫画] 加载下一页
- function copymanga_nextL() {
- let next;
- next = getCSS('.comicContent-next > a')
- if (next) {
- if (next.href === curSite.pageUrl) return
- curSite.pageUrl = next.href;
- insStyle('h4.header, h4.header +div[style*="fixed"] {display: none !important;}');
- insIframe(curSite.pageUrl);
- }
- }
-
-
- // 插入 iframe 加载下一页
- function insIframe(src) {
- // 停用当前页面翻页
- curSite.SiteTypeID = 0;
- // 当滚动条到底部时(即完全显示 iframe 框架),隐藏当前页面的滚动条
- window.addEventListener('scroll', function (e) {
- let scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
- scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
- clientHeight = document.documentElement.clientHeight || document.body.clientHeight
- if (scrollTop + clientHeight + 10 >= scrollHeight) {
- if (!getCSS('#xiu-scroll')) {
- let newStyle = document.createElement('style'); newStyle.id = 'xiu-scroll';
- document.lastElementChild.appendChild(newStyle).textContent = 'html::-webkit-scrollbar {width: 0 !important;height: 0 !important;} html {scrollbar-width: none !important;}';
- }
- } else {
- if (getCSS('#xiu-scroll')) {
- getCSS('#xiu-scroll').remove();
- }
- }
- //console.log(`${scrollTop} + ${clientHeight} >= ${scrollTop + clientHeight} / ${scrollHeight}`)
- }, false);
-
- // 创建 iframe
- let iframe = document.createElement('iframe');
- iframe.style = 'position: absolute; width: 100%; height: 100%; border: none;';
- iframe.src = src;
-
- // 添加历史记录
- if (curSite.pager.history) {
- // 加载完成后才继续
- iframe.onload = function() {
- let title_ = iframe.contentWindow.document.title;
- if (!title_) {title_ = window.top.document.title;};
- window.top.history.pushState(`{title: ${document.title}, url: ${location.href}}`, title_, curSite.pageUrl);
- window.top.document.title = iframe.contentWindow.document.title
- };
+ addHistory(pageElems);
+ if (replaceElement(pageElems)) pageNum.now = pageNum._now + 1
}
-
- // 插入 iframe
- document.lastElementChild.appendChild(iframe);
}
- // [漫画星球] 获取下一页地址
- function mhxqiu_nextL() {
- let next = getCSS('#mainControlNext');
- if (next) {
- if (next.href === curSite.pageUrl) return
- curSite.pageUrl = next.href;
- //console.log(curSite.pageUrl)
- getPageElems(curSite.pageUrl);
- }
- }
// [漫画星球] 插入数据
function mhxqiu_insertE(pageElems, type) {
if (!pageElems) return
@@ -5709,40 +5427,17 @@
// 插入图片
let _img = '';
- for (let now of newImgs) {
- _img += `