Bug 562366 - revise dialog styling to match new context and site menus [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2010-04-30 01:00:27 -04:00
parent abd56c0b95
commit e36598229f
12 changed files with 437 additions and 290 deletions

View File

@ -5,25 +5,16 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="dialog">
<content>
<xul:stack>
<xul:box xbl:inherits="orient" class="dialog-dark" align="center">
<children/>
</xul:box>
<xul:image collapsed="true" top="-10" left="0" anonid="close" class="close-button"
onclick="document.getBindingParent(this).close()"/>
</xul:stack>
<content orient="vertical" xbl:inherits="orient, closebutton" flex="1">
<children/>
</content>
<implementation implements="nsIDOMEventListener">
<field name="arguments"/>
<field name="parent"/>
<property name="_scrollbox" readonly="true" onget="return this.getElementsByTagName('scrollbox')[0];"/>
<constructor><![CDATA[
if (!this.hasAttribute("orient"))
this.setAttribute("orient", "vertical");
if (this.hasAttribute("closebutton") && (this.getAttribute("closebutton") == "true"))
document.getAnonymousElementByAttribute(this, "anonid", "close").removeAttribute("collapsed");
this._closed = false;
if (this.hasAttribute("script")) {
try {
@ -35,29 +26,55 @@
}
}
window.addEventListener("unload", this, true);
let scrollbox = this._scrollbox;
if (scrollbox) {
window.addEventListener("resize", this, true);
scrollbox.addEventListener("overflow", this, true);
}
]]></constructor>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
if (aEvent.originalTarget == document && aEvent.type == "unload")
this._removeDialog();
switch(aEvent.type) {
case "unload":
if (aEvent.originalTarget == document)
this._removeDialog();
break;
case "resize":
case "overflow":
let scrollbox = this._scrollbox;
let style = document.defaultView.getComputedStyle(scrollbox, null);
let newHeight = Math.ceil(scrollbox.firstChild.getBoundingClientRect().height) +
parseInt(style.marginTop) +
parseInt(style.marginBottom);
scrollbox.style.minHeight = Math.min(window.innerHeight / 2, newHeight) + "px";
break;
}
]]></body>
</method>
<method name="close">
<body>
<body><![CDATA[
if (this.hasAttribute("onclose")) {
var f = new Function(this.getAttribute("onclose"));
f.call(this);
let func = new Function(this.getAttribute("onclose"));
func.call(this);
}
this._removeDialog();
</body>
]]></body>
</method>
<method name="_removeDialog">
<body><![CDATA[
window.removeEventListener("unload", this, true);
let scrollbox = this._scrollbox;
if (scrollbox) {
window.removeEventListener("resize", this, true);
scrollbox.removeEventListener("overflow", this, true);
}
this.parentNode.parentNode.removeChild(this.parentNode);
this._closed = true;
@ -70,15 +87,14 @@
</method>
<method name="waitForClose">
<body>
<body><![CDATA[
let thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService(Components.interfaces.nsIThreadManager)
.currentThread;
while (!this._closed)
thread.processNextEvent(true);
</body>
]]></body>
</method>
</implementation>
</binding>
</bindings>

View File

@ -1,27 +1,40 @@
<?xml version="1.0"?>
<!DOCTYPE fdialog SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-alert-dialog"
onload="document.getElementById('prompt-button-ok').focus()"
onclose="this.PromptHelper.onCloseAlert(this);"
script="chrome://browser/content/prompt/prompt.js">
<!DOCTYPE prompt SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog id="prompt-alert-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="document.getElementById('prompt-button-ok').focus()"
onclose="this.PromptHelper.onCloseAlert(this);"
script="chrome://browser/content/prompt/prompt.js">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="document.getElementById('prompt-alert-dialog').close()"/>
<command id="cmd_cancel" oncommand="document.getElementById('prompt-alert-dialog').close()"/>
</commandset>
<label id="prompt-alert-title" crop="center"/>
<scrollbox orient="vertical" class="prompt-message">
<description id="prompt-alert-message"/>
</scrollbox>
<hbox id="prompt-alert-checkbox-box" collapsed="true" align="center" class="prompt-message">
<description id="prompt-alert-checkbox-msg"/>
<checkbox class="toggle-dark" id="prompt-alert-checkbox"/>
</hbox>
<hbox pack="center" class="prompt-buttons">
<button id="prompt-button-ok" class="button-dark" label="&ok.label;" command="cmd_ok"/>
<vbox class="prompt-header" flex="1">
<hbox>
<label id="prompt-alert-title" class="prompt-title" crop="center" flex="1"/>
<toolbarbutton class="close-button" command="cmd_cancel"/>
</hbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-alert-message"/>
</scrollbox>
<hbox id="prompt-alert-checkbox-box" collapsed="true" align="center" class="prompt-message" flex="1">
<label id="prompt-alert-checkbox-label" class="prompt-checkbox-label" crop="center" flex="1"/>
<checkbox id="prompt-alert-checkbox" class="toggle-dark"/>
</hbox>
</vbox>
<hbox class="prompt-buttons">
<button id="prompt-button-ok" label="&ok.label;" command="cmd_ok"/>
</hbox>
</dialog>

View File

@ -1,28 +1,41 @@
<?xml version="1.0"?>
<!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-confirm-dialog"
onload="document.getElementsByAttribute('command', 'cmd_ok')[0].focus()"
onclose="this.PromptHelper.onCloseConfirm(this)"
script="chrome://browser/content/prompt/prompt.js">
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog id="prompt-confirm-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="document.getElementsByAttribute('command', 'cmd_ok')[0].focus()"
onclose="this.PromptHelper.onCloseConfirm(this)"
script="chrome://browser/content/prompt/prompt.js">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(true)"/>
<command id="cmd_cancel" oncommand="document.getElementById('prompt-confirm-dialog').PromptHelper.closeConfirm(false)"/>
</commandset>
<label id="prompt-confirm-title"/>
<scrollbox orient="vertical" class="prompt-message">
<description id="prompt-confirm-message"/>
</scrollbox>
<hbox id="prompt-confirm-checkbox-box" collapsed="true" align="center" class="prompt-message">
<description id="prompt-confirm-checkbox-msg"/>
<checkbox class="toggle-dark" id="prompt-confirm-checkbox"/>
</hbox>
<hbox pack="center" id="prompt-confirm-button-box" class="prompt-buttons">
<button id="prompt-confirm-button-ok" class="button-dark" label="&ok.label;" command="cmd_ok"/>
<button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
<vbox class="prompt-header" flex="1">
<hbox>
<label id="prompt-confirm-title" class="prompt-title" crop="center" flex="1"/>
<toolbarbutton class="close-button" command="cmd_cancel"/>
</hbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-confirm-message"/>
</scrollbox>
<hbox id="prompt-confirm-checkbox-box" collapsed="true" align="center" class="prompt-message" flex="1">
<label id="prompt-confirm-checkbox-label" class="prompt-checkbox-label" crop="center" flex="1"/>
<checkbox class="toggle-dark" id="prompt-confirm-checkbox"/>
</hbox>
</vbox>
<hbox id="prompt-confirm-buttons-box" class="prompt-buttons">
<button label="&ok.label;" command="cmd_ok"/>
<button label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

View File

@ -31,79 +31,65 @@
*
* ***** END LICENSE BLOCK ***** */
var PromptHelper = {
closeDialog : function(confirm, id) {
let dialog = document.getElementById(id);
if (typeof confirm == "boolean" && dialog.arguments && "defaultButton" in dialog.arguments)
// confirmEx always returns 1 when dismissed with "escape" (bug 345067).
dialog.arguments.result = confirm ? dialog.arguments.defaultButton : 1;
else
dialog.arguments.result = confirm;
dialog.close();
},
//
// alert dialog
//
onCloseAlert: function(dialog) {
if (dialog.arguments) {
dialog.arguments.value = document.getElementById("prompt-alert-checkbox").checked;
}
},
//
// confirm dialog
//
closeConfirm : function(confirm) {
this.closeDialog(confirm, "prompt-confirm-dialog");
},
onCloseConfirm: function(dialog) {
if (dialog.arguments && ("checkbox" in dialog.arguments)) {
dialog.arguments.checkbox.value = document.getElementById("prompt-confirm-checkbox").checked;
}
},
//
// prompt dialog
//
closePrompt : function(confirm) {
this.closeDialog(confirm, "prompt-prompt-dialog");
},
onClosePrompt: function(dialog) {
if (dialog.arguments) {
dialog.arguments.checkbox.value = document.getElementById("prompt-prompt-checkbox").checked;
dialog.arguments.value.value = document.getElementById("prompt-prompt-textbox").value;
}
},
//
// user / password dialog
//
closePassword : function(confirm) {
this.closeDialog(confirm, "prompt-password-dialog");
},
onClosePassword: function(dialog) {
if (dialog.arguments) {
dialog.arguments.checkbox.value = document.getElementById("prompt-password-checkbox").checked;
dialog.arguments.user.value = document.getElementById("prompt-password-user").value;
dialog.arguments.password.value = document.getElementById("prompt-password-password").value;
}
},
//
// select dialog
//
closeSelect: function(confirm) {
this.closeDialog(confirm, "prompt-select-dialog");
},
onCloseSelect: function(dialog) {
if (dialog.arguments) {
dialog.arguments.selection.value = document.getElementById("prompt-select-list").selectedIndex;
}
const PromptHelper = {
closeDialog: function(confirm, id) {
let dialog = document.getElementById(id);
if (typeof confirm == "boolean" && dialog.arguments && "defaultButton" in dialog.arguments)
// confirmEx always returns 1 when dismissed with "escape" (bug 345067).
dialog.arguments.result = confirm ? dialog.arguments.defaultButton : 1;
else
dialog.arguments.result = confirm;
dialog.close();
},
// Alert dialog
onCloseAlert: function(dialog) {
if (dialog.arguments)
dialog.arguments.value = document.getElementById("prompt-alert-checkbox").checked;
},
// Confirm dialog
closeConfirm: function(confirm) {
this.closeDialog(confirm, "prompt-confirm-dialog");
},
onCloseConfirm: function(dialog) {
if (dialog.arguments && ("checkbox" in dialog.arguments))
dialog.arguments.checkbox.value = document.getElementById("prompt-confirm-checkbox").checked;
},
// Prompt dialog
closePrompt: function(confirm) {
this.closeDialog(confirm, "prompt-prompt-dialog");
},
onClosePrompt: function(dialog) {
if (dialog.arguments) {
dialog.arguments.checkbox.value = document.getElementById("prompt-prompt-checkbox").checked;
dialog.arguments.value.value = document.getElementById("prompt-prompt-textbox").value;
}
}
},
// User / Password dialog
closePassword: function(confirm) {
this.closeDialog(confirm, "prompt-password-dialog");
},
onClosePassword: function(dialog) {
if (dialog.arguments) {
dialog.arguments.checkbox.value = document.getElementById("prompt-password-checkbox").checked;
dialog.arguments.user.value = document.getElementById("prompt-password-user").value;
dialog.arguments.password.value = document.getElementById("prompt-password-password").value;
}
},
// Select dialog
closeSelect: function(confirm) {
this.closeDialog(confirm, "prompt-select-dialog");
},
onCloseSelect: function(dialog) {
if (dialog.arguments)
dialog.arguments.selection.value = document.getElementById("prompt-select-list").selectedIndex;
}
};

View File

@ -1,29 +1,43 @@
<?xml version="1.0"?>
<!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-prompt-dialog"
onload="document.getElementById('prompt-prompt-textbox').focus()"
onclose="this.PromptHelper.onClosePrompt(this)"
script="chrome://browser/content/prompt/prompt.js">
<!DOCTYPE prompt SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog id="prompt-prompt-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="document.getElementById('prompt-prompt-textbox').focus()"
onclose="this.PromptHelper.onClosePrompt(this)"
script="chrome://browser/content/prompt/prompt.js">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(true)"/>
<command id="cmd_cancel" oncommand="document.getElementById('prompt-prompt-dialog').PromptHelper.closePrompt(false)"/>
</commandset>
<label id="prompt-prompt-title"/>
<scrollbox orient="vertical" class="prompt-message">
<description id="prompt-prompt-message"/>
</scrollbox>
<textbox id="prompt-prompt-textbox"/>
<hbox id="prompt-prompt-checkbox-box" collapsed="true" align="center" class="prompt-message">
<description id="prompt-prompt-checkbox-msg"/>
<checkbox class="toggle-dark" id="prompt-prompt-checkbox"/>
</hbox>
<hbox pack="center" id="prompt-prompt-button-box" class="prompt-buttons">
<button class="button-dark" label="&ok.label;" command="cmd_ok"/>
<button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
<vbox class="prompt-header" flex="1">
<hbox>
<label id="prompt-prompt-title" class="prompt-title" crop="center" flex="1"/>
<toolbarbutton class="close-button" command="cmd_cancel"/>
</hbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-prompt-message"/>
</scrollbox>
<textbox id="prompt-prompt-textbox"/>
<hbox id="prompt-prompt-checkbox-box" collapsed="true" align="center" class="prompt-message" flex="1">
<label id="prompt-prompt-checkbox-label" class="prompt-checkbox-label" crop="center" flex="1"/>
<checkbox id="prompt-prompt-checkbox" class="toggle-dark"/>
</hbox>
</vbox>
<hbox class="prompt-buttons">
<button label="&ok.label;" command="cmd_ok"/>
<button label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

View File

@ -1,50 +1,63 @@
<?xml version="1.0"?>
<!DOCTYPE dialog [
<!ENTITY % promptDTD SYSTEM "chrome://browser/locale/prompt.dtd">
<!ENTITY % commonDialogDTD SYSTEM "chrome://global/locale/commonDialog.dtd">
%promptDTD;
%commonDialogDTD;
<!DOCTYPE prompt [
<!ENTITY % promptDTD SYSTEM "chrome://browser/locale/prompt.dtd">
<!ENTITY % commonDialogDTD SYSTEM "chrome://global/locale/commonDialog.dtd">
%promptDTD;
%commonDialogDTD;
]>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-password-dialog"
onload="document.getElementById('prompt-password-user').focus()"
onclose="this.PromptHelper.onClosePassword(this)"
script="chrome://browser/content/prompt/prompt.js">
<dialog id="prompt-password-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="document.getElementById('prompt-password-user').focus()"
onclose="this.PromptHelper.onClosePassword(this)"
script="chrome://browser/content/prompt/prompt.js">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(true)"/>
<command id="cmd_cancel" oncommand="document.getElementById('prompt-password-dialog').PromptHelper.closePassword(false)"/>
</commandset>
<label id="prompt-password-title"/>
<scrollbox orient="vertical" class="prompt-message">
<description id="prompt-password-message"/>
</scrollbox>
<grid>
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&editfield0.label;"/>
<textbox id="prompt-password-user"/>
</row>
<row align="center">
<label value="&editfield1.label;"/>
<textbox type="password" id="prompt-password-password"/>
</row>
</rows>
</grid>
<vbox class="prompt-header" flex="1">
<hbox>
<label id="prompt-password-title" class="prompt-title" crop="center" flex="1"/>
<toolbarbutton class="close-button" command="cmd_cancel"/>
</hbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-password-message"/>
</scrollbox>
<grid>
<columns>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&editfield0.label;"/>
<textbox id="prompt-password-user"/>
</row>
<row align="center">
<label value="&editfield1.label;"/>
<textbox type="password" id="prompt-password-password"/>
</row>
</rows>
</grid>
<hbox id="prompt-password-checkbox-box" collapsed="true" align="center" class="prompt-message">
<description id="prompt-password-checkbox-msg"/>
<checkbox class="toggle-dark" id="prompt-password-checkbox"/>
</hbox>
<hbox pack="center" id="prompt-password-button-box" class="prompt-buttons">
<button class="button-dark" label="&ok.label;" command="cmd_ok"/>
<button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
<hbox id="prompt-password-checkbox-box" collapsed="true" align="center" class="prompt-message" flex="1">
<label id="prompt-password-checkbox-label" class="prompt-checkbox-label" crop="center" flex="1"/>
<checkbox id="prompt-password-checkbox" class="toggle-dark"/>
</hbox>
</vbox>
<hbox class="prompt-buttons">
<button label="&ok.label;" command="cmd_ok"/>
<button label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

View File

@ -1,25 +1,38 @@
<?xml version="1.0"?>
<!DOCTYPE vbox SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="prompt-select-dialog"
onload="document.getElementById('prompt-select-list').focus()"
onclose="this.PromptHelper.onCloseSelect(this)"
script="chrome://browser/content/prompt/prompt.js">
<!DOCTYPE prompt SYSTEM "chrome://browser/locale/prompt.dtd">
<dialog id="prompt-select-dialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="document.getElementById('prompt-select-list').focus()"
onclose="this.PromptHelper.onCloseSelect(this)"
script="chrome://browser/content/prompt/prompt.js">
<keyset>
<key keycode="VK_RETURN" command="cmd_ok"/>
<key keycode="VK_ESCAPE" command="cmd_cancel"/>
</keyset>
<commandset>
<command id="cmd_ok" oncommand="document.getElementById('prompt-select-dialog').PromptHelper.closeSelect(true)"/>
<command id="cmd_cancel" oncommand="document.getElementById('prompt-select-dialog').PromptHelper.closeSelect(false)"/>
</commandset>
<label id="prompt-select-title"/>
<scrollbox orient="vertical" class="prompt-message">
<description id="prompt-select-message"/>
</scrollbox>
<menulist id="prompt-select-list" class="button-dark"/>
<hbox pack="center" id="prompt-prompt-button-box" class="prompt-buttons">
<button class="button-dark" label="&ok.label;" command="cmd_ok"/>
<button class="button-dark" label="&cancel.label;" command="cmd_cancel"/>
<vbox class="prompt-header" flex="1">
<hbox>
<label id="prompt-select-title" class="prompt-title" crop="center" flex="1"/>
<toolbarbutton class="close-button" command="cmd_cancel"/>
</hbox>
<scrollbox orient="vertical" class="prompt-message" flex="1">
<description id="prompt-select-message"/>
</scrollbox>
<menulist id="prompt-select-list" class="button-dark"/>
</vbox>
<hbox class="prompt-buttons">
<button label="&ok.label;" command="cmd_ok"/>
<button label="&cancel.label;" command="cmd_cancel"/>
</hbox>
</dialog>

View File

@ -56,32 +56,6 @@ promptService.prototype = {
return win ? win.document : null;
},
// add a width style to prevent a element to grow larger
// than the screen width
sizeElement: function(id, percent) {
let elem = this.getDocument().getElementById(id);
let screenW = this.getDocument().getElementById("main-window").getBoundingClientRect().width;
elem.style.width = screenW * percent / 100 + "px"
},
// size the height of the scrollable message. this assumes the given element
// is a child of a scrollbox
sizeScrollableMsg: function(id, percent) {
let doc = this.getDocument();
let screenH = doc.getElementById("main-window").getBoundingClientRect().height;
let maxHeight = screenH * percent / 100;
let elem = doc.getElementById(id);
let style = doc.defaultView.getComputedStyle(elem, null);
let height = Math.ceil(elem.getBoundingClientRect().height) +
parseInt(style.marginTop) +
parseInt(style.marginBottom);
if (height > maxHeight)
height = maxHeight;
elem.parentNode.style.height = height + "px";
},
openDialog: function(aParent, aSrc, aParams) {
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
let browser = wm.getMostRecentWindow("navigator:browser");
@ -103,8 +77,6 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/alert.xul", null);
doc.getElementById("prompt-alert-title").value = aTitle;
doc.getElementById("prompt-alert-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-alert-message", 80);
this.sizeScrollableMsg("prompt-alert-message", 25);
dialog.waitForClose();
},
@ -119,12 +91,9 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/alert.xul", aCheckState);
doc.getElementById("prompt-alert-title").value = aTitle;
doc.getElementById("prompt-alert-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-alert-message", 80);
this.sizeScrollableMsg("prompt-alert-message", 25);
doc.getElementById("prompt-alert-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-alert-checkbox-msg"), aCheckMsg);
this.sizeElement("prompt-alert-checkbox-msg", 50);
this.setLabelForNode(doc.getElementById("prompt-alert-checkbox-label"), aCheckMsg);
doc.getElementById("prompt-alert-checkbox-box").removeAttribute("collapsed");
dialog.waitForClose();
@ -142,8 +111,6 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/confirm.xul", params);
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-confirm-message", 80);
this.sizeScrollableMsg("prompt-confirm-message", 25);
dialog.waitForClose();
return params.result;
@ -162,12 +129,9 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/confirm.xul", params);
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-confirm-message", 80);
this.sizeScrollableMsg("prompt-confirm-message", 25);
doc.getElementById("prompt-confirm-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-msg"), aCheckMsg);
this.sizeElement("prompt-confirm-checkbox-msg", 50);
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-label"), aCheckMsg);
doc.getElementById("prompt-confirm-checkbox-box").removeAttribute("collapsed");
dialog.waitForClose();
@ -247,17 +211,14 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/confirm.xul", params);
doc.getElementById("prompt-confirm-title").value = aTitle;
doc.getElementById("prompt-confirm-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-confirm-message", 80);
this.sizeScrollableMsg("prompt-confirm-message", 25);
doc.getElementById("prompt-confirm-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-msg"), aCheckMsg);
this.sizeElement("prompt-confirm-checkbox-msg", 50);
this.setLabelForNode(doc.getElementById("prompt-confirm-checkbox-label"), aCheckMsg);
if (aCheckMsg) {
doc.getElementById("prompt-confirm-checkbox-box").removeAttribute("collapsed");
}
let bbox = doc.getElementById("prompt-confirm-button-box");
let bbox = doc.getElementById("prompt-confirm-buttons-box");
while (bbox.lastChild) {
bbox.removeChild(bbox.lastChild);
}
@ -294,7 +255,6 @@ promptService.prototype = {
if (bTitle) {
let button = doc.createElement("button");
this.setLabelForNode(button, bTitle);
button.setAttribute("class", "button-dark");
if (i == defaultButton) {
button.setAttribute("command", "cmd_ok");
}
@ -326,12 +286,9 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/prompt.xul", params);
doc.getElementById("prompt-prompt-title").value = aTitle;
doc.getElementById("prompt-prompt-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-prompt-message", 80);
this.sizeScrollableMsg("prompt-prompt-message", 25);
doc.getElementById("prompt-prompt-checkbox").checked = aCheckState.value;
this.setLabelForNode(doc.getElementById("prompt-prompt-checkbox-msg"), aCheckMsg);
this.sizeElement("prompt-prompt-checkbox-msg", 50);
this.setLabelForNode(doc.getElementById("prompt-prompt-checkbox-label"), aCheckMsg);
doc.getElementById("prompt-prompt-textbox").value = aValue.value;
if (aCheckMsg) {
doc.getElementById("prompt-prompt-checkbox-box").removeAttribute("collapsed");
@ -375,17 +332,13 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/promptPassword.xul", params);
doc.getElementById("prompt-password-title").value = aTitle;
doc.getElementById("prompt-password-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-password-message", 80);
this.sizeScrollableMsg("prompt-password-message", 25);
doc.getElementById("prompt-password-checkbox").checked = aCheckState.value;
doc.getElementById("prompt-password-user").value = aUsername.value;
doc.getElementById("prompt-password-password").value = aPassword.value;
if (aCheckMsg) {
doc.getElementById("prompt-password-checkbox-box").removeAttribute("collapsed");
this.setLabelForNode(doc.getElementById("prompt-password-checkbox-msg"), aCheckMsg);
this.sizeElement("prompt-password-checkbox-msg", 50);
this.sizeElement("prompt-password-checkbox-box", 50);
this.setLabelForNode(doc.getElementById("prompt-password-checkbox-label"), aCheckMsg);
}
dialog.waitForClose();
@ -501,8 +454,6 @@ promptService.prototype = {
let dialog = this.openDialog(aParent, "chrome://browser/content/prompt/select.xul", params);
doc.getElementById("prompt-select-title").value = aTitle;
doc.getElementById("prompt-select-message").appendChild(doc.createTextNode(aText));
this.sizeElement("prompt-select-message", 80);
this.sizeScrollableMsg("prompt-select-message", 25);
let list = doc.getElementById("prompt-select-list");
for (let i = 0; i < aCount; i++)

View File

@ -886,6 +886,7 @@ box[type="documenttab"]:only-child .documenttab-close {
display: none;
}
.prompt-buttons,
#pageactions-container {
background: rgb(210, 210, 210) -moz-linear-gradient(top, rgba(255,255,255,0.4) 0%, rgba(235,235,235,0.4) 90%, rgba(185,185,185,0.4) 100%);
border: none;
@ -896,31 +897,50 @@ box[type="documenttab"]:only-child .documenttab-close {
-moz-border-radius-bottomright: 8px;
}
.prompt-buttons > button,
pageaction {
border-color: rgb(255,255,255) rgb(215,215,215) rgb(215,215,215) rgb(255,255,255);
-moz-border-top-colors: rgb(255, 255, 255);
-moz-border-right-colors: rgb(215, 215, 215);
-moz-border-bottom-colors: rgb(215, 215, 215);
-moz-border-left-colors: rgb(255, 255, 255);
background-color: rgb(235,235,235);
border-style: solid;
border-width: 1px;
border-width: 1px !important;
height: 64px;
width :100%;
}
/* Override buttons style */
.prompt-buttons > button {
margin: 0;
-moz-border-image: none !important;
}
.prompt-buttons > button > .button-box {
padding: 0 4px 1px 3px !important;
}
@media (min-width: 500px) {
.prompt-buttons > button,
pageaction {
width: 50%;
}
.prompt-buttons > button:nth-last-child(2):not(:nth-child(even)),
pageaction:nth-last-child(2):not(:nth-child(even)) {
background-image: -moz-linear-gradient(top, rgb(235,235,235) 0%, rgb(215,215,215) 90%);
border-bottom: 1px solid #fff;
-moz-border-radius-bottomleft: 8px;
}
.prompt-buttons > button:first-child,
.prompt-buttons > button:nth-child(2),
pageaction:first-child,
pageaction:nth-child(2) {
background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(235,235,235) 90%) !important;
}
.prompt-buttons > button:last-child:not(:nth-child(even)),
pageaction:last-child:not(:nth-child(even)) {
border-bottom: 1px solid #fff;
-moz-border-radius-bottomleft: 8px;
@ -928,6 +948,7 @@ pageaction {
width: 100%;
}
.prompt-buttons > button:last-child:not(:nth-child(odd)),
pageaction:last-child:not(:nth-child(odd)) {
border-bottom: 1px solid #fff;
-moz-border-radius-bottomright: 8px;
@ -935,23 +956,27 @@ pageaction {
}
@media (max-width: 499px) {
.prompt-buttons > button:last-child,
pageaction:last-child {
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
}
}
.prompt-buttons > button:last-child,
pageaction:last-child {
background-image: -moz-linear-gradient(top, rgb(235,235,235) 0%, rgb(215,215,215) 90%);
}
.prompt-buttons > button:first-child,
pageaction:first-child {
background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(235,235,235) 90%);
}
.prompt-buttons > button:hover:active,
pageaction:hover:active {
background-image: none !important;
background-color: #8db8d8;
background-color: #8db8d8 !important;
}
pageaction .pageaction-image {
@ -964,9 +989,10 @@ pageaction:not([image]) .pageaction-image {
width: 0;
}
.prompt-buttons > button,
pageaction .pageaction-title {
font-size: 24px !important;
color: #414141;
color: #414141 !important;
}
pageaction .pageaction-desc {

View File

@ -94,31 +94,76 @@ textbox[isempty="true"] {
.dialog-dark {
color: #fff;
background-color: #36373b;
border: 3px solid #262629;
border-width: 4px 3px 4px 3px;
border-style: solid;
-moz-border-top-colors: black #4a4b4f;
-moz-border-left-colors: black #4a4b4f;
-moz-border-bottom-colors: black #4a4b4f;
-moz-border-right-colors: black #4a4b4f;
-moz-border-radius: 8px 8px 8px 8px;
padding: 8px;
-moz-box-shadow: black 0 2px 2px;
padding: 8px;
}
/* prompt dialogs ---------------------------------------------------------- */
dialog {
.modal-block {
padding: 64px;
}
.modal-block dialog {
color: #fff;
background-color: transparent;
-moz-border-radius: 8px;
-moz-box-shadow: black 0 2px 2px;
}
.prompt-header {
padding: 8px;
font-size: 18px !important;
-moz-border-radius: 8px 8px 0 0;
background-color: #36373b;
border-style: solid;
border-width: 4px 3px 2px 3px;
-moz-border-top-colors: black #4a4b4f;
-moz-border-left-colors: black #4a4b4f;
-moz-border-bottom-colors: black #4a4b4f;
-moz-border-right-colors: black #4a4b4f;
}
dialog hbox > .close-button {
min-height: 0 !important;
min-width: 0 !important;
display: none;
}
dialog[closebutton="true"] hbox > .close-button {
display: -moz-box;
}
.prompt-title {
font-size: 24px !important;
}
dialog .prompt-message {
font-size: 18px !important;
@media (max-width: 499px) {
.modal-block {
padding: 32px;
}
.prompt-header {
font-size: 16px !important;
}
.prompt-title {
font-size: 18px !important;
}
}
dialog > scrollbox.prompt-message {
margin: 8px 0 8px 0;
}
dialog > hbox.prompt-message {
.prompt-message {
margin-top: 8px;
}
dialog > hbox.prompt-buttons {
margin-top: 8px;
.prompt-checkbox-label {
text-align: right;
}
/* buttons ----------------------------------------------------------------- */

View File

@ -539,6 +539,7 @@ box[type="documenttab"]:only-child .documenttab-close {
display: none;
}
.prompt-buttons,
#pageactions-container {
background: rgb(210, 210, 210) -moz-linear-gradient(top, rgba(255,255,255,0.4) 0%, rgba(235,235,235,0.4) 90%, rgba(185,185,185,0.4) 100%);
border: none;
@ -549,31 +550,50 @@ box[type="documenttab"]:only-child .documenttab-close {
-moz-border-radius-bottomright: 1.1mm;
}
.prompt-buttons > button,
pageaction {
border-color: rgb(255,255,255) rgb(215,215,215) rgb(215,215,215) rgb(255,255,255);
-moz-border-top-colors: rgb(255, 255, 255);
-moz-border-right-colors: rgb(215, 215, 215);
-moz-border-bottom-colors: rgb(215, 215, 215);
-moz-border-left-colors: rgb(255, 255, 255);
background-color: rgb(235,235,235);
border-style: solid;
border-width: 1px;
border-width: 1px !important;
height: 64px;
width: 100%;
}
/* Override buttons style */
.prompt-buttons > button {
margin: 0;
-moz-border-image: none !important;
}
.prompt-buttons > button > .button-box {
padding: 0 4px 1px 3px !important;
}
@media all and (orientation: landscape) {
.prompt-buttons > button,
pageaction {
width: 50%;
}
.prompt-buttons > button:nth-last-child(2):not(:nth-child(even)),
pageaction:nth-last-child(2):not(:nth-child(even)) {
background-image: -moz-linear-gradient(top, rgb(235,235,235) 0%, rgb(215,215,215) 90%);
border-bottom: 1px solid #fff;
-moz-border-radius-bottomleft: 1.1mm;
}
.prompt-buttons > button:first-child,
.prompt-buttons > button:nth-child(2),
pageaction:first-child,
pageaction:nth-child(2) {
background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgb(235,235,235) 90%) !important;
}
.prompt-buttons > button:last-child:not(:nth-child(even)),
pageaction:last-child:not(:nth-child(even)) {
border-bottom: 1px solid #fff;
-moz-border-radius-bottomleft: 1.1mm;
@ -581,6 +601,7 @@ pageaction {
width: 100%;
}
.prompt-buttons > button:last-child:not(:nth-child(odd)),
pageaction:last-child:not(:nth-child(odd)) {
border-bottom: 1px solid #fff;
-moz-border-radius-bottomright: 1.1mm;
@ -588,23 +609,27 @@ pageaction {
}
@media all and (orientation: portrait) {
.prompt-buttons > button:last-child,
pageaction:last-child {
-moz-border-radius-bottomleft: 1.1mm;
-moz-border-radius-bottomright: 1.1mm;
}
}
.prompt-buttons > button:last-child,
pageaction:last-child {
background-image: -moz-linear-gradient(top, rgb(235,235,235) 0%, rgb(215,215,215) 90%);
}
.prompt-buttons > button:first-child,
pageaction:first-child {
background-image: -moz-linear-gradient(top, rgb(255,255,255) 0%, rgba(235,235,235) 90%);
}
.prompt-buttons > button:hover:active,
pageaction:hover:active {
background-image: none !important;
background-color: #8db8d8;
background-color: #8db8d8 !important;
}
pageaction .pageaction-image {
@ -617,9 +642,10 @@ pageaction:not([image]) .pageaction-image {
width: 0;
}
.prompt-buttons > button,
pageaction .pageaction-title {
font-size: 9pt !important;
color: #414141;
color: #414141 !important;
}
pageaction .pageaction-desc {

View File

@ -66,31 +66,62 @@ textbox[isempty="true"] {
.dialog-dark {
color: #fff;
background-color: #36373b;
border: 0.3mm solid #262629;
border-width: 0.4mm 0.3mm 0.4mm 0.3mm;
border-style: solid;
-moz-border-top-colors: black #4a4b4f;
-moz-border-left-colors: black #4a4b4f;
-moz-border-bottom-colors: black #4a4b4f;
-moz-border-right-colors: black #4a4b4f;
-moz-border-radius: 1mm 1mm 1mm 1mm;
padding: 1mm;
-moz-box-shadow: black 0 0.25mm 0.25mm;
padding: 1mm;
}
/* prompt dialogs ---------------------------------------------------------- */
dialog {
.modal-block {
padding: 8mm;
}
.modal-block dialog {
color: #fff;
background-color: transparent;
-moz-border-radius: 1mm;
-moz-box-shadow: black 0 0.1mm 0.1mm;
}
.prompt-header {
padding: 1mm;
font-size: 8pt !important;
-moz-border-radius: 1mm 1mm 0 0;
background-color: #36373b;
border-style: solid;
border-width: 0.4mm 0.3mm 0.2mm 0.3mm;
-moz-border-top-colors: black #4a4b4f;
-moz-border-left-colors: black #4a4b4f;
-moz-border-bottom-colors: black #4a4b4f;
-moz-border-right-colors: black #4a4b4f;
}
dialog hbox > .close-button {
min-height: 0 !important;
min-width: 0 !important;
display: none;
}
dialog[closebutton="true"] hbox > .close-button {
display: -moz-box;
}
.prompt-title {
font-size: 9pt !important;
}
dialog .prompt-message {
font-size: 8pt !important;
}
dialog > scrollbox.prompt-message {
margin: 1mm 0 1mm 0;
}
dialog > hbox.prompt-message {
.prompt-message {
margin-top: 1mm;
}
dialog > hbox.prompt-buttons {
margin-top: 1mm;
.prompt-checkbox-label {
text-align: right;
}
/* buttons ----------------------------------------------------------------- */