murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
532 stars 89 forks source link

Updates for Greasemonkey 4 #159

Open naught101 opened 6 years ago

naught101 commented 6 years ago

Greasemonkey is changing, and old scripts are unlikely to continue to work with it: https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html

Are there already plans for MB-userscripts to be upgraded to handle this?

Schweinepriester commented 6 years ago

+1

murdos commented 6 years ago

Thanks for the information, I was not aware of these changes. There's currently no plan for updating the scripts. So if you want to take of that and submit patches, you're welcome ;-)

Schweinepriester commented 6 years ago

As suggested by http://www.greasespot.net/2017/09/greasemonkey-4-for-users.html

If you rely on such scripts, you might want to install Violentmonkey or Tampermonkey, both of which provide better compatibility for existing scripts.

I tested "Import Bandcamp releases to MusicBrainz" with Tampermonkey which seems to work in FF 57 :)

augustjanse commented 6 years ago

Not sure of the details, but there's no Greasemonkey extension for Chrome. So it's not entirely unproblematic to merge Greasemonkey exclusive features.

Freso commented 6 years ago

Discogs importer seems to be broken.

StigNygaard commented 6 years ago

Discogs importer stops at line 23 with a "jQuery is not defined" error :-/ It looks like the "require scripts" ain't downloaded. It could maybe be related to this: https://github.com/greasemonkey/greasemonkey/issues/2631

Maybe it would work if script was hosted on greasy fork or similar? On the other hand, exactly jQuery is imported from ajax.googleapis.com, unlike the other require scripts which are included from raw.githubusercontent.com. So maybe it is not related to that issue anyway.

StigNygaard commented 6 years ago

I think I got the Discogs script to work on my GM4. My userscript was transferred from GM3.x and it seems that the "@require'd" files was lost in the process. I edited the script a couple of places in the built-in editor, increased the version-number and added the postfix "?v=1" to all the "@require URLs". Saved and closed editor. When re-opening script in editor again, I see all the "@require'd" files added in tabs, and script seems to be working again (I haven't actually tried an import to MB, but buttons and icons are back).

BTW. Among GM4's current issues are one that prevents installing new userscripts directly from GitHub. Also GM4 currently doesn't have any functionality for auto-update of userscripts :-/

LaHaine commented 6 years ago

@StigNygaard can you please share your changes, e.g. by forking on github?

StigNygaard commented 6 years ago

Hi @LaHaine

My point was, I didn't actually change anything of importance. I just triggered GreaseMonkey 4 to re-load the "sidecar files" from the @require statements by doing some random neutral editing in the script. But it might not be enough to do one single little edit. You might need to do some "random" edits in multiple places. I was successful by doing the following: 1) Open script in GM4's builtin editor. If you only see one tab in the editor, continue with the following steps: 2) Increment the version number found in the header-lines a bit. 3) Add "?v=1" as postfix (extra parameter) to all the @require URLs in header-lines. 4) Insert or remove a random empty line somewhere in the main script code. 5) Save (Ctrl-S). 6) Close editor. 7) Re-open editor: You will now probably see multiple tabs. One for the main script and one for each required "sidecar file". Most likely the script now also works.

After above editing was done and GM4 had found the "sidecar files, I could paste the exact original content back, and it was still working.

There's a number of bugs regarding handling the "sidecar files" in GM4.0. Above is a work-around for one of those bugs.

BTW, there's also some other problems with the editor and GM4.0 in general. If above doesn't work, you could try doing same steps in a beta-version of GM4.1 which is a bit better: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/versions/beta