BooruBear

Gathers tags from a few boorus

Versión del día 6/12/2022. Echa un vistazo a la versión más reciente.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Necesitará instalar una extensión como Tampermonkey para instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión como Stylus para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

Necesitará instalar una extensión del gestor de estilos de usuario para instalar este estilo.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         BooruBear
// @namespace    https://greasyfork.org/scripts/456125-boorubear/code/BooruBear.user.js
// @version      0.3
// @description  Gathers tags from a few boorus
// @author       You
// @match        https://danbooru.donmai.us/*
// @match        https://gelbooru.com/*
// @match        https://rule34.xxx/*
// @grant        none
// @license      MIT
// ==/UserScript==

// Create the button and textarea elements
var button = document.createElement("button");
var textarea = document.createElement("textarea");
var closeButton = document.createElement("button");

button.innerHTML = "Extract Tags";
button.style.position = "fixed";
button.style.bottom = "0";
button.style.right = "0";
button.style.backgroundColor = "black";
button.style.color = "white";

textarea.style.position = "fixed";
textarea.style.bottom = "0";
textarea.style.right = "0";
textarea.style.width = "400px";
textarea.style.height = "200px";
textarea.style.backgroundColor = "black";
textarea.style.color = "white";
textarea.style.display = "none";

closeButton.innerHTML = "Close";
closeButton.style.position = "fixed";
closeButton.style.bottom = "210px";
closeButton.style.right = "0";
closeButton.style.backgroundColor = "black";
closeButton.style.color = "white";
closeButton.style.display = "none";

// Add the button and textarea to the page
document.body.appendChild(button);
document.body.appendChild(textarea);
document.body.appendChild(closeButton);

// Add a click event listener to the button
button.addEventListener("click", function() {
  // Find all instances of "tags=" in the page
  var matches = document.body.innerHTML.match(/tags=([^&"]+)/g);

  if (matches) {
    // For each match, extract the text after the "=" and before the next " or &
    for (var i = 0; i < matches.length; i++) {
      var tag = matches[i].split("=")[1];

      // Replace "%3A" with ":", "%28" with "(", and "%29" with ")"
      tag = tag.replace(/%3A/g, ":").replace(/%28/g, "(").replace(/%29/g, ")").replace(/%27/g, "'").replace(/%21/g, "!").replace(/%3F/g, "?");

      // Exclude instances of "all" and tags that include "user:", "date:", or "status:"
      if (tag.toLowerCase() !== "all" && !tag.toLowerCase().includes("user:") && !tag.toLowerCase().includes("date:") && !tag.toLowerCase().includes("status:") && !tag.toLowerCase().includes("order:") && !tag.toLowerCase().includes("my_tags")) {
        // Append the tag to the textarea
        textarea.value += tag + " ";
      }
    }
  }

  // Show the textarea and close button
  textarea.style.display = "block";
  closeButton.style.display = "block";
});

// Add a click event listener to the close button
closeButton.addEventListener("click", function() {
  // Hide the textarea and close button
  textarea.style.display = "none";
  closeButton.style.display = "none";
});