firefox userChrome.js greasemonkeyスクリプトスレ
■ このスレッドは過去ログ倉庫に格納されています
0311名無しさん@お腹いっぱい。
2007/05/09(水) 02:36:23ID:cRfW6U4o0マダ見てたら一応 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 = "http://www.google.co.jp/search?q=" + 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);
})();
■ このスレッドは過去ログ倉庫に格納されています