// cnt_storyboard
function show_div(num) {
for (i = 0; i < num; i++) {
$("#fld_" + i.toString()).show();
}
}
function one_div(idx, num) {
for (i = 0; i < num; i++) {
if (idx == i) {
$("#fld_" + i.toString()).show();
} else {
$("#fld_" + i.toString()).hide();
}
}
}
function sound(txt) {
const synth = window.speechSynthesis;
slang = "en";
slang = slang + "-" + slang.toUpperCase();
sentences = txt.replace(/
$/g, '').replace(/<[^>]*>?/gm, '').split(/[\\.!?]/);
for (i = 0; i < sentences.length; i++) {
var utterThis = new SpeechSynthesisUtterance(sentences[i]);
utterThis.lang = slang;
synth.speak(utterThis);
}
}
// adapt
function content_adapt() {
// keys
var language = ['','en','es','de','pt','fr'];
var code = getCookie('druyd1');
if(code == '' || code == '[]'){
code = '{}';
setCookie('druyd1',code,365);
}
parameter = JSON.parse(code);
// user
en_user_cookie = getCookie('druyd');
if(en_user_cookie != '' && en_user_cookie.length > 0){
var de_user_cookie = base64DecodeUnicode(en_user_cookie);
var user_data = JSON.parse(de_user_cookie);
var html;
var url_structure = window.location.href.split('/');
semester = url_structure[url_structure.length-2].split('-')[1];
nlang = language.indexOf(url_structure[url_structure.length-1]);
if(nlang == undefined){ nlang = 1; }
var date = new Date().toJSON();
$('#actual_date').text(date);
if(parameter.student > 0){
student = parameter.student;
} else {
student = user_data[0];
}
var code = getCookie('druyd1');
if(code == '[]'){ code = '{}'; }
var obj = JSON.parse(code);
obj.student = student;
var code2 = JSON.stringify(obj);
setCookie('druyd1',code2,365);
if(user_data[0] == 1 && semester > 0){
('#students').removeAttr('hidden');
.ajax({
type:'POST',
url: '/getStudentList',
data: JSON.stringify([semester, 'Seleccione']),
contentType:'application/json',
dataType: 'json',
success: function(data){
student_list = [];
for(var i = 1;i < data.length;i++){
student_list.push(data[i].value);
}
idx = getIdxComboBox(student,data);
setupCombobox($('#student_list'), '100%', data, idx, false);
}
});
html = "
"
('#setup').html(html);
} else {
$('#name').html(user_data[2]+", "+user_data[3]);
$('#student').removeAttr('hidden');
}
setupTests(semester, student, nlang);
} else {
window.location = window.location.href+'/login';
}
}
// actions
(document).ready(function () {
content_adapt()
// content_action in cnt_storyboard
('#student_list').on('select',function(event){
student = $('#student_list').jqxComboBox('getSelectedItem').value;
setupTests(semester, student, nlang);
var code = getCookie('druyd1');
if(code == '[]'){ code = '{}'; }
var obj = JSON.parse(code);
obj.student = student;
var code2 = JSON.stringify(obj);
setCookie('druyd1',code2,365);
});
('#tests').on('click', '.test_0', function() {
reroute(semester,test_list[0][0],
('#mode_0'),test_list[0][6],('#sub_0'),language[user_data[5]]);
});
('#tests').on('click', '.test_1', function() {
reroute(semester,test_list[1][0],$('#mode_1'),test_list[1][6],$('#sub_1'),language[user_data[5]]);
});
('#tests').on('click', '.test_2', function() {
reroute(semester,test_list[2][0],
('#mode_2'),test_list[2][6],('#sub_2'),language[user_data[5]]);
});
('#tests').on('click', '.test_3', function() {
reroute(semester,test_list[3][0],$('#mode_3'),test_list[3][6],$('#sub_3'),language[user_data[5]]);
});
('#tests').on('click', '.test_4', function() {
reroute(semester,test_list[4][0],
('#mode_4'),test_list[4][6],('#sub_4'),language[user_data[5]]);
});
('#tests').on('click', '.test_5', function() {
reroute(semester,test_list[5][0],$('#mode_5'),test_list[5][6],$('#sub_5'),language[user_data[5]]);
});
('#tests').on('click', '.test_6', function() {
reroute(semester,test_list[6][0],
('#mode_6'),test_list[6][6],('#sub_6'),language[user_data[5]]);
});
('#setup').on('click', '.btn_setup', function() {
$.ajax({
type:'POST',
url: '/setStudentTest',
data: JSON.stringify([semester, nlang]),
contentType:'application/json',
dataType: 'json',
success: function(data){
Swal.fire({icon:'info',title: 'Info',text: 'test_structured'});
}
});
});
('#tests').on('click', '.run_0', function() {
genall(semester,test_list[0][0],nlang);
});
('#tests').on('click', '.run_1', function() {
genall(semester,test_list[1][0],nlang);
});
('#tests').on('click', '.run_2', function() {
genall(semester,test_list[2][0],nlang);
});
('#tests').on('click', '.run_3', function() {
genall(semester,test_list[3][0],nlang);
});
('#tests').on('click', '.run_4', function() {
genall(semester,test_list[4][0],nlang);
});
('#tests').on('click', '.run_5', function() {
genall(semester,test_list[5][0],nlang);
});
('#tests').on('click', '.run_6', function() {
genall(semester,test_list[7][0],nlang);
});
('#tests').on('click', '.print_0', function() {
gprint(semester,test_list[0][0],nlang);
});
('#tests').on('click', '.print_1', function() {
gprint(semester,test_list[1][0],nlang);
});
('#tests').on('click', '.print_2', function() {
gprint(semester,test_list[2][0],nlang);
});
('#tests').on('click', '.print_3', function() {
gprint(semester,test_list[3][0],nlang);
});
('#tests').on('click', '.print_4', function() {
gprint(semester,test_list[4][0],nlang);
});
('#tests').on('click', '.print_5', function() {
gprint(semester,test_list[5][0],nlang);
});
('#tests').on('click', '.print_6', function() {
gprint(semester,test_list[7][0],nlang);
});
('#tests').on('click', '.check_0', function() {
gcheck(semester,test_list[0][0],nlang);
});
('#tests').on('click', '.check_1', function() {
gcheck(semester,test_list[1][0],nlang);
});
('#tests').on('click', '.check_2', function() {
gcheck(semester,test_list[2][0],nlang);
});
('#tests').on('click', '.check_3', function() {
gcheck(semester,test_list[3][0],nlang);
});
('#tests').on('click', '.check_4', function() {
gcheck(semester,test_list[4][0],nlang);
});
('#tests').on('click', '.check_5', function() {
gcheck(semester,test_list[5][0],nlang);
});
('#tests').on('click', '.check_6', function() {
gcheck(semester,test_list[7][0],nlang);
});
var idx = 0;
var num = "1";
("#lr").hide()
("#content").css({ 'height': (window.innerHeight -
('#head').height() - 16) + 'px' });
('#select input[type=radio]').change(function () {
("#content").css({ 'height': (window.innerHeight - $('#head').height() - 16) + 'px' });
if ((this).val() == 2) {
("#lr").show(num);
cnt = idx + 1
('#cnt').text(cnt.toString() + ' of ' + num.toString());
one_div(idx, num);
("#fld_video").hide();
} else {
$("#lr").hide();
if ($(this).val() == 3) {
one_div(-1, num);
$("#fld_video").show();
} else {
show_div(num);
$("#fld_video").hide();
}
}
});
('#select input[type=label]').click(function () {
});
("#left").click(function () {
idx--;
if (idx < 0) { idx = num - 1; }
cnt = idx + 1
$('#cnt').text(cnt.toString() + ' of ' + num.toString());
one_div(idx, num);
});
("#right").click(function () {
idx++;
if (idx > num - 1) { idx = 0; }
cnt = idx + 1
('#cnt').text(cnt.toString() + ' of ' + num.toString());
one_div(idx, num);
});
("#ctrl").click(function () {
if (
("#index-panel").is(":visible") == true) {
$("#index-panel").hide();
$('#mainSplitter').jqxSplitter({ panels: [{ size: '0%' }, { size: '100%' }] });
$("#arrow").attr("src", "/static/icons/chevronright32b.png");
} else {
$("#index-panel").show();
$('#mainSplitter').jqxSplitter({ panels: [{ size: '25%' }, { size: '75%' }] });
$("#arrow").attr("src", "/static/icons/chevronleft32b.png");
}
});
// radiobuttons of Model
('#networkEquation').on("click", function () {
setNetworkEquation(vgraph_network);
});
$('#networkNumber').on("click", function () {
setNetworkNumber(vgraph_network);
});
});