fix alert placement on iPad 2

This commit is contained in:
Raphaël Jakse 2020-07-13 15:50:44 +02:00
parent 921e2f620d
commit 08a7890bf7
3 changed files with 24 additions and 9 deletions

View File

@ -12,7 +12,7 @@
-webkit-justify-content:center;
justify-content:center;
line-height:1.5em;
text-align:center
text-align:center;
}
.alert-outer {
@ -31,6 +31,15 @@
padding:4px;
}
.alert.on-ipad.prompt {
justify-content:flex-start;
position:absolute;
}
.alert.on-ipad.prompt .alert-outer {
margin-top:1em;
}
.alert-content {
padding:1ex
}

View File

@ -57,6 +57,11 @@
divAlert.className = "alert";
divAlert.style.display = "none";
// eslint-disable-next-line require-unicode-regexp
if ((/iPad|iPhone|iPod/g).test(navigator.userAgent)) {
divAlert.classList.add("on-ipad");
}
divAlertContent = document.createElement("div");
divAlertContent.className = "alert-content";
divAlertContent.style.whiteSpace = "pre-wrap";
@ -114,6 +119,8 @@
prepare();
}
divAlert.classList.remove("prompt");
divAlertContent.textContent = msg;
divAlertInput.style.display = "none";
divAlertConfirm.style.display = "none";
@ -130,6 +137,8 @@
prepare();
}
divAlert.classList.add("prompt");
divAlertContent.textContent = msg;
divAlertInput.style.display = "";
alertInput.value = defaultText || "";
@ -139,12 +148,9 @@
divAlertCallback = callback;
divAlert.style.display = "";
// eslint-disable-next-line require-unicode-regexp
if (!(/iPad|iPhone|iPod/g).test(navigator.userAgent)) {
alertInput.focus();
alertInput.setSelectionRange(0, alertInput.value.length);
alertInput.select();
}
alertInput.focus();
alertInput.setSelectionRange(0, alertInput.value.length);
alertInput.select();
};
global.myConfirm = function (msg, callbackYes, callbackNo) {
@ -152,6 +158,8 @@
prepare();
}
divAlert.classList.remove("prompt");
divAlertContent.textContent = msg;
divAlertInput.style.display = "none";
divAlertConfirm.style.display = "";

View File

@ -1436,8 +1436,6 @@
}
function initChat() {
chatMessages.style.width = chatMessages.offsetWidth + "px";
const btn = document.getElementById("chat-btn");
chatTextarea.onmouseup = function () {