Anarios / return-youtube-dislike

Chrome extension to return youtube dislikes
https://returnyoutubedislike.com/
GNU General Public License v3.0
12.64k stars 565 forks source link

fix get count dislikes on mobile version of youtube #888

Closed TalosDx closed 1 year ago

TalosDx commented 1 year ago

The pull request fixes getting dislikes on the mobile version of the site. It fixes it in two ways.

  1. Checking the existence of the dislikes button before adding a listener to increase the number of dislikes.
  2. An alternative solution, in case the error still occurred. (Possibly requires a fix, because it is performed without delay)

Problem founded in compiled code: изображение

buttons.children[0].children[0].addEventListener("click", likeClicked);
buttons.children[0].children[1].addEventListener("click", dislikeClicked);
buttons.children[0].children[0].addEventListener("touchstart", likeClicked);
buttons.children[0].children[1].addEventListener("touchstart", dislikeClicked);

buttons.children[0].children[1] is undefined

Why getDislikesButtons() compiled to buttons.children[0].children[1] i don't know.

sy-b commented 1 year ago

Thank you! 🙂

TalosDx commented 1 year ago

It is also worth looking into that the code compiles. It is possible that the problem is in the compilation. I say this because my code practically did not change after compilation.

Anarios commented 1 year ago

Thanks a lot

TalosDx commented 1 year ago

After being accepted into the main branch, it is also necessary to collect it into a single file (dir UserScript), I tried to do it locally, but for some reason it was collected in several different files.

ranazee commented 1 year ago

Solve this iss8