write-ups-challenges-2020-2021/break_the_gate/script/main.js

35 lines
851 B
JavaScript
Raw Normal View History

2022-11-24 17:03:20 +00:00
function openAnimation() {
$('.lock img').attr('src', 'img/lock_unlocked.gif')
$('.front').delay(1000).fadeOut('slow')
$('.left').delay(1300).hide("slide", {direction: "left" }, 1000)
$('.right').delay(1300).hide("slide", {direction: "right" }, 1000)
}
function errorAnimation() {
$('body').css('background-color', 'red');
for (var i = 0; i <= 3; i++) {
$('.half').delay(500).hide(1)
$('.half').delay(500).show(1)
}
}
function goNext() {
$('body').css('background-color', 'black');
openAnimation();
setTimeout(function(){ window.location = "index.php"; }, 2900);
}
function sendAuth(thisData, ok, nok) {
$.ajax('authenticateLevel.php', {
type: 'POST',
data: thisData,
success: function (data) {
if (data.substr(0, 6) == 'IGCTF{') {
document.cookie = "currentLevel=" + data;
ok()
} else {
nok()
}
}
});
}