-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinlineScript.js
50 lines (50 loc) · 1.81 KB
/
inlineScript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(function () {
var params = new URLSearchParams(document.currentScript.src.split("?")[1]);
var call = params.get("call");
if (call === "pxvdwn_one_click_bm_dl")
try {
if (pxvdwn_one_click_bm_dl_start_flag);
} catch (e) {
pxvdwn_one_click_bm_dl_start_flag = true;
var originalFetch = window.fetch;
window.fetch = async (url, options) => {
try {
if (typeof url === "string")
if (
url.indexOf("/ajax/novels/bookmarks/add") != -1 ||
url.indexOf("/ajax/illusts/bookmarks/add") != -1 ||
url.indexOf("/rpc/index.php") != -1
)
if (options && options.body) {
var postData = JSON.parse(options.body);
var mode = "";
var itemMode = "";
if (postData.illust_id) {
if (postData.illust_id instanceof Array)
postData.illust_id = postData.illust_id[0];
itemId = postData.illust_id;
itemMode = "illust";
} else if (postData.novel_id) {
if (postData.novel_id instanceof Array)
postData.novel_id = postData.novel_id[0];
itemId = postData.novel_id;
itemMode = "novel";
}
window.postMessage(
{
type: "pxvdwn_one_click_bm_dl",
text:
'{"itemId":"' +
itemId +
'","itemMode":"' +
itemMode +
'"}',
},
"*"
);
}
} catch (e) {}
return originalFetch(url, options);
};
}
})();