Danbooru

Danbooru 2 Issues Topic

Posted under General

This topic has been locked.

tapnek said:

Why change the font for the search text, especially to one that is smaller?

It wasn't changed, so much as not accounted for. The default style for all text areas are monospace (Consolas) unless specified otherwise, and when the input type was switched, the CSS wasn't updated accordingly.

Ne_Obliviscaris said:

always got error 504 everytime I try to upload something.

Same, there seem to be some problems with the upload system right now. I'm getting "This upload is being processed. Please wait a few seconds." on repeat whenever it doesn't directly go to Failbooru.

I have an issue that only happens in Chrome, not Firefox.

If I am on the upload page and scroll down to click on one of the tags from the "related tags" lists, the page jumps up to the text input box for tags. So I would scroll down to click on a tag, the page jumps all the way up to the input box, and I would need to scroll back down for each tag I want to click on. In Firefox I could click many tags in a row and the page wouldn't jump back up to the text box with the blue focus border.

Does anyone else have this issue? This is probably a browser-specific issue not a site issue but if anyone else experiences this and was able to change it that would be so helpful.

忍猫 said:

I have an issue that only happens in Chrome, not Firefox.

If I am on the upload page and scroll down to click on one of the tags from the "related tags" lists, the page jumps up to the text input box for tags. So I would scroll down to click on a tag, the page jumps all the way up to the input box, and I would need to scroll back down for each tag I want to click on. In Firefox I could click many tags in a row and the page wouldn't jump back up to the text box with the blue focus border.

Does anyone else have this issue? This is probably a browser-specific issue not a site issue but if anyone else experiences this and was able to change it that would be so helpful.

Yeah, it's related to a recent fix. I submitted issue #3333 because Chrome was clobbering the cursor position and setting it to 0 when toggling one of the tags. This made it so that if you wanted to do a related tag search on a tag just added, you would have to go up to the text box every time to reselect the tag. The solution uses the Javascript focus function which does work, but has the unintended consequence as you noted of making the window jump up to the tag box.

Therefore, I submitted a pull request with issue #3338 that fixes this issue and has already been merged, however it has not yet been deployed to the server. In the meantime, since this bug is pretty debilitating to the way I tag images, I developed some Javascript that basically rebinds the toggle function taking the fix I developed into account. Feel free to use or just wait until the fix gets deployed.

Javascript code
// ==UserScript==
// @name         Rebind Tag Toggle
// @match        *://*.donmai.us/posts/*
// @match        *://*.donmai.us/uploads*
// @grant        none
// @run-at       document-end
// ==/UserScript==

const timer_poll_interval = 100;

var myToggleTag = function(e) {
    var $field = $("#upload_tag_string,#post_tag_string");
    var tag = $(e.target).html().replace(/ /g, "_").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");

    if (Danbooru.RelatedTag.tags_include(tag)) {
        var escaped_tag = Danbooru.regexp_escape(tag);
        $field.val($field.val().replace(new RegExp("(^|\\s)" + escaped_tag + "($|\\s)", "gi"), "$1$2"));
    } else {
        $field.val($field.val() + " " + tag);
    }
    $field.val($field.val().trim().replace(/ +/g, " ") + " ");

    Danbooru.RelatedTag.update_selected();
    if (Danbooru.RelatedTag.recent_artist && $("#artist-tags-container").css("display") === "block") {
        Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
    }

    setTimeout(()=>{$field.prop('selectionStart', $field.val().length);},timer_poll_interval);
    e.preventDefault();
};

