Danbooru

[Userscript] Danbooru EX

Posted under General

evazion said:

Not yet, but I've been thinking about how to add that. I think it will be possible, the data dump from topic #12774 includes all that information. I will post a list of the top uploaders in that thread. You are ranked #44.

Um, what ranking? In terms of what?

New release

v608: https://github.com/evazion/danbooru-ex/raw/6973bf4adc11ee563d46f28f934959eef451b166/dist/danbooru-ex.user.js
v609: https://github.com/evazion/danbooru-ex/raw/50a7fe89265f2e4607e2c4f16928a8f3a52a5fe9/dist/danbooru-ex.user.js

I had really intended to work on this more, but I got sidetracked by other projects and didn't have as much time for it as I had hoped. orz. So I still haven't gotten to a lot of the stuff I had planned on yet, but anyway, here's an interim release with a couple new features:

Features
  • Add large image previews when hovering over thumbnails or post #1234 links. (Screencast)
  • Reworked /artists page (Screencast):
    • Include artist #1234 links
    • Include artist post counts
    • Include links to artist wiki and tag search.
    • Make other names / group name link to artist search, to make searching for dupes easier.
    • Include created/updated times.

Updated

For the image previews:

  • Are the images the medium, i.e. the sample images?
  • Are any of the images cached, or does it do a fetch each time?

Both of the above would be important to know for those with slower connections or limited bandwidth per month, e.g. mobile hotspots or smartphone tethering.

For the artists page:

  • Just my opinion, but the artist #1234 links are superfluous since they already get linked with the artist name. Maybe just add a non-linked ID number.
  • Adding limit=20 to the URL manually broke the Javascript processing for that page. (Any number does the same though)

I don't know if it would be helpful to add the creator. I would say adding the updater would be helpful, but unfortunately that isn't part of the available artist information, like how it is available in the wiki page information.

For the image previews:

  • Are the images the medium, i.e. the sample images?
  • Are any of the images cached, or does it do a fetch each time?

Yeah, the previews are the sample images. They should be cached by your browser. It is wasteful to download a full image just to scale it down to 450px, but that can't be helped.

Also there is a JSON query on every tooltip popup, which is not cached and costs a little bandwidth, but more importantly it adds latency. This could be improved.

Finally the fact that thumbnails are triggered by mouse hover doesn't play well with phone/tablets. Would need some other way of triggering previews for this to work well on mobile.

  • Just my opinion, but the artist #1234 links are superfluous since they already get linked with the artist name. Maybe just add a non-linked ID number.

