fix: add delay

This commit is contained in:
tretrauit 2024-03-07 00:09:31 +07:00
parent 75760a5b16
commit 528f19e5b5

View File

@ -5,7 +5,7 @@
// @match *://www.pixiv.net/*/artworks/* // @match *://www.pixiv.net/*/artworks/*
// @icon https://upload.wikimedia.org/wikipedia/commons/7/7e/Pixiv_Icon.svg // @icon https://upload.wikimedia.org/wikipedia/commons/7/7e/Pixiv_Icon.svg
// @grant none // @grant none
// @version 1.0.0 // @version 1.0.1
// @author tretrauit // @author tretrauit
// @run-at document-idle // @run-at document-idle
// @homepageURL https://gitlab.com/tretrauit/scripts // @homepageURL https://gitlab.com/tretrauit/scripts
@ -13,10 +13,13 @@
// @downloadURL https://git.tretrauit.me/tretrauit/scripts/raw/branch/main/userscripts/pixiv-ai-notifier.user.js // @downloadURL https://git.tretrauit.me/tretrauit/scripts/raw/branch/main/userscripts/pixiv-ai-notifier.user.js
// ==/UserScript== // ==/UserScript==
const tagElms = document.querySelectorAll(".gtm-new-work-tag-event-click"); console.log("AI notifier for Pixiv is running...");
for (const elm of tagElms) { setTimeout(() => {
if (elm.parentElement.parentElement.textContent.toLowerCase().includes("ai")) { const tagElms = document.querySelectorAll(".gtm-new-work-tag-event-click");
alert("AI artwork detected :("); for (const elm of tagElms) {
break; if (elm.parentElement.parentElement.textContent.toLowerCase().includes("ai")) {
alert("AI artwork detected :(");
break;
}
} }
} }, 1000);