Skip to content

Instantly share code, notes, and snippets.

@Griever
Created November 16, 2011 15:16
Show Gist options
  • Save Griever/1370304 to your computer and use it in GitHub Desktop.
Save Griever/1370304 to your computer and use it in GitHub Desktop.
Panoのサイドバーでタブのコンテキストメニューを使えるようにする
// ==UserScript==
// @name Pano++
// @description Panoのサイドバーでタブのコンテキストメニューを使えるようにする
// @namespace http://d.hatena.ne.jp/Griever/
// @author Griever
// @include chrome://pano/content/sidebar.xul
// @compatibility Firefox 5
// @version 0.0.1
// ==/UserScript==
(function(){
window.panoooooo = {
init: function() {
this.treechildren = document.getElementById('panoTabGroupTreeChildren');
this.treechildren.addEventListener("contextmenu", this, false);
},
uninit: function() {
this.treechildren.removeEventListener("contextmenu", this, false);
},
handleEvent: function(event) {
switch(event.type){
case "contextmenu":
var item = gPanoramaTree.view.getItemFromEvent(event);
if ((item.type & gPanoramaTree.TAB_ITEM_TYPE) <= 0) return;
event.preventDefault();
event.stopPropagation();
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('contextmenu', true, true, window,
0, event.screenX, event.screenY, 0, 0,
false, false, false, false, 2, null);
item.tab.dispatchEvent(evt);
break;
}
},
};
panoooooo.init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment