Makes creating IMDb lists more efficient and convenient
< Feedback on IMDb - List Helper
IIRC it needs to access unsafeWindow so that the bindings that IMDb code has get triggered. Anyway, I switched from GM to ViolentMonkey (because all my other scripts stopped working as well) and it works without modification.
But if triggering IMDb code was truly necessary, the script wouldn't be able to add any items to the list, right? And yet it does add them with its own isolated copy of jQuery if I manually hit "Skip" multiple times.
So I think there's just some small bug in how it loops over the list of URLs, not related to the interplay between two scripts.
Btw, I am sticking with GM and updating mine as I go, trying to wean smaller ones off jQuery/GM APIs as much as possible.
themagician, I've rewritten your script in jQuery-less modern JS using fetch
and MutationObserver
and a nice small csv parser d3-dsv
. It no longer uses any GM_* methods or interacts with the page's jQuery, so as a result it's compatible with all three userscript engines and works in Chrome again, and both notes at the top of your description are no longer needed.
https://github.com/monk-time/userscripts/blob/master/3rd-party/IMDb%20-%20List%20Helper.user.js
Sadly the commit history is a bit messy, but it's based on 2.4.1 and keeps all features from it. If you like it you can use it freely, just restore original @name and @author so that the script will auto-update.
I've kept the structure mostly intact but moved HTML creation and CSS styles to the top of the file to separate them from the rest of the code. And to save the users from messing with regex I set it to search for the whole string if the default regex for IMDb ID fails. (edit: this is now optional and off by default)
Broken in Greasemonkey 4 (edit: no longer relevant)
The last update to Firefox (FF57) and Greasemonkey (GM4.0) has broken many userscripts, and IMDb List Helper is one of them. On a fresh profile with no other scripts installed I get
ReferenceError: jQuery is not defined
in the console. GM4 doesn't allow directly interacting with webpage JS objects (see this and this issue) except throughunsafeWindow
, but even though the script uses that, its first jQuery-dependant@require
is executed before that and crashes the script becausejQuery
is not available at that moment.But I've noticed that adding another
@require
with the latest jQuery before the first one (you need to removejquery-csv
, save the script and only then add both back, otherwise they won't load in a proper order) and removing the first two lines makes the script somewhat functional. I can paste IMDb urls into the script's textbox, clicking "Start" adds the first item to the list, but then it stops withTypeError: $(...).first(...)[0] is undefined
. Clicking "Skip" adds the next one and stops again with the same error.All this makes me think that the script should be able work without interacting with the page's jQuery. themagician, what do you think?