Skip to content

Commit 30d2a31

Browse files
committed
新增 [漫画柜] 支持
1 parent bd6a2af commit 30d2a31

1 file changed

Lines changed: 105 additions & 26 deletions

File tree

Autopage.user.js

Lines changed: 105 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name 自动无缝翻页
3-
// @version 3.5.0
3+
// @version 3.5.1
44
// @author X.I.U
55
// @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(以上仅一小部分,更多的写不下了...
66
// @match *://*/*
@@ -2585,6 +2585,42 @@
25852585
scrollD: 1500
25862586
}
25872587
}, // 漫画台 - 搜索页
2588+
manhuagui: {
2589+
host: 'www.mhgui.com',
2590+
functionStart: function() {if (/\/comic\/\d+\/\d+\.html/.test(location.pathname)) {
2591+
if (!getXpath('//li[@class="pfunc"]/a[@class="current" and text()="双击"]')) getXpath('//li[@class="pfunc"]/a[text()="双击"]').click();
2592+
pausePage = false;
2593+
setTimeout(manhuagui_init, 100);
2594+
curSite = DBSite.manhuagui;
2595+
} else if (location.pathname.indexOf('list/') > -1 || location.pathname.indexOf('/s/') > -1) {
2596+
curSite = DBSite.manhuagui_list;
2597+
}},
2598+
insStyle: '.sub-btn, .tc {display: none !important;} #mangaBox > img {width: auto !important;height: auto !important;display: block !important;margin: 0 auto !important;}',
2599+
pager: {
2600+
type: 4,
2601+
nextL: manhuagui_nextL,
2602+
pageE: 'css;body > script:not([src])',
2603+
insertP: ['css;#mangaBox', 3],
2604+
insertE: manhuagui_insertE,
2605+
replaceE: 'css;title',
2606+
interval: 4000,
2607+
scrollD: 2500
2608+
}
2609+
}, // 漫画柜
2610+
manhuagui_list: {
2611+
pager: {
2612+
type: 1,
2613+
nextL: '//div[@class="pager"]/a[text()="下一页"]',
2614+
pageE: 'css;.book-result > ul > li, .book-list > ul > li',
2615+
insertP: ['css;.book-result > ul, .book-list > ul', 3],
2616+
replaceE: 'css;.pager',
2617+
scrollD: 1500
2618+
},
2619+
function: {
2620+
bF: src_bF,
2621+
pF: [0, 'img[data-src]', 'data-src']
2622+
}
2623+
}, // 漫画台 - 分类/搜索页
25882624
manhuadb: {
25892625
host: 'www.manhuadb.com',
25902626
functionStart: function() {if (/\/manhua\/\d+\/.+\.html/.test(location.pathname)) {
@@ -5287,7 +5323,7 @@
52875323
_img += `<img src="${asset_domain}${img_pre}${now}">`;
52885324
}
52895325
getCSS('.img-content > img').remove();
5290-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5326+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
52915327

52925328
}
52935329
// [漫画猫] 获取下一页地址
@@ -5330,13 +5366,60 @@
53305366
_img += `<img src="${vg_r_data.dataset.chapterDomain}${img_pre}${now}">`;
53315367
}
53325368
if (_img) {
5333-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5369+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
53345370
// 当前页码 + 1
53355371
pageNum.now = pageNum._now + 1
53365372
}
53375373
}
53385374

53395375

