Add custom grade message
Remove hardcoded grade message and add support for custom grade messages.
This commit is contained in:
parent
4cf98ca23d
commit
d61a0fdce8
|
@ -201,6 +201,25 @@ function setUpStrings(){
|
||||||
reports.appendChild(reportEl);
|
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.
|
// Hide quiz and then show the results.
|
||||||
quizEl.style['display'] = 'none';
|
quizEl.style['display'] = 'none';
|
||||||
document.getElementById('results').style['display'] = 'unset';
|
document.getElementById('results').style['display'] = 'unset';
|
||||||
|
|
|
@ -54,8 +54,8 @@
|
||||||
<span id="badge-f" class="badge grade-f">Grade F</span>
|
<span id="badge-f" class="badge grade-f">Grade F</span>
|
||||||
|
|
||||||
</center><br/>
|
</center><br/>
|
||||||
<p>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.</p>
|
<div id="grade-message"></div>
|
||||||
<p>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.</p>
|
|
||||||
<h2>Your Privacy Report</h2>
|
<h2>Your Privacy Report</h2>
|
||||||
<i>The good, bad and ugly</i>
|
<i>The good, bad and ugly</i>
|
||||||
<div id="reports">
|
<div id="reports">
|
||||||
|
|
Reference in New Issue