.getService(Components.interfaces.nsIPrefService)
.getBranch(null);
var gStartTime = 0;
+var gMbrotBundle;
function Startup() {
updateIterMenu();
updatePaletteMenu();
- document.getElementById("statusLabel").value =
- document.getElementById("mbrotBundle").getString("statusEmpty");
+ gMbrotBundle = document.getElementById("mbrotBundle");
+ document.getElementById("statusLabel").value = gMbrotBundle.getString("statusEmpty");
}
function drawImage() {
document.getElementById("drawButton").hidden = true;
- document.getElementById("statusLabel").value =
- document.getElementById("mbrotBundle").getString("statusDrawing");
+ document.getElementById("statusLabel").value = gMbrotBundle.getString("statusDrawing");
let Cr_min = -2.0;
let Cr_max = 1.0;
let endTime = new Date();
let timeUsed = (endTime.getTime() - gStartTime.getTime()) / 1000;
document.getElementById("statusLabel").value =
- document.getElementById("mbrotBundle").getFormattedString("statusTime", [timeUsed.toFixed(3)]);
+ gMbrotBundle.getFormattedString("statusTime", [timeUsed.toFixed(3)]);
gStartTime = 0;
}
if (event.button == 0) {
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
- var ok = prompts.confirm(null, "XXX Zoom in",
+ var ok = prompts.confirm(null, gMbrotBundle.getString("zoomConfirmTitle"),
+ gMbrotBundle.getString("zoomConfirmLabel") + ' --- ' +
zoomstart.x + ',' + zoomstart.y + '-' +
(event.clientX - canvas.offsetLeft) + ',' +
(event.clientY - canvas.offsetTop));
}
function saveImage() {
- const bundle = document.getElementById("mbrotBundle");
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = null;
try {
.createInstance(nsIFilePicker);
} catch (e) {}
if (!fp) return;
- var promptString = bundle.getString("savePrompt");
+ var promptString = gMbrotBundle.getString("savePrompt");
fp.init(window, promptString, nsIFilePicker.modeSave);
- fp.appendFilter(bundle.getString("pngFilterName"), "*.png");
+ fp.appendFilter(gMbrotBundle.getString("pngFilterName"), "*.png");
fp.defaultString = "mandelbrot.png";
var fpResult = fp.show();
}
// Create the "Nothing Available" Menu item and disable it.
var na = aParent.appendChild(document.createElement("menuitem"));
- na.setAttribute("label",
- document.getElementById("mbrotBundle").getString("noBookmarks"));
+ na.setAttribute("label", gMbrotBundle.getString("noBookmarks"));
na.setAttribute("disabled", "true");
}
function saveBookmark() {
// retrieve wanted bookmark name with a prompt
- var mbrotBundle = document.getElementById("mbrotBundle");
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var input = {value: ""}; // empty default value
- var ok = prompts.prompt(null, "XXX Title", "XXX Please enter a name for the bookmark", input, null, {});
+ var ok = prompts.prompt(null, gMbrotBundle.getString("saveBookmarkTitle"), gMbrotBundle.getString("saveBookmarkLabel"), input, null, {});
// ok is true if OK is pressed, false if Cancel. input.value holds the value of the edit field if "OK" was pressed.
if (!ok || !input.value)
return