Donmai

[Userscript] Safelist Plus

Posted under General

Safelist Plus is an alternate blacklist handler for Danbooru with UI enhancements. It was designed primarily to have multiple blacklists for multiple occasions, whether it be at work, at home with others, or by oneself. It supports user awareness and quick reaction in addition to better censorship and functional obfuscation.

Installation

Project page
Main script

Main features

  • Multiple blacklists
    • With two constant lists all and none
  • Customizable names
    • Makes them easier to remember
    • Can obfuscate the functionality of Safelist
  • Customizable CSS styles
    • Visual cue for the active list
    • Instant feedback that a list has changed
  • Customizable hotkeys
    • Quick switching of lists

Controls

Safelist controls are available wherever there are blacklist controls, and are located in the sidebar or at the top of the content depending on the page.

The enable/disable links are used to turn Safelist on/off, and each list link (or hotkey) will activate the effects for that list.

The constant lists are always bolded, and the active list is in italics. If no lists are active when Safelist is enabled, then it will default to showing no posts.

Settings

The program settings for Safelist Plus are located with Danbooru settings (My Account >> Settings >> Userscript Menus).

Level settings are located on the post index page.

Setting/Control Details
General Settings:
  • Use Session Enable: Have a different state of enabled on each page tab.
  • Use Session Level: Have a different active list on each page tab.
  • Enable Write Mode: Enable writes to your Danbooru blacklist with the Push button.
  • Enable Validate Mode: Currently disabled.
  • Enable Order Mode: Currently disabled.
General controls:
  • Submit: Save all of the settings and reload as required.
  • Add: Add a new list/level.
  • Reset All: Reset all settings to factory default.
  • Show Raw: Used to transfer settings between domains/computers.
Level settings:
  • Hotkey: Key combination used to change levels.
  • Enable: (All/None) Enable or disable constant lists (all or none).
  • Background Process: Process a list in the background so that changing lists is more responsive.
  • Blacklisted Tags: Works exactly the same as Danbooru's blacklist
  • Custom CSS: Style to apply to the whole site.
List controls:
  • Pull: Populate tag list with a user's Danbooru blacklist tags.
  • Push: Write a tag list to a user's Danbooru blacklist.
  • Delete: Delete the level.

CSS examples

The following are several examples of how the CSS function can be used to better indicate the current level

CSS examples
Name replaces site title
#app-name-header {
    visibility: hidden;
    position: relative;
}
#app-name-header:after {
    content: "Safebooru";
    color: #888;
    visibility: visible;
    position: absolute;
    top: 0;
    left: 0;
}
Name appended after site title
#app-name-header:after {
    content: " (All)";
    color: red;
    font-size: 0.8em;
    vertical-align: 5%;
}
Highlighted site title
#app-name-header a {
    background-color: lightgreen;
}

Alternate use cases

In addition to being an alternative blacklist handler, Safelist can be used for a number of alternative purposes.

Single use
  • Quickly update Danbooru's blacklist
  • Quickly try out the effects of different CSS
  • Contrast and compare different CSS setups (e.g. topic #9588 and topic #12923)
  • Contrast and compare different blacklists
Constant use
  • Situational CSS
    • Have a different CSS depending on the time of day or any other factor
  • Assist with tagging
    • E.g. a list with 1girl and multiple girls would quickly locate posts without a girl counter
    • Saves having to do a separate tag search, plus you won't lose your place
  • Quickly swap between different ratings
    • Have three lists with -rating:s, -rating:q, and -rating:e
  • Expand search capabilities beyond tag limit
    • Positive search terms become negative list entries
    • Negative search terms become positive list entries
  • Panic mode, i.e. hide EVERYTHING!

Caveats

Danbooru's blacklist will always process no matter what! Therefore, having a ginormous Danbooru blacklist could potentially cause a lengthy delay in page loading in addition to Safelist processing.

Also, there is no Danbooru setting to turn blacklists off. Danbooru's "disable all blacklists" is actually a misnomer since it will first process the blacklist as if it was enabled before hiding them again (multiple times). This extra work was observed to take at least twice as long than enabled blacklists.

Final

Any suggestions or feedback are appreciated.

Latest edits

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

Versions

Show
  • (2017-07-11)
    • Version 2 (37) - Initial release
  • (2019-07-30)
    • Version 3 - Initial release of overhauled version
  • (2019-12-23)
    • Version 4 Updated library version
      • Several additions/improvements on settings menu
    • Added CSS examples to OP

Updated

Just a bit of background on the above... it's been something I've been working on for the last month, but it's still my first Javascript coding experience. I've been heavily Beta-ing it for the last week to try to iron out any errors, but it's likely something was missed due to the nature of coding... (ツ)

Anyways, please report any errors in this thread. Also, if you have an idea for a UI enhancement related to blacklists, please feel free to share. Thanks.

Any chance this will be updated? I ran into some trouble using it:

  • The settings link only shows up if i change run-at to document-idle.
  • The posts show up vertically when Safelist is enabled.

I'm using Firefox Nightly 70.0a1 and Chrome Canary 77.0.3859.0, both with Tampermonkey Beta 4.9.5941.
Anyway, thanks for the script. It's really nice.

To be honest, I was thinking of moving this script into an unsupported status, since I didn't think anyone used it nor do I use it anymore. But if there's interest, I can take a look at it again, although it's been 2 years since I last looked at the code, so it'll be a while before I can wrap my head around it. I'll try to get that done by next week.

The Safelist script was overhauled (~85% changed) and released as Version 3 of Safelist Plus.

The name and link are now different, and the old version and addons were removed to the unsupported directory in the Javascripts repository (https://github.com/BrokenEagle/JavaScripts).

Adds
  • Moved the program settings to (My Account >> Settings >> Userscript Menus)
    • Level settings are still settable from the post search page
  • Intertab communication to reflect changes immediately
    • With the exception of active status/level if session levels or session status is enabled (program settings)
  • Standardized and improved validation of data
  • Several other performance improvements
Removes
  • Text/tab scrubbing
  • Validation addon
  • Order addon

Not sure if text/tab scrubbing will be brought back as it's not clear how needful/useful those are. The validation and order addons will be brought back at a later date once the OR operator "~" is taken into account.

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

  • Additions
    • Add control next to Safelist sidebar/topbar (triangle icon) which allows the list to be collapsed/expanded
    • 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
  • Changes
    • Settings menu now adapts to the color changes of the chosen theme (light/dark)
  • Fixes
    • Fix display issue with Safelist level menu on post index page
    • Fix issue with browser hotkeys interferrring with Safelist level hotkeys
    • Fix comments not displaying correctly on pages other than comment pages
  • Other
    • Multiple internal code changes and refactors
1