Danbooru

Read the rules before proceeding!

Topic: Danbooru (etc...) userscripts

Posted under General

BrokenEagle98

With the change to the new shortened artist URLs, the following can be used to bring back the full length URLs. Use the Bookmarklet if it's only needed occasionally, or the Userscript if it's to be used all the time. (ref forum #136217)

Bookmarklet

javascript:$.each($("#artist-related-tags-column a[target=_blank]"),(i,entry)=>{entry.innerHTML=entry.href;});

Note: Unfortunately, DText doesn't allow one to create a link out of the above, so the bookmarklet will have to be set manually.

Userscript

Runs once
// ==UserScript==
// @name           Danbooru Artist URLs
// @match          *://*.donmai.us/posts/*
// @match          *://*.donmai.us/uploads/new
// @grant          none
// @run-at         document-idle
// @description    Show old-style full length artist URLs.
// ==/UserScript==

var artistinterval = setInterval(()=>{
    if ($("#artist-related-tags-column").length === 0) {
        return;
    }
    $.each($("#artist-related-tags-column a[target=_blank]"), (i,entry)=>{
        entry.innerHTML=entry.href;
    });
    clearInterval(artistinterval);
},1000);
Runs continuously
// ==UserScript==
// @name           Danbooru Artist URLs
// @match          *://*.donmai.us/posts/*
// @match          *://*.donmai.us/uploads/new
// @grant          none
// @run-at         document-idle
// @description    Show old-style full length artist URLs.
// ==/UserScript==

setInterval(()=>{
    if ($("#artist-related-tags-column").length === 0) {
        return;
    }
    $.each($("#artist-related-tags-column a[target=_blank]"), (i,entry)=>{
        entry.innerHTML=entry.href;
    });
},1000);

The interval timer is needed since the artist URLs are only loaded after the edit tab is opened.

Edit:
  • (2017-09-21)
    • Added continuous version in response to forum #136258
    • Added the uploads page to the pages the userscript runs on

Updated by BrokenEagle98

  • ID: 136245
  • Permalink
  • BrokenEagle98

    The following will make maintaining bookmarks on Danbooru easier, as it removes the trailing search parameters thereby leaving a clean URL to bookmark. Use the Bookmarklet if it's only needed occasionally, or the Userscript if it's to be used all the time. (ref forum #136183)

    Bookmarklet

    javascript:$.each($(".post-preview a"),(i,entry)=>{entry.href=entry.pathname;});
    

    Note: Unfortunately, DText doesn't allow one to create a link out of the above, so the bookmarklet will have to be set manually.

    Userscript

    // ==UserScript==
    // @name           Danbooru Post URLs
    // @match          *://*.donmai.us/posts?*
    // @grant          none
    // @run-at         document-idle
    // @description    Remove trailing search parameters from image links on the post search page.
    // ==/UserScript==
    
    $.each($(".post-preview a"), (i,entry)=>{
        entry.href = entry.pathname;
    });
    

    Updated by BrokenEagle98

  • ID: 136251
  • Permalink
  • southrim

    BrokenEagle98 said:

    The following will make maintaining bookmarks on Danbooru easier, as it removes the trailing search parameters thereby leaving a clean URL to bookmark. Use the Bookmarklet if it's only needed occasionally, or the Userscript if it's to be used all the time. (ref forum #136183)

    Awesome, thank you so much. I successfully implemented the Danbooru Post URLs user script in Greasemonkey and it's working just fine - being on all the time works for me, since I make heavy use of "bookmark all tabs"

    Updated by southrim

  • ID: 136389
  • Permalink
  • BrokenEagle98

    The following is for those that want or miss the huge textarea that post flag reasons used to have.

    Bookmarklet

    javascript:$.each($("#post_flag_reason"),(i,entry)=>{entry.outerHTML = `<textarea id="post_flag_reason" class="text optional" rows="20" name="post_flag[reason]" cols="30"></textarea>`});
    

    Note: Unfortunately, DText doesn't allow one to create a link out of the above, so the bookmarklet will have to be set manually.

    Userscript

    // ==UserScript==
    // @name           Danbooru Post Flags
    // @match          *://*.donmai.us/posts/*
    // @grant          none
    // @run-at         document-idle
    // @description    Switch post flags to use the larger-sized textarea.
    // ==/UserScript==
    
    $.each($("#post_flag_reason"),(i,entry)=>{
        entry.outerHTML = `<textarea id="post_flag_reason" class="text optional" rows="20" name="post_flag[reason]" cols="30"></textarea>`
    });
    
  • ID: 138888
  • Permalink
  • 1
  • 2
  • 3
  • >>