Danbooru Tag Extractor

Extracts data-tag-name values from a Danbooru page

As of 2024-10-28. See the latest version.

// ==UserScript==
// @name         Danbooru Tag Extractor
// @version      1.3
// @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);
    });
})();