07/05/09 02:36:23 cRfW6U4o0
>>308
マダ見てたら一応 Tb2.0forWinで動いた。
(function() {
const Prgpath = "C:\\Program Files\\Mozilla Firefox\\firefox.exe"
window.SelectionSearch = function() {
var win = document.commandDispatcher.focusedWindow;
var sel = win.getSelection().toString();
if ( !sel ) return;
sel = sel.split("\n");
var param = encodeURI(sel);
param = "URLリンク(www.google.co.jp) + param + "&lr=lang_ja&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&client=firefox";
var file = Components.classes['@mozilla.org/file/local;1'].getService(Components.interfaces.nsILocalFile);
var process = Components.classes['@mozilla.org/process/util;1'].getService(Components.interfaces.nsIProcess);
file.initWithPath(Prgpath);
process.init(file);
var arr=new Array();
arr[0]=param;
var out = {};
process.run(false,arr,arr.length,out);
};
var newItem = document.createElement("menuitem");
newItem.setAttribute("label", "Search by Google");
newItem.setAttribute("id", "SearchSelection_menu");
newItem.setAttribute("oncommand", "SelectionSearch();");
document.getElementById("messagePaneContext").appendChild(newItem);
document.getElementById("messagePaneContext").addEventListener("popupshowing", function() {
document.getElementById("SearchSelection_menu").hidden = !gContextMenu.isTextSelected;
}, false);
})();