|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 3.2.6 |
| 3 | +// @version 3.2.7 |
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、FitGirl、片库、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画DB、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了... |
6 | 6 | // @match *://*/* |
|
2642 | 2642 | scrollD: 800 |
2643 | 2643 | } |
2644 | 2644 | }, // Mangabz 漫画 - 分类/搜索页 |
| 2645 | + xmanhua: { |
| 2646 | + host: ['xmanhua.com', 'www.xmanhua.com'], |
| 2647 | + functionStart: function() {if (/\/m\d+/.test(location.pathname)) { |
| 2648 | + setTimeout(mangabz_init, 500); |
| 2649 | + curSite = DBSite.xmanhua; |
| 2650 | + } else if (/\/\d+xm\//.test(location.pathname)) { |
| 2651 | + if (document.querySelector('.detail-list-form-more')) document.querySelector('.detail-list-form-more').click(); |
| 2652 | + } else if (location.pathname.indexOf('/manga-list') > -1 || location.pathname === '/search') { |
| 2653 | + curSite = DBSite.xmanhua_list; |
| 2654 | + }}, |
| 2655 | + insStyle: '#Autopage_number, a.reader-bottom-page {display: none !important;} .header, .reader-bottom {opacity: 0.3 !important;} #cp_img > img{display: block !important;margin: 0 auto !important;width: auto !important; height: auto !important;}', |
| 2656 | + pager: { |
| 2657 | + type: 4, |
| 2658 | + nextL: xmanhua_nextL, |
| 2659 | + insertP: ['css;#cp_img', 3], |
| 2660 | + insertE: xmanhua_insertE, |
| 2661 | + replaceE: 'css;.reader-title, body > .container > div:not([id]), title', |
| 2662 | + interval: 500, |
| 2663 | + scrollD: 1500 |
| 2664 | + } |
| 2665 | + }, // Xmanhua 漫画 |
| 2666 | + xmanhua_list: { |
| 2667 | + pager: { |
| 2668 | + type: 1, |
| 2669 | + nextL: '//div[@class="page-pagination"]//a[contains(text(), ">")]', |
| 2670 | + pageE: 'css;ul.mh-list > li', |
| 2671 | + insertP: ['css;ul.mh-list', 3], |
| 2672 | + replaceE: 'css;.page-pagination', |
| 2673 | + scrollD: 1000 |
| 2674 | + } |
| 2675 | + }, // Xmanhua 漫画 - 分类/搜索页 |
2645 | 2676 | cocomanga: { |
2646 | 2677 | host: 'www.cocomanga.com', |
2647 | 2678 | functionStart: function() {if (location.pathname.indexOf('.html') > -1) { |
|
5436 | 5467 | } |
5437 | 5468 |
|
5438 | 5469 |
|
| 5470 | + // [Xmanhua 漫画] 获取下一页地址 |
| 5471 | + function xmanhua_nextL() { |
| 5472 | + var url = ''; |
| 5473 | + if (XMANHUA_PAGE === XMANHUA_IMAGE_COUNT) { // 下一话 |
| 5474 | + url = getXpath('//a[./img[contains(@src, "reader-bottom-right-2.png")]]') |
| 5475 | + if (url === curSite.pageUrl) return |
| 5476 | + curSite.pageUrl = url |
| 5477 | + //console.log(curSite.pageUrl) |
| 5478 | + getPageElems(curSite.pageUrl); // 访问下一话 URL 获取 |
| 5479 | + } else { // 下一页 |
| 5480 | + if (!mkey) var mkey = ''; |
| 5481 | + url = location.origin + location.pathname + 'chapterimage.ashx' + `?cid=${XMANHUA_CID}&page=${XMANHUA_PAGE + 1}&key=${(mkey)}&_cid=${XMANHUA_CID}&_mid=${XMANHUA_MID}&_dt=${XMANHUA_VIEWSIGN_DT}&_sign=${XMANHUA_VIEWSIGN}` |
| 5482 | + if (url === curSite.pageUrl) return |
| 5483 | + curSite.pageUrl = url |
| 5484 | + //console.log(curSite.pageUrl) |
| 5485 | + getPageElems(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取 |
| 5486 | + } |
| 5487 | + } |
| 5488 | + // [Xmanhua 漫画] 插入数据 |
| 5489 | + function xmanhua_insertE(pageElems, type) { |
| 5490 | + if (pageElems) { |
| 5491 | + if (type === 'Next') { |
| 5492 | + let imgArr = eval(pageElems), |
| 5493 | + _img = ''; |
| 5494 | + for (let now of imgArr) { |
| 5495 | + _img += `<img src="${now}">`; |
| 5496 | + } |
| 5497 | + if (_img) { |
| 5498 | + document.querySelector(curSite.pager.insertP[0].replace('css;', '')).insertAdjacentHTML(getAddTo(curSite.pager.insertP[1]), _img); // 将 img 标签插入到网页中 |
| 5499 | + |
| 5500 | + // 添加历史记录 |
| 5501 | + XMANHUA_PAGE += imgArr.length; |
| 5502 | + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, document.title, location.origin + XMANHUA_CURL.substring(0, XMANHUA_CURL.length - 1) + '-p' + XMANHUA_PAGE + '/'); |
| 5503 | + } |
| 5504 | + } else { |
| 5505 | + // 插入 <script> 标签 |
| 5506 | + insScriptAll('css;html:not([dir]) > head > script:not([src])', document.body, pageElems); |
| 5507 | + |
| 5508 | + // 添加历史记录 |
| 5509 | + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
| 5510 | + |
| 5511 | + // 当前页码 + 1 |
| 5512 | + pageNum.now = pageNum._now + 1 |
| 5513 | + |
| 5514 | + // 替换待替换元素 |
| 5515 | + let oriE = getAll(curSite.pager.replaceE), |
| 5516 | + repE = getAll(curSite.pager.replaceE, pageElems, pageElems); |
| 5517 | + if (oriE.length === repE.length) { |
| 5518 | + for (let i = 0; i < oriE.length; i++) { |
| 5519 | + oriE[i].outerHTML = repE[i].outerHTML; |
| 5520 | + } |
| 5521 | + } |
| 5522 | + XMANHUA_PAGE = 0; |
| 5523 | + xmanhua_nextL(); |
| 5524 | + } |
| 5525 | + } |
| 5526 | + } |
| 5527 | + |
| 5528 | + |
5439 | 5529 | // [COCOMANGA 漫画] 初始化(调整本话图片) |
5440 | 5530 | function cocomanga_init() { |
5441 | 5531 | let last = document.querySelector('.mh_comicpic:last-of-type'); |
|
0 commit comments