From d61a0fdce846bfaed3373b037dce12053c80fa36 Mon Sep 17 00:00:00 2001 From: luca0N! Date: Wed, 2 Jun 2021 19:10:25 -0300 Subject: [PATCH] Add custom grade message Remove hardcoded grade message and add support for custom grade messages. --- res/js/main.js | 19 +++++++++++++++++++ session.html | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/res/js/main.js b/res/js/main.js index 26b5bad..6e6b927 100644 --- a/res/js/main.js +++ b/res/js/main.js @@ -201,6 +201,25 @@ function setUpStrings(){ reports.appendChild(reportEl); } + // Set the grade message (if it exists. + let gme = document.getElementById('grade-message'); // Grade Message Element + + // Check if this quiz contains custom grade messages. + if (quiz.gradeMessages != undefined && quiz.gradeMessages != null){ + let gmt, gmto = quiz.gradeMessages['grade-' + grade]; + + // Check if there is a grade message for the current grade. + if (gmto !== undefined && gmto !== null){ + gmt = gmto.split('\n'); + for (let i = 0; i < gmt.length; i++){ + let line = gmt[i]; + let p = document.createElement('p'); + p.innerText = line; + gme.appendChild(p); + } + } + } + // Hide quiz and then show the results. quizEl.style['display'] = 'none'; document.getElementById('results').style['display'] = 'unset'; diff --git a/session.html b/session.html index b62064e..13768d4 100644 --- a/session.html +++ b/session.html @@ -54,8 +54,8 @@ Grade F
-

Oh no, looks like you got a bad grade! Unfortunately, many popular services do not respect your privacy, and you're likely using some of them.

-

But you can increase your privacy grade. Do not be discouraged from performing good privacy practices because you can increase it drastically with little to no effort.

+
+

Your Privacy Report

The good, bad and ugly