This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* run this in the console on the ClassDojo page */ | |
function download(url, prefix) { | |
fetch(url).then(function(t) { | |
return t.blob().then((b)=> { | |
var a = document.createElement("a"); | |
a.href = URL.createObjectURL(b); | |
var n = url.lastIndexOf('/'); | |
var filename = url.substring(n + 1); | |
var randomStr = Math.random().toString(36).substring(5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* run this in the console on the ClassDojo page */ | |
function download(url, prefix) { | |
fetch(url).then(function(t) { | |
return t.blob().then((b)=> { | |
var a = document.createElement("a"); | |
a.href = URL.createObjectURL(b); | |
var n = url.lastIndexOf('/'); | |
var filename = url.substring(n + 1); | |
a.setAttribute("download", prefix+filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jQuery's ':empty' selector only returns true if the element contains no text node, or whose text node consists exclusively of zero or more spaces and tabs. This ':notext' selector will return true for elements whose text nodes can also contain line breaks (any whitespace character) and HTML comments. | |
*/ | |
$.expr[':'].notext = function detectNoText(x){ | |
return x.innerHTML && x.innerHTML.replace(/(<!--.*(?!-->))|\s+/g, '').length === 0 | |
} |