Setting - Modify all [Auto-Sell / Auto-Salvage] at once

HV 设置:一次性修改所有的【自动出售/自动拆解】

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Setting - Modify all [Auto-Sell / Auto-Salvage] at once
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  HV 设置:一次性修改所有的【自动出售/自动拆解】
// @author       ssnangua
// @match        https://hentaiverse.org/?s=Character&ss=se
// @match        https://hentaiverse.org/isekai/?s=Character&ss=se
// @match        https://alt.hentaiverse.org/?s=Character&ss=se
// @match        https://alt.hentaiverse.org/isekai/?s=Character&ss=se
// @icon         https://www.google.com/s2/favicons?sz=64&domain=hentaiverse.org
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const sell_selects = document.querySelectorAll("#settings_autosalvage td:nth-child(2)>select");
    const salvage_selects = document.querySelectorAll("#settings_autosalvage td:nth-child(3)>select");
    const first_tr = document.querySelector("#settings_autosalvage tr");
    const all_tr = first_tr.cloneNode(true);
    all_tr.id = "__modify_all__";
    const all_label = all_tr.querySelector("td:nth-child(1)");
    const [all_sell_select, all_salvage_select] = all_tr.querySelectorAll("select");
    all_label.textContent = first_tr.querySelector("td:nth-child(1)").textContent === "短剑" ? "全部" : "All";
    all_sell_select.name = "as_c_all";
    all_salvage_select.name = "as_s_all";
    all_sell_select.addEventListener("change", () => {
        sell_selects.forEach((select) => {
            select.value = all_sell_select.value;
        });
    });
    all_salvage_select.addEventListener("change", () => {
        salvage_selects.forEach((select) => {
            select.value = all_salvage_select.value;
        });
    });
    first_tr.parentNode.insertBefore(all_tr, first_tr);

    GM_addStyle(`#__modify_all__ {
      td, select {
        font-weight: bold;
      }
    }`);
})();