2017-04-13 19:33:34 +02:00
|
|
|
/* Pop up Purchase Server Box */
|
|
|
|
function travelBoxInit() {
|
|
|
|
var cancelButton = document.getElementById("travel-box-cancel");
|
|
|
|
|
|
|
|
//Close Dialog box
|
|
|
|
cancelButton.addEventListener("click", function() {
|
|
|
|
travelBoxClose();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", travelBoxInit, false);
|
|
|
|
|
|
|
|
travelBoxClose = function() {
|
|
|
|
var travelBox = document.getElementById("travel-box-container");
|
|
|
|
travelBox.style.display = "none";
|
|
|
|
}
|
|
|
|
|
|
|
|
travelBoxOpen = function() {
|
|
|
|
var travelBox = document.getElementById("travel-box-container");
|
|
|
|
travelBox.style.display = "block";
|
|
|
|
}
|
|
|
|
|
|
|
|
travelBoxSetText = function(txt) {
|
|
|
|
var travelBoxText = document.getElementById("travel-box-text");
|
|
|
|
travelBoxText.innerHTML = txt;
|
|
|
|
}
|
|
|
|
|
|
|
|
travelBoxCreate = function(destCityName, cost) {
|
|
|
|
travelBoxSetText("Would you like to travel to " + destCityName + "? The trip will cost $" + cost + ".");
|
|
|
|
|
|
|
|
//Clear old event listeners from Confirm button
|
2017-05-05 23:27:35 +02:00
|
|
|
var newConfirmButton = clearEventListeners("travel-box-confirm");
|
|
|
|
//var confirmButton = document.getElementById("travel-box-confirm");
|
|
|
|
//var newConfirmButton = confirmButton.cloneNode(true);
|
|
|
|
//confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
|
2017-04-13 19:33:34 +02:00
|
|
|
newConfirmButton.addEventListener("click", function() {
|
|
|
|
travelBoxClose();
|
|
|
|
travelToCity(destCityName, cost);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
travelBoxOpen();
|
|
|
|
}
|