如果所在區域,ISP,或是不可抗力的因素而無法正常連接cdn.jsdelivr.net的依賴庫時,請自行修改腳本將所有cdn.jsdelivr.net替換成unpkg.com,或自行尋找可替代的依賴庫CDN。
紳士漫畫wnacg,由於Fancybox功能的緣故,元素結構導致可能會被擋廣告擴充套件的規則隱藏掉圖片,下拉閱讀頁需要加白名單網址(信任名單),腳本已隱藏廣告元素,或在該網站關閉Fancybox功能。
「 點擊展開查看 」
[{
name: "規則名稱",
enable: 0, //填0禁用此規則
icon: 0, //填0不顯示左下圖示
key: 0, //填0不綁定快捷鍵
url: { //將URL拆分判斷,格式類型詳見內置函式的fn.checkUrl(object);
t: "",
h: "",
p: "",
s: "",
e: "",
d: ""
},
url: () => Boolean,
//reg和url擇其一作為規則匹配的方式
reg: /www\.xxxxx\.com/, //正規表達式匹配網址
reg: [ //匹配正規表達式陣列
/RegExp/,
/RegExp/
],
reg: () => {
//函式寫法返回布林值Boolean
if (/^https?:\/\/www\.everiaclub\.com\/.+/.test(siteUrl)) {
if(!siteUrl.includes(".html")) {
return true;
}
}
return false;
},
//SPA網頁URL只匹配域名,SPA函式用於判斷頁面域名以外的元素返回Boolean或Promise(例如需要API請求),切換腳本UI事件添加移除
SPA: () => document.URL.includes("/albums/"),
//不切換
SPA: true,
//與SPA屬性搭配使用,觀察URL變化,用於SPA網頁並且URL是會變換的,更替腳本變數諸如globalImgArray、nextLink、customTitle
observerURL: true,
delay: 300, //延遲載入規則
include: "元素選擇器", //網頁必須包含的元素
include: ["A元素選擇器", "B元素選擇器", "C元素選擇器", "D元素選擇器"], //網頁必須包含陣列裡的所有元素
exclude: "元素", //網頁要排除的元素
exclude: ["A元素選擇器", "B元素選擇器", "C元素選擇器", "D元素選擇器"], //網頁要排除陣列裡其中的元素
init: "code", //載入頁面後要優先執行的代碼
init: () => {
code;
},
init: async () => await fn.waitEle("元素選擇器"), //等待直至元素出現
init: async () => await fn.waitVar("變數名"), //等待直至window的變數出現
init: () => fn.addMutationObserver(() => fn.remove("div[class][style*='z-index']")), //動態刪除元素
imgs: "#TheImg", //CSS選擇器
imgs: "//img[@id="TheImg"]", //XPath選擇器
//IMG、DIV、A、LINK、P、SPAN、LI、FIGURE、ARTICLE,9種元素會先判斷有沒有圖片網址放在dataset屬性,如果沒有IMG取src屬性,A、LINK取href屬性。
imgs: () => { //也可自己創建Array,有時大圖是在A元素上需要透過xhr獲取或放在script或變數或透過api取得的json。
code;
return Array;
},
referrerpolicy: "no-referrer", //https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/referrerPolicy
repeat: 1, //重複取得圖片元素,特殊情況會用到例如ViperGirls網站
thums: ".thums", //Fancybox要用的縮略圖網址選擇器
//頁面不適合直接修改插入腳本用的圖片,在頁面右下創建一個浮動可拖動的捕獲之眼,這樣行動裝置才能使用到分頁畫廊。
capture: "selector",
capture: () => _this.imgs(),
fn: () => { //手動調用自訂函式, 綁定快捷鍵數字鍵6,浮動選單增加自訂函式選單項
…code;
},
//scrollEle當規則有fn屬性時無法調用
scrollEle: ["元素", time], //[自動滾動元素, 滾動的間隔], 綁定快捷鍵數字鍵6
scrollEle: async () => {
…code;
},
button: [4, "24%", 1] , //[無作用, "寬度%", 在按鈕之前添加多少空行],有此屬性才會添加功能按鈕
insertImg: ["元素", 1, time], //[清空此元素內容插入圖片, 0(手動)1(自動)2(自動Lazy loading模式)3(手動Lazy loading模式), 自動延遲時間(預設0)]。
insertImg: [
["元素", (插入在此元素) 0(裡面)1(之前) 2(之後), "要移除的元素"], 0(手動) 1(自動) 2(自動Lazy loading模式) 3(手動Lazy loading模式), 自動延遲時間(預設0)
],
endColor: "white", //更改頁面容器底部統計圖片數量的文字顏色
insertImgBF: () => {
//插入圖片之前要執行的代碼
code;
},
insertImgAF: (parent) => { //參數parent是插入的圖片的父元素
//插入圖片後要執行的代碼
code;
},
go: 1, //insertImg配套選項,圖片插入在頁面偏下位置時,滾動至第一張大圖的位置。
customTitle: ".title", //元素選擇器取得元素的字串。
customTitle: () => {
code;
return text;
},
observerTitle: true, //觀察元素變化重新取得標題字串,用於SPA網頁
autoDownload: [1, time], //1載入頁面後立即開始下載,與next搭配可以實現全自動下載,time延遲幾秒後點擊下一頁(預設5)。
next: "//a[text()='下一章']", //設定下一頁元素綁定右方向鍵點擊下一頁。
next: () => {
code;
return link;
},
prev: "//a[text()='上一章']", //設定上一頁元素綁定左方向鍵點擊上一頁,填1則使用history.back();。
css: "css", //自訂樣式。
mcss: "css", //自訂樣式只作用在觸控裝置。
hide: "selector", //用CSS隱藏元素
autoClick: "元素", //載入頁面後點擊一次此元素,能簡單做到自動簽到、展開目錄、Show All
autoClick: ["元素", 1000], //元素,延遲毫秒時間(預設1000)
observerClick: "元素", //使用Intersection Observer API,元素進入可視範圍內才點擊
observerClick: ["元素A", "元素B"],
loadMore: "元素", //監聽scroll事件,滾至頁面底部時點擊元素,能簡單做到自動載入更多
openInNewTab: ".manga-cover>a:not([target=_blank])", //指定的A元素在新分頁開啟
topButton: true, //添加返回頂部按鈕
threading: 1, //有些網站限制連接數,下載連接數太大容易出錯,適當降低連接數。
fetch: 1, //使用Fetch API下載圖片,需要圖片下載請求的伺服器有開放CORS。
referer: "src", //下載圖片時傳遞的參照頁,預設是使用當前域名,"url"參照頁為當前文檔網址,"src"參照頁為圖片網址,也能自訂如"https://www.example.com/"或空""
infiniteScroll: true, //漫畫分類標記有無限滾動模式
gallery: 1, //影子畫廊調用Iframe畫廊
downloadVideo: true, //下載變數videoSrcArray裡的影片直連網址
//離開影子畫廊後要滾動到此元素的位置,寫成"last:selector"則取多個元素的最後一個。
focus: "selector",
//不是簡單的首尾元素就寫成用函式判斷返回DOM元素
focus: () => HTMLElement,
closeAF: () =>, //離開影子畫廊後要運行的函式
aeg: 0, //0不能自動進入影子畫廊
category: "comic" //類別photo、nsfw1、nsfw2、hcomic、comic、lazyload、ad、none
}, {
name: "規則2",
enable: 0,
icon: 0,
key: 0,
url: {
t: "",
h: "",
p: "",
s: "",
e: "",
d: ""
},
url: () =>,
reg: /www\.xxxxx\.com/,
reg: [
//,
//
],
reg: () =>,
SPA: () =>,
SPA: true,
observerURL: true,
delay: 300,
include: "",
include: [""],
exclude: "",
exclude: [""],
init: "code",
init: () => {
code
},
imgs: "",
imgs: () => {
code
},
referrerpolicy: "no-referrer",
repeat: 1,
thums: "",
capture: "",
capture: () => _this.imgs(),
fn: () =>,
scrollEle: ["", 500],
scrollEle: async () => {
…code;
},
button: [4],
insertImg: ["", 0, time],
insertImg: [
["", 1, ""], 2, time
],
endColor: "white",
insertImgBF: () => {
code;
},
insertImgAF: (parent) => {
code
},
go: 1,
customTitle: "",
customTitle: () => {
code
},
customTitle: () => fn.dt({
s: "",
d: ""
}),
observerTitle: true,
autoDownload: [1, time],
next: "",
next: () => {
code
},
prev: "",
css: "",
mcss: "",
hide: "",
autoClick: "",
autoClick: ["", time],
observerClick: "",
observerClick: [""],
loadMore: "",
openInNewTab: "",
topButton: true,
threading: 1,
fetch: 1,
referer: "src",
infiniteScroll: true,
gallery: 1,
downloadVideo: true,
focus: "",
focus: () =>,
closeAF: () =>,
aeg: 0,
category: ""
}, {
name: "規則3",
…
}]
// 網站自帶Fancybox燈箱功能,不注入FancyboxCSS樣式
fancybox: {
v: 3,
css: false
},
// 頁面容器使用Fancybox3.5.7
fancybox: {
v: 3,
insertLibrarys: 1
},
// 不使用燈箱功能
fancybox: {
blacklist: 1
},