HV 训练助手 (Training Helper)

持续训练 (Hentaiverse Continuous Training)

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         HV 训练助手 (Training Helper)
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  持续训练 (Hentaiverse Continuous Training)
// @author       ssnangua
// @match        *://hentaiverse.org/?s=Character&ss=tr
// @match        *://alt.hentaiverse.org/?s=Character&ss=tr
// @icon         https://hentaiverse.org/y/favicon.png
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  "use strict";
  document.querySelector("#mainpane").style.overflow = "auto";

  console.log("[HV 训练助手]", localStorage.ngTrain);

  document
    .querySelectorAll("#train_table tr>td:last-child>img")
    .forEach((el, index) => {
      const isCur = String(index) === localStorage.ngTrain;
      if (isCur && el.onclick) el.click();

      const btn = document.createElement("div");
      btn.style.cssText =
        "white-space: nowrap; font-weight: bold;" +
        (!localStorage.ngTrain || isCur || el.onclick
          ? "text-shadow: 0 0 2px orange; cursor: pointer;"
          : "color: #454543;");
      btn.innerHTML = "持续训练";
      if (isCur) {
        btn.innerHTML = "持续中…";
        btn.onmouseover = () => (btn.innerHTML = "不再持续");
        btn.onmouseout = () => (btn.innerHTML = "持续中…");
        btn.onclick = () => {
          delete localStorage.ngTrain;
          location.reload();
        };
      } else if (!localStorage.ngTrain) {
        btn.onclick = () => {
          localStorage.ngTrain = String(index);
          if (el.onclick) el.click();
          else location.reload();
        };
      }
      el.parentNode.appendChild(btn);
    });
})();