96 lines
3.4 KiB
JavaScript
96 lines
3.4 KiB
JavaScript
|
/**
|
||
|
* /include/script.js
|
||
|
* @version 1.1
|
||
|
* @desc Main script file
|
||
|
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
|
||
|
* @copy 2018 Fándly Gergő Zoltán
|
||
|
* License:
|
||
|
Töri Érettsegi Előkeszítő, an app to prepare for the History tests in Romania for Hungarian students
|
||
|
Copyright (C) 2018 Fándly Gergő Zoltán
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
**/
|
||
|
|
||
|
function toggleMyContent(el){
|
||
|
if($(el).parent().children("div[data-name=mycontent]").css("display")=="none"){
|
||
|
$(el).parent().children("div[data-name=mycontent]").slideDown();
|
||
|
}
|
||
|
else{
|
||
|
$(el).parent().children("div[data-name=mycontent]").slideUp();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function search(el, entry){
|
||
|
$(entry).children().each(function(){
|
||
|
if($(this).text().toLowerCase().indexOf($(el).val().toLowerCase())!=-1){
|
||
|
$(this).slideDown();
|
||
|
}
|
||
|
else{
|
||
|
$(this).slideUp();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function loadTest(store){
|
||
|
$("#menu").slideUp();
|
||
|
var sQuiz=new $.sQuiz($("#quizArea"), store);
|
||
|
sQuiz.setRegionalization({
|
||
|
"downloadResults":"Eredmények letöltése",
|
||
|
"uploadResults":"Eredmények feltöltése",
|
||
|
"customAction":"Vissza tanulni!",
|
||
|
"quizFinished":"Gratulálok! Befejezted a kvízt!",
|
||
|
"resultsGot":"Elért eredményed",
|
||
|
"yourname":"Neved",
|
||
|
"idForResult":"Add oda ezt az azonosítót a tanárodnak, hogy megnézhesse eredményedet!",
|
||
|
"timeLeft":"Hátralévő idő a teljes kvízre",
|
||
|
"timeLeftPerTest":"Hátralévő idő erre a kérdésre",
|
||
|
"submit":"Beküldés",
|
||
|
"nextQuestion":"Következő kérdés",
|
||
|
"startQuiz":"Kvíz indítása",
|
||
|
"answer":"Válasz"
|
||
|
});
|
||
|
sQuiz.setQuizDoneCallback(function(res, quiz){
|
||
|
var all=quiz.questions.length;
|
||
|
var good=0;
|
||
|
$.each(res, function(key, val){
|
||
|
if(val.correct){
|
||
|
good++;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var ratio=100*good/all;
|
||
|
|
||
|
if(good==all){
|
||
|
$("#messageAfterQuiz").html("Tökéletes lett! Gratulálok! Csak így tovább!");
|
||
|
}
|
||
|
else if(ratio>90){
|
||
|
$("#messageAfterQuiz").html("Szinte hibátlan! Még gyakorolj!");
|
||
|
}
|
||
|
else if(ratio>70){
|
||
|
$("#messageAfterQuiz").html("Elmegy, de messze még a hibátlantól. Olvasd még át párszor a jegyzeteket!");
|
||
|
}
|
||
|
else if(ratio>40){
|
||
|
$("#messageAfterQuiz").html("Valamit tudsz, de még sokat kell tanulni!");
|
||
|
}
|
||
|
else{
|
||
|
$("#messageAfterQuiz").html("Nem ártana tanulnod...");
|
||
|
}
|
||
|
});
|
||
|
sQuiz.setQuizDoneOptions({
|
||
|
download: true,
|
||
|
custom: "$("#quizArea").slideUp(); $("#menu").slideDown(); $("#messageAfterQuiz").html("")"
|
||
|
});
|
||
|
sQuiz.init();
|
||
|
}
|