function $(id) {return document.getElementById(id);} var timeout; document.onmousemove = function(){ clearTimeout(timeout); timeout = setTimeout(function(){ if (getCGI('goback.cgi?') === true) { $('count-wrap').style.display = 'block'; $('countdown').style.display = 'block'; countdown(); } }, 1800000); }; function countdown() { var countDown = 5; setInterval(function () { if (countDown == 1) { window.location.href = 'https:' + window.location.origin.substring(window.location.protocol.length); } if (countDown > 0){countDown--;} document.getElementById('count-number').innerHTML = countDown; return countDown; }, 1000); } function getCGI(url) { var q,a; if (url == 'goback.cgi') { q = confirm("Вы уверены что хотите вернуться в основной интерфейс?"); a = "Возврат отменен."; } else {q = true;} if (q) { if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // xmlhttp.onreadystatechange = true; xmlhttp.open("GET", url, true); xmlhttp.send(); return true; } else { alert(a); } } var _validFileName = 'IBP.bin'; function Validate(oForm) { var arrInputs = oForm.getElementsByTagName('input'); for (var i = 0; i < arrInputs.length; i++) { var oInput = arrInputs[i]; var blnValid = false; if (oInput.type == 'file') { if (oInput.files.length === 0) { alert('Путь к файлу не указан'); blnValid = false; return false; }else{ var sFileName = oInput.files[0].name; if (sFileName == _validFileName) { blnValid = true; $('goback').className += ' disabled'; break; } if (!blnValid) { alert('Файл ' + sFileName + ' не валиден, расширение и имя файла должно соответствовать: [ ' + _validFileName + ' ]'); return false; } } } } return true; } $('goback').onclick = function(){ a = 'goback.cgi'; if (getCGI(a) === true) { $('count-wrap').style.display = 'block'; $('countdown').style.display = 'block'; countdown(); } }; $("uploadBtn").onchange = function () {document.getElementById("uploadFile").value = this.files[0].name;};