Skip to content

Instantly share code, notes, and snippets.

@jlewin
Created October 9, 2025 14:05
Show Gist options
  • Save jlewin/23cd12ec95c94dfce23125f33dd84e25 to your computer and use it in GitHub Desktop.
Save jlewin/23cd12ec95c94dfce23125f33dd84e25 to your computer and use it in GitHub Desktop.
Quick revisions to get canvas to print clean quiz results
// Turn on styles for print
document.querySelectorAll('*[media=screen]').forEach(e => e.media = 'all');
// Remove noisy answer indicators
document.querySelectorAll('.answer_indicator').forEach(e => e.style.display = 'none')
// Hide non-helpful quiz help instructions
document.querySelector('.quiz-header').style.display = 'none';
// Hide unhelpful quiz submission details
document.querySelectorAll('.quiz_score, .quiz_duration').forEach(e => e.style.display = 'none');
if (!document.querySelector('.quiz-submission .quiz_score').nextElementSibling.classList.length) {
// Hide non-classed submission date field
document.querySelector('.quiz-submission .quiz_score').nextElementSibling.style.display = 'none';
}
// Hide question headers
document.querySelectorAll('.question .header').forEach(function(e) {
e.style.display = 'none';
})
// Hide wrong answers
document.querySelectorAll('.answer.answer_for_').forEach(function(e) {
if (!e.classList.contains('selected_answer') && !e.classList.contains('correct_answer')) {
e.remove();
}
})
.header-bar-outer-container,
#right-side {
display: none;
}
#questions.assessment_results .question_holder .question {
margin: 8px !important;
border: none;
border-top: solid 1px #ddd;
width: 100%;
}
#questions.assessment_results .question_holder .question .text {
padding: 10px 10px 4px !important;
}
#questions.assessment_results .question_holder .question .text .question_text {
padding: 0;
margin: 0;
}
#questions.assessment_results .question_holder .question .text .question_text p {
padding: 0;
margin: 0;
}
#questions.assessment_results .question_holder .question .answer_for_ {
border: none;
}
.answers .user_content {
padding-left: 20px;
font-size: 0.8em
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment