Skip to content

Instantly share code, notes, and snippets.

@Griever Griever/Pano.uc.js
Created Nov 16, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.