Anarios / return-youtube-dislike

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

(Feature Request): Pale Moon Compatibility #128

Closed Zorgodon closed 2 years ago

Zorgodon commented 2 years ago

Extension or Userscript?

Userscript

Request or suggest a new feature!

Is there any chance you could make the userscript compatible with Pale Moon/UXP Browsers (http://www.palemoon.org) ?

Ways to implement this!

No response

Can you work on this?

laughingsheep commented 2 years ago

What part of the userscript doesn't work in Pale Moon / what is the behavior?

Zorgodon commented 2 years ago

The error in the console is:

expected expression, got '.'          Return_Youtube_Dislike.user.js:28:7

Line 28: ?.querySelector("#top-level-buttons-computed");

If I comment it out, I get the same error, now for Line 236: if (getButtons()?.offsetParent && isVideoLoaded()) {

It seems PM doesn't like the '?.' syntax, but unfortunately I don't know JS so I'm not sure what '?.' means. The script doesn't log 'starting up' to the console as it's getting bogged down in what it thinks are errors in the function definitions. I'm using Greasemonkey 3.31.4 by the way.

laughingsheep commented 2 years ago

The userscript is made for tampermonkey as seen on the website https://www.returnyoutubedislike.com/install. There is no official support for greasemonkey. Can you use tampermonkey instead?

Btw, the ? in line 236 is part of Optional Chaining which is a feature introduced in 2020.

Zorgodon commented 2 years ago

Changing .? to . made it work.

According to Mozilla, the latter returns an error rather than a string if a reference is undefined.

I don't see any errors in my console on PM or Chrome when running with the change, so I think this is a sensible patch to increase browser compatibility.

Zorgodon commented 2 years ago

Patch here (currently closed as it removes the hover stats feature that doesn't work in PM): https://github.com/Anarios/return-youtube-dislike/pull/234