Copy Prompt

danbooru.donmai.us—gelbooru.com—safebooru.org—yande.re—rule34.xxx—furry.booru.org—nozomi.la—www.zerochan.net(nozomi/zerochan不支持列表页面直接复制)

Stan na 27-10-2023. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Copy Prompt
// @namespace    http://tampermonkey.net/
// @version      1.1.6
// @description  danbooru.donmai.us—gelbooru.com—safebooru.org—yande.re—rule34.xxx—furry.booru.org—nozomi.la—www.zerochan.net(nozomi/zerochan不支持列表页面直接复制)
// @author       zuogangju
// @match        *://danbooru.donmai.us/*
// @match        *://gelbooru.com/*
// @match        *://safebooru.org/*
// @match        *://yande.re/*
// @match        *://rule34.xxx/*
// @match        *://furry.booru.org/*
// @match        *://nozomi.la/*
// @match        *://www.zerochan.net/*
// @match        *://safe.aibooru.online/*
// @match        *://aibooru.online/*
// @match        *://xbooru.com/*
// @match        *://konachan.com/*
// @match        *://konachan.net/*
// @match        *://furbooru.org/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js
// @resource     customCSS https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.css
// @grant        GM_setClipboard
// ==/UserScript==


// 获取当前页面的URL
const currentURL = window.location.href;

const myEvent="mousemove"





/*复制文本到剪切板并弹出复制成功*/
function copyPrompt(tagsValue){
    console.log("prompt:")
    console.log(tagsValue)
    // 复制选中内容到剪贴板
    // navigator.clipboard.writeText(tagsValue)
    GM_setClipboard(tagsValue)
    Swal.fire({
        //position: 'top-end',
        icon: 'success',
        title: '复制成功',
        showConfirmButton: false,
        timer: 600
    })
}


function addEvent(selectors, qualifiedName) {
    // 选择所有图片元素
    let imageElements = document.querySelectorAll(selectors);
    // 遍历每个图片元素并添加鼠标移动监听事件
    imageElements.forEach(function (image) {
        image.addEventListener(myEvent, function (event) {
            if (event.ctrlKey) {
                // 获取data-tags属性的值
                const data = image.getAttribute(qualifiedName);
                copyPrompt(data)
            }
            // 这里可以执行你想要的操作,例如显示在页面上等
        });
    });
}

window.onload=function() {
    'use strict';
    let selectors = '[data-tags]';
    let qualifiedName ="data-tags";

    if(currentURL.includes("danbooru.donmai.us")
        ||currentURL.includes("aibooru.online")
        ||currentURL.includes("safe.aibooru.online")
        ||currentURL.includes("gelbooru.com")){
        addEvent(selectors, qualifiedName);
    }else if (currentURL.includes("www.zerochan.net")){
        selectors = "#content .preview img";
        qualifiedName ="alt";
    }else if (currentURL.includes("safebooru.org")){
        selectors = "#content img";
        qualifiedName ="alt";
    } else if (currentURL.includes("yande.re")
        ||currentURL.includes("rule34.xxx")
        ||currentURL.includes("xbooru.com")
    ||currentURL.includes("konachan.com")
    ||currentURL.includes("konachan.net")){
        selectors = "#image";
        qualifiedName ="alt";
    }else if (currentURL.includes("nozomi.la")){
        selectors = ".container img";
        qualifiedName ="alt";
    }else if (currentURL.includes("furbooru.org")){
        selectors = "[data-image-tag-aliases]";
        qualifiedName ="data-image-tag-aliases";
    }



    addEvent(selectors, qualifiedName);
};