From 2a6504ee7f51067620631305a7a74c3d74bab7bf Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 3 Jan 2024 21:33:45 -0500 Subject: [PATCH] DLSite userscript --- dlsite.user.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 dlsite.user.js diff --git a/dlsite.user.js b/dlsite.user.js new file mode 100644 index 0000000..11dc2f3 --- /dev/null +++ b/dlsite.user.js @@ -0,0 +1,46 @@ +// ==UserScript== +// @name DLSite TL Unclaimed Works +// @namespace https://xeno.science/ +// @version 1.0 +// @description See which works on DLSite Translators Unite haven't already been started by other translators +// @author xenofem +// @match https://*.dlsite.com/*/works/translatable +// @match https://*.dlsite.com/*/works/translatable?* +// @match https://*.dlsite.com/*/works/translatable/* +// @run-at document-idle +// @sandbox DOM +// @license MIT +// ==/UserScript== + +const MY_LANGUAGE = "英語"; + +function checkUnclaimed() { + const works = document.getElementsByClassName("search_result_img_box_inner"); + + for (const work of works) { + let unclaimed = false; + const tlTable = work.getElementsByClassName("translation_table")[0]; + for (const row of tlTable.getElementsByTagName("tr")) { + if (row.children[0].textContent === MY_LANGUAGE && + row.children[1].textContent === "受付中" && + row.children[2].textContent === "0" && + row.children[3].textContent === "0") { + unclaimed = true; + break; + } + } + if (!unclaimed) { + work.style.opacity = "0.2"; + } + } +} + +const checkButton = document.createElement("button"); +checkButton.textContent = "Check unclaimed works"; +checkButton.style.position = "fixed"; +checkButton.style.top = "10px"; +checkButton.style.right = "10px"; +checkButton.addEventListener("click", checkUnclaimed); +document.body.appendChild(checkButton); + +checkUnclaimed();