function rebindRelatedtag() {
    let $tags = $(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4");
    if ($tags.length && $._data($(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4")[0],"events").click.length) {
        console.log("Rebinding toggle tags!");
        clearInterval(rebindRelatedtag.timer);
        Danbooru.RelatedTag.toggle_tag = myToggleTag;
        $(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4").off().click(Danbooru.RelatedTag.toggle_tag);
        console.log("Rebound toggle tags!");
    }
}

function programLoad() {
    if (typeof window.Danbooru === undefined) {
        console.log("Danbooru not installed yet!");
        return;
    }
    if (typeof window.jQuery === undefined) {
        console.log("jQuery not installed yet!");
        return;
    }
    clearInterval(programLoad.timer);
    if ($("#c-uploads #a-new,#c-posts #a-show").length) {
        main();
    }
}

function main() {
    console.log("Main: Unfocus");
    rebindRelatedtag.timer = setInterval(rebindRelatedtag,timer_poll_interval);
}

programLoad.timer = setInterval(programLoad,timer_poll_interval);

BrokenEagle98 said:

Yeah, it's related to a recent fix. I submitted issue #3333 because Chrome was clobbering the cursor position and setting it to 0 when toggling one of the tags. This made it so that if you wanted to do a related tag search on a tag just added, you would have to go up to the text box every time to reselect the tag. The solution uses the Javascript focus function which does work, but has the unintended consequence as you noted of making the window jump up to the tag box.

Therefore, I submitted a pull request with issue #3338 that fixes this issue and has already been merged, however it has not yet been deployed to the server. In the meantime, since this bug is pretty debilitating to the way I tag images, I developed some Javascript that basically rebinds the toggle function taking the fix I developed into account. Feel free to use or just wait until the fix gets deployed.

Javascript code
// ==UserScript==
// @name         Rebind Tag Toggle
// @match        *://*.donmai.us/posts/*
// @match        *://*.donmai.us/uploads*
// @grant        none
// @run-at       document-end
// ==/UserScript==

const timer_poll_interval = 100;

var myToggleTag = function(e) {
    var $field = $("#upload_tag_string,#post_tag_string");
    var tag = $(e.target).html().replace(/ /g, "_").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&amp;/g, "&");

    if (Danbooru.RelatedTag.tags_include(tag)) {
        var escaped_tag = Danbooru.regexp_escape(tag);
        $field.val($field.val().replace(new RegExp("(^|\\s)" + escaped_tag + "($|\\s)", "gi"), "$1$2"));
    } else {
        $field.val($field.val() + " " + tag);
    }
    $field.val($field.val().trim().replace(/ +/g, " ") + " ");

    Danbooru.RelatedTag.update_selected();
    if (Danbooru.RelatedTag.recent_artist && $("#artist-tags-container").css("display") === "block") {
        Danbooru.RelatedTag.process_artist(Danbooru.RelatedTag.recent_artist);
    }

    setTimeout(()=>{$field.prop('selectionStart', $field.val().length);},timer_poll_interval);
    e.preventDefault();
};

function rebindRelatedtag() {
    let $tags = $(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4");
    if ($tags.length && $._data($(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4")[0],"events").click.length) {
        console.log("Rebinding toggle tags!");
        clearInterval(rebindRelatedtag.timer);
        Danbooru.RelatedTag.toggle_tag = myToggleTag;
        $(".tag-type-0,.tag-type-1,.tag-type-3,.tag-type-4").off().click(Danbooru.RelatedTag.toggle_tag);
        console.log("Rebound toggle tags!");
    }
}

function programLoad() {
    if (typeof window.Danbooru === undefined) {
        console.log("Danbooru not installed yet!");
        return;
    }
    if (typeof window.jQuery === undefined) {
        console.log("jQuery not installed yet!");
        return;
    }
    clearInterval(programLoad.timer);
    if ($("#c-uploads #a-new,#c-posts #a-show").length) {
        main();
    }
}

function main() {
    console.log("Main: Unfocus");
    rebindRelatedtag.timer = setInterval(rebindRelatedtag,timer_poll_interval);
}

programLoad.timer = setInterval(programLoad,timer_poll_interval);

Thanks for your help, @BrokenEagle98. It was driving me crazy trying to find a workaround.

忍猫 said:

I have an issue that only happens in Chrome, not Firefox.

If I am on the upload page and scroll down to click on one of the tags from the "related tags" lists, the page jumps up to the text input box for tags. So I would scroll down to click on a tag, the page jumps all the way up to the input box, and I would need to scroll back down for each tag I want to click on. In Firefox I could click many tags in a row and the page wouldn't jump back up to the text box with the blue focus border.

Does anyone else have this issue? This is probably a browser-specific issue not a site issue but if anyone else experiences this and was able to change it that would be so helpful.

Firefox here. Also experiencing this problem.

Is it just me or is the movile version of this site heavily downgraded and ugly to use?

Specifically, I lost the option to save pictures, and the site is jampacked and it overall makes it ugly as hell. Its really annoying going to this site and having to manually remember to switch to desktop

Thank god for a "desktop version" button below.

When I uploaded post #2906639 with the newpool metatag to create a pool, the pool was created but post ID wasn't inserted into it. Trying to visit the post gave an error message until I manually added it to the pool. I forgot to save the error though...

EDIT: oops, copy-pasted the wrong post number into this comment

@忍猫 @Ne_Obliviscaris

The fix (issue #3338) for the issue with the tag toggle (forum #138102) has been deployed, and I verified that it works by turning the "Unfocus Tags" Javascript off, so it's not longer needed and probably not recommended to keep as future iterations of the code may cause things to break if its left on. It was only a temporary fix after all.

fossilnix said:

When I uploaded post #2906639 with the newpool metatag to create a pool, the pool was created but post ID wasn't inserted into it. Trying to visit the post gave an error message until I manually added it to the pool. I forgot to save the error though...

EDIT: oops, copy-pasted the wrong post number into this comment

The only recent change to the newpool metatag was a change of order of when it gets applied due to its case-sensitivity (issue #3341), but which shouldn't be causing the issue you've described as it only changed the order and nothing else. I'm somewhat suspicious though that it might be related to the use of Unicode characters, as when I tested the newpool metatag as part of of the above fix I used all Roman uppercase characters which worked just fine. I must admit though that I only tested it on an existing post and not an upload, so it could potentially also be that as well...?