|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 自动无缝翻页 |
3 | | -// @version 2.5.5 |
| 3 | +// @version 2.5.6 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 无缝拼接下一页内容(瀑布流),目前支持:[所有使用「Discuz!、Flarum、DUX(WordPress)」的网站]、百度、谷歌、必应、搜狗、头条搜索、360 搜索、微信搜索、贴吧、豆瓣、微博、NGA、V2EX、龙的天空、起点小说、煎蛋网、IT之家、千图网、Pixabay、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、FitGirl、片库、茶杯狐、NO视频、低端影视、奈菲影视、91美剧网、真不卡影院、音范丝、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、极简插件、小众软件、动漫狂、漫画猫、漫画DB、HiComic、动漫之家、古风漫画网、PubMed、wikiHow、GreasyFork、Github、StackOverflow(以上仅一部分,更多的写不下了... |
6 | 6 | // @match *://*/* |
|
2441 | 2441 | before: szcdmj_functionBefore |
2442 | 2442 | } |
2443 | 2443 | }, // 砂之船动漫家 |
| 2444 | + mangabz: { |
| 2445 | + SiteTypeID: 0, |
| 2446 | + host: 'mangabz.com', |
| 2447 | + functionStart: function() {if (/\/m\d+/.test(location.pathname)) { |
| 2448 | + setTimeout(mangabz_init, 500); |
| 2449 | + curSite = DBSite.mangabz; |
| 2450 | + document.lastElementChild.appendChild(document.createElement('style')).textContent = 'body > .container > div:not([id]) {display: none !important;} .top-bar {opacity: 0.3 !important;} #cp_img > img{display: block !important;margin: 0 auto !important;width: auto !important; height: auto !important;}'; |
| 2451 | + } else if (/\/\d+bz\//.test(location.pathname)) { |
| 2452 | + if (document.querySelector('.detail-list-form-more')) document.querySelector('.detail-list-form-more').click(); |
| 2453 | + } else if (location.pathname.indexOf('/manga-list') > -1 || location.pathname === '/search') { |
| 2454 | + curSite = DBSite.mangabz_list; |
| 2455 | + }}, |
| 2456 | + pager: { |
| 2457 | + type: 4, |
| 2458 | + nextLink: mangabz_functionNext, |
| 2459 | + insertPosition: ['css;#cp_img', 3], |
| 2460 | + insertElement: mangabz_insertElement, |
| 2461 | + replaceE: 'css;p.top-title, body > .container > div:not([id]), title', |
| 2462 | + intervals: 500, |
| 2463 | + scrollDelta: 1000 |
| 2464 | + } |
| 2465 | + }, // Mangabz 漫画 |
| 2466 | + mangabz_list: { |
| 2467 | + SiteTypeID: 0, |
| 2468 | + pager: { |
| 2469 | + type: 1, |
| 2470 | + nextLink: '//div[@class="page-pagination"]//a[@href][contains(text(), ">")]', |
| 2471 | + pageElement: 'css;ul.mh-list > li', |
| 2472 | + insertPosition: ['css;ul.mh-list', 3], |
| 2473 | + replaceE: 'css;.page-pagination', |
| 2474 | + scrollDelta: 800 |
| 2475 | + } |
| 2476 | + }, // Mangabz 漫画 - 分类/搜索页 |
2444 | 2477 | netbian: { |
2445 | 2478 | SiteTypeID: 0, |
2446 | 2479 | host: 'pic.netbian.com', |
|
3884 | 3917 | } |
3885 | 3918 |
|
3886 | 3919 |
|
| 3920 | + // [Mangabz 漫画] 初始化(调整本话图片) |
| 3921 | + function mangabz_init() { |
| 3922 | + pageNumber('del'); |
| 3923 | + let showimage = document.getElementById('showimage'), |
| 3924 | + cp_img = document.getElementById('cp_img'), |
| 3925 | + cp_image = document.getElementById('cp_image'); |
| 3926 | + if (showimage) {showimage.removeAttribute('oncontextmenu');} |
| 3927 | + if (cp_img) {cp_img.removeAttribute('oncontextmenu');} |
| 3928 | + if (cp_image) { |
| 3929 | + cp_image.removeAttribute('oncontextmenu'); |
| 3930 | + cp_image.removeAttribute('id'); |
| 3931 | + cp_image.removeAttribute('style'); |
| 3932 | + } |
| 3933 | + } |
| 3934 | + // [Mangabz 漫画] 获取下一页地址 |
| 3935 | + function mangabz_functionNext() { |
| 3936 | + var url = ''; |
| 3937 | + if (MANGABZ_PAGE === MANGABZ_IMAGE_COUNT) { // 下一话 |
| 3938 | + url = getElementByXpath('//a[./img[contains(@src, "icon_xiayizhang")]]') |
| 3939 | + if (url === curSite.pageUrl) return |
| 3940 | + curSite.pageUrl = url |
| 3941 | + //console.log(curSite.pageUrl) |
| 3942 | + getPageElems(curSite.pageUrl); // 访问下一话 URL 获取 |
| 3943 | + } else { // 下一页 |
| 3944 | + if (!mkey) var mkey = ''; |
| 3945 | + url = location.origin + location.pathname + 'chapterimage.ashx' + `?cid=${MANGABZ_CID}&page=${MANGABZ_PAGE + 1}&key=${(mkey)}&_cid=${MANGABZ_CID}&_mid=${MANGABZ_MID}&_dt=${MANGABZ_VIEWSIGN_DT}&_sign=${MANGABZ_VIEWSIGN}` |
| 3946 | + if (url === curSite.pageUrl) return |
| 3947 | + curSite.pageUrl = url |
| 3948 | + //console.log(curSite.pageUrl) |
| 3949 | + getPageElems(curSite.pageUrl, 'text', 'GET', '', 'Next'); // 访问下一页 URL 获取 |
| 3950 | + } |
| 3951 | + } |
| 3952 | + // [Mangabz 漫画] 插入数据 |
| 3953 | + function mangabz_insertElement(pageElems, type) { |
| 3954 | + if (pageElems) { |
| 3955 | + if (type === 'Next') { |
| 3956 | + let imgArr = eval(pageElems), |
| 3957 | + _img = ''; |
| 3958 | + for (let now of imgArr) { |
| 3959 | + _img += `<img src="${now}">`; |
| 3960 | + } |
| 3961 | + if (_img) { |
| 3962 | + document.querySelector(curSite.pager.insertPosition[0].replace('css;', '')).insertAdjacentHTML(addTo(curSite.pager.insertPosition[1]), _img); // 将 img 标签插入到网页中 |
| 3963 | + |
| 3964 | + // 添加历史记录 |
| 3965 | + MANGABZ_PAGE += imgArr.length; |
| 3966 | + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, document.title, location.origin + MANGABZ_CURL.substring(0, MANGABZ_CURL.length - 1) + '-p' + MANGABZ_PAGE + '/'); |
| 3967 | + } |
| 3968 | + } else { |
| 3969 | + // 插入 <script> 标签 |
| 3970 | + let scriptElement = pageElems.querySelectorAll('html:not([dir]) > head > script:not([src])'), scriptText = ''; |
| 3971 | + scriptElement.forEach(function (one) {scriptText += ';' + one.textContent;}); |
| 3972 | + if (scriptText) { |
| 3973 | + document.body.appendChild(document.createElement('script')).textContent = scriptText; |
| 3974 | + |
| 3975 | + window.history.pushState(`{title: ${document.title}, url: ${location.href}}`, pageElems.querySelector('title').textContent, curSite.pageUrl); |
| 3976 | + |
| 3977 | + // 替换待替换元素 |
| 3978 | + let oriE = getAllElements(curSite.pager.replaceE), |
| 3979 | + repE = getAllElements(curSite.pager.replaceE, pageElems, pageElems); |
| 3980 | + if (oriE.length === repE.length) { |
| 3981 | + for (let i = 0; i < oriE.length; i++) { |
| 3982 | + oriE[i].outerHTML = repE[i].outerHTML; |
| 3983 | + } |
| 3984 | + } |
| 3985 | + MANGABZ_PAGE = 0; |
| 3986 | + mangabz_functionNext(); |
| 3987 | + } |
| 3988 | + } |
| 3989 | + } |
| 3990 | + } |
| 3991 | + |
| 3992 | + |
3887 | 3993 | // 自动无缝翻页 |
3888 | 3994 | function pageLoading() { |
3889 | 3995 | if (curSite.SiteTypeID > 0) { |
|
4138 | 4244 |
|
4139 | 4245 |
|
4140 | 4246 | // 类型 4 专用 |
4141 | | - function getPageElems(url, type = 'text', method = 'GET', data = '', type2) { |
| 4247 | + function getPageElems(url, type = '', method = 'GET', data = '', type2) { |
4142 | 4248 | //console.log(url, data) |
4143 | 4249 | let mimeType = ''; |
4144 | 4250 | if (curSite.pager.mimeType) mimeType = curSite.pager.mimeType; |
|
4160 | 4266 | case 'json': |
4161 | 4267 | curSite.pager.insertElement(response.response, type2); |
4162 | 4268 | break; |
| 4269 | + case 'text': |
| 4270 | + curSite.pager.insertElement(response.responseText, type2) |
| 4271 | + break; |
4163 | 4272 | default: |
4164 | 4273 | curSite.pager.insertElement(ShowPager.createDocumentByString(response.responseText), type2) |
4165 | 4274 | } |
|
0 commit comments