-
Notifications
You must be signed in to change notification settings - Fork 0
/
userscript.user.js
39 lines (33 loc) · 1.07 KB
/
userscript.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
// ==UserScript==
// @name Hide and remove non-JP in NovelUpdates
// @namespace https://github.com/volcbs/Non-JP-Novelupdates
// @include https://www.novelupdates.com/*
// @exclude https://www.novelupdates.com/series/*
// @version 1.1
// @grant none
// ==/UserScript==
// Get all rows in the table
let rows = document.querySelectorAll("tr");
// Loop through all rows
for (let i = 0; i < rows.length; i++) {
let row = rows[i];
// Get the first column in the row
let firstCol = row.querySelector("td:nth-child(1)");
if (!firstCol) continue;
// Get the text of the first column
let text = firstCol.textContent;
// If the text doesn't contain [JP], hide the row
if (!text.includes("[JP]")) {
row.style.display = "none";
} else {
// If it does contain [JP], remove it from the text
text = text.replace("[JP]", "");
// Keep the URL in the first column
let link = firstCol.querySelector("a");
if (link) {
firstCol.innerHTML = `<a href="${link.href}">${text}</a>`;
} else {
firstCol.textContent = text;
}
}
}