Danbooru

[Userscript] RecentTagsCalc

Posted under General

RecentTagsCalc replaces the current recent tags calculated by Danbooru for the tag edit form on uploads/posts. The default settings were designed to emulate the original functionality of recent tags before October 2018. The tags are calculated from both uploads and post edits, after the edit form has been submitted.

Installation

Project page
Main script

https://raw.githubusercontent.com/BrokenEagle/JavaScripts/stable/recenttagscalc.user.js

Usage notes

The tag list on the edit form works exactly the same as before. Also, the script calculates tags in the background automatically. Please note that this does not occur on tag edits that occur from the post index using the tag script or edit functions.

Tags can be pinned so that they always appear on every page load. This is done by clicking the oval icon next to a tag in the Recent tags list, which will change the oval to solid. To unpin a tag, click the oval icon next to the tag so that the oval icon is empty.

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

Final

Future additions:

  • Order by tag usage
    • Similar to Danbooru's current method
    • However usage calculations will be user controlled
  • Have choice for fallback sort when two tags evaluate the same
    • Such as two tags having the same category for category sort...
    • ...or two tags having the same post count for post count sort

Any suggestions or feedback is appreciated.

Latest edits

  • (2019-12-28)
    • Version 7 Updated library version
  • Verified working on Firefox
  • Added extra usage notes

Versions

Updated

Pushed Version 3 which primarily adds the ability to cache the frequent/favorite tags, as well as fixing several minor issues such as concurrency and synchronization between tabs.

The caching of frequent tags was added as it was noticed that the frequent tags was taking about 1.5 seconds to load each time the new upload or post edit forms were opened. This also had the effect of causing the recent tags to take the same amount of time since it waits for Danbooru to add those columns before updating them. With the option of caching frequent tags turned on though (it is turned on by default), it can load those tags as soon as it gains execution.

The expiration time on updating the cached frequent tags is currently set at one week, although a control has been added to the user settings which allows for them to be manually updated if needed.

Minor versions
  • (2019-01-13)
    • 3.1
      • Remove unnecessary network calls when frequent tags are cached
      • Added compatibility with IndexedAutocomplete

Updated

Pushed Version 4 which adds the ability to sort new recent tags by tag category.

It was also sorting alphabetically for post count sort when the post counts were equal, but that was changed to use form order instead.

Minor versions
  • (2019-01-28)
    • 4.1
      • Fixed issue with how data was being broadcast
      • Only affected other tabs that were also on the user settings page

Updated

Pushed Version 5 which adds the ability to pin recent tags, which is done by clicking the circle icons next to the tags so that a pin icon appears. To unpin a tag, reverse the process by clicking the pin icon until the circle icon appears.

Additionally, the multiple tag lists option has been enabled, along with a setting to control the amount of tag groups. To help identify a group better, it also labels each group as the Nth upload or edit.

Finally, the cache editor being prototyped (forum #154196, forum #154240, forum #154285, forum #154332) was added. It's pretty much finalized by this point, so the code will be migrated and standardized across all scripts at the next library update.

Minor versions
  • (2019-02-08)
    • 5.1 - Fixed pinned tags not being checked on a page refresh

Updated

Pushed Version 6 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.

Minor versions
  • (2019-02-16)
    • 6.1 - Fixed bug with incorrect function name on uploads page
  • (2019-05-19)
    • 6.2
      • Made use of "only" parameter
      • Fixed link binding for manual tags refresh
    • 6.3 - Fix network function not working without ID

Updated

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

  • Additions
    • 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
    • Alter how tags are checked on a new tab to avoid having default tag categories
    • Fix the width of sort items on the settings menu
  • Other
    • Multiple internal code changes and refactors
  • 1