Danbooru Tag Extractor

Extracts data-tag-name values from a Danbooru page

目前為 2024-10-28 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Danbooru Tag Extractor
// @version      1.3.1
// @description  Extracts data-tag-name values from a Danbooru page
// @author       Nina_
// @match        https://danbooru.donmai.us/posts/*
// @grant        none
// @license MIT
// @namespace https://greasyfork.org/users/1387362
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function() {

        const tags = document.querySelectorAll('[data-tag-name]');

        const tagNames = Array.from(tags).map(tag => tag.getAttribute('data-tag-name'));

        const tagString = tagNames.join(', ');

        console.log(tagString);

        const outputElement = document.createElement('div');
        outputElement.style.position = 'fixed';
        outputElement.style.bottom = '10%'; //Position
        outputElement.style.right = '10%'; //Position
        outputElement.style.width = '500px'; // Initial width
        outputElement.style.height = '300px'; // Initial height
        outputElement.style.backgroundColor = 'white';
        outputElement.style.padding = '10px';
        outputElement.style.border = '1px solid black';
        outputElement.style.color = 'black';
        outputElement.style.resize = 'both';
        outputElement.style.overflow = 'auto';
        outputElement.textContent = tagString;
        document.body.appendChild(outputElement);
    });
})();


/*
 * Greasy Fork Description:
 * This userscript extracts all tags (data-tag-name) from Danbooru posts and displays them in a box at the bottom-right corner of the page.
 * It allows users to easily copy the tags for use in other applications. The initial size of the box is set to 500x300 pixels.
 *
 * Greasy Fork 简介:
 * 这个脚本会从 Danbooru 帖子中提取所有标签(data-tag-name),并将它们显示在页面右下角的一个框中。标签以英文逗号分隔开。
 * 用户可以方便地复制这些标签用于其他应用程序。初始框的大小设置为 500x300 像素。
 */