CSS
new function () {
var items = [
{label:"复制当前标签【标题】",
oncommand: function() {addMenu.copy(addMenu.convertText("%TITLE%"));},
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAXElEQVQ4jWNgGCzgPxZMSA2GJKkWEmXAfwYGBg9yDfBgYGCYCcXEWogCjjIwMChDaZIBssY8KCYJ5DGghjhJrlBmwPTjTKg4ToCsAVvAeaCJ0S8dkGQARUl54AAAWsMsNkwmkt8AAAAASUVORK5CYII="},
{label:"复制当前标签【地址】",oncommand: function() {addMenu.copy(addMenu.convertText("%URL%"));},image:""},
{label:"复制当前标签标题和地址",
oncommand: function() {addMenu.copy(addMenu.convertText("%TITLE%\n%URL%"));},image:""},
{label:"复制当前标签源代码",oncommand: function() {addMenu.copy(addMenu.convertText( '<a href="%URL%" target="_blank">%TITLES%</a>'));},image:""},
{},
{label:"复制所有标签标题",oncommand: function() {(function(){
var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1'].getService(Components.interfaces.nsIClipboardHelper);
var titles = "";
Array.slice(gBrowser.tabContainer.childNodes).forEach(function(tab) {
titles += tab.label + "\n";
});
gClipboardHelper.copyString(titles);
})();},image:""},
{label:"复制所有标签地址",oncommand: function() {(function(){
var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1'].getService(Components.interfaces.nsIClipboardHelper);
var URLs = "";
Array.slice(gBrowser.tabContainer.childNodes).forEach(function(tab) {
var url = gBrowser.getBrowserForTab(tab).currentURI.spec;
URLs += url + "\n";
});
gClipboardHelper.copyString(URLs);
})();},image:""},
{label:"复制所有标签标题和地址",oncommand: function() {(function() {
var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1'].getService(Components.interfaces.nsIClipboardHelper);
var txt = "";
Array.slice(gBrowser.tabContainer.childNodes).forEach(function(tab) {
var url = gBrowser.getBrowserForTab(tab).currentURI.spec;
txt += tab.label + "\n" + url + "\n";
});
gClipboardHelper.copyString(txt);
})();},image:""},
{label:"复制所有标签HTML链接",oncommand: function() {(function() {
var gClipboardHelper = Components.classes['@mozilla.org/widget/clipboardhelper;1'].getService(Components.interfaces.nsIClipboardHelper);
var txt = "";
Array.slice(gBrowser.tabContainer.childNodes).forEach(function(tab) {
var url = gBrowser.getBrowserForTab(tab).currentURI.spec;
txt += "<a href=" + "\""+ url +"\" "+ "target=\"_blank\">" + tab.label + "</a>"+ "<br>"+ "\r";
});
gClipboardHelper.copyString(txt);
})();},image:""},
{},
{
label:"复制 Favicon 的 URL",
text:"%FAVICON%",
image:" "
}, {
label:"复制 Favicon 的 Base64",
text:"%FAVICON_BASE64%",
image:" "
}
];
var menu = TabMenu({id:"context_TabInfoCopy",onpopupshowing: syncHidden});
menu(items);
};
//复制链接文本地址
new function () {
var items = [
{
label:"复制链接地址(A)",
command:"context-copylink",
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFklEQVQ4T6XTvSuGURzG8c+zGxnIoCgbCyUGiUnJSylSDFIGmZWUEjbFaFCUmESUxcugsBhkpSz4FwwGnTp33Y/u57nVfbbz8vv+znWd65QUHKWC9f4DaMc2OvCGTRwnjfMAwzjEMg7Qi10sYS9AqgFGY9EIrlNSJ7GK1jxAExpwj3p8RUhbXKupBOjGJ95jwRzW0IifKGcIXVmAfpxiBicIxTvowyMSTwbivMyDQLxB0HiGBWxhEFcYw36c32W9wgPOsYG6KGEq3iicb0Ft0jkL8I1OvMTNxLgefKQ8Kcte+hlfsYKj1IngSZAzgYus1KYBszFl87jFNNYxjstKkf8bpGBgSFkznrCI52r/JS/KuX+tMOAX/9gzEZGy3OQAAAAASUVORK5CYII="
},
{
label:"复制链接文本",
text:"%LINK_TEXT%",
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA/0lEQVQ4T6XTsStFYRjH8c/9SzDJYJDFIAausitGBgOLwT/AYuCKQSmjhUERmxR/giiMymIUmQz06L11ei+9p+5bZzrP++37/H7nNHR5GpX7OxiqwfvAHD5jtgp4xi5uC5Br9CHmOwDzuCkAvkuAcaz9AblCE0VA1wY9WEgGF9jObIoGEU5vuvSKpwwQhtFCvKsV4gQ2U3BnaOGhDc1rzFsYxSmWECFOYj+F+Vt3CXCOExwistnAJabTGkXAPRaxh/cEiN2PMFjH4BiPaecRrGIZY/8ZvCGeOF9YwR0OkvoUZjCMl9xgFgOVyqLv9aQa30V/qnSrXWEOqPEjdo78AAIxShEhs/7CAAAAAElFTkSuQmCC"
},
{
label:"复制链接文本+地址",
text:"%LINK_TEXT%\n%l",
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAPklEQVQ4jWNgoCL4TyQWwGcAIQtgNFZDiDUAp1piDEDGBA3A6VdCBhAKRIIGEAOGqAuINoBiFwysAaRg6gAAE7tI6EZZDKkAAAAASUVORK5CYII="
},
{
label: "复制链接源代码",
tooltiptext: "左键:HTML代码\n中键:UBB代码\n右键:MD代码",
onclick: function(event) {
var formats = [
'<a href="%l" target="_blank">%LINK_TEXT%</a>',
"[url=%RLINK_OR_URL%]%RLT_OR_UT%[/url]",
"[%RLT_OR_UT%](%RLINK_OR_URL%)",
];
var str = addMenu.convertText(formats[event.button]);
addMenu.copy(str);
if (event.button === 1) { // 中键点击后自动关闭菜单
document.getElementById("contentAreaContextMenu").hidePopup();
}
},
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAFVBMVEUAAAAAAABmZmbc3Ny3t7eRkZE6OjpRDxSxAAAAAXRSTlMAQObYZgAAADJJREFUCNdjwASCECDAIADhY2UwMQoKsgqAGUyMJiAGoyATYzJMhEEYxhDAoh1hBQYAAPxVA4qkxzcpAAAAAElFTkSuQmCC"
},
];
var menu = PageMenu({ condition:'link', insertBefore:'context-openlink',icon:'image', image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABdklEQVQ4T43TPUiXURTH8Y9pJSpFIEKamxAYhEO1ikOQFAlODTkIgr1gRQSlEA2CvUCUREWBEjQ4FYHoII7i4mpLU0VDRNbQC9WgceI88OchX+723Ht/33t+v3OeKltbO9CGarzB70JWtQX9cTzHnrz7Ew9wI0CbAU6neBUv8AsnEnYTI5sBDqAD77CQFezGMprRtB4g9g+hDq/xuWT1Ic7hWBkQ30O4gtYURfkvcQYruTeFU2VAiCfQjz94gm3owy7cwVV0YT470VJUUCmOFp3EXL4WlYzhPA5jBjtxGfcKwFk8wg90YwmjKfyaoEg/rGzHJAawFoB6fEQtOrGI+7iYoFk0YhA1eJwB/uMG4GiW+yz9x35TZhBWIodYa7iN4cqOBKAHr3A3068834v9GVj0/lt5cgOwD2/xHgfxPS8dQUva+LDeyBchjuMCvmAaDehNi9ey9P8yCkC05RYuVdz6hOt4utEPV57EeLk9RzdsxRRuuP4CTWBJwwkoqucAAAAASUVORK5CYII=",onpopupshowing: syncHidden });
menu(items);
items.forEach(function(it){
if (it.command)
css('#contentAreaContextMenu[addMenu~="link"] #' + it.command + '{ display: none !important; }')
});
};
//图片
new function () {
var items = [
{command: 'context-copyimage-contents',
image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAnElEQVQ4jWNgGCzgAwMDw38S8XtkA/6TYel/bJwEqMn7GRgYBAgYsAGbAR8YGBgMoJIFBAxAkYcZcIGBgWE91BUOeDQvYMDhBQGoyQ5Ql2AzpABqEVYDYCCBAeKdD1A2DARAxQTwGQDTbADFFxgYGOZD2Q+gNIalyLGArAjmrQNQNQlY9GAYgCv6DND4eMOAGICih5yk/IEMS2kAABDmRWASmruSAAAAAElFTkSuQmCC"
},
{command: 'context-reloadimage'},
{command: 'context-copyimage'},
{
label:"复制图片 Base64",
text:"%IMAGE_BASE64%",
image:" "
},
{command: 'context-saveimage'},
{command: 'context-viewimageinfo'},
{},
{
label: "以图识图",
tooltiptext: "谷歌/百度/搜狗/tineye",
condition: "image",
image: " ",
oncommand: function() {
var url = encodeURIComponent(gContextMenu.mediaURL || gContextMenu.imageURL || gContextMenu.bgImageURL);
gBrowser.addTrustedTab('http://www.google.com/searchbyimage?image_url=' + url);
gBrowser.addTrustedTab('http://image.baidu.com/pcdutu?queryImageUrl=' + url);
gBrowser.addTrustedTab('http://pic.sogou.com/ris?query=' + url);
gBrowser.addTrustedTab('http://www.tineye.com/search/?pluginver=firefox-1.0&sort=size&order=desc&url=' + url);
}
},];
var menu = PageMenu({ condition:'image', id:'context-copyimage_new',insertAfter:'context-viewimage', icon:'image', image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAABqUlEQVQ4T7WTO0gDQRCG/9lNULAQUQRBNF6SixYicuYKsRYrbWwELaKWqWxsLLQQH51Ya5HGUgVBBAtRRDT4KDUPLAw2FmKKJODdjlyCcD5OouBWy87MN49/luBx9JCZIHCb22xDDGcy5/nvQsgTFOyLg0ST214oyZVc7qzovGma0eYTctK528wbpIfMeS/Yt5lttQWBJhBNgShW9mFsUiRs8m9AYDUCiC4Qlt1x/wKavUtfrFZbna4ZAyTlSdlfqQF3RbNQ6hREi47NYkxks8mHTs3oVkLGCBxkxrEiK5HJXD9pmlEvBPVWEsurjyBL7bIUY45JFLH+Wms1SPLdArgH+ADAMIieX/Kl/ro6f+MH1VzD/tKaHoouEGH6Lp1sdbQJBAK1Nf7mJ4Dn2FaXnq19nlEkaK6w4N5UOjn4Pjs9bN6AsQNlH/4CFB1ioj1AxSB4n1mOCvAav6oeZ5eqBgEgPRidIYElgPxgLjDTeCp7sf2jal7yt7cbLT6f6CgW1c3j42XBadMTxOBDMJ1Wu0flD/3+RT7tUbWMr35lUCh69HdCJdJijr8BP9bKXB0KZjgAAAAASUVORK5CYII=",onpopupshowing: syncHidden});
menu(items);
items.forEach(function(it){
if (it.command)
css('#contentAreaContextMenu[addMenu~="image"] #' + it.command + '{ display: none !important; }')
});
};
Alles anzeigen