-
Notifications
You must be signed in to change notification settings - Fork 0
/
nekopost_reload_pushstate.user.js
40 lines (40 loc) · 1.39 KB
/
nekopost_reload_pushstate.user.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
// ==UserScript==
// @name nekopost_reload_pushstate
// @namespace https://github.com/Plong-Wasin
// @version 1.0.1
// @description nekopost_reload_pushstate
// @author Plong-Wasin
// @updateURL https://github.com/Plong-Wasin/plugins-nekopost-v8/raw/main/nekopost_reload_pushstate.user.js
// @downloadURL https://github.com/Plong-Wasin/plugins-nekopost-v8/raw/main/nekopost_reload_pushstate.user.js
// @match https://www.nekopost.net/manga/*
// @match https://www.nekopost.net/project/*
// @match https://2nd.nekopost.net/manga/*
// @exclude https://www.nekopost.net/manga/*/*
// @exclude https://2nd.nekopost.net/manga/*/*
// @grant window.close
// ==/UserScript==
"use strict";
(() => {
function ready(fn) {
if (document.readyState != "loading") {
fn();
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
function delegate(el, event, selector, fn) {
el.addEventListener(event, function (e) {
if (e.target.closest(selector)) {
fn.call(this, e);
}
});
}
ready(() => {
delegate(document, "click", "a", function (e) {
const target = e.target.closest("a");
if (target?.closest(".listChapter")) {
window.location.href = target.href;
}
});
});
})();