Mercurial > hg > FirefoxAddon
comparison firefoxaddon/template/content/overlay.js_tmpl @ 0:9869cf47fcf8 default tip
initial commit of Firefox addon template
author | k0s <k0scist@gmail.com> |
---|---|
date | Sun, 28 Mar 2010 16:25:58 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9869cf47fcf8 |
---|---|
1 var ${package} = { | |
2 onLoad: function() { | |
3 // initialization code | |
4 this.initialized = true; | |
5 this.strings = document.getElementById("${package}-strings"); | |
6 document.getElementById("contentAreaContextMenu") | |
7 .addEventListener("popupshowing", function(e) { this.showContextMenu(e); }, false); | |
8 }, | |
9 | |
10 showContextMenu: function(event) { | |
11 // show or hide the menuitem based on what the context menu is on | |
12 // see http://kb.mozillazine.org/Adding_items_to_menus | |
13 document.getElementById("context-${package}").hidden = gContextMenu.onImage; | |
14 }, | |
15 onMenuItemCommand: function(e) { | |
16 var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] | |
17 .getService(Components.interfaces.nsIPromptService); | |
18 promptService.alert(window, this.strings.getString("helloMessageTitle"), | |
19 this.strings.getString("helloMessage")); | |
20 }, | |
21 onToolbarButtonCommand: function(e) { | |
22 // just reuse the function above. you can change this, obviously! | |
23 ${package}.onMenuItemCommand(e); | |
24 } | |
25 | |
26 }; | |
27 window.addEventListener("load", function(e) { ${package}.onLoad(e); }, false); |