Enchoseon / gelbooru-overhaul-userscript

Various toggleable changes to Gelbooru such as enlarging the gallery, removing the sidebar, and more.
4 stars 2 forks source link

Feature brainstorm #8

Closed PetrK39 closed 1 year ago

PetrK39 commented 1 year ago

I'm thinking about how to implement auto-updating the blacklist using '@resource'. This can't be done by user.js manual changes because it is overwritten as it updates. It can't be done by accessing a second userscript because their resources are isolated ('@namespace' is a useless property).

One way to do this is to have a second unupdatable script that will store the user-defined '@resource */blacklist_NAME.txt', putting it in the Web Storage and retrieving it every time the original script is run. What's your thoughts?

Offtopic

Could we implement AdBlock? For some reason adblock extensions tend to fail on gelbooru and I have no pleasure seeing porn ad while browsing site

Enchoseon commented 1 year ago

I'm not sure what you mean by auto-updating the blacklist, could you clarify what you mean?

R.e. Offtopic

I haven't experienced my adblocker failing on Gelbooru—I'm currently using uBlock Origin, which iirc is one of the few pure content blockers capable of bypassing CNAME-cloaked ads on Firefox; maybe Gelbooru uses those? Idk.

If it's easy and can be done properly (e.g. blocking the content from loading, not just hiding it with CSS) I see no reason why not, other than the overlap with existing extensions.

PetrK39 commented 1 year ago

To make it short: script 1 - original gelbooru overhaul user.js script 2 - single-purpose helper script

User defines their remote blacklist file links in script 2 '@resource's (private repo, secret gist, whatever) Script 2 puts blacklists in localStorage In script 1 blacklistManager extracts localStorage and adds/upadtes blacklists When user changes content of defined blacklist script 2 updates its resource and puts updated blacklist in localStorage Script 1 updates blacklists with no need to do it manually in blacklist config window

userscript manager's config storage contains rolling cache so updating blacklist every time is not big deal however, the mechanics of resource updating need some investigation there's also edge cases like removing of currently disabled entries in script 1 or removing resource in script 2

PetrK39 commented 1 year ago

Anyway I'll try it after 1.0.0 merge. Another unpleasant discovery, although gelbooru autocomplete script was borrowed from danbooru it lacks of some features like meta tags autocompletion and I'm thinking on reimplementing its functionality in separate module if necessarily.

PetrK39 commented 1 year ago

Autocomplete part seems quite complicated with most of the interaction going through application.grid.js and jquery.js widget things So at this moment I have no idea how to trick it to show 'bookmarked' tags or reimplement it without big html changes Edit: Found a relatively simple way to do it. Unfortunately gelbooru doesn't provide tag aliases as danbooru do and I'm not sure they are compatible. (I'll try to use DB autocompletion api anyway) Edit 2: I gave up. If you would like to try to do something with it, I left a branch with my attempts