display: -webkit-flex;
появился в iOS 7. <html>
<body onload="Load()">
<dialog></dialog>
<script>
function Load()
{
setTimeout(async() => {
await Myconfirmselect(
"Готовы?",
[
"Да",
"Нет",
"Отмена"
]
)
.then(VarAnswer =>
{
if (VarAnswer == "Да")
{
}
if (VarAnswer == "Нет")
{
}
if (VarAnswer == "Отмена")
{
}
});
alert("!");
await Myconfirmselect("Это alert!");
await Myconfirmselect("Это prompt!", "Текст промпта")
.then(VarAnswer =>
{
});
}, 500);
}
function Myconfirmselect()
{
var VarGenDiv;
var VarAnswer = new Promise(resolve =>
{
document.querySelector("dialog").innerHTML += `
<div>
<textarea></textarea>
</div>
`;
document.querySelector("dialog").style.textAlign = "center";
VarGenDiv = document.querySelector("dialog").querySelector("div");
VarGenDiv.style.position = "initial";
VarGenDiv.querySelector("textarea").style.width = "100%";
VarGenDiv.querySelector("textarea").style.textAlign = "center";
VarGenDiv.querySelector("textarea").style.resize = "none";
VarGenDiv.querySelector("textarea").readOnly = true;
VarGenDiv.querySelector("textarea").style.border = "none";
VarGenDiv.querySelector("textarea").value = arguments[0];
setTimeout(() =>
{
VarGenDiv.querySelector("textarea").style.cssText += 'height: auto; padding: 0';
VarGenDiv.querySelector("textarea").style.cssText += 'height: ' + VarGenDiv.querySelector("textarea").scrollHeight + 'px';
}, 100);
//Add this buttons if alert//#
if (arguments.length == 1)
{
arguments[0] = ["ОК"];
}
//Add this buttons if confirm//#
if (arguments.length == 2)
{
if (Array.isArray(arguments[1]))
{
arguments[0] = arguments[1];
}
//Add this buttons if prompt//#
else
{
var VarInputText = document.createElement("input");
VarInputText.type = "text";
VarInputText.value = arguments[1];
VarInputText.style.paddingBottom = "10px";
VarInputText.style.paddingTop = "10px";
VarInputText.style.marginTop = "10px";
VarInputText.style.textAlign = "center";
VarGenDiv.appendChild(VarInputText);
arguments[0] = ["ОК"];
}
}
for (var i = 0; i < arguments[0].length; i++)
{
var VarButton = document.createElement("button");
VarButton.textContent = arguments[0][i];
VarButton.style.marginLeft = "10px";
VarButton.style.marginTop = "10px";
VarButton.addEventListener("click", (e) =>
{
document.querySelector("dialog").style.animation = "AnimFormHide 0.1s both";
setTimeout(() =>
{
if (VarGenDiv.contains(VarGenDiv.querySelector("input")))
{
resolve(VarGenDiv.querySelector("input").value);
}
else
{
resolve(e.target.textContent);
}
document.querySelector("dialog").style.textAlign = "initial";
document.querySelector("dialog").removeChild(VarGenDiv);
document.querySelector("dialog").close();
}, 150);
});
VarGenDiv.appendChild(VarButton);
}
document.querySelector("dialog").style.animation = "AnimFormShow 0.25s both";
document.querySelector("dialog").showModal();
});
return VarAnswer;
}
</script>
<style>
@keyframes AnimFormShow
{
0%
{
transform: translateY(-150%);
}
}
@keyframes AnimFormHide
{
100%
{
transform: translateY(-150%);
display: none;
}
}
dialog
{
border: 2px solid black;
border-radius: 15px;
}
dialog::backdrop
{
background: rgba(0,0,0,.6);
}
div
{
padding: 10px 5px;
box-sizing: border-box;
}
div
{
position: absolute;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
padding-bottom: 0;
}
input
{
height: 15px;
margin-bottom: 20px;
width: 100%;
}
</style>
</body>
</html>
function Load()
{
setTimeout(async() =>
{
await Myconfirmselect(
"Хранилище пустое!" + "¤" +
"Создать хранилище в браузере" + "¥" + "Inls();" + "º" +
"Выбрать файл хранилища" + "¥" + "Editselfile('.txt', false, 'Import&');"
);
alert("!");
}, 500);
}
async function Myconfirmselect(VarInput)
{
await new Promise(resolve =>
{
document.querySelector("dialog").innerHTML += `
<div>
<textarea></textarea>
</div>
`;
document.querySelector("dialog").style.textAlign = "center";
document.querySelector("dialog").querySelector("div").querySelector("textarea").style.width = "100%";
document.querySelector("dialog").querySelector("div").querySelector("textarea").style.textAlign = "center";
document.querySelector("dialog").querySelector("div").querySelector("textarea").style.resize = "none";
document.querySelector("dialog").querySelector("div").querySelector("textarea").readOnly = true;
document.querySelector("dialog").querySelector("div").querySelector("textarea").value = VarInput.split("¤")[0];
for (var i = 0; i < VarInput.split("¤")[1].split("º").length; i++)
{
var VarButton = document.createElement("button");
VarButton.textContent = VarInput.split("¤")[1].split("º")[i].split("¥")[0];
VarButton.id = VarInput.split("¤")[1].split("º")[i].split("¥")[1];
VarButton.style.marginLeft = "10px";
VarButton.style.marginTop = "10px";
VarButton.addEventListener("click", () =>
{
eval(event.target.id);
ButtonClosealert();
});
document.querySelector("dialog").querySelector("div").appendChild(VarButton);
}
function ButtonClosealert()
{
document.querySelector("dialog").style.animation = "AnimFormHide 0.1s both";
setTimeout(() =>
{
document.querySelector("dialog").style.textAlign = "initial";
document.querySelector("dialog").removeChild(document.querySelector("dialog").querySelector("div"));
document.querySelector("dialog").close();
}, 100);
}
document.querySelector("dialog").style.animation = "AnimFormShow 0.25s both";
document.querySelector("dialog").showModal();
Bye();
function Bye()
{
if (!document.querySelector("dialog").open)
{
setTimeout(resolve, 100);
}
else
{
setTimeout(Bye, 100);
}
}
});
}