1 // Shows a clear confirmation
2 function webdeveloper_clearConfirmation(message
)
4 var stringBundle
= document
.getElementById("webdeveloper-string-bundle");
6 return webdeveloper_confirmationDialog(stringBundle
.getString("webdeveloper_clearConfirmation"), message
, stringBundle
.getString("webdeveloper_clear"));
9 // Shows a close confirmation
10 function webdeveloper_closeConfirmation(message
)
12 var stringBundle
= document
.getElementById("webdeveloper-string-bundle");
14 return webdeveloper_confirmationDialog(stringBundle
.getString("webdeveloper_closeConfirmation"), message
, stringBundle
.getString("webdeveloper_close"));
17 // Shows a confirmation dialog
18 function webdeveloper_confirmationDialog(title
, message
, buttonText
)
20 // If the hide confirmation dialogs preference is not set to true
21 if(!webdeveloper_getBooleanPreference("webdeveloper.confirmation.dialogs.hide", true))
23 var checkBox
= {value: false};
24 var promptServiceInterface
= Components
.interfaces
.nsIPromptService
;
25 var result
= Components
.classes
["@mozilla.org/embedcomp/prompt-service;1"].getService(promptServiceInterface
).confirmEx(null, title
, message
, promptServiceInterface
.BUTTON_TITLE_IS_STRING
* promptServiceInterface
.BUTTON_POS_0
+ promptServiceInterface
.BUTTON_TITLE_CANCEL
* promptServiceInterface
.BUTTON_POS_1
, buttonText
, null, null, document
.getElementById("webdeveloper-string-bundle").getString("webdeveloper_stopConfirmation"), checkBox
);
27 // If the check box was checked
30 webdeveloper_setBooleanPreference("webdeveloper.confirmation.dialogs.hide", true);
33 // If the delete is confirmed
45 // Shows a delete confirmation
46 function webdeveloper_deleteConfirmation(message
)
48 var stringBundle
= document
.getElementById("webdeveloper-string-bundle");
50 return webdeveloper_confirmationDialog(stringBundle
.getString("webdeveloper_deleteConfirmation"), message
, stringBundle
.getString("webdeveloper_delete"));
53 // Shows an error message
54 function webdeveloper_error(message
)
56 Components
.classes
["@mozilla.org/embedcomp/prompt-service;1"].getService(Components
.interfaces
.nsIPromptService
).alert(null, document
.getElementById("webdeveloper-string-bundle").getString("webdeveloper_errorMessage"), message
);
59 // Shows an informational dialog
60 function webdeveloper_informationalDialog(title
, message
)
62 var checkBox
= {value: false};
63 var promptServiceInterface
= Components
.interfaces
.nsIPromptService
;
64 var stringBundle
= document
.getElementById("webdeveloper-string-bundle");
65 var result
= Components
.classes
["@mozilla.org/embedcomp/prompt-service;1"].getService(promptServiceInterface
).alertCheck(null, title
, message
, stringBundle
.getString("webdeveloper_stopInformational"), checkBox
);
67 // If the check box was checked
70 webdeveloper_setBooleanPreference("webdeveloper.informational.dialogs.hide", true);
75 function webdeveloper_message(title
, message
)
77 Components
.classes
["@mozilla.org/embedcomp/prompt-service;1"].getService(Components
.interfaces
.nsIPromptService
).alert(null, title
, message
);