終極自動翻頁 - 加載並拼接下一分頁內容至當前頁尾,智能適配任意網頁
另外這個站的情況差不多,閱讀需要背景開啟等待讀取,再切換分頁才能匹配到自定義規則,不然會是腳本的自驅動匹配。
在正常匹配自定義規則的情況下,點擊下一話跳轉後卻又是腳本的自驅動匹配,需要重新載入網頁才能匹配到自定義規則,不過只要網頁有緩存過就能正常匹配自定義規則。
例如從第一話點擊下一話至第五話,二至五話因為沒有緩存過,都是腳本的自驅動匹配。
但又從第五話點擊上一話回至第一話,四至一話由於緩存過,是匹配自定義規則的。
{
"name": "漫畫屋 - 閱讀",
"example": "https://mh5.tw/series-wunalfy-484928-1-%E4%B8%8D%E5%B9%B8%E8%81%B7%E6%A5%AD%E7%9A%84%E5%B9%B8%E9%81%8B?",
"url": "^https?://mh5\\.tw/series",
"nextLink": "a.cur+a",
"pageElement": ".ptview>img:not([style])",
"replaceElement": ".setnmh-pagedos",
"pageAction": "document.querySelector('.pagetual_pageBar').remove();setTimeout(()=>{let last=document.querySelector('.setnmh-readagin');let lastimg=document.querySelector('.ptview>img:last-child');let p=document.createElement('p');p.innerText='本話/集已達最後一頁';p.style='font-size:24px;height: 40px;line-height: 40px;text-align: center;margin: 10px auto;';if(last){lastimg.parentNode.insertBefore(p,lastimg);lastimg.remove()}},200)",
"initRun": 1,
"autoLoadNum": "0",
"css": ".setnmh-seebox img{margin-bottom:0!important;box-shadow:none!important}"
},
{
"name": "漫畫屋 - 分類",
"example": "https://mh5.tw/allcartoonlist",
"url": "^https?://mh5\\.tw/allcartoonlist",
"nextLink": "a.cur+a",
"pageElement": "dl.alllist",
"replaceElement": "div.num",
"css": ".pagetual_pageBar{margin-bottom:0px!important}.pagetual_pageBar+dl{margin-top:-10px!important}"
}
我就純測試腳本規則,回報一下遇到的情況。
因爲遍歷規則的時候元素尚不存在,加上 pinUrl 根據 url 鎖定規則就可以了
因爲遍歷規則的時候元素尚不存在,加上 pinUrl 根據 url 鎖定規則就可以了
原來如此,懂了。
遇到了個腳本載入的小問題
發現在以下這兩個站的漫畫閱讀,如果是新分頁前景開啟連結,主控台沒有看到有載入永頁機腳本,需要新分頁背景開啟連結等待網頁讀取一下,再切換到該分頁才有正常載入到腳本。
在正常載入腳本的情況下,點擊下一話按鈕跳轉到下一話,有時也會沒有載入到腳本。
{ "name": "Xmanhua - PC版閱讀", "example": "https://xmanhua.com/m10344/", "url": "^https?://xmanhua\\.com/m\\d+(-p\\d+)?/", "nextLink": ".chapterpage.now+a", "pageElement": "#cp_image", "replaceElement": ".reader-bottom", "pageAction": "document.querySelector('.pagetual_pageBar').remove();", "rate": 3, "css": ".container{width:auto!important}#cp_img img{width:auto!important;height:auto!important;max-width:100%!important;display:block!important;margin:0 auto !important}" }, { "name": "Mangabz - PC版閱讀", "example": "https://www.mangabz.com/m38701/", "url": "^https?://www\\.mangabz\\.com/m\\d+(-p\\d+)?/", "nextLinkByUrl": [ "(/m\\d+)(-p(\\d+))?/$", "$1-p{($3.0||1)+1}/" ], "stopSign": "let c = doc.querySelector('#lbcurrentpage').innerText; if (c == MANGABZ_IMAGE_COUNT) return true;", "pageElement": "#cp_image", "replaceElement": "#lbcurrentpage", "pageAction": "document.querySelector('.pagetual_pageBar').remove();", "rate": 3, "css": "a[href^='j']{display:none!important}.container{width:auto!important}#cp_img img{width:auto!important;height:auto!important;max-width:100%!important;display:block!important;margin:0 auto !important}" }, { "name": "Mangabz / Xmanhua - 分類", "example": "https://www.mangabz.com/manga-list-0-0-0/,https://xmanhua.com/manga-list-0-0-0/", "url": "^https?://(www\\.)?(mangabz|xmanhua)\\.com/manga-list", "nextLink": "//div[contains(@class,'page-pagination')]//a[contains(text(), '>')]", "pageElement": "ul.mh-list", "replaceElement": ".page-pagination", "css": ".mh-list{padding-bottom:0px!important}.pagetual_pageBar+.mh-list{padding-top:0px!important}.pagetual_pageBar{margin-top:0px!important}" }