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

Blacklist helper #9

Open PetrK39 opened 1 year ago

PetrK39 commented 1 year ago

Feel free to double-check it. It works not as good as I expected with a few minutes of resource update delay but still better than copying in manually. Ping me if docs need more explanation.

As the next step I would like to make some cleanup and then document all modules (maybe with some fancy 'jsdoc to md' github actions)

Enchoseon commented 1 year ago

As a heads up I'm going to be really delayed in responding for the next couple of weeks. Will check this as soon as I can.

Enchoseon commented 1 year ago

First run on a fresh install in a new browser in Violentmonkey 2.14.0 on Firefox 114.0.1, got this error:

index.php:544:1
[GELO]: Current page type is gallery Gelbooru Overhaul.user.js:209:25
Uncaught TypeError: scope.blacklistItems is undefined
    buildEditWindow moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:2725
    registerEditWinow moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:2655
    setupManager moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:3088
    applyTweakAdvancedBlacklist moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:1931
    onUpdate moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:732
    onUpdate moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:732
    applyConfig moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:789
    applyConfig moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:788
    applyConfig moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:787
    main moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:3503
    onDOMReady moz-extension://77a38d0a-1ec2-4156-abd3-1911b458b984/ Gelbooru Overhaul.user.js#1:171
index.php:2725:13

Crashes the entire script.

Here's the snippet the error points to:

resources/gelbooru-overhaul.blacklistManager.js
221-            let nameList = document.createElement("datalist");
222-            nameList.setAttribute("id", "go-advBlacklistListNames");
223:            scope.blacklistItems.forEach(i => {

Still don't have time to look onto it properly, but posting this here for proper bookkeeping.

PetrK39 commented 1 year ago

Looks like 'scope' is undefined. I'll try replace it with my recent discovery 'this.func = this.func.bind(this) when I get my hands on the code. But I'm actually working on cleaning up code from things like that in a separate branch anyway

PetrK39 commented 1 year ago

I just forgot to declare 'blacklistItems' in the class. Actually I got a different error but I believe this should fix it.