// JavaScript Document // GLOBAL VARIABLES dateToday = 20240907; timeStamp = 20240907213442; serverDate = new Date('2024 09 07'); function checkLength(field, len, n) { next = document.getElementById(n); if(field.value.length == len) { next.focus(); return true; } } // SM HINDER: hinderStudent0 = 'hinder_student_school:'; hinderStudent1 = 'hinder_student_number:'; hinderMilitary0 = 'hinder_military_base:'; hinderMilitary1 = 'hinder_military_co:'; var DLs = null; var Ins = null; saveScreenInter = -1 function initSaveScreen(){ $('
').hide() .appendTo('body') .append('') .append('') .append('') .append(''); sendPage(); } function fixinput(){ var input = $('input[type=text]'), checkbox = $('input[type=checkbox]'), text = $('textarea'), select = $('select'); input.each(function(){ obj=$(this); obj.attr('value', obj.val()); }); checkbox.each(function(){ obj=$(this); obj.attr('checked', obj.prop('checked')); }); text.each(function(){ obj=$(this); obj.html(obj.val()); }); select.each(function(){ obj=$(this); obj.find(':selected').attr('selected', 'selected'); }); return false; } function sendPage(){ if(saveScreenInter == -1) return false; var act=$(document.activeElement); if(act.is('input') && act.attr('type')=='text') { //console.log("Skipped SaveScreen"); //console.log(document.activeElement); return false; } fixinput(); var html=$('#Content').html(); $.post('../inc/savescreen.php',{ css:JSON.stringify(header_css), data:html, csrf: getCSRF() }); //console.log("Ran SaveScreen"); } if(typeof(getpage) != 'undefined') { setTimeout(initSaveScreen,200); saveScreenInter=setInterval(sendPage,5000); } function stopSaveScreen() { clearInterval(saveScreenInter); saveScreenInter = -1; } if (typeof console !== 'object') { console = {}; console.log=function(data){}; } Date.now = Date.now || function() { return +new Date; };