Single post in Quality of Life changes [UserScript]
Forum Index > PokéFarm > Guides > Quality of Life changes [UserScript] >
I come to you with a bug report! Your script uncovered a bug on the server, which I have patched, but it shouldn't be happening in the first place!
https://pokefarm.com/forum/thread/320255/Error-while-party-clicking/post/6152449
The offending code seems to be this:
/*
* Sometimes clicks happen to fast for Pokefarm to add the 'working' class
* so, instead of waiting for that class to exist, add the qolpartyclickhide
* class here if Hide All mode is enabled
*/
obj.jQuery(document).on('click','#partybox>div.party>div', (e) => {
if (obj.settings.hideAll === true) {
// sometimes the target is the div, sometimes it's the div.action
const target$ = obj.jQuery(e.target);
let divPkmn$;
let divAction$;
if(target$.hasClass('action')) {
divPkmn$ = target$.parent().children('div.pkmn');
divAction$ = target$;
} else if(target$.attr('data-berry') !== undefined) {
divPkmn$ = target$.parent().parent().parent().children('div.pkmn');
divAction$ = target$.parent().parent().parent().children('div.action');
} else {
divPkmn$ = target$.children('div.pkmn');
divAction$ = target$.children('div.action');
}
divPkmn$.children().remove();
divAction$.addClass('qolpartyclickhide').removeClass('working');
}
});
I think .removeClass('working') is incorrect, because this allows (attempted) duplicate interactions to be sent.