$(document).ready(function() { var datum = new Date() var tag = datum.getDay(); var std = datum.getHours(); // nicht zwischen Freitag 17:00.01 Uhr und Montag 00:00:01 Uhr anzeigen // var showCounter = true; // Sonntag oder Samstag? // if(tag==0 || tag==6) { showCounter = false; } // Freitag + später als 17 Uhr // if(tag==5 && std >= 17) { showCounter = false; } if(showCounter == true) { const chtml = '
17:00
17:30

: :

'; $(chtml).insertAfter('#template_header_list'); const ltime = 17; const second = 1000; const minute = second * 60; const hour = minute * 60; let countDown = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), ltime,0,0).getTime(); let x = setInterval(function() { let now = new Date().getTime(); let distance = countDown - now; var _h = Math.floor(distance / (hour)); var _m = Math.floor((distance % (hour)) / (minute)); var _s = Math.floor((distance % (minute)) / second); if(_h<0){_h = 24+_h;} if(_m<0){_m = 60+_m;} if(_s<0){_s = 60+_s;} if(_h<10){_h = "0"+_h;} if(_m<10){_m = "0"+_m;} if(_s<10){_s = "0"+_s;} document.getElementById('hours').innerText = _h; document.getElementById('minutes').innerText = _m; document.getElementById('seconds').innerText = _s; }, second); } });