Skip to content

Commit 887ce84

Browse files
committed
优化 [游侠网] 规则; 优化 代码(insScript 相关)
1 parent a9b2cdd commit 887ce84

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

Autopage.user.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 自动无缝翻页
44
// @name:zh-TW 自動無縫翻頁
55
// @name:en AutoPager
6-
// @version 5.2.4
6+
// @version 5.2.5
77
// @author X.I.U
88
// @description ⭐无缝衔接下一页内容到网页底部(类似瀑布流)⭐,目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP...」论坛】【百度、谷歌(Google)、必应(Bing)、搜狗、微信、360、Yahoo、Yandex 等搜索引擎...】、贴吧、豆瓣、知乎、微博、NGA、V2EX、B 站(Bilibili)、煎蛋网、龙的天空、起点中文、IT之家、千图网、千库网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、漫画猫、漫画屋、漫画 DB、动漫之家、拷贝漫画、HiComic、Mangabz、Xmanhua 等漫画网站...】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了...
99
// @description:zh-TW ⭐無縫銜接下一頁內容到網頁底部(類似瀑布流)⭐,支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎(Google、Bing、Yahoo...) 等網站~
@@ -41,7 +41,7 @@
4141
['menu_rules', '更新外置翻页规则 (每天自动)', '更新外置翻页规则 (每天自动)', {}],
4242
['menu_customRules', '自定义翻页规则', '自定义翻页规则', {}]
4343
], menuId = [], webType = 0, curSite = {SiteTypeID: 0}, DBSite, SiteType, pausePage = true, pageNum = {now: 1, _now: 1}, urlC = false, nowLocation = '', lp = location.pathname;
44-
window.autoPage = {lp: ()=>location.pathname, indexOF: indexOF, isMobile: isMobile, isUrlC: isUrlC, forceTarget: forceTarget, getAll: getAll, getOne: getOne, getAllXpath: getAllXpath, getXpath: getXpath, getAllCSS: getAllCSS, getCSS: getCSS, getNextE: getNextE, getNextEP: getNextEP, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getCookie: getCookie, insStyle: insStyle, src_bF: src_bF, xs_bF: xs_bF}
44+
window.autoPage = {lp: ()=>location.pathname, indexOF: indexOF, isMobile: isMobile, isUrlC: isUrlC, forceTarget: forceTarget, getAll: getAll, getOne: getOne, getAllXpath: getAllXpath, getXpath: getXpath, getAllCSS: getAllCSS, getCSS: getCSS, getNextE: getNextE, getNextEP: getNextEP, getNextEPN: getNextEPN, getNextUPN: getNextUPN, getNextUP: getNextUP, getNextF: getNextF, getCookie: getCookie, insStyle: insStyle, insScript: insScript, src_bF: src_bF, xs_bF: xs_bF}
4545

