site-accueil-insa/assets/map/alert.js
Guillaume Joffre ac14795c8a les maps
2022-06-13 01:21:54 +02:00

38 lines
No EOL
1.4 KiB
JavaScript

function CustomAlert(){
this.alert = function(message,title){
document.body.innerHTML = document.body.innerHTML + '<div id="dialogoverlay"></div><div id="dialogbox" class="slit-in-vertical"><div><div id="dialogboxhead"></div><div id="dialogboxbody"></div><div id="dialogboxfoot"></div></div></div>';
let dialogoverlay = document.getElementById('dialogoverlay');
let dialogbox = document.getElementById('dialogbox');
let winH = window.innerHeight;
dialogoverlay.style.height = winH+"px";
dialogbox.style.top = "100px";
dialogoverlay.style.display = "block";
dialogbox.style.display = "block";
document.getElementById('dialogboxhead').style.display = 'block';
if(typeof title === 'undefined') {
document.getElementById('dialogboxhead').style.display = 'none';
} else {
document.getElementById('dialogboxhead').innerHTML = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> '+ title;
}
document.getElementById('dialogboxbody').innerHTML = message;
document.getElementById('dialogboxfoot').innerHTML = '<button class="pure-material-button-contained active" onclick="customAlert.ok()">OK</button>';
}
this.ok = function(){
document.getElementById('dialogbox').style.display = "none";
document.getElementById('dialogoverlay').style.display = "none";
}
}
let customAlert = new CustomAlert();