ao3 savior

Hide specified works on AO3

< Обсуждения: ao3 savior

Отзыв: Хороший — скрипт работает как нужно

Possibility for a whitelist?

Just like the title says - I've had a go at it myself but I'm useless at js. Basically, you'd allow the filter to blacklist all things tagged with "Leo Fitz/Jemma Simmons" UNLESS if it was also tagged with "Antoine Triplett/Daisy Johnson". And so on.

Just a suggestion - you are, regardless, my savior. AO3 is almost unusable without this script.

tuffАвтор
§
Создано: 03.01.2016

Added, for tags only, no * wildcard

Doesn't seem to be working for me- I added a very simple tag, single-word, no *, but it continues to be blocked if it has a tag on my blacklist. Am I doing it wrong?

tuffАвтор
§
Создано: 12.01.2016

I'm not able to reproduce this. Please post your config?

Okay, is the config just a copy-paste of what's in my script?

tuffАвтор
§
Создано: 12.01.2016

Just the /**** CONFIG ********************/ block is enough

§
Создано: 28.08.2016
Изменено: 28.08.2016

Hello, I looked through the script today and I found what looks like a bug in the handling of the whitelist.

Specifically, it seems that the script goes through the tags only once and checks both the whitelist and the blacklist at same time (added comments for clarity):

for (var i = 0, tag; tag = $(tags[i]).text(); i++) { // for each tag
for (var j = 0, wlTag; wlTag = _cfg.tagWhitelist[j]; j++) { // check the whitelist
if (tag == wlTag) { // if matched
return ''; // exit, do not hide work
}
}

for (var j = 0, blTag; blTag = _cfg.tagBlacklist[j]; j++) { // check the blacklist
if (termsMatch(tag, blTag)) { // if matched
return reason +'tags include ' +blTag +''; // exit, hide work
}
}
}


Since finding either one ends the search, this means that the script goes with whatever is found first. If a blacklisted tag is listed earlier than a whitelisted one, the work will get blocked anyway.

I think that the above code should be split into two separate for-cycles, so that all of the tags are checked for the whitelist first. Like this:

// check whitelist
for (var i = 0, tag; tag = $(tags[i]).text(); i++) {
for (var j = 0, wlTag; wlTag = _cfg.tagWhitelist[j]; j++) {
if (tag == wlTag) {
return '';
}
}
}

//check blacklist
for (var i = 0, tag; tag = $(tags[i]).text(); i++) {
for (var j = 0, blTag; blTag = _cfg.tagBlacklist[j]; j++) {
if (termsMatch(tag, blTag)) {
return reason +'tags include ' +blTag +'';
}
}
}


ETA: As an aside, I was going through the script because I'm trying to add some additional functionality to my copy (dividing blacklisted tags into categories, so that I can display more generic reasons for hiding a work). Would you be interested in checking it out once it's finished?

tuffАвтор
§
Создано: 04.09.2016

Nice find, thanks very much! Should be fixed now.

I'll certainly check out your script, link me whenever.

Ответить

Войдите, чтобы ответить.