1
// Open a dialog to choose an application
2
function webdeveloper_chooseApplication()
4
var filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
6
filePicker.init(window, document.getElementById("webdeveloper-string-bundle").getString("webdeveloper_chooseApplication"), filePicker.modeOpen);
8
// If the user selected an application
9
if(filePicker.show() == filePicker.returnOK)
11
document.getElementById("webdeveloper.view.source.with.path").value = filePicker.file.path;
15
// Clears the view source with option
16
function webdeveloper_clearViewSourceWith()
18
window.opener.webdeveloper_viewSourceWithDescription = null;
19
window.opener.webdeveloper_viewSourceWithKey = null;
20
window.opener.webdeveloper_viewSourceWithPath = null;
23
// Initializes the view source with dialog box
24
function webdeveloper_initializeViewSourceWith()
27
var stringBundle = document.getElementById("webdeveloper-string-bundle");
29
// If running on a Mac
30
if(webdeveloper_isMac())
32
modifiers = stringBundle.getString("webdeveloper_keyboardShortcutModifiersMac");
36
modifiers = stringBundle.getString("webdeveloper_keyboardShortcutModifiers");
39
document.getElementById("webdeveloper-keyboard-shortcut-modifiers").value = modifiers;
41
// If the first argument equals add
42
if(window.arguments[0] == "add")
44
document.title = stringBundle.getString("webdeveloper_addViewSourceWith");
48
document.title = stringBundle.getString("webdeveloper_editViewSourceWith");
50
document.getElementById("webdeveloper.view.source.with.description").value = window.arguments[1];
51
document.getElementById("webdeveloper.view.source.with.path").value = window.arguments[2];
52
document.getElementById("webdeveloper.view.source.with.key").value = window.arguments[3];
56
// Saves the view source with option
57
function webdeveloper_saveViewSourceWith()
59
var description = document.getElementById("webdeveloper.view.source.with.description").value.trim();
61
var key = document.getElementById("webdeveloper.view.source.with.key").value.trim();
62
var path = document.getElementById("webdeveloper.view.source.with.path").value.trim();
63
var stringBundle = document.getElementById("webdeveloper-string-bundle");
65
// If the description is empty
68
errors += stringBundle.getString("webdeveloper_emptyDescription") + "\n";
71
// If the path is empty
74
errors += stringBundle.getString("webdeveloper_emptyPath") + "\n";
77
// If there are errors
80
webdeveloper_error(errors.trim());
86
window.opener.webdeveloper_viewSourceWithDescription = description;
87
window.opener.webdeveloper_viewSourceWithKey = key;
88
window.opener.webdeveloper_viewSourceWithPath = path;