This file contains hidden or 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
let downloaded = new Set(); | |
let observer = new MutationObserver(arr => { | |
for (let mutationRecord of arr) { | |
for (let node of Array.from(mutationRecord.addedNodes)) { | |
let canvas = node.parentElement.getElementsByTagName("canvas")[0]; | |
if (canvas && !downloaded.has(canvas.id)) { | |
downloaded.add(canvas.id); | |
saveCanvasAsPNG(canvas); | |
} | |
} |
This file contains hidden or 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
function recursiveAssign(target, ...sources) { | |
for (let i of let objs = Object.keys(sources)) { | |
let obj = sources[objs[i]]; | |
if ((typeof obj !== "object" || obj === null) && obj === sources[sources.length-1]) { | |
// If `sources[objs[i]]` is a a non `Object` built-in and the is (or is the same as) last element in `sources`, then there is no need to go any further. Also, `typeof null === "object"` | |
if (obj === sources[sources.length-1]) { | |
target = obj; | |
return; | |
} | |
} else { |
NewerOlder