Donmai

[Userscript] Displaypostinfo

Posted under General

DisplayPostInfo adds additional information about a post in various places, such as on the post page or post search page.

Installation

Project page
Main script
Updates

This script was transferred from the Gist published on forum #154468.

Usage notes

Information is populated automatically:

  • Post show page
    • In the Information section
      • Uploader name
      • Top tagger name
      • Post views
  • Post index page
    • After the Tags section
      • Post statistics
      • Domain statistics
    • In the basic/advanced tooltips
      • Uploader name

Settings can be modified from your Danbooru user edit page, (My Account >> Settings >> Userscript Menus) under DisplayPostInfo.

Final

Any suggestions or feedback is appreciated.

Latest edits

  • (2022-09-04) Updated script link in OP

Versions

Show
  • (2019-02-06)
  • (2019-02-07)
    • Version 6 - Cache user information differently
      • Add missing basic tooltip setting to menu
      • Add purge cache control to menu
  • (2019-02-15)
    • Version 7 Updated to newest library
  • (2019-05-09)
    • Version 8 Added post/tag statistics
  • (2019-12-22)
    • Version 9 Updated library version
      • Add extra post statistics on index view
      • Several additions/improvements on settings menu
  • (2019-02-19)
    • Version 10 Added domain statistics
  • (2019-08-29)
    • Version 11 Updated library version
      • Added ability to alter delays on post tooltips
  • (2021-01-05)
    • Version 12 Added favorites styling back in

Updated

feline_lump said:

Doesn't work with Greasemonkey on Firefox 64.0, unfortunately. Thank you for this regardless.

Isn't 64 an outdated version? I thought it's 65 now.
But anyway, this only seems available on Tampermonkey for the time being.

Lacrimosa said:

Isn't 64 an outdated version? I thought it's 65 now.
But anyway, this only seems available on Tampermonkey for the time being.

Downloaded a browser update and Tampermonkey, and it works! Thanks.

The only comment/suggestion I have so far is that using underscores instead of spaces in usernames feels a little unnatural. Otherwise, it's great.

Pushed Version 4 which adds the uploader to basic tooltips (Disable post tooltips set to "No" under Advanced settings).

The basic tooltips are rendered on the fly, and there is a quarter second delay to avoid triggering on all mouseovers, so the tooltip may not show the uploader initially. Also, since the tooltips come from an attribute and not an HTML element, leaving the mouse stationary over a thumbnail may not work either. The best method I've found is to slowly drag the pointer over the thumbnail.

I may in the future cache usernames differently, moving toward a scheme where I can query all of the users on a page in a single batch. That would allow the pre-rendering of all basic tooltips on the page at once, and thus avoid the render delay as mentioned above.

feline_lump said:

Doesn't work with Greasemonkey on Firefox 64.0, unfortunately. Thank you for this regardless.

I'll take a look into that, although since you have a working version on Tampermonkey now (forum #154494), that'll be a lower priority task.

feline_lump said:

The only comment/suggestion I have so far is that using underscores instead of spaces in usernames feels a little unnatural. Otherwise, it's great.

Yeah, I didn't really pay attention to that aspect, as I used the username as how it's stored in the database. I'll fix that in the next update, which I hope to push by the end of the day.

Pushed Version 5 which adds caching to the top tagger results. This will on average make the results load much faster.

The results are cached on the first page load of a post, and are keyed to the current tags on that post. If the tags on the post change, then the top tagger calculations will be run and cached again. This data gets cached for a month so that old results get pruned.

Besides the above, usernames were fixed so that underscores get replaced by spaces in the shown text.

Pushed Version 6 which retrieves and caches user info differently, grabbing all users at once at page load instead of individually.

The effect of this is most apparent on both kinds of post tooltips, especially the basic tooltip. There is no longer any jitter from the username getting loaded into the tooltip, as it is already there.

Besides the above, the missing setting for basic post tooltips was added to the menu (it is enabled by default regardless). Additionally, a Purge cache control was added to the menu.

Pushed Version 7 which primarily integrates the new library code that was finalized earlier this week. This is coming out as a major version since a large majority of the code was changed while updating to the new library version and standardizing all of the affected userscripts.

Additionally, all of the menus were standardized, and fully working cache editors were incorporated. Also, a new control was added under cache settings which shows the size of all the userscript data amongst all of the various data storage.

Besides all of the above, the post views are now being cached for a short duration (5 mins) on a per-tab basis. In other words, the caching in one tab will not affect any other tab.

Minor versions
  • (2019-02-15)
    • 7.1 - Fixed cache expiration not being checked for post views
  • (2019-02-16)
    • 7.2 - Adjusted post views cache expires <fredgido Discord>
      • Posts < 1 hour old are cached in tab storage for only 1 minute
      • Posts 1 hour .. 1 day old are cached in browser storage on a 1 minute - 1 hour logarithmic scale
      • Posts 1 day .. 1 month old are cached in browser storage on a 1 hour - 1 day logarithmic scale
      • Posts > 1 month are cached in browser storage for 1 day

Updated

Pushed Version 8 which primarily adds post and tag statistics to the post index view, which can be turned off/on from the settings menu.

The post statistics only uses the data from all of the posts on the current page.
The tag statistics are the percentage of posts on the current page with that tag.

