tyduptyler13 / PlugPlus

Plug.dj script plugin for Chrome
https://www.facebook.com/PlugPlus
15 stars 9 forks source link

Turning off AutoWoot still processes the queued woot #22

Closed benjamw closed 10 years ago

benjamw commented 10 years ago

I have my AutoWoot time set to 90 seconds, and I turned off AutoWoot after a song started, yet it still processed the woot as if it were still on.

tyduptyler13 commented 10 years ago

This is because when a song is played, the autowoot code is triggered. It will delay the actual woot for the delay time in the settings.

This can be fixed by checking the autowoot setting again in the timeout code.

This should only be a problem for the first woot after it is disabled.

tyduptyler13 commented 10 years ago

You can evade wooting a song by meh'ing it early.

benjamw commented 10 years ago

I meh'd a song, and it still auto wooted after the set time.

benjamw commented 10 years ago

Thanks for the fix on the previously meh'd song issue, but the original issue has not been fixed. I offer a possible solution: without digging too deeply into the workings of the code to give line numbers and locations for things, you could set a variable to the setTimeout. If the AutoWoot button is clicked, turning off the already-run AutoWoot setTimeout code, then run clearTimeout on that variable and it will halt the execution of the code.

Example: http://stackoverflow.com/questions/452003/how-to-cancel-kill-window-settimeout-before-it-happens-on-the-client

benjamw commented 10 years ago

Another possible solution would be to test the PlugSettings.autoWoot value at the same time as the API.getUser().vote value, and if PlugSettings.autoWoot is false, halt execution.

tyduptyler13 commented 10 years ago

I'll try to fix this when I have time. (Quite busy with work)

benjamw commented 10 years ago

No worries. Totally understandable. Thanks for an awesome plugin! =)