Utilisateur:

Essais

Storyboard

>Modèle

ID:(1925, 0)


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++) (idx == i) ? $("#fld_" + i).show() : $("#fld_" + i).hide(); } function content_adapt() { // getView {purl} // 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'; } } $(document).ready(function () { $('#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 = parseInt("1", 10) || 0; function resizeContent(){ const headH = $('#head').length ? $('#head').height() : 0; const toolbarH = $('#sb-toolbar').outerHeight() || 0; const H = window.innerHeight - headH - toolbarH - 16; $("#sb-content").css({ height: H + "px" }); } resizeContent(); $(window).on("resize", resizeContent); function lr_show(){ $("#lr").removeClass("d-none").addClass("d-flex"); } function lr_hide(){ $("#lr").removeClass("d-flex").addClass("d-none"); $("#cnt").text(""); } function renderMode(){ const v = $('#select input[type=radio]:checked').val(); // "1"|"2"|"3" if (v === "2") { lr_show(); $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); $("#fld_video").hide(); } else if (v === "3") { lr_hide(); one_div(-1, num); $("#fld_video").show(); } else { lr_hide(); show_div(num); $("#fld_video").hide(); } } // Bind radios $('#select input[type=radio]').off('change.story').on('change.story', function () { resizeContent(); renderMode(); }); // Initial correct state (fixes: lr visible at start / missing text on first select) renderMode(); // Arrows (only meaningful in mode 2) $("#left").off('click.story').on('click.story', function () { idx--; if (idx < 0) idx = num - 1; $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); }); $("#right").off('click.story').on('click.story', function () { idx++; if (idx > num - 1) idx = 0; $("#cnt").text((idx + 1) + " of " + num); one_div(idx, num); }); // Toggle index-panel $("#ctrl").off('click.story').on('click.story', function () { if ($("#index-panel").is(":visible")) { $("#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"); } }); // Rabbit back: aquí lo dejamos disabled hasta que conectes tu stack real // $("#rabbit-back").prop("disabled", false).on("click", function(){ ... }); });