Besides the above, it also:

  • Hides/displays elements on all tabs after a settings change
    • Except for basic/advanced tooltips (at this time)
  • Makes use of the "only" parameter (issue #4068)

BrokenEagle98 said:

@nanami

Are you using Version 8.6?

If so, what browser version are you using? Also can you open up your dev console (should be F12) to see if there are any errors being reported?

I was using version 5. I've just installed version 8.6 and uninstalled version 5 from Tampermonkey (using Edge, Chromium Dev version). Everything works now.

Updating the code on Greasemonkey (on Firefox) though seems to remove the ability to show the uploader's name.
(EDIT: But then again, you did say above the code is otherwise untested in Greasemonkey/Firefox, so this comment is also a good barometer for that.)

Updated

nanami said:

Updating the code on Greasemonkey (on Firefox) though seems to remove the ability to show the uploader's name.
(EDIT: But then again, you did say above the code is otherwise untested in Greasemonkey/Firefox, so this comment is also a good barometer for that.)

I just tested and confirmed that the latest version does work on Firefox when using Tampermonkey. I updated the OP to reflect that.

As for Greasemonkey, none of my scripts are or will be written to be compatible with it, so if they do work then it's only happenstance.

I don't know if something has been changed in Edge (Chromium version), but the script seems to be not working anymore. The code is not working in Chrome (version 78) either. The script still works on Firefox, BTW.

Updated

nanami said:

I don't know if something has been changed in Edge (Chromium version), but the script seems to be not working anymore. The code is not working in Chrome (version 78) either. The script still works on Firefox, BTW.

I just tested it on Chrome (Version 78.0.3904.87 (Official Build) (64-bit)), and it works just fine for me. I don't have Edge/Chromium though. Are you using Version 8.6 of DisplayPostInfo?

One thing you can also try is opening up the dev console (F12) and seeing if there are any errors (red background). Additionally, you can turn on debug logging.

JSPLib.debug.debug_console = true;

The above is on line 35 of the code.

BrokenEagle98 said:

I just tested it on Chrome (Version 78.0.3904.87 (Official Build) (64-bit)), and it works just fine for me. I don't have Edge/Chromium though. Are you using Version 8.6 of DisplayPostInfo?

One thing you can also try is opening up the dev console (F12) and seeing if there are any errors (red background).

An error does come up:

userscript.html?id=4057cee1-26bb-41ee-a5db-548c1906ee30:2 ERROR: Execution of script 'DisplayPostInfo' failed! undefineds called with a non-global RegExp argument

Still using 8.6 BTW. Also, am also using DText Styler and that is working fine.

nanami said:

An error does come up:

userscript.html?id=4057cee1-26bb-41ee-a5db-548c1906ee30:2 ERROR: Execution of script 'DisplayPostInfo' failed! undefineds called with a non-global RegExp argument

Still using 8.6 BTW. Also, am also using DText Styler and that is working fine.

Hmm... not sure how that's happening to be honest. I just installed Edge and added Tampermonkey and that script and both still work fine for me. Unfortunately, if I can't replicate the error, there's not much I can do to fix it. I did notice though that Chrome and Edge share a lot of the same libraries on disk, so I imagine that if one gets corrupted than both will become corrupted.

I can suggest though:

  • deleting and reinstalling the script
  • deleting and reinstalling Tampermonkey
  • change to an alternate Chrome/Edge profile
  • reset Chrome/Edge
  • reinstall Chrome/Edge

BrokenEagle98 said:

Hmm... not sure how that's happening to be honest. I just installed Edge and added Tampermonkey and that script and both still work fine for me. Unfortunately, if I can't replicate the error, there's not much I can do to fix it. I did notice though that Chrome and Edge share a lot of the same libraries on disk, so I imagine that if one gets corrupted than both will become corrupted.

BTW, which version of Edge (Chromium version) did you download? There are three versions, Canary, Dev, and Beta (final stable version is still in the works). I'm using the Dev version and it seems the latest update to the Dev version borked the script somewhat.

As for the fixes, deleting and reinstalling the script and deleting Tampermonkey have not remedied the problem. I'm now using Tampermonkey Beta, but no dice so far.

nanami said:

BTW, which version of Edge (Chromium version) did you download? There are three versions, Canary, Dev, and Beta (final stable version is still in the works). I'm using the Dev version and it seems the latest update to the Dev version borked the script somewhat.

As for the fixes, deleting and reinstalling the script and deleting Tampermonkey have not remedied the problem. I'm now using Tampermonkey Beta, but no dice so far.

I downloaded the Beta version since it was the most stable. Like I said before, the Chrome and Edge installs seem to share library files somewhat. Since it seems like something in them got messed up in them, perhaps doing a complete uninstall/reinstall would fix things.

https://www.wintips.org/how-to-completely-uninstall-re-install-google-chrome/

Pushed Version 9 which primarily includes an update to the library code plus a few additions and fixes:

  • Additions
    • Extra post statistics of pending, banned, flagged, and deleted count on the post index page
    • Add new menu library elements/functions for cache editor
      • The raw program data can be extracted using the cache editor, which facilitates transferring program data to another browser/domain
      • Controls which are not applicable are hidden, for example Local storage must be selected before the raw data option becomes visible
  • Changes
    • Settings menu now adapts to the color changes of the chosen theme (light/dark)
  • Fixes
    • Fix error when post previews after page initialization get added
  • Other
    • Add statistical debug data for data retrieval
    • Multiple internal code changes and refactors
1 2