forked from alice0775/userChrome.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontextOpenlinkForWebPanel.uc.js
More file actions
36 lines (35 loc) · 1.4 KB
/
contextOpenlinkForWebPanel.uc.js
File metadata and controls
36 lines (35 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// ==UserScript==
// @name contextopenlinkForWebPanel.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description Web Panel 右クリックメニュー
// @include chrome://browser/content/web-panels.xul
// @compatibility Firefox 3.1b3 3.5b4pre 3.6a1pre
// @author Alice0775
// @version 2012/12/08 22:30 Bug 788290 Bug 788293 Remove E4X
// @version LastMod 2009/03/17 23:00
// ==/UserScript==
(function(){
const kXULNS =
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
function DOM (xmlns, xml) {
var doc = (new DOMParser()).parseFromString(
'<root xmlns="' + xmlns + '">' + xml + "</root>",
"application/xml"
);
var imported = document.importNode(doc.documentElement, true);
var range = document.createRange();
range.selectNodeContents(imported);
var fragment = range.extractContents();
range.detach();
return fragment.childNodes.length > 1 ? fragment : fragment.firstChild;
}
self.elem = DOM(kXULNS,
'<menuitem id="context-openlinkInWebPanel" \
label="Open Link in Web Panel" \
accesskey="O" \
oncommand="loadWebPanel(gContextMenu.linkURL)" \
observes="gContextMenu.onLink"/>'
);
var ref = document.getElementById('context-openlink');
ref.parentNode.insertBefore(self.elem, ref);
})();