Skip to content

Instantly share code, notes, and snippets.

@tomaszgalinski
tomaszgalinski / download-classdojo-media.js
Last active June 6, 2023 14:23 — forked from Patrick330/download-classdojo-media.js
Saving the images and videos from your ClassDojo storyline
/* 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);
@Patrick330
Patrick330 / download-classdojo-media.js
Last active January 5, 2024 14:12 — forked from travishorn/download-classdojo-media.md
Saving the images and videos from your ClassDojo storyline
/* 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);
@barneycarroll
barneycarroll / jquery.notextSelector.js
Last active January 14, 2024 07:57
`:notext` is an alternative to the `:empty` selector for jQuery. Elements consisting exclusively of an amount of whitespace or HTML comments will be returned.
/*
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
}