Firefox 其实自带右键搜索选中文本的,但是有时候我本并不想用默认搜索引擎搜索技术内容(都是上简中互联网的,DDDD)
原来我是用 Selection Context Search 这个拓展的,但是忘记从哪个版本开始,只要一重启 Firefox,这个插件就丢配置,所以使用 addMenuPlus 替代它。
依赖 addMenuPlus.uc.js 脚本
addMenuPlus 是一个非常强大的定制菜单的 uc 脚本。通过配置文件可添加、修改、隐藏菜单,修改后无需重启生效。ywzhaiqi 基于 Griever/addMenu.uc.js 修改增...
下面直接给出 addMenuPlus 配置
new function () {
var items = [{
id: 'addMenu-sitesearch-insertpoint',
label: 'separator',
}, {
label: Services.locale.appLocaleAsBCP47.includes("zh-") ? '生成二维码' : 'Generate QR code',
where: 'tab',
url: "https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?text=%s",
image: "data:image/svg+xml;base64,77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgZmlsbD0iY29udGV4dC1maWxsIiBmaWxsLW9wYWNpdHk9ImNvbnRleHQtZmlsbC1vcGFjaXR5Ij4NCiAgPHBhdGggZD0iTTMgM0wzIDlMOSA5TDkgM0wzIDMgeiBNIDExIDNMMTEgNUwxMyA1TDEzIDNMMTEgMyB6IE0gMTUgM0wxNSA5TDIxIDlMMjEgM0wxNSAzIHogTSA1IDVMNyA1TDcgN0w1IDdMNSA1IHogTSAxNyA1TDE5IDVMMTkgN0wxNyA3TDE3IDUgeiBNIDExIDdMMTEgOUwxMyA5TDEzIDdMMTEgNyB6IE0gMyAxMUwzIDEzTDUgMTNMNSAxMUwzIDExIHogTSA3IDExTDcgMTNMOSAxM0w5IDExTDcgMTEgeiBNIDExIDExTDExIDEzTDEzIDEzTDEzIDExTDExIDExIHogTSAxMyAxM0wxMyAxNUwxNSAx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AgMCAzIDQuNSB6IE0gNyA1TDcgN0wyMiA3TDIyIDVMNyA1IHogTSAzIDEwLjUgQSAxLjUgMS41IDAgMCAwIDEuNSAxMiBBIDEuNSAxLjUgMCAwIDAgMyAxMy41IEEgMS41IDEuNSAwIDAgMCA0LjUgMTIgQSAxLjUgMS41IDAgMCAwIDMgMTAuNSB6IE0gNyAxMUw3IDEzTDEzLjEwNTQ2OSAxM0MxNC4zNjc0NjkgMTEuNzY0IDE2LjA5NCAxMSAxOCAxMUw3IDExIHogTSAxOCAxM0MxNS4yIDEzIDEzIDE1LjIgMTMgMThDMTMgMjAuOCAxNS4yIDIzIDE4IDIzQzE5IDIzIDIwLjAwMDc4MSAyMi42OTkyMTkgMjAuODAwNzgxIDIyLjE5OTIxOUwyMi41OTk2MDkgMjRMMjQgMjIuNTk5NjA5TDIyLjE5OTIxOSAyMC44MDA3ODFDMjIuNjk5MjE5IDIwLjAwMDc4MSAyMyAxOSAyMyAxOEMyMyAxNS4yIDIwLjggMTMgMTggMTMgeiBNIDE4IDE1QzE5LjcgMTUgMjEgMTYuMyAyMSAxOEMyMSAxOS43IDE5LjcgMjEgMTggMjFDMTYuMyAyMSAxNSAxOS43IDE1IDE4QzE1IDE2LjMgMTYuMyAxNSAxOCAxNSB6IE0gMyAxNi41IEEgMS41IDEuNSAwIDAgMCAxLjUgMTggQSAxLjUgMS41IDAgMCAwIDMgMTkuNSBBIDEuNSAxLjUgMCAwIDAgNC41IDE4IEEgMS41IDEuNSAwIDAgMCAzIDE2LjUgeiBNIDcgMTdMNyAxOUwxMS4wODAwNzggMTlDMTEuMDMzMDc4IDE4LjY3MyAxMSAxOC4zNCAxMSAxOEMxMSAxNy42NiAxMS4wMzMwNzggMTcuMzI3IDExLjA4MDA3OCAxN0w3IDE3IHoiIC8+DQo8L3N2Zz4=",
accesskey: 'S',
onshowing: function (e) {
var sel = addMenu.convertText(Services.locale.appLocaleAsBCP47.includes("zh-") ? "搜索: %SEL%" : "Search %SEL% by");
if (sel && sel.length > 15)
sel = sel.substr(0, 15) + "...";
this.label = sel;
let popupNode = this.querySelector('menupopup');
popupNode.querySelectorAll('.auto-generated').forEach(m => { m.parentNode.removeChild(m); })
let ins = popupNode.firstChild;
Services.search.getEngines().then(
engines => engines.forEach((item) => {
let menuitem;
menuitem = addMenu.newMenuitem({
label: item._name,
class: "auto-generated",
where: 'tab',
text: "%s",
keyword: item._definedAliases[0]
});
ins.parentNode.insertBefore(menuitem, ins);
}))
},
});
menu(items);
css("#context-searchselect { display: none } #contentAreaContextMenu #addMenu-search-select .menu-accel-container { visibility: hidden; }");
};