282872 - downloads dialog OK must be clicked twice to start download

This commit is contained in:
ben%bengoodger.com 2005-02-20 21:51:30 +00:00
parent 05bc50ffc6
commit 5a79023d0a
3 changed files with 15 additions and 7 deletions

View File

@ -202,8 +202,8 @@ function commonDialogOnLoad()
setTimeout(commonDialogReenableButtons, delayInterval);
document.documentElement.addEventListener("blur", commonDialogBlur, false);
document.documentElement.addEventListener("focus", commonDialogFocus, false);
addEventListener("blur", commonDialogBlur, false);
addEventListener("focus", commonDialogFocus, false);
}
getAttention();
@ -212,16 +212,20 @@ function commonDialogOnLoad()
var gDelayExpired = false;
var gBlurred = false;
function commonDialogBlur()
function commonDialogBlur(aEvent)
{
if (aEvent.target != document)
return;
gBlurred = true;
document.documentElement.getButton("accept").disabled = true;
document.documentElement.getButton("extra1").disabled = true;
document.documentElement.getButton("extra2").disabled = true;
}
function commonDialogFocus()
function commonDialogFocus(aEvent)
{
if (aEvent.target != document)
return;
gBlurred = false;
// When refocusing the window, don't enable the buttons unless the countdown
// delay has expired.

View File

@ -51,7 +51,7 @@
<dialog id="unknownContentType"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="dialog.initDialog();" onunload="if (dialog) dialog.onCancel();"
onblur="dialog.onBlur();" onfocus="dialog.onFocus();"
onblur="dialog.onBlur(event);" onfocus="dialog.onFocus(event);"
style="width: 34em;"
screenX="" screenY=""
persist="screenX screenY"

View File

@ -517,12 +517,16 @@ nsUnknownContentTypeDialog.prototype = {
_blurred: false,
_delayExpired: false,
onBlur: function() {
onBlur: function(aEvent) {
if (aEvent.target != this.mDialog.document)
return;
this._blurred = true;
this.mDialog.document.documentElement.getButton("accept").disabled = true;
},
onFocus: function() {
onFocus: function(aEvent) {
if (aEvent.target != this.mDialog.document)
return;
this._blurred = false;
if (this._delayExpired) {
var script = "document.documentElement.getButton('accept').disabled = false";