☰

JavDB2MissAV

JavDB快速跳转到MissAV在线播放页

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         JavDB2MissAV
// @namespace    https://gitee.com/mirrors406
// @version      2025.11.08
// @description  JavDB快速跳转到MissAV在线播放页
// @author       Mirrors406
// @match        https://javdb.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  "use strict";

  const isDetailPage = location.href.includes("/v/");

  const getMissAvSearch = (name) => `https://missav.ai/search/${name}`;
  const getMissAvDetail = (name) => `https://missav.ai/${name}`;

  /**处理详情页 */
  const handleDetailPage = () => {
    if (!isDetailPage) return;

    const nameDom = document
      .querySelector(".movie-panel-info")
      .querySelector(".first-block");

    const copyBtn = nameDom.querySelector(".copy-to-clipboard");
    const name = copyBtn.getAttribute("data-clipboard-text");

    const a = document.createElement("a");
    a.target = "_blank";
    a.className = "button is-white";
    a.style.color = "rgb(238, 97, 132)";
    a.textContent = "MissAV";

    a.href = getMissAvDetail(name);
    a.addEventListener("contextmenu", (e) => {
      e.preventDefault();
      window.open(getMissAvSearch(name));
    });

    nameDom.appendChild(a);
  };

  /**处理列表页 */
  const handleListPage = () => {
    if (isDetailPage) return;

    const handler = (item) => {
      const box = item.querySelector(":scope>.box");
      box.target = "_blank";

      const name = item
        .querySelector(".video-title")
        .querySelector("strong").innerText;

      const tagsDom = item.querySelector(".tags");

      const a = document.createElement("a");
      a.target = "_blank";
      a.className = "tag";
      a.style.marginLeft = "8px";
      a.style.color = "#fff";
      a.style.background = "rgb(238, 97, 132)";
      a.textContent = "MissAV";

      a.href = getMissAvDetail(name);
      a.addEventListener("contextmenu", (e) => {
        e.preventDefault();
        window.open(getMissAvSearch(name));
      });

      tagsDom.appendChild(a);
    };

    const list = document
      .querySelector(".movie-list")
      .querySelectorAll(":scope>.item");

    list.forEach((item) => {
      try {
        handler(item);
      } catch (error) {
        console.error(error);
      }
    });
  };

  handleDetailPage();
  handleListPage();
  console.log("---- JavDB To MissAV -----");
})();