y: event.clientY - canvas.offsetTop};
break;
case 'up':
- if (event.button == 0)
- alert(zoomstart.x + ',' + zoomstart.y + '-' +
- (event.clientX - canvas.offsetLeft) + ',' +
- (event.clientY - canvas.offsetTop));
+ 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",
+ zoomstart.x + ',' + zoomstart.y + '-' +
+ (event.clientX - canvas.offsetLeft) + ',' +
+ (event.clientY - canvas.offsetTop));
+ // ok is now true if OK was clicked, and false if cancel was clicked
+ }
zoomstart = undefined;
break;
}
}
function saveBookmark() {
- // XXX: retrieve wanted bookmark name
- var bmName = "mandelbrot bm test";
+ // 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, {});
+ // 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
+
+ var bmName = input.value;
// Open or create the bookmarks database.
var file = Components.classes["@mozilla.org/file/directory_service;1"]