window.addEventListener("load", function(e) { TV2Developer.init(); }, false);
+
+document.getElementById('contentAreaContextMenu').addEventListener("popupshowing", function(e) { TV2Developer.showContextMenu(e); }, false);
+document.getElementById('contentAreaContextMenu').addEventListener("popuphiding", function(e) { TV2Developer.hideContextMenu(e); }, false);
if (tv2_uriOnly.substr(0,2)=='/s') {
typeId = 8; typeName = 'I2_Image_Selection';
} else {
- typeId = 7; typeName = ' I2_Image';
+ typeId = 7; typeName = 'I2_Image';
}
}
links.push(new this.TV2LinkSplit());
var instantApply = getBoolPref("browser.preferences.instantApply", false);
var features = "chrome,titlebar,toolbar,centerscreen" + (instantApply ? ",dialog=no" : ",modal");
window.openDialog('chrome://tv2developer/content/options.xul','tv2options',features);
- }
+ },
+
+ /* Show Context Menu */
+ showContextMenu: function(event) {
+ var menu = document.getElementById('contentAreaContextMenu');
+ var menuLocation = document.getElementById('context-sep-open');
+ function createItem() {
+ var menuItem = document.createElement('menuitem');
+ menuItem.setAttribute('id', 'tv2developer-link');
+ menuItem.setAttribute('label', 'Test link');
+ menu.insertBefore(menuItem, menuLocation);
+ }
+ },
+
+ /* Clean up on close */
+ hideContextMenu: function(event) {
+ var menu = document.getElementById('contentAreaContextMenu');
+ /* clean up menu */
+ var children = menu.childNodes;
+ for (var i = children.length - 1; i >= 0; --i) {
+ if (children[i].getAttribute('id').substr(0, 13) == 'tv2developer-') {
+ menu.removeChild(children[i]);
+ }
+ }
+ }
}