Skip to content

Instantly share code, notes, and snippets.

@nathanhleung
Last active November 22, 2016 17:59
Show Gist options
  • Save nathanhleung/ed47ec099a10c311f5d92f1b8d694db1 to your computer and use it in GitHub Desktop.
Save nathanhleung/ed47ec099a10c311f5d92f1b8d694db1 to your computer and use it in GitHub Desktop.
schoology-bookmarklets
$('.nathan-appended').remove(); // remove previously appended stuff
// find each course
$('.gradebook-course').each((i, el) => {
// for each course, find the MP grades
const mpGrades = $(el).find('.period-row .awarded-grade .rounded-grade');
const latestMp = mpGrades[mpGrades.length - 1];
const grade = $(latestMp).html();
// get overall grade
const overallGrade = $(el).find('.summary-course .awarded-grade .rounded-grade').html();
// put the grade next to the course title
$(el).find('.gradebook-course-title').append(
// give nathan-appended class so then we can remove the stuff later
// grade || 'N/A' -> if grade is undefined, then 'N/A' will print
`<div
class='nathan-appended'
style='
position: relative;
top: -10px;
right: 20px;
text-align: right;
color: #3aa406;
font-size: 13px;
font-weight: bold;
float: right;
'
>
MP: ${grade || 'N/A'}
<br>
Average: ${overallGrade || 'N/A'}&nbsp;
</div>`
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment