Donmai

Danbooru (etc...) userscripts

Posted under General

Is there a CSS that removes the downvote button? I've no need for a function that is both completely useless to me and has been used by other users as a way to "attack" other uploaders.

It also serves as a safety measure so that I don't accidentally press the downvote button (which fortunately hasn't happened yet) when browsing on mobile.

Is there a userscript or CSS that adds a tagbox (with a fully functioning tag autocomplete dropdown menu) into the main upload page without anything uploaded, similarly to the old upload page?

Jisadel said:

Is there a userscript or CSS that adds a tagbox (with a fully functioning tag autocomplete dropdown menu) into the main upload page without anything uploaded, similarly to the old upload page?

Here you go:

Show
// ==UserScript==
// @name        Danbooru - add tag box on /uploads/new
// @version     0.1.1
// @author      imapiekindaguy
// @match       *://*.donmai.us/uploads/new
// @grant       GM_addStyle
// @run-at      document-idle
// ==/UserScript==

GM_addStyle(`
div#c-uploads div#a-new textarea {
  width: 100%;
  max-width: 100%;
  height: 20vh;
}
`);

document.querySelector("div#a-new").insertAdjacentHTML("beforeend", `
<div>
  <div class="flex justify-between">
    <label for="post_tag_string">Tags</label>

    <span data-tag-counter="" data-for="#post_tag_string" class="text-muted text-sm">
      <span class="tag-count"></span>
    </span>
  </div>

  <div class="input text optional post_tag_string"><textarea data-autocomplete="tag-edit" data-shortcut="e" class="text optional ui-autocomplete-input" name="post[tag_string]" id="post_tag_string" autocomplete="off" title="Shortcut is e"></textarea></div>
</div>`
);

Danbooru.Autocomplete.initialize_all();

Updated

imapiekindaguy said:

Here you go:

Show
// ==UserScript==
// @name        Danbooru - add tag box on /uploads/new
// @version     0.1.0
// @author      imapiekindaguy
// @match       *://*.donmai.us/uploads/new
// @grant       GM_addStyle
// @run-at      document-idle
// ==/UserScript==

GM_addStyle(`
div#c-uploads div#a-new textarea {
  width: 100%;
  max-width: 100%;
  height: 20vh;
}
`);

document.querySelector("div#a-new").insertAdjacentHTML("beforeend", `
<div>
  <div class="flex justify-between">
    <label for="post_tag_string">Tags</label>

    <span data-tag-counter="" data-for="#post_tag_string" class="text-muted text-sm">
      <span class="tag-count"></span>
    </span>
  </div>

  <div class="input text optional post_tag_string"><textarea data-autocomplete="tag-edit" data-shortcut="e" class="text optional ui-autocomplete-input" name="post[tag_string]" id="post_tag_string" autocomplete="off" title="Shortcut is e"></textarea></div>
</div>`
);

Although a tag box is added, the autocomplete doesn't seem to function on the added tag box. If there's no way to make it work, then it's alright.

Jisadel said:

Although a tag box is added, the autocomplete doesn't seem to function on the added tag box. If there's no way to make it work, then it's alright.

Oh, sorry about that. Add the line Danbooru.Autocomplete.initialize_all(); to the end of the script.

I was wondering why it just seemed to work for me; I have another script that was enabling autocomplete.

imapiekindaguy said:

Oh, sorry about that. Add the line Danbooru.Autocomplete.initialize_all(); to the end of the script.

I was wondering why it just seemed to work for me; I have another script that was enabling autocomplete.

Nice, the script works! Thank you! :LeoNice:

1 8 9 10 11 12