Please see Patrick330's fork of this script.
ClassDojo changes their site regularly, so a script like this needs regular maintenance. I have decided to archive this project and stop providing updates. Patrick330's fork linked above may be a good alternative.
ClassDojo is a classroom communication app used to share reports between parents and teachers. Teachers track student behavior and upload photos or videos. The gamification style system teaches developmental skills through real-time feedback.
When your child's teacher shares a photo, it goes on your parent "storyline". Unfortunately, ClassDojo does not provide any means of saving these photos. In fact, the photos are displayed in a <div>
using style: background-image('...');
so right-clicking and choosing "Save image" is not an option.
Hi everyone!
First of all, thanks a whole lot for this script! The logic is well made and it allowed me to download my child's year story worth of photos (about 500 items). As is, the script did not work for me and gave me the infamous 'undefined' message. I spent a few minutes debugging and here are my observations :
var headerNode = currentValue.parentNode.querySelector('[data-test-name="storyPostHeader"]');
var teacher = headerNode.querySelector('.css-tg8rmq').innerText;
var className = headerNode.querySelectorAll('.css-7guneq')[0].innerText;
var postDate = headerNode.querySelectorAll('.css-7guneq')[1].innerText;
I had to find the right css codes for my story... So I console.log()'d the value of headerNode and I was able to find the needed values within the output just before the teacher's and class names. I replaced the values for the three lines and it worked for me. My code looked like this :
The post at the top of my list was a post with no media, so as is, the script ran in an endless loop. That's because the case at the bottom of the script didn't handle a post with no images. So in the case I added a case 2, which is basically the same logic as the first one, to reset the lastImage variable and exit the first while loop (I first tried a 'default' case, but for a lot of the stories with multiple images the script did not retrieve all of them)
switch(numDivs) {
case 1:
lastImage = true;
break;
case 2:
lastImage = true;
break;
case 3:
if (firstImage == true) {
lastImage = false;
eventFire(contentNode.nextSibling, 'click');
} else {
lastImage = true;
}
break;
case 4:
eventFire(contentNode.nextSibling.nextSibling, 'click');
}
Lastly, to make sure I did not get only a few posts, I had to 'load' the entire year by going at the bottom of the page (pressing page down or end will do the trick).
I ran this with Edge and my 500 or so files were downloaded in a less than 10 minutes. Thanks again!