Untitled
unknown
javascript
5 years ago
1.3 kB
5
Indexable
<script>
function countdown(elementName, minutes, seconds) {
var element, endTime, hours, mins, msLeft, time;
function twoDigits(n) {
return (n <= 9 ? "0" + n : n);
}
function updateTimer() {
msLeft = endTime - (+new Date);
if (msLeft < 1000) {
localStorage.setItem('is_modal', "false");
goto();
} else {
time = new Date(msLeft);
hours = time.getUTCHours();
mins = time.getUTCMinutes();
element.innerHTML = (hours ? hours + ':' + twoDigits(mins) : mins) + ':' + twoDigits(time.getUTCSeconds());
setTimeout(updateTimer, time.getUTCMilliseconds() + 500);
}
}
element = document.getElementById(elementName);
endTime = (+new Date) + 1000 * (60 * minutes + seconds) + 500;
updateTimer();
}
function startCountdown() {
localStorage.setItem('is_modal', "true");
countdown("ten-countdown", 10, 0);
$("#myModal").modal();
}
function close() {
goto();
}
function goto() {
let _url = null;
switch (window.location.href.split('/')[3]) {
case "instagram-takipci-hilesi":
_url = "https://bayigram.com/instagram-takipci-satin-al/";
break;
}
window.location = _url;
}
</script>Editor is loading...