mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 22:06:02 +01:00
Add files via upload
This commit is contained in:
2
ND_ATMs/source/ui/js/jquery-3.6.0.min.js
vendored
Normal file
2
ND_ATMs/source/ui/js/jquery-3.6.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
145
ND_ATMs/source/ui/js/listener.js
Normal file
145
ND_ATMs/source/ui/js/listener.js
Normal file
@@ -0,0 +1,145 @@
|
||||
$(function() {
|
||||
let deposit = false
|
||||
let withdraw = false
|
||||
|
||||
function display(bool) {
|
||||
if (bool) {
|
||||
$("#overlay").show();
|
||||
} else {
|
||||
$("#overlay").hide();
|
||||
}
|
||||
}
|
||||
function atmDisplay(bool) {
|
||||
if (bool) {
|
||||
$("#atm").show();
|
||||
$("#loader").hide();
|
||||
$("#confirmationScreen").hide();
|
||||
$("#successScreen").hide()
|
||||
} else {
|
||||
$("#atm").hide();
|
||||
}
|
||||
}
|
||||
function loader(bool) {
|
||||
if (bool) {
|
||||
$("#loader").show();
|
||||
$("#atm").hide();
|
||||
$("#confirmationScreen").hide();
|
||||
$("#successScreen").hide()
|
||||
} else {
|
||||
$("#loader").hide();
|
||||
}
|
||||
}
|
||||
function confirmationScreen(bool) {
|
||||
if (bool) {
|
||||
$("#confirmationScreen").show();
|
||||
$("#atm").hide();
|
||||
$("#loader").hide();
|
||||
$("#successScreen").hide()
|
||||
} else {
|
||||
$("#confirmationScreen").hide();
|
||||
}
|
||||
}
|
||||
function successScreen(bool) {
|
||||
if (bool) {
|
||||
$("#successScreen").show()
|
||||
$("#confirmationScreen").hide();
|
||||
$("#atm").hide();
|
||||
$("#loader").hide();
|
||||
} else {
|
||||
$("#successScreen").hide()
|
||||
}
|
||||
}
|
||||
display(false)
|
||||
atmDisplay(true)
|
||||
loader(false)
|
||||
confirmationScreen(false)
|
||||
successScreen(false)
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
const item = event.data;
|
||||
if (item.status) {
|
||||
display(true)
|
||||
$("#playername").text(item.playerName)
|
||||
$("#balance").text(item.balance)
|
||||
$("#date").text(item.date)
|
||||
$("#time").text(item.time)
|
||||
} else {
|
||||
display(false)
|
||||
}
|
||||
})
|
||||
|
||||
$("#withdrawButton").click(function() {
|
||||
withdraw = true
|
||||
$.post("https://ND_ATMs/sound", JSON.stringify({}));
|
||||
atmDisplay(false)
|
||||
loader(true)
|
||||
setTimeout(() => {
|
||||
loader(false)
|
||||
confirmationScreen(true)
|
||||
}, 400);
|
||||
return false
|
||||
})
|
||||
|
||||
$("#depositButton").click(function() {
|
||||
deposit = true
|
||||
$.post("https://ND_ATMs/sound", JSON.stringify({}));
|
||||
atmDisplay(false)
|
||||
loader(true)
|
||||
setTimeout(() => {
|
||||
loader(false)
|
||||
confirmationScreen(true)
|
||||
}, 400);
|
||||
return false
|
||||
})
|
||||
|
||||
$("#cancelButton").click(function() {
|
||||
withdraw = false
|
||||
deposit = false
|
||||
$.post("https://ND_ATMs/sound", JSON.stringify({}));
|
||||
confirmationScreen(false)
|
||||
loader(true)
|
||||
setTimeout(() => {
|
||||
loader(false)
|
||||
atmDisplay(true)
|
||||
}, 300);
|
||||
return false
|
||||
})
|
||||
|
||||
$("#atm").submit(function() {
|
||||
$.post("https://ND_ATMs/sound", JSON.stringify({}));
|
||||
confirmationScreen(false)
|
||||
loader(true)
|
||||
setTimeout(() => {
|
||||
loader(false)
|
||||
if (withdraw) {
|
||||
$.post("https://ND_ATMs/withdraw", JSON.stringify({
|
||||
amount: $("#enteredAmount").val()
|
||||
}));
|
||||
} else if (deposit) {
|
||||
$.post("https://ND_ATMs/deposit", JSON.stringify({
|
||||
amount: $("#enteredAmount").val()
|
||||
}));
|
||||
}
|
||||
withdraw = false
|
||||
deposit = false
|
||||
successScreen(true)
|
||||
}, 2500);
|
||||
return false
|
||||
})
|
||||
|
||||
$("#mainMenuButton").click(function() {
|
||||
$.post("https://ND_ATMs/sound", JSON.stringify({}));
|
||||
successScreen(false)
|
||||
loader(true)
|
||||
setTimeout(() => {
|
||||
loader(false)
|
||||
atmDisplay(true)
|
||||
}, 300);
|
||||
return false
|
||||
})
|
||||
|
||||
$("#closeButton").click(function() {
|
||||
$.post("https://ND_ATMs/close", JSON.stringify({}));
|
||||
return
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user