JAV跳转&磁力下载

Simplified JAV site navigation

// ==UserScript==
// @name         JAV跳转&磁力下载
// @version      1.3
// @description  Simplified JAV site navigation
// @license      GPL
// @match        *://*.javlibrary.com/*
// @match        *://*.javbus.com/*
// @require      https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
// @connect      sukebei.nyaa.si
// @grant        GM_addStyle
// @namespace https://sleazyfork.org/zh-CN/scripts/428639-onejavoneweb
// ==/UserScript==

(() => {
    'use strict';

    // Simplified Configuration
    const jav_configuration = {
        javbus: 'https://www.javbus.com',
        javlibrary: 'https://www.javlibrary.com',
        magnet: 'https://sukebei.nyaa.si/',
    };

    // Basic Styles (Simplified)
    GM_addStyle(`.jav-table {font-family: sans-serif; font-size: 14px; background-color: #fff; border: 1px solid #ccc; padding: 5px; position: absolute; z-index: 9999;} .jav-link {display: block; margin-bottom: 3px; color: #337ab7;} .jav-link:hover {text-decoration: underline;}`);

    class JAV {
        constructor(i) {
            this.fanhao = i.trim().replace(/ +/, '-'); // Simplified fanhao handling
        }

        create_table() {
            const javbusLink = `${jav_configuration.javbus}/search/${this.fanhao}`;
            const javlibraryLink = `${jav_configuration.javlibrary}/cn/vl_searchbyid.php?keyword=${this.fanhao}`;
            const magnetLink = `${jav_configuration.magnet}/?f=0&c=0_0&q=${this.fanhao}`;

            return `<div class="jav-table">
                        <a class="jav-link" target="_blank" href="${javbusLink}">JavBus</a>
                        <a class="jav-link" target="_blank" href="${javlibraryLink}">JAVLibrary</a>
                        <a class="jav-link" target="_blank" href="${magnetLink}">Magnet Download</a>
                    </div>`;
        }
    }

    // JavBus to JavLibrary and Magnet
    if ($('body div.container div.movie.row div.col-md-9.screencap')[0]) {
        $('body').on('mouseenter', 'div.container div.movie.row div.col-md-9.screencap', function () {
            const bango = $('body div.container h3').text().trim().split(' ')[0];
            const jav = new JAV(bango);
            $(this).prepend(jav.create_table());
        });
        $('body').on('mouseleave', 'div.container div.movie.row div.col-md-9.screencap', function () {
            $(this).find('.jav-table').remove();
        });
    }

    // JavLibrary to JavBus and Magnet
    if ($('body.main div#content div#rightcolumn table#video_jacket_info tbody tr td div#video_jacket')[0]) {
      $('body').on('mouseenter', '#video_jacket', function () {
          const bango = $('#video_title > h3').text().trim().split(' ')[0];
          const jav = new JAV(bango);
          $(this).prepend(jav.create_table());
      });
      $('body').on('mouseleave', '#video_jacket', function () {
          $(this).find('.jav-table').remove();
      });
    }

})();