5376+
// [漫画柜] 初始化(将本话其余图片插入网页中)
5377+
function manhuagui_init() {
5378+
// hook imgDate 代码
5379+
SMH.imgData = function(n) {window['imgDate'] = n;return{preInit:function(){}}}
5380+
// 重新执行本页的 imgDate 代码
5381+
insScriptAll(curSite.pager.pageE);
5382+
let _img = '', imgPath = `${location.protocol}//i.hamreus.com${window['imgDate'].path}`;
5383+
//console.log(imgPath, window['imgDate'])
5384+
if (!(window['imgDate']) || !(imgPath)) return
5385+
// 遍历图片文件名数组,组合为 img 标签
5386+
for (let i = 0; i < window['imgDate'].files.length; i++) {
5387+
_img += `<img src="${imgPath + window['imgDate'].files[i]}?e=${window['imgDate'].sl.e}&m=${window['imgDate'].sl.m}">`
5388+
}
5389+
// 插入并覆盖原来的一个图片
5390+
getOne(curSite.pager.insertP[0]).innerHTML = _img;
5391+
pausePage = true;
5392+
}
5393+
// [漫画柜] 获取下一页地址
5394+
function manhuagui_nextL() {
5395+
if (window['imgDate'].nextId == 0) return
5396+
var url = location.origin + location.pathname.replace(window['imgDate'].cid.toString(), window['imgDate'].nextId.toString())
5397+
if (url === curSite.pageUrl) return
5398+
curSite.pageUrl = url
5399+
getPageElems(curSite.pageUrl);
5400+
}
5401+
// [漫画柜] 插入数据
5402+
function manhuagui_insertE(pageElems, type) {
5403+
if (!pageElems) return
5404+
// 重新执行本页的 imgDate 代码
5405+
insScriptAll(curSite.pager.pageE, document.body, pageElems);
5406+
let _img = '', imgPath = `${location.protocol}//i.hamreus.com${window['imgDate'].path}`;
5407+
//console.log(imgPath, window['imgDate'])
5408+
if (!(window['imgDate']) || !(imgPath)) return
5409+
// 遍历图片文件名数组,组合为 img 标签
5410+
for (let i = 0; i < window['imgDate'].files.length; i++) {
5411+
_img += `<img src="${imgPath + window['imgDate'].files[i]}?e=${window['imgDate'].sl.e}&m=${window['imgDate'].sl.m}">`
5412+
}
5413+
// 将 img 标签插入到网页中
5414+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
5415+
// 添加历史记录
5416+
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
5417+
document.title = pageElems.querySelector('title').textContent;
5418+
// 当前页码 + 1
5419+
pageNum.now = pageNum._now + 1
5420+
}
5421+
5422+
53405423
// [漫画DB] 初始化(将本话其余图片插入网页中)
53415424
function manhuadb_init() {
53425425
let _img = '',
@@ -5351,7 +5434,7 @@
53515434
let src = data.dataset.host + data.dataset.img_pre + json[i].img;
53525435
_img += `<img class="img-fluid show-pic" src="${src}">`
53535436
}
5354-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5437+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
53555438
}
53565439
}
53575440
})
@@ -5395,7 +5478,7 @@
53955478
if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'
53965479
_img += `<img src="${src}">`
53975480
})
5398-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5481+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
53995482
window.document.title = window.document.title.replace(/(\(.+\))? - HiComic/, `(${getCSS('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话)
54005483
}
54015484
// [HiComic(嗨漫画)] 获取下一页地址
@@ -5426,7 +5509,7 @@
54265509
if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h';
54275510
_img += `<img src="${src}">`
54285511
}
5429-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5512+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
54305513
// 当前页码 + 1
54315514
pageNum.now = pageNum._now + 1
54325515
}
@@ -5439,7 +5522,7 @@
54395522
_img += `<img src="${one.dataset.original}">`;
54405523
one.parentElement.remove();
54415524
})
5442-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5525+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
54435526

54445527
}
54455528
// [动漫之家] 获取下一页地址
@@ -5469,7 +5552,7 @@
54695552
_img += `<img src="${img_prefix}${now}">`;
54705553
}
54715554
if (_img) {
5472-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5555+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
54735556

54745557
// 添加历史记录
54755558
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
@@ -5495,7 +5578,7 @@
54955578
_img += `<img src="${one.dataset.original}">`;
54965579
one.parentElement.parentElement.remove();
54975580
})
5498-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5581+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
54995582

55005583
}
55015584
// [动漫之家-漫画] 获取下一页地址
@@ -5520,7 +5603,7 @@
55205603
_img += `<img src="${img_prefix}${now}">`;
55215604
}
55225605
if (_img) {
5523-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5606+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
55245607

55255608
// 添加历史记录
55265609
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
@@ -5631,7 +5714,7 @@
56315714
}
56325715
if (_img) {
56335716
// 将 img 标签插入到网页中
5634-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
5717+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
56355718

56365719
// 添加历史记录
56375720
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
@@ -5671,7 +5754,7 @@
56715754

56725755
// 插入图片
56735756
setTimeout(function() {
5674-
getCSS(curSite.pager.insertP[0].replace('css;', '')).appendChild(document.createElement('img')).src = mhpicurl;
5757+
getOne(curSite.pager.insertP[0]).appendChild(document.createElement('img')).src = mhpicurl;
56755758

56765759
// 添加历史记录
56775760
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
@@ -5702,7 +5785,7 @@
57025785
_img += `<img src="https://img.shishi-life.com/${one}">`;
57035786
}
57045787
}
5705-
getCSS(curSite.pager.insertP[0].replace('css;', '')).innerHTML = _img;
5788+
getOne(curSite.pager.insertP[0]).innerHTML = _img;
57065789

57075790
}
57085791
// [乐语漫画] 获取下一页地址
@@ -5732,7 +5815,7 @@
57325815
}
57335816
if (_img) {
57345817
// 将 img 标签插入到网页中
5735-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
5818+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img);
57365819

57375820
// 添加历史记录
57385821
window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl);
@@ -5754,7 +5837,7 @@
57545837

57555838
// [古风漫画网] 获取下一页地址
57565839
function gufengmh_nextL() {
5757-
let pageElems = getCSS(curSite.pager.pageE.replace('css;', '')); // 寻找数据所在元素
5840+
let pageElems = getOne(curSite.pager.pageE); // 寻找数据所在元素
57585841
if (pageElems) {
57595842
let comicUrl, nextId;
57605843
var url = '';
@@ -5780,7 +5863,7 @@
57805863
let url = curSite.pageUrl;
57815864
pageElems = getOne(curSite.pager.pageE, pageElems, pageElems);
57825865
let chapterImages, chapterPath;
5783-
getCSS(curSite.pager.pageE.replace('css;', '')).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL
5866+
getOne(curSite.pager.pageE).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL
57845867
pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历
57855868
//console.log(one)
57865869
if (one.indexOf('chapterImages') > -1) { // 图片文件名数组
@@ -5798,7 +5881,7 @@
57985881
chapterImages.forEach(function (one2){ // 遍历图片文件名数组,组合为 img 标签
57995882
_img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">'
58005883
})
5801-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5884+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
58025885
// 当前页码 + 1
58035886
pageNum.now = pageNum._now + 1
58045887
}
@@ -5860,7 +5943,7 @@
58605943
_img += `<img src="${now}">`;
58615944
}
58625945
if (_img) {
5863-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
5946+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
58645947

58655948
// 添加历史记录
58665949
MANGABZ_PAGE += imgArr.length;
@@ -5919,7 +6002,7 @@
59196002
_img += `<img src="${now}">`;
59206003
}
59216004
if (_img) {
5922-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
6005+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
59236006

59246007
// 添加历史记录
59256008
XMANHUA_PAGE += imgArr.length;
@@ -5954,7 +6037,7 @@
59546037
function cocomanga_init() {
59556038
let last = getCSS('.mh_comicpic:last-of-type');
59566039
if (last && last.getAttribute('p')) {
5957-
getCSS(curSite.pager.insertP[0].replace('css;', '')).innerHTML = ''; // 删除旧图片元素
6040+
getOne(curSite.pager.insertP[0]).innerHTML = ''; // 删除旧图片元素
59586041
cocomanga_img(parseInt(last.getAttribute('p'))) // 插入新图片元素
59596042
}
59606043
}
@@ -5965,7 +6048,7 @@
59656048
for (let i=1; i<=totalImageCount; i++) {
59666049
_img += `<div class="mh_comicpic" p="${i}"><img src="${__cr.getPicUrl(i)}"></div>`;
59676050
}
5968-
getCSS(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
6051+
getOne(curSite.pager.insertP[0]).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中
59696052
}
59706053
// [COCOMANGA 漫画] 获取下一页地址
59716054
function cocomanga_nextL() {
@@ -6231,11 +6314,7 @@
62316314
if (typeof curSite.pager.nextL == 'function') {
62326315
url = curSite.pager.nextL();
62336316
} else {
6234-
if (curSite.pager.nextL.slice(0,4) === 'css;') {
6235-
url = this.getFullHref(getCSS(curSite.pager.nextL.slice(4)));
6236-
} else {
6237-
url = this.getFullHref(getXpath(curSite.pager.nextL));
6238-
}
6317+
url = this.getFullHref(getOne(curSite.pager.nextL));
62396318
}
62406319
//console.log(url, curSite.pageUrl);
62416320
if (url === '') return;

0 commit comments

Comments
 (0)