Я не думаю, что это возможно в приглашении для сборки, но вы можете легко сделать это с помощью специального окна приглашения.
1) Создайте диалоговое окно XUL alert_prompt.xul следующим образом:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog id="alertprompt" title="Alert"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
buttonlabelcancel="Cancel"
buttonlabelaccept="Save"
height="140"
width="250"
ondialogaccept="return alert_prompt.doOK();"
ondialogcancel="return alert_prompt.doCancel();">
<script type="application/javascript" src="chrome://hello/content/alert_prompt.js"/>
<dialogheader title="Timer Alert Prompt"/>
<label id="result" value="This prompt will close in 10 seconds." align="center"/>
</dialog>
2) Создайте файл Javascript для этого окна XUL alert_prompt.js
var alert_prompt = {
init : function()
{
alert_prompt.timedCount(0);
},
timedCount : function(c)
{
//update the prompt message
document.getElementById('result').value="This prompt will close in "+ (10 - c) + " seconds.";
//if 10 seconds are over close the window
if(c == 10)
{
window.close();
}
//update the counter
c=c+1;
//use the timer
t=setTimeout(
function()
{
alert_prompt.timedCount(c);
},1000)
},
doOK : function()
{
//code that you want to run when save button is pressed
return true;
},
doCancel : function()
{
//code that you want to run when cancel button is pressed
return true;
},
};
window.addEventListener("load", alert_prompt.init, false);
3) Вместо отображения предупреждения, как раньше, используйте этот оператор:
openDialog("chrome://hello/content/alert_prompt.xul","alert_prompt","modal");
Если вы хотите вернуть значение из окна предупреждения, например, какая кнопка была нажата, вы можете сделать это так же, как обсуждалось ЗДЕСЬ
Я не уверен насчет расположения модального окна, поэтому вы можете задать это в отдельном вопросе.