|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 3.5.0 |
| 3 | +// @version 3.5.1 |
4 | 4 | // @author X.I.U |
5 | 5 | // @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(以上仅一小部分,更多的写不下了... |
6 | 6 | // @match *://*/* |
|
2585 | 2585 | scrollD: 1500 |
2586 | 2586 | } |
2587 | 2587 | }, // 漫画台 - 搜索页 |
| 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 | + }, // 漫画台 - 分类/搜索页 |
2588 | 2624 | manhuadb: { |
2589 | 2625 | host: 'www.manhuadb.com', |
2590 | 2626 | functionStart: function() {if (/\/manhua\/\d+\/.+\.html/.test(location.pathname)) { |
|
5287 | 5323 | _img += `<img src="${asset_domain}${img_pre}${now}">`; |
5288 | 5324 | } |
5289 | 5325 | 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 标签插入到网页中 |
5291 | 5327 |
|
5292 | 5328 | } |
5293 | 5329 | // [漫画猫] 获取下一页地址 |
|
5330 | 5366 | _img += `<img src="${vg_r_data.dataset.chapterDomain}${img_pre}${now}">`; |
5331 | 5367 | } |
5332 | 5368 | 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 标签插入到网页中 |
5334 | 5370 | // 当前页码 + 1 |
5335 | 5371 | pageNum.now = pageNum._now + 1 |
5336 | 5372 | } |
5337 | 5373 | } |
5338 | 5374 |
|
5339 | 5375 |
|
| 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 | + |
5340 | 5423 | // [漫画DB] 初始化(将本话其余图片插入网页中) |
5341 | 5424 | function manhuadb_init() { |
5342 | 5425 | let _img = '', |
|
5351 | 5434 | let src = data.dataset.host + data.dataset.img_pre + json[i].img; |
5352 | 5435 | _img += `<img class="img-fluid show-pic" src="${src}">` |
5353 | 5436 | } |
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 标签插入到网页中 |
5355 | 5438 | } |
5356 | 5439 | } |
5357 | 5440 | }) |
|
5395 | 5478 | if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h' |
5396 | 5479 | _img += `<img src="${src}">` |
5397 | 5480 | }) |
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 标签插入到网页中 |
5399 | 5482 | window.document.title = window.document.title.replace(/(\(第.+\))? - HiComic/, `(${getCSS('.chapter_name').textContent}) - HiComic`); // 修改网页标题(加上 第 X 话) |
5400 | 5483 | } |
5401 | 5484 | // [HiComic(嗨漫画)] 获取下一页地址 |
|
5426 | 5509 | if (src.indexOf('!p_c_c_') === -1) src += '!p_c_c_h'; |
5427 | 5510 | _img += `<img src="${src}">` |
5428 | 5511 | } |
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 标签插入到网页中 |
5430 | 5513 | // 当前页码 + 1 |
5431 | 5514 | pageNum.now = pageNum._now + 1 |
5432 | 5515 | } |
|
5439 | 5522 | _img += `<img src="${one.dataset.original}">`; |
5440 | 5523 | one.parentElement.remove(); |
5441 | 5524 | }) |
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 标签插入到网页中 |
5443 | 5526 |
|
5444 | 5527 | } |
5445 | 5528 | // [动漫之家] 获取下一页地址 |
|
5469 | 5552 | _img += `<img src="${img_prefix}${now}">`; |
5470 | 5553 | } |
5471 | 5554 | 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 标签插入到网页中 |
5473 | 5556 |
|
5474 | 5557 | // 添加历史记录 |
5475 | 5558 | window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
|
5495 | 5578 | _img += `<img src="${one.dataset.original}">`; |
5496 | 5579 | one.parentElement.parentElement.remove(); |
5497 | 5580 | }) |
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 标签插入到网页中 |
5499 | 5582 |
|
5500 | 5583 | } |
5501 | 5584 | // [动漫之家-漫画] 获取下一页地址 |
|
5520 | 5603 | _img += `<img src="${img_prefix}${now}">`; |
5521 | 5604 | } |
5522 | 5605 | 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 标签插入到网页中 |
5524 | 5607 |
|
5525 | 5608 | // 添加历史记录 |
5526 | 5609 | window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
|
5631 | 5714 | } |
5632 | 5715 | if (_img) { |
5633 | 5716 | // 将 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); |
5635 | 5718 |
|
5636 | 5719 | // 添加历史记录 |
5637 | 5720 | window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
|
5671 | 5754 |
|
5672 | 5755 | // 插入图片 |
5673 | 5756 | 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; |
5675 | 5758 |
|
5676 | 5759 | // 添加历史记录 |
5677 | 5760 | window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
|
5702 | 5785 | _img += `<img src="https://img.shishi-life.com/${one}">`; |
5703 | 5786 | } |
5704 | 5787 | } |
5705 | | - getCSS(curSite.pager.insertP[0].replace('css;', '')).innerHTML = _img; |
| 5788 | + getOne(curSite.pager.insertP[0]).innerHTML = _img; |
5706 | 5789 |
|
5707 | 5790 | } |
5708 | 5791 | // [乐语漫画] 获取下一页地址 |
|
5732 | 5815 | } |
5733 | 5816 | if (_img) { |
5734 | 5817 | // 将 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); |
5736 | 5819 |
|
5737 | 5820 | // 添加历史记录 |
5738 | 5821 | window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
|
5754 | 5837 |
|
5755 | 5838 | // [古风漫画网] 获取下一页地址 |
5756 | 5839 | function gufengmh_nextL() { |
5757 | | - let pageElems = getCSS(curSite.pager.pageE.replace('css;', '')); // 寻找数据所在元素 |
| 5840 | + let pageElems = getOne(curSite.pager.pageE); // 寻找数据所在元素 |
5758 | 5841 | if (pageElems) { |
5759 | 5842 | let comicUrl, nextId; |
5760 | 5843 | var url = ''; |
|
5780 | 5863 | let url = curSite.pageUrl; |
5781 | 5864 | pageElems = getOne(curSite.pager.pageE, pageElems, pageElems); |
5782 | 5865 | let chapterImages, chapterPath; |
5783 | | - getCSS(curSite.pager.pageE.replace('css;', '')).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL |
| 5866 | + getOne(curSite.pager.pageE).innerText = pageElems.textContent; // 将当前网页内的数据所在元素内容改为刚刚获取的下一页数据内容,以便循环获取下一页 URL |
5784 | 5867 | pageElems.textContent.split(';').forEach(function (one){ // 分号 ; 分割为数组并遍历 |
5785 | 5868 | //console.log(one) |
5786 | 5869 | if (one.indexOf('chapterImages') > -1) { // 图片文件名数组 |
|
5798 | 5881 | chapterImages.forEach(function (one2){ // 遍历图片文件名数组,组合为 img 标签 |
5799 | 5882 | _img += '<img src="https://res.xiaoqinre.com/' + chapterPath + one2 + '" data-index="0" style="display: inline-block;">' |
5800 | 5883 | }) |
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 标签插入到网页中 |
5802 | 5885 | // 当前页码 + 1 |
5803 | 5886 | pageNum.now = pageNum._now + 1 |
5804 | 5887 | } |
|
5860 | 5943 | _img += `<img src="${now}">`; |
5861 | 5944 | } |
5862 | 5945 | 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 标签插入到网页中 |
5864 | 5947 |
|
5865 | 5948 | // 添加历史记录 |
5866 | 5949 | MANGABZ_PAGE += imgArr.length; |
|
5919 | 6002 | _img += `<img src="${now}">`; |
5920 | 6003 | } |
5921 | 6004 | 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 标签插入到网页中 |
5923 | 6006 |
|
5924 | 6007 | // 添加历史记录 |
5925 | 6008 | XMANHUA_PAGE += imgArr.length; |
|
5954 | 6037 | function cocomanga_init() { |
5955 | 6038 | let last = getCSS('.mh_comicpic:last-of-type'); |
5956 | 6039 | if (last && last.getAttribute('p')) { |
5957 | | - getCSS(curSite.pager.insertP[0].replace('css;', '')).innerHTML = ''; // 删除旧图片元素 |
| 6040 | + getOne(curSite.pager.insertP[0]).innerHTML = ''; // 删除旧图片元素 |
5958 | 6041 | cocomanga_img(parseInt(last.getAttribute('p'))) // 插入新图片元素 |
5959 | 6042 | } |
5960 | 6043 | } |
|
5965 | 6048 | for (let i=1; i<=totalImageCount; i++) { |
5966 | 6049 | _img += `<div class="mh_comicpic" p="${i}"><img src="${__cr.getPicUrl(i)}"></div>`; |
5967 | 6050 | } |
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 标签插入到网页中 |
5969 | 6052 | } |
5970 | 6053 | // [COCOMANGA 漫画] 获取下一页地址 |
5971 | 6054 | function cocomanga_nextL() { |
|
6231 | 6314 | if (typeof curSite.pager.nextL == 'function') { |
6232 | 6315 | url = curSite.pager.nextL(); |
6233 | 6316 | } 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)); |
6239 | 6318 | } |
6240 | 6319 | //console.log(url, curSite.pageUrl); |
6241 | 6320 | if (url === '') return; |
|
0 commit comments