The thought was that whenever an ID is shown, it should be listed with dtext syntax (e.g. artist #1234, comment #1234, forum #1234), both to make copy-pasting easier and to reinforce that dtext should be used to link to things. It does make the listing pretty noisy though, I may remove it.

  • Adding limit=20 to the URL manually broke the Javascript processing for that page. (Any number does the same though)

I can't reproduce a bug for limit=20, but it was broken for limit>20. Should be fixed now. It's still broken for limit=1000 though (you have to break large API requests into batches otherwise you'll get 414 URL Too Long errors, and I haven't bothered yet).

I don't know if it would be helpful to add the creator. I would say adding the updater would be helpful, but unfortunately that isn't part of the available artist information, like how it is available in the wiki page information.

I noticed this too. I want to put the last updater in there, and it's possible to find out by looking at the artist versions, but it would take a bunch of API requests to do that for every artist on the page. Would have to adjust things server-side to make it efficient.

@evazion
It seems that this script only allows to "View" an image. When I change the mode to "Approve" and then I click on the image, I don't approve the image, but instead I'm directed to the post, just like when the mode is on "View".
The same with the other modes ("Edit", "Tag Script" etc.)

evazion said:

Yeah the mode menu in the sidebar is broken at the moment. Try using the mode menu in the header next to the search bar, that one should work.

@evazion
There isn't the "Approve" mode, sadly :(.
The other modes are working fine, though.

Updated

Works perfectly outside the mod queue which is extremely helpful.
The mod queue doesn't show any sign of it being broken in the queue. Simply because there is a manual "Approve" option that doesn't require the modes. So the queue works fine.
Thank you again a lot!

I'd like to make the following feature request with multiple parts.
It's purely optional though and very low priority.

Part 1 (Visually identify link types)

It's not readily evident the types of DText links without hovering over the link, be they wiki links, tag search links, or textile links. Recently, I've started adding bold {} around tag searches to clarify that it's not a wiki link. Wiki links are the most common, so they should be left as is. Textile links though could also use an identifier, since they could be linked to an external site, potentially even a malicious site. E.g. this link to http://www.google.com is actually to Wikipedia.

To sum up...

  • Tag searches get identified (Maybe with bold {})
  • Textile links get identified (Maybe with bold "")

This all may require getting the original DText data though instead of parsing the HTML...?

Part 2 (Visually identify link information)

Adding extra visual information to links based upon information about the endpoint.

  • Nonexistant/deleted wikis (Maybe surrounded with bold [])
  • Wikis with 0 posts (Maybe surrounded with bold <>)
  • Tag searches with zero results (Maybe surrounded with bold **)

Part 3 (Bonus round)

Adding extra visual information (like strikethrough) and/or removing the hyperlink for all dead/non-working internal/external links.

Re: identifying links, this may be doable in custom CSS. I have some proof-of-concept CSS that marks external links, I'll post it in the custom CSS thread. Adding CSS classes for the various kinds of links would make it easier though.

Re: wiki links with zero posts, I collect the post count already, it comes as part of fetching the tag type for tag colorizing. So that's no problem, just have to add a data-post-count="0" attribute to the links, then you can style it with custom CSS.

Marking nonexistent/deleted wikis and empty tag searches would take extra API requests to gather this information, but it should be doable.

Re: part 3, marking dead links is a good idea but it requires some care. Checking if links are dead means doing automatic GET requests to external servers, which can be abused (look up superlogout).

Additional Feature Requests

  • 'E' hotkey on posts page changes the mode to Edit
  • Display the original hover-over text (i.e. post tags, source, score, uploader name) in addition to the enlarged images (as it currently is).

For that last one, I don't know if both are possible at the same time, but if it is, that information is useful. I frequently hover over posts to quickly check the scores, check the uploader, and check if it's been properly tagged.

New release

v1301: https://github.com/evazion/danbooru-ex/raw/stable/dist/danbooru-ex.user.js
Repo: https://github.com/evazion/danbooru-ex

This is a major update. This release adds options to disable unwanted tweaks, fixes many bugs (hopefully), and adds a major new feature: an image preview panel. Basically, in preview mode clicking a thumbnail opens a side panel showing the full size image. This makes browsing and tag scripting much, much faster and easier. Demos:

Tag scripting has also been reworked to support this mode. Now in tag script mode, clicking a thumbnail selects the post and opens the preview, but does not apply the script. You select everything first then you click Apply or press Shift+A to apply the script to the selected posts. So tag scripting now works basically the same way file managers work: you select items first, then apply the action second.

Lastly, I finally documented all the assorted stuff this script does, see here: https://github.com/evazion/danbooru-ex

Changes
New features
  • Preview panel mode.
  • New tag scripting mode.
  • There are now config settings. Edit the variables at the top of the script to disable tweaks you don't want.
  • The tag sidebar is resizeable. You can collapse it to gain space, or expand it so those annoyingly long tags don't wrap around so much.
  • The search bar can now be closed so it doesn't follow you as you scroll (I like that behavior, but I'm sure some of you hate it).
  • Bad wiki links are underlined (links to empty or nonexistent tags). (However, links to tags that do exist but that don't have wiki pages are not yet handled).
  • Pressing Ctrl+Enter in the search bar opens the search in a new tab.
Fixes
  • Performance has been greatly improved. Flickering of page elements has been reduced.
  • Fix broken autocomplete in search bar.
  • Fix various mode menu brokenness.
  • Fix header layout brokenness at smaller screen widths (should now work up to ~960px).
  • Other things I've forgotten - bug me if there are other things still unfixed.

EDIT: I just realized that using the config options is buggy, so uh, nevermind on that.

Updated

Display the original hover-over text (i.e. post tags, source, score, uploader name) in addition to the enlarged images (as it currently is).

This is still broken, currently I'm using the jquery UI tooltips plugin for this and it doesn't seem to have a way to show the original tooltips. Eventually I want to display all the metadata in the tooltip next to the thumbnail, just not sure how to keep it readable when the tag list grows huge.

Wikis with 0 posts (Maybe surrounded with bold <>)
Tag searches with zero results (Maybe surrounded with bold **)

These two I added, but they're styled as dotted underlines. Nonexistent wikis I don't do yet though, just nonexistent tags.

Also I add CSS classes to wiki links based on tag counts: tag-post-count-{empty, small, medium, large, huge, gigantic} for 0, 0-100, 100-1000, 1000-10000, 10000-100000, 100000+ posts. I don't add any styling to them but it could be done with custom CSS.

1 2 3 4 5 6 7