Created
March 17, 2019 18:54
-
-
Save tzhenghao/31a99bc5aa24a5cb3f9bc62a4b0d4274 to your computer and use it in GitHub Desktop.
Singapore Airlines scam counter logic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zeit = new Date(); | |
var sec = zeit.getSeconds(); | |
if (sec < 6 ){ | |
sec = 9 | |
} | |
if (sec > 5 & sec < 13 ){ | |
sec = 8 | |
} | |
if (sec > 11 & sec < 19 ){ | |
sec = 7 | |
} | |
if (sec > 17 & sec < 25 ){ | |
sec = 6 | |
} | |
if (sec > 23 & sec < 31 ){ | |
sec = 5 | |
} | |
if (sec > 29 & sec < 37 ){ | |
sec = 4 | |
} | |
if (sec > 35 & sec < 43 ){ | |
sec = 3 | |
} | |
if (sec > 41 & sec < 49 ){ | |
sec = 2 | |
} | |
if (sec > 47 & sec < 55 ){ | |
sec = 1 | |
} | |
if (sec > 54){ | |
sec=0 | |
}; | |
var add = sec; | |
var zeit2 = new Date(); | |
var minute = zeit2.getMinutes(); | |
var timer1 = (60-minute)*60; | |
if (timer1 > 1800) { | |
var resttimer = (30-minute)*10 | |
} else { | |
var resttimer = (60-minute)*10 | |
}; | |
var timer = resttimer + add + 67; | |
function updateTimer() { | |
timer--; | |
$("#gutschein").text(timer); | |
if (timer < 9) { | |
stopFunction(); | |
} | |
} | |
var myTimer = window.setInterval(updateTimer, 6000); | |
function stopFunction() { | |
window.clearInterval(myTimer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment