GetJavCover

在javBus番片详情页面上生成下载按钮,点击按钮自动下载封面大图

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         GetJavCover
// @namespace    https://www/github.com/coverli/
// @version      1.0.0
// @description  在javBus番片详情页面上生成下载按钮,点击按钮自动下载封面大图
// @author       CoverLi
// @match        目标网站
// @license      MIT
// @run-at       document-idle

// @include     *://*javbus.com/*
// @include     *://www.*bus*/*
// @include     *://www.*javsee*/*
// @include     *://www.*seejav*/*

// @grant       unsafeWindow
// @grant       GM_addStyle(css)
// ==/UserScript==

(function () {
    'use strict';
    var br = document.createElement("br");
    var btn = document.createElement("button");
    btn.class = "downloadBtn";
    btn.innerHTML = "下載";
    btn.style.width = "50px";
    btn.style.height = "50px";
    btn.style.background = "#6e8eb5";
    btn.style.borderRadius = "50%";
    btn.style.cursor = "pointer";
    btn.style.border = "none";
    btn.style.fontSize = "16px";
    btn.style.color = "ffffff";

    btn.onclick = function () {
        var url = document.getElementsByClassName('bigImage').item(0).href;
        var name = document.title.replace(' - JavBus', '');
        fetch(url).then(async res => await res.blob()).then((blob) => {
            const a = document.createElement('a');
            a.style.display = 'none';
            a.href = URL.createObjectURL(blob);
            a.download = name + '.jpg';
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
        })
    }
    var code = document.getElementsByClassName('header_hobby')[0];
    var empty = document.getElementsByClassName('header_hobby')[0];
    code.parentElement.insertBefore(btn, code);
    empty.parentElement.insertBefore(br, empty);
})();