4646
for (let i=0;i<menuAll.length;i++){ // 如果读取到的值为 null 就写入默认值
4747
if (GM_getValue(menuAll[i][0]) == null){GM_setValue(menuAll[i][0], menuAll[i][3])};
@@ -1853,7 +1853,7 @@ function: {
18531853
function manhuagui_insertE(pageE, type) {
18541854
if (!pageE) return
18551855
// 重新执行本页的 imgDate 代码
1856-
insScript(curSite.pager.pageE, document.body, pageE);
1856+
insScript(curSite.pager.pageE, pageE);
18571857
let _img = '', imgPath = `${location.protocol}//i.hamreus.com${window['imgDate'].path}`;
18581858
//console.log(imgPath, window['imgDate'])
18591859
if (!(window['imgDate']) || !(imgPath)) return
@@ -1887,7 +1887,7 @@ function: {
18871887
function _36manga_insertE(pageE, type) {
18881888
if (!pageE) return
18891889
// 插入并执行数据代码
1890-
insScript(curSite.pager.pageE, document.body, pageE);
1890+
insScript(curSite.pager.pageE, pageE);
18911891
let _img = '', imgPath = `${SinConf.resHost[0].domain[0]}${chapterPath}`;
18921892
if (!(chapterImages) || !(imgPath)) return
18931893
// 遍历图片文件名数组,组合为 img 标签
@@ -1941,7 +1941,7 @@ function: {
19411941
function imanhuaw_insertE(pageE, type) {
19421942
if (!pageE) return
19431943
// 插入并运行 <script>
1944-
insScript('//head/script[not(@src)][contains(text(), "qTcms_S_m_murl_e")]', document.body, pageE);
1944+
insScript('//head/script[not(@src)][contains(text(), "qTcms_S_m_murl_e")]', pageE);
19451945
// 将 img 标签插入到网页中
19461946
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), imanhuaw_getIMG());
19471947
addHistory(pageE);
@@ -2043,7 +2043,7 @@ function: {
20432043
function dmzj_insertE(pageE, type) {
20442044
if (!pageE) return
20452045
// 插入并运行 <script>
2046-
insScript('head > script[type]:not([src])', document.body, pageE);
2046+
insScript('head > script[type]:not([src])', pageE);
20472047

20482048
// 插入图片
20492049
let _img = '', _img_arr;
@@ -2065,7 +2065,7 @@ function: {
20652065
function dmzj_manhua_insertE(pageE, type) {
20662066
if (!pageE) return
20672067
// 插入并运行 <script>
2068-
insScript('head > script[type]:not([src])', document.body, pageE);
2068+
insScript('head > script[type]:not([src])', pageE);
20692069

20702070
// 插入图片
20712071
let _img = '';
@@ -2101,7 +2101,7 @@ function: {
21012101
//console.log(pageE)
21022102
if (!pageE) return
21032103
// 插入并运行 <script>
2104-
insScript('//script[contains(text(),"chapterImages")]', document.body, pageE);
2104+
insScript('//script[contains(text(),"chapterImages")]', pageE);
21052105

21062106
let host = SinMH.getChapterImage(1).split('/')[0] + '//' + SinMH.getChapterImage(1).split('/')[2];
21072107
if (!host) host = document.querySelector(curSite.pager.insertP[0]).src.split('/')[0] + '//' + document.querySelector(curSite.pager.insertP[0]).src.split('/')[2]
@@ -2129,7 +2129,7 @@ function: {
21292129
function mhxqiu_insertE(pageE, type) {
21302130
if (!pageE) return
21312131
// 插入并运行 <script>
2132-
insScript('//script[contains(text(), "eval") and contains(text(), "newImgs")]', document.body, pageE);
2132+
insScript('//script[contains(text(), "eval") and contains(text(), "newImgs")]', pageE);
21332133

21342134
// 插入图片
21352135
let _img = '';
@@ -2180,7 +2180,7 @@ function: {
21802180
function leyuman_insertE(pageE, type) {
21812181
if (!pageE) return
21822182
// 插入并运行 <script>
2183-
insScript('//body//script[not(@src)][contains(text(), "z_img=")]', document.body, pageE);
2183+
insScript('//body//script[not(@src)][contains(text(), "z_img=")]', pageE);
21842184

21852185
// 插入图片
21862186
let _img = '';
@@ -2219,7 +2219,7 @@ function: {
22192219
function _77mh_insertE(pageE, type) {
22202220
if (!pageE) return
22212221
// 插入并运行 <script>
2222-
insScript('//script[not(@src)][contains(text(), "eval(")]', document.body, pageE);
2222+
insScript('//script[not(@src)][contains(text(), "eval(")]', pageE);
22232223

22242224
// 插入图片
22252225
let _img = '';
@@ -2323,7 +2323,7 @@ function: {
23232323
}
23242324
} else { // 下一话
23252325
// 插入 <script> 标签
2326-
insScript('html:not([dir]) > head > script:not([src])', document.body, pageE);
2326+
insScript('html:not([dir]) > head > script:not([src])', pageE);
23272327
addHistory(pageE);
23282328
pageNum.now = pageNum._now + 1
23292329
replaceElems(pageE)
@@ -2362,7 +2362,7 @@ function: {
23622362
}
23632363
} else { // 下一话
23642364
// 插入 <script> 标签
2365-
insScript('html:not([dir]) > head > script:not([src])', document.body, pageE);
2365+
insScript('html:not([dir]) > head > script:not([src])', pageE);
23662366
addHistory(pageE);
23672367
pageNum.now = pageNum._now + 1
23682368
replaceElems(pageE)
@@ -2401,7 +2401,7 @@ function: {
24012401
}
24022402
} else { // 下一话
24032403
// 插入 <script> 标签
2404-
insScript('html:not([dir]) > head > script:not([src])', document.body, pageE);
2404+
insScript('html:not([dir]) > head > script:not([src])', pageE);
24052405
addHistory(pageE);
24062406
pageNum.now = pageNum._now + 1
24072407
replaceElems(pageE)
@@ -2431,7 +2431,7 @@ function: {
24312431
function cocomanga_insertE(pageE, type) {
24322432
if (pageE) {
24332433
// 插入 <script> 标签
2434-
insScript('head > script:not([src]), script[src*="custom.js"], script[src*="dynamicjs.js"]', document.body, pageE);
2434+
insScript('head > script:not([src]), script[src*="custom.js"], script[src*="dynamicjs.js"]', pageE);
24352435

24362436
// 插入新图片元素
24372437
setTimeout(function() {
@@ -2794,15 +2794,15 @@ function: {
27942794
if (curSite.pager.scriptT || curSite.pager.scriptT == 0) {
27952795
switch (curSite.pager.scriptT) {
27962796
case 0: // 下一页的所有 <script> 标签
2797-
insScript('script', toE, response); break;
2797+
insScript('script', response); break;
27982798
case 1: // 下一页的所有 <script> 标签(不包括 src 链接)
2799-
insScript('script:not([src])', toE, response); break;
2799+
insScript('script:not([src])', response); break;
28002800
case 2: // 下一页主体元素 (pageE) 的同级 <script> 标签
28012801
if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
2802-
insScript(null, toE, pageE); break;
2802+
insScript(null, pageE); break;
28032803
case 3: // 下一页主体元素 (pageE) 的子元素 <script> 标签
28042804
if (curSite.pager.insertP[1] === 2 || curSite.pager.insertP[1] === 4 || curSite.pager.insertP[1] === 5) pageE.reverse(); // 为了避免 JS 执行顺序反了,还需要再给反转回去
2805-
insScript('script:not([src])', toE, pageE); break;
2805+
insScript('script:not([src])', pageE); break;
28062806
}
28072807
}
28082808

@@ -3029,7 +3029,7 @@ function: {
30293029
window.top.document.title = title;
30303030
}
30313031
// 插入 <Script>
3032-
function insScript(selector, toE = document.body, contextNode = document) {
3032+
function insScript(selector, contextNode = document, toE = document.body) {
30333033
let scriptElems = contextNode;
30343034
if (selector) {
30353035
if (contextNode instanceof Array) {

other/Autopage/rules.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,7 @@
15481548
],
15491549
"replaceE": ".page_fenye",
15501550
"scrollE": ".page_fenye",
1551+
"scriptT": 2,
15511552
"interval": 500,
15521553
"scrollD": 100
15531554
}

0 commit comments

Comments
 (0)