Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/scale/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/modules/scale/server_off.html |
<!DOCTYPE html> <html> <head> <meta name="robots" content="noindex,nofollow"> <meta http-equiv="Content-Type" content="text/html; charset=##CHARSET##"> <title>##SITE_NAME##</title> <style type="text/css"> body{background-color: #E1EFF6;} .bx-adm-scale-available-text{text-align: center; width: 100%;} .bx-adm-scale-available-message, .bx-adm-scale-available-time{ color: #494B51; font-size: 18px; font-weight: bold; } </style> </head> <body> <!--SCALE_SERVER_NOT_AVAILABLE--> <div class="bx-adm-scale-available-text"> <div class="bx-adm-scale-available-message">##AVAILABLE_MESSAGE##</div> <div class="bx-adm-scale-available-time" id="timetoevent"></div> </div> <script type="text/javascript"> var now = new Date(), availableDateTime = ##AVAILABLE_DATETIME##, //don't touch it can be parsed serverNow = ##SERVER_NOW##, //this too timePeriod = availableDateTime - serverNow, timeToComplete = now.getTime() + timePeriod; function timeToEvent() { var now = new Date(); if(now > timeToComplete) { window.location.reload(); return false; } var result = '', deltaTime = timeToComplete-now, hours = Math.floor(deltaTime/3600000), minutes = Math.floor(deltaTime/60000)-hours*60, seconds = Math.floor(deltaTime/1000)-hours*3600-minutes*60; hours = (hours < 10) ? "0"+hours : hours; minutes = (minutes < 10) ? "0"+minutes : minutes; seconds = (seconds < 10) ? "0"+seconds : seconds; return hours+" ##HOURS## "+minutes+" ##MINS## "+seconds+" ##SECS##"; } function checkServerAvailability() { if(typeof XMLHttpRequest === 'undefined') return false; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", '?r='+Math.random(), true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { if(xmlhttp.responseText && xmlhttp.responseText.search('SCALE_SERVER_NOT_AVAILABLE') == -1) window.location.reload(); } } }; xmlhttp.send(null); return true; } window.onload = function() { var span = document.getElementById('timetoevent'), now = new Date(); if(now > timeToComplete) timeToComplete.setTime(now.getTime()+timePeriod); window.setInterval(function(){ var timePeriod = timeToEvent(); if(timePeriod) span.innerHTML = timePeriod; },1000); window.setInterval(function(){ checkServerAvailability(); },60000); }; </script> </body> </html>