Danbooru

Danbooru (etc...) userscripts

Posted under General

Reposting from my unneeded topic #24158.
Short summary I'm looking for a replacement or fix for webcomic user, if you're unfamiliar with the script it preloaded images on a page and let you browse through them like a gallery with the arrow keys.

Fhtagn said:

I've made this simple extension recently (Firefox only at the moment).
https://github.com/lowest-fhtagn/danbooru-enhancer

It's basically "Post to Danbooru" bookmarklet except on right-click context menu.

I've also added a feature to make Danbooru's sidebar sticky, which has personally made things more convenient for me especially when tagging, among other stuff.

The 'official' danbooru extension for Firefox already does this, for what it's worth: https://addons.mozilla.org/en-US/firefox/addon/upload-to-danbooru/ (There's also a Chrome version, but I don't wanna go to the chrome web store and find it)

Auto redirect to banned artist profile

Redirect to artist profile page instead of showing a takedown request message if you click a banned artist tag.

Show
// ==UserScript==
// @name       Redirect to banned artist profile
// @version       0.1
// @description       Redirect to banned artist profile from takedown page
// @author       Sibyl
// @match       https://danbooru.donmai.us/posts?tags=*
// @grant       none
// ==/UserScript==

(function () {
  "use strict";
  const p = document.querySelector("#page > p:last-child");
  if (p && p.innerText.indexOf("takedown request") > -1) {
    let tag = new URL(location).searchParams.get("tags")?.trim();
    if (tag) {
      let url = new URL("https://danbooru.donmai.us/artists/show_or_new");
      url.searchParams.set("name", tag);
      location.href = url;
    }
  }
})();
View post on other boorus

Add buttons to post information column and click to view post on yande.re, Gelbooru or SankakuComplex.

Show
// ==UserScript==
// @name       View post on other boorus
// @version       0.1
// @description       Add buttons to post information column and click to view post on other boorus.
// @author       Sibyl
// @match       https://danbooru.donmai.us/posts/*
// @grant       none
// ==/UserScript==

(function () {
  "use strict";
  const a = document.querySelector("#post-info-size > a:first-of-type");
  const md5 = a?.href?.match(/([a-z0-9]{32})\./)[1];
  if (md5) {
    document
      .querySelector("#post-info-id")
      .insertAdjacentHTML(
        "beforeend",
        `<div>&nbsp;<a id="post-on-g" target="_blank" href="https://gelbooru.com/index.php?page=post&s=list&md5=${md5}" style="color:#FFF;background-color:#2A88FE;">&nbsp;G&nbsp;</a>&nbsp;|&nbsp;<a id="post-on-y" target="_blank" href="https://yande.re/post/show?md5=${md5}" style="color:#EE8887;background-color:#222;">&nbsp;Y&nbsp;</a>&nbsp;|&nbsp;<a id="post-on-s" target="_blank" href="https://beta.sankakucomplex.com/?tags=md5%3A${md5}" style="color:#FFF;background-color:#FF761C;">&nbsp;S&nbsp;</a></div>`
      );
    document.head.insertAdjacentHTML(
      "beforeend",
      `<style>body[data-current-user-theme=dark]{--booru-border:1px dotted;}body[data-current-user-theme=light]{--booru-border:1px;} #post-info-id>div{display:inline-block;}#post-info-id a{font-weight:bold;}#post-info-id a {border:var(--booru-border);border-radius:3px;} #post-info-id a:hover{filter:opacity(50%);}</style>`
    );
  }
})();

Userscript for uploading to danbooru.

https://github.com/hdk5/upload-to-danbooru.user.js

Unlike the browser extension, which aims to be lightweight and universal, this one does the opposite by supporting only very few sites and including specific hacks for them.

Supported sites so far are:

  • Fantia (post_content_photo type)
    • Adds the upload button to full-size image page
    • Sends the direct image url with post url as referer
    • Currently almost works with the extension, but danbooru doesn't recognize the referer - which I don't like.
    • The full-size image page still has to be opened manually
  • Fantia (album_image type)
    • Adds the upload button on the image in the article
    • Sends the direct image url with post url as referer
    • Doen't work (and never will) with the extension
  • Fantia (download type)
    • Adds the upload button near the download button (e.g. mp4 video)
    • Sends the direct media url with post url as referer
    • Same as the previous, doen't work with the extension
  • Misskey
    • Adds the upload button to reactions row on each tweet
    • Works with the extension's address bar action, but each tweet has to be opened in new tab - which I am too lazy to do and just don't like
  • Pixiv
    • Adds the upload button on post thumbnails
    • Extension's context menu action uploads only the first image in the set - which I don't like
    • Works with the extension's address bar action, but each post has to be opened in new tab - which I am too lazy to do and just don't like

As always, Idk shit about javascript and Idk about another simple way to get a Pixiv user's stacc id, but here's a bookmarklet I made for this since it's useful to know to create qualifiers, search for other accounts and check the user's activity.

javascript:location = location.href.replace("en/users", "stacc/id")

And here's an userscript version, it does the same by pressing a key. You can set your desired key in the 11th line, I use "]".

// ==UserScript==
// @name        Get Stacc ID
// @match       */en/users/*
// @version      1
// @description  Replaces a Pixiv profile url and redirects to their Stacc.
// @author       Individual
// @grant       none
// ==/UserScript==

function doc_keyUp(e) {
    if (e.key === "]") {
if (location.href.match("en/users")) {
	location.href = location.href.replace("en/users", "stacc/id");
}
            }
}
document.addEventListener("keyup", doc_keyUp, false);

It simply replaces the url and redirects you to their Stacc page. If you don't use Pixiv in English, just edit the "en/" parts.

EDIT: Thank you so much 岩戸鈴芽!

Updated

Sessyoin_Kiara said:

...

I was actually unaware of this redirect, here's a bookmarklet you can use to easily copy the stacc URL, similar to the one for Twitter intent IDs. Same disclaimer about using Pixiv in anything other than English applies:

javascript:(() => fetch(location.href.replace("en/users", "stacc/id")).then(r => prompt("stacc URL", r.url)))()
1 4 5 6 7 8 9