var noScroll = function(e) { e.preventDefault(); } var MessageBox = (function(){ // ****************************************** // ??????F????? // ?????@?F???b?Z?[?W?{?b?N?X?????? // ****************************************** function Hidden(){ document.getElementById("screenLock").style.visibility = 'hidden'; document.getElementById("messageBox").style.visibility = 'hidden'; document.body.removeEventListener('touchmove', noScroll); } // ****************************************** // ??????F?\?? // ?????@?F???b?Z?[?W?{?b?N?X??\?????? // ****************************************** function Show(){ document.getElementById("screenLock").style.visibility = 'visible'; document.getElementById("messageBox").style.visibility = 'visible'; document.body.addEventListener('touchmove', noScroll); } return { // ****************************************** // ??????F?x??(alert) // ?????@?F?x??????b?Z?[?W?{?b?N?X??\?????? // ****************************************** Alert: function(msgTitle, msgText, okFunc){ // ?{?^?????? document.getElementById("okBtn").style.display = 'inline'; document.getElementById("yesBtn").style.display = 'none'; document.getElementById("noBtn").style.display = 'none'; // ?^?C?g?????? document.getElementById("messageTitle").innerHTML = repBR(msgTitle); // ???b?Z?[?W???? document.getElementById("messageBody").innerHTML = repBR(msgText); // ?\?? Show(); // ????? document.getElementById("okBtn").onclick = function(){ Hidden(); okFunc(); }; }, // ****************************************** // ??????F?m?F(confirm) // ?????@?F?m?F????b?Z?[?W?{?b?N?X??\?????? // ****************************************** Confirm: function(msgTitle, msgText, yesFunc, noFunc){ // ?{?^?????? document.getElementById("okBtn").style.display = 'none'; document.getElementById("yesBtn").style.display = 'inline'; document.getElementById("noBtn").style.display = 'inline'; // ?^?C?g?????? document.getElementById("messageTitle").innerHTML = repBR(msgTitle); // ???b?Z?[?W???? document.getElementById("messageBody").innerHTML = repBR(msgText); // ?\?? Show(); // ?uYES?v?{?^?? document.getElementById("yesBtn").onclick = function(){ Hidden(); yesFunc(); }; // ?uNO?v?{?^?? document.getElementById("noBtn").onclick = function(){ Hidden(); noFunc(); }; } } })(); function alertOK(title, txt, func1){ if (func1 == '') { func1 = function(){return false;}; } MessageBox.Alert(title, txt, func1); } function alertYESNO(title, txt, func1, func2){ if (func1 == '') { func1 = function(){return false;}; } if (func2 == '') { func2 = function(){return false;}; } MessageBox.Confirm( title, txt, function(){func1()}, function(){func2()} ); } function repBR(target) { var retStr = target; while(0 <= retStr.indexOf("\n")) { retStr = retStr.replace("\n", "
"); } return retStr; }