Open meganlavengood opened 8 months ago
This could be related to the jQuery upgrades that Canvas is pushing out.
I've got version 2.2.4, which is the version that was deployed on March 13 and my script is still running. Even if the JavaScript upgrade isn't affecting my script directly, it could be affecting another script that then breaks mine.
Loading the latest version of jQuery is pretty sure to break things. You need the jQuery that comes with Canvas since they have patched the ajax to automatically add the csrf token to provide authentication. Loading it from http instead of https (that may have just been a typo on your part) makes it worse since that's insecure on a page that is running secure.
Depending on how you load your jQuery, you may need to use the noConflict() to release $ back to the other software. That's my best first guess is that something removed the jQuery from $ and now it's not available. My script doesn't do that, though.
Another possibility is that the script is running before jQuery is installed. Despite Canvas guaranteeing it would be available (it hasn't always been despite the guarantee), I don't know anything about tamperish but I suspect it's something else.
There is a possibility that the other error messages blocked execution. Are you running any other scripts that use jQuery? Does your institution have any global JavaScript installed that uses jQuery? Are there any noConflicts() in places?
Go to the Rubrics page and then open the developer tools console. Try executing these commands (enter after each one)
$
if it comes back as undefined, then something has removed $ so it is no longer associated with jQuery.$().jquery
will not work if the first one doesn't. If it does, it should be 2.2.4. If something else, then another script is overriding Canvas' jQuery.jQuery().jquery
should be 2.2.4 because that's what Canvas is loading. If something else, then another script is overriding it and that's a good place to look to see if it's responsible for detaching $ from jQuery.At some point, I should rewrite this script to not rely on jQuery; it was just easier at the time as I needed their dialog box. Right now, I'm in the middle of a time-critical project and don't have time to try and track down an issue I'm not seeing. If you can do some debugging on your end and get back, that would help.
If you have other scripts, then debugging may involve turning off some of your other scripts and reloading the rubric importer. If it works with all of the other scripts disabled, then you can start turning them back on in groups until you find one that breaks it. It's possible that more than one is breaking things, so I would start by disabling all. Then turn half back on and retest. If it works, then turn on half of what's left and repeat until you find the one that's bad. If the first half broke it, then turn off half of those and test.
If the script doesn't work at all when all of your other scripts are disabled, then it could be something your institution is loading, something to do with tamperish, or that there is a problem with Canvas not making jQuery available. If it's the case of Canvas not making $ available, then disabling tamperish and running those three commands would identify that.
I tried the commands above and #
returned function(e,t){return new p.fn.init(e,t)} = $2
. And I had 2.2.4 for my jQuery version.
I don't have any other scripts running through Tamperish. I have a Zotero extension running, but disabled it on the website. I still saw it loading in my browser extension scripts somehow. But I'm unclear on whether that could even be interfering. I'm not sure how to find out if there are other institution scripts that use jQuery, and also not sure how else to check for noConflicts(). Sorry, I am a big faker when it comes to JS and jQuery.
Hey, I am very excited about this script. I don't know a ton about js but I usually feel competent enough to copy-paste JS from the internet and tweak it make it work for my needs.
I got the script running on the page using Tamperish (instead of Tamper Monkey) and the new button Import Rubric appears on the Rubrics page, but when I click it nothing happens. Here's some info from console (not totally sure which is relevant except the last bit).
I think I've seen that reference error before when using jQuery and not importing it correctly, so I added
// @require http://code.jquery.com/jquery-latest.js
to the header but still got the same error.