No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

721 líneas
28 KiB

  1. // ========================== KeySnail Init File =========================== //
  2. // この領域は, GUI により設定ファイルを生成した際にも引き継がれます
  3. // 特殊キー, キーバインド定義, フック, ブラックリスト以外のコードは, この中に書くようにして下さい
  4. // ========================================================================= //
  5. //{{%PRESERVE%
  6. // prompt.rows = 12;
  7. // prompt.useMigemo = false;
  8. // prompt.migemoMinWordLength = 2;
  9. // prompt.displayDelayTime = 300;
  10. // command.kill.killRingMax = 15;
  11. // command.kill.textLengthMax = 8192;
  12. //userscript.addLoadPath(".");
  13. //userscript.require("verticaltab.js");
  14. //////////////////////////////////////
  15. //// sitelocalkeymap
  16. var local = {};
  17. plugins.options["site_local_keymap.local_keymap"] = local;
  18. function fake(k, i) function () { key.feed(k, i); };
  19. function pass(k, i) [k, fake(k, i)];
  20. function ignore(k, i) [k, null];
  21. // ext.add("ext-name", function () {}, "ext description");
  22. // style.register("");
  23. // local["^http://"] = [['a', function(ev, arg){}],];
  24. ///////////////////////////////////////////
  25. //// firefox
  26. // style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}");
  27. util.setPrefs(
  28. {
  29. "browser.tabs.loadDivertedInBackground": true,
  30. "dom.disable_window_open_feature.location": false,
  31. "dom.max_script_run_time": 30,
  32. "browser.bookmarks.max_backups":0,
  33. "browser.urlbar.autocomplete.enabled":false,
  34. "browser.cache.memory.capacity":16384,
  35. "browser.sessionhistory.max_total_viewers":8,
  36. "browser.download.manager.closeWhenDone":true,
  37. "browser.download.useDownloadDir":false,
  38. "browser.tabs.closeWindowWithLastTab":false,
  39. "network.dns.disableIPv6":true,
  40. "browser.urlbar.trimURLs":false,
  41. "browser.fullscreen.autohide":false,
  42. "keyword.URL":"http://www.bing.com/search?q=",
  43. }
  44. );
  45. ///////////////////////////////////
  46. //検索エンジン
  47. plugins.options["search-url-list"] = [
  48. ["bing","http://bing.com/search?q=%q"],
  49. ["yatwitter search","http://yats-data.com/yats/search?query=%q"],
  50. ["twitter search","http://search.twitter.com/search?q=%q&lang=all"],
  51. ["tospy", "http://topsy.com/s?allow_lang=ja&q=%q"],
  52. ["2ch","http://2ch-ranking.net/search.php?q=%q&imp=and&order=time"],
  53. ["I\'m feelig lucky!","http://www.google.co.jp/search?q=%q&btnI=kudos"],
  54. ["uncyclopedia","http://ja.uncyclopedia.info/wiki/%q"],
  55. ["wikipedia","http://ja.wikipedia.org/wiki/%q"],
  56. ["nicovideo.jp","http://www.nicovideo.jp/search/%q"],
  57. ["alc","http://eow.alc.co.jp/%q/UTF-8/"],
  58. ["google map","http://maps.google.co.jp/maps?hl=ja&q=%q&um=1&ie=UTF-8&sa=N&tab=wl"],
  59. ["weblio","http://www.weblio.jp/content_find?query=%q"],
  60. ["shoutcast","http://www.shoutcast.com/Internet-Radio/%q"],
  61. ["10sr.posterous.com","http://www.google.com/search?q=%q&ie=UTF-8&oe=UTF-8&hl=ja&domains=10sr.posterous.com&sitesearch=10sr.posterous.com"],
  62. ["delicious 10sr","http://delicious.com/10sr?addtag=%q&setcount=50&opennew=1"],
  63. ["open raw","%r"],
  64. ];
  65. plugins.options["my-keysnail-bookmarks"] = [
  66. "twitter.com",
  67. ];
  68. //sitelocal
  69. //////////////////////////////////////////
  70. // 2ch chaika
  71. local["^http://127.0.0.1:8823/thread/"] = [
  72. ['k', function (ev, arg) {
  73. curl = window.content.location.href;
  74. kurl = curl.replace(/http:.*thread\/(.*\/).*/, "chaika://post/$1");
  75. window.content.location.href = kurl;
  76. }
  77. ],
  78. ];
  79. local["^http://w2.p2.2ch.net/p2/read.php"] = [
  80. ['k', function (ev, arg) {
  81. var url = window.content.location.href;
  82. var pt = /host=(.*?)&bbs=(.*?)&key=(.*?)&ls=/ ;
  83. var result = url.match(pt);
  84. var k = format("chaika://post/http://%s/test/read.cgi/%s/%s/", result[1], result[2], result[3]);
  85. window.content.location.href = k;
  86. }
  87. ],
  88. ];
  89. /////////////////////////////////////////
  90. // feedly用マップ
  91. local["^http://www.feedly.com/"] = [
  92. ['d', null],
  93. ['j', null],
  94. ['k', null],
  95. ['n', null],
  96. ['p', null],
  97. ['o', null],
  98. ['b', null],
  99. ['S', null],
  100. ['s', null],
  101. ['?', null],
  102. ['r', null],
  103. ['g', null],
  104. // ['x', function (ev, arg) {ev.target.dispatchEvent(key.stringToKeyEvent("g", true));}],
  105. ['l', function (ev, arg) {window.content.location.href = "http://www.feedly.com/home#latest";}],
  106. [['t', 'p'], function (ev, arg) {ev.target.dispatchEvent(key.stringToKeyEvent("t", true));}],
  107. [['t', 'w'], function (ev, arg) {ext.exec("twitter-client-tweet", arg, ev);}],
  108. ];
  109. /////////////////////////////////////////
  110. //nicovideo用
  111. local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [
  112. ["i", function (ev, arg) { ext.exec("nicoinfo", arg); }],
  113. ["p", function (ev, arg) { ext.exec("nicopause", arg); }],
  114. ["o", function (ev, arg) { ext.exec("nicommentvisible", arg); }],
  115. ["m", function (ev, arg) { ext.exec("nicomute", arg); }],
  116. [".", function (ev, arg) { ext.exec("nicovolumeIncrement", arg); }],
  117. [",", function (ev, arg) { ext.exec("nicovolumeDecrement", arg); }],
  118. ['f', function (ev, arg) {
  119. curl = window.content.location.href;
  120. kurl = curl.replace(/nicovideo.jp/, "nicovideofire.jp");
  121. window.content.location.href = kurl;
  122. }
  123. ],
  124. ];
  125. /////////////////////////////////////////
  126. // tumblr/dashboard
  127. local["^http://www.tumblr.com/dashboard"] = [
  128. // ["C-<left>", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(-1, true); }],
  129. // ["C-<right>", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(1, true); }],
  130. ["<left>", function (ev, arg) {window.content.location.href = "http://www.tumblr.com/dashboard"; }],
  131. // ["<right>", null],
  132. ["J", function (ev, arg) {
  133. if (window.loadURI) {
  134. loadURI("javascript:(function(){b=20;s=100;t=document.getElementById('next_page_link').href.split('/')[5];max=t.substr(0,t.length-5);min=max-s;i=Math.floor(Math.random()*(max-min)+min);u=(i<b)?'http://www.tumblr.com/dashboard':'http://www.tumblr.com/dashboard/2/'+i+'00000';window.content.location.href=u;}())");
  135. }
  136. }],
  137. ];
  138. ///////////////////////////////////
  139. //tanythhing用
  140. plugins.options["tanything_opt.keymap"] = {
  141. "\\" : "prompt-cancel",
  142. "j" : "prompt-next-completion",
  143. "k" : "prompt-previous-completion",
  144. "o" : "localOpen",
  145. ":" : "localClose",
  146. "L" : "localMovetoend"
  147. };
  148. //////////////////////////////////////////
  149. // yatc
  150. style.register("#keysnail-twitter-client-container{ display:none !important; }");
  151. plugins.options["twitter_client.popup_new_statuses"] = false;
  152. plugins.options["twitter_client.automatically_begin"] = false;
  153. plugins.options["twitter_client.automatically_begin_list"] = false;
  154. plugins.options["twitter_client.timeline_count_beginning"] = 0;
  155. plugins.options["twitter_client.timeline_count_every_updates"] = 0;
  156. plugins.options["twitter_client.tweet_keymap"] = {
  157. "C-RET" : "prompt-decide",
  158. "RET" : ""
  159. };
  160. plugins.options["twitter_client.jmp_id"] = "10sr";
  161. plugins.options["twitter_client.jmp_key"] = "R_c51f889a77cb4b4e993ed868f65083f5";
  162. plugins.options["twitter_client.use_jmp"] = true;
  163. ////////////////////////////////////////////
  164. // エクステ
  165. ext.add('auto-install-plugins', function(ev, arg){
  166. var urls = [
  167. 'https://github.com/mooz/keysnail/raw/master/plugins/yet-another-twitter-client-keysnail.ks.js',
  168. 'https://github.com/mooz/keysnail/raw/master/plugins/site-local-keymap.ks.js',
  169. 'https://github.com/azu/KeySnail-Plugins/raw/master/JSReference/js-referrence.ks.js',
  170. 'https://raw.github.com/gongo/keysnail_plugin/master/linksnail.ks.js',
  171. 'https://github.com/tkosaka/keysnail-plugin/raw/master/nicontroller.ks.js',
  172. 'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js',
  173. 'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js',
  174. 'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js',
  175. ];
  176. function inst(a){
  177. if(a.length == 0){
  178. display.showPopup("auto-install-plugins", "All installation finished.");
  179. }else{
  180. var url = a.shift();
  181. var path = userscript.pluginDir + userscript.directoryDelimiter + url.match(/[^/]+$/)[0];
  182. if(plugins.context[path] === undefined){
  183. userscript.installPluginFromURL(url, function(){inst(a);});
  184. }else{
  185. inst(a);
  186. }
  187. }
  188. }
  189. inst(urls);
  190. }, 'Install plugins automatically if not installed yet.');
  191. ext.add('put-aside-this-page', function (ev, arg) {
  192. var n = gBrowser.mCurrentTab._tPos;
  193. gBrowser.moveTabTo(gBrowser.mCurrentTab, 0);
  194. if (n != 0) {
  195. gBrowser.selectedTab = gBrowser.mTabs[n];
  196. }
  197. }, 'put aside this page');
  198. ext.add('send-escape', function (ev, arg) {
  199. ev.target.dispatchEvent(key.stringToKeyEvent("ESC", true));
  200. }, 'escape');
  201. ext.add("open-hatebu-comment", function (ev, arg) {
  202. if (window.loadURI) {
  203. loadURI("javascript:location.href='http://b.hatena.ne.jp/entry?mode=more&url='+escape(location.href);");
  204. }
  205. }, 'hatebu');
  206. ext.add("fullscreen-page",function (ev) {
  207. getBrowser().selectedTab = getBrowser().addTab("http://home.tiscali.nl/annejan/swf/timeline.swf");
  208. BrowserFullScreen();
  209. }, "fullscreen page");
  210. ext.add("focus-on-content", function(){
  211. let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
  212. gBrowser.focus();
  213. content.focus();
  214. }, "forcus on content");
  215. ext.add("hide-sidebar", function(){
  216. var sidebarBox = document.getElementById("sidebar-box");
  217. if (!sidebarBox.hidden) {
  218. toggleSidebar(sidebarBox.getAttribute("sidebarcommand"));
  219. }
  220. }, "hide-sidebar");
  221. ext.add("close-and-next-tab", function (ev, arg) {
  222. var n = gBrowser.mCurrentTab._tPos;
  223. BrowserCloseTabOrWindow();
  224. gBrowser.selectedTab = gBrowser.mTabs[n];
  225. }, "close and focus to next tab");
  226. /////////////////////////////////////
  227. // google itranslate
  228. (function(){
  229. let targetLang = "ja"; // target lang to translate into
  230. let alternativeLang = "en"; // if given word is in targetLang, use this instead as a target lang
  231. function translate(word, target, next) {
  232. next("", "", " getting...");
  233. const base = "https://www.googleapis.com/language/translate/v2?key=%s&q=%s&target=%s";
  234. const apikey = "AIzaSyBq48p8NhFgaJ1DfUJ5ltbwLxeXpjEL86A";
  235. let ep = util.format(base, apikey, encodeURIComponent(word), target);
  236. util.httpGet(ep, false, function (res) {
  237. if (res.status === 200) {
  238. let json = decodeJSON(res.responseText);
  239. let srclang = json.data.translations[0].detectedSourceLanguage;
  240. if (target == srclang) {
  241. lookupword(word, alternativeLang);
  242. } else {
  243. let result = json.data.translations[0].translatedText;
  244. next(srclang, target, result);
  245. }
  246. } else {
  247. next("", "", "ERROR!");
  248. }
  249. });
  250. };
  251. function echo(srclang, from, tglang, to){
  252. display.echoStatusBar(srclang + " : " + from + " -> " + tglang + " : " + to);
  253. };
  254. function decodeJSON(json) {
  255. return util.safeEval("(" + json + ")");
  256. };
  257. function lookupword(word, target){
  258. translate(word, target, function (src, tg, translated) {
  259. echo(src, word, tg, translated);
  260. });
  261. };
  262. function read (aInitialInput) {
  263. let prevText = "";
  264. prompt.reader({
  265. message : "word or sentence to translate:",
  266. initialinput : aInitialInput,
  267. onChange: function (arg) {
  268. let word = arg.textbox.value;
  269. if (word !== prevText) {
  270. prevText = word;
  271. lookupword(word, targetLang);
  272. }
  273. },
  274. callback: function (s){},
  275. });
  276. };
  277. ext.add("google-itranslate",function(){read(content.document.getSelection() || "");},"google itranslate");
  278. })();
  279. //////////////////////////////////////
  280. //
  281. ext.add("restart-firefox-add-menu", function(){
  282. const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
  283. var cmdelm = document.createElementNS(XUL_NS, "command");
  284. cmdelm.setAttribute("id", "my_cmd_restartFirefoxKs")
  285. cmdelm.setAttribute("oncommand", "ext.exec('restart-firefox');");
  286. var commandset = document.getElementById("mainCommandSet");
  287. // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem"));
  288. commandset.appendChild(cmdelm);
  289. var menuelm = document.createElementNS(XUL_NS, "menuitem");
  290. menuelm.setAttribute("label", "Restart Firefox");
  291. menuelm.setAttribute("id", "my_menu_restartFirefoxKs")
  292. menuelm.setAttribute("command", "my_cmd_restartFirefoxKs");
  293. var menu = document.getElementById("menu_FilePopup");
  294. // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem"));
  295. menu.appendChild(menuelm);
  296. }, "add restart firefox menu");
  297. //////////////////////////////////////
  298. // restart firefox
  299. // http://keysnail.g.hatena.ne.jp/Shinnya/20100723/1279878815
  300. ext.add("restart-firefox",function (ev) {
  301. const nsIAppStartup = Components.interfaces.nsIAppStartup;
  302. // Notify all windows that an application quit has been requested.
  303. var os = Components.classes["@mozilla.org/observer-service;1"]
  304. .getService(Components.interfaces.nsIObserverService);
  305. var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
  306. .createInstance(Components.interfaces.nsISupportsPRBool);
  307. os.notifyObservers(cancelQuit, "quit-application-requested", null);
  308. // Something aborted the quit process.
  309. if (cancelQuit.data)
  310. return;
  311. // Notify all windows that an application quit has been granted.
  312. os.notifyObservers(null, "quit-application-granted", null);
  313. // Enumerate all windows and call shutdown handlers
  314. var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
  315. .getService(Components.interfaces.nsIWindowMediator);
  316. var windows = wm.getEnumerator(null);
  317. while (windows.hasMoreElements()) {
  318. var win = windows.getNext();
  319. if (("tryToClose" in win) && !win.tryToClose())
  320. return;
  321. }
  322. Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup)
  323. .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
  324. }, "restart firefox");
  325. /////////////////////////////////////////
  326. // copy feed url
  327. ext.add("copy-url", function () {
  328. const doc = content.document;
  329. let feeds = [[e.getAttribute("title"), e.getAttribute("href")]
  330. for ([, e] in Iterator(doc.querySelectorAll(['link[type="application/rss+xml"]',
  331. 'link[type="application/atom+xml"]'])))];
  332. var uh = window.content.location.href.replace(/(.*?\/\/[^/]*)(\/.*)?/,"$1");
  333. for (i = 0; i < feeds.length; i++)
  334. if ( feeds[i][1].substr(0,1) == "/" ) feeds[i][1] = uh + feeds[i][1];
  335. feeds.unshift([window.content.document.title,window.content.location.href]);
  336. prompt.selector(
  337. {
  338. message : "Select Feed",
  339. collection : feeds,
  340. callback : function (i) {
  341. if (i >= 0)
  342. command.setClipboardText(feeds[i][1]);
  343. }
  344. }
  345. );
  346. }, "Copy url or feed url of current page");
  347. ///////////////////////////////////////
  348. // 評価しちゃうっぽい とりあえずこんな感じで
  349. ext.add("keysnail-setting-menu",function(){
  350. var settingmenulist = [["keysnail setting dialogue", function(){return function(){KeySnail.openPreference();};}],
  351. ["keysnail plugin manager", function(){return function(){userscript.openPluginManager();}}],
  352. ["firefox addon manager", function(){return function(){BrowserOpenAddonsMgr();};}],
  353. ["reload .keysnail.js", function(){return function() {userscript.reload();};}],
  354. // ["check for plugins update", function(){return function(){ext.exec("check-for-plugins-update");};}],
  355. ["restart firefox", function(){return function(){ext.exec("restart-firefox");};}],
  356. ];
  357. prompt.selector(
  358. {
  359. message : "open setting dialog",
  360. collection : settingmenulist,
  361. callback : function (i) { settingmenulist[i][1]()(); },
  362. });
  363. },"open keysnail setting menu");
  364. // //////////////////////////
  365. // //プラグイン一括アップデート
  366. // ext.add("check-for-plugins-update", function () {
  367. // [p for (p in plugins.context)].forEach(function (p) { try { userscript.updatePlugin(p); } catch(e) {} });
  368. // }, "Check for all plugin's update");
  369. ////////////////////////
  370. //マルチプルタブハンドラ
  371. ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () {
  372. BrowserCloseTabOrWindow();
  373. // if (MultipleTabService) {
  374. // //BrowserCloseTabOrWindow();
  375. // //MultipleTabService.setSelection(gBrowser.mCurrentTab, true);
  376. MultipleTabService.closeTabs(MultipleTabService.getSelectedTabs());
  377. // } else {
  378. // BrowserCloseTabOrWindow();}
  379. }, '選択タブと現在のタブを閉じる');
  380. ext.add("if-mth-exist", function() {
  381. if (MultipleTabService === undefined) display.echoStatusBar("mth not exist.");
  382. },'if mth exist');
  383. ////////////////////////
  384. //検索
  385. ext.add("query-then-engine", function () {
  386. prompt.reader({message : "Search Word?:",
  387. callback : function (q) {
  388. if (q) {
  389. prompt.selector({ message : "search \"" + q + "\" with?",
  390. collection : plugins.options["search-url-list"],
  391. width : [20,80],
  392. callback : function (i) { getBrowser().selectedTab = getBrowser().addTab(plugins.options["search-url-list"][i][1].replace("%r",q).replace("%q",encodeURIComponent(q))); },
  393. });
  394. };
  395. },
  396. initialInput : content.document.getSelection() || "",
  397. });
  398. }, "enter search word and then select engine");
  399. /////////////////////////////////////
  400. // 閉じたタブリスト
  401. ext.add("list-closed-tabs", function () {
  402. const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
  403. var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
  404. var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
  405. var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))];
  406. if (!closedTabs.length)
  407. return void display.echoStatusBar("最近閉じたタブが見つかりませんでした", 2000);
  408. prompt.selector(
  409. {
  410. message : "select tab to undo:",
  411. collection : closedTabs,
  412. flags : [ICON | IGNORE, 0, 0],
  413. callback : function (i) { if (i >= 0) window.undoCloseTab(i); }
  414. });
  415. }, "List closed tabs");
  416. ext.add("echo-closed-tabs", function () {
  417. var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
  418. var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
  419. // var closedTabs = [[tab.image || fav, tab.title, tab.url] for each (tab in json.decode(ss.getClosedTabData(window)))];
  420. var lasttab = json.decode(ss.getClosedTabData(window))[0];
  421. dump = ""
  422. for (var i in lasttab) { dump += lasttab[i] + "\n"; }
  423. confirm(dump);
  424. }, "List closed tabs");
  425. //}}%PRESERVE%
  426. // ========================================================================= //
  427. // ========================= Special key settings ========================== //
  428. key.quitKey = "<delete>";
  429. key.helpKey = "C-h";
  430. key.escapeKey = "C-q";
  431. key.macroStartKey = "";
  432. key.macroEndKey = "";
  433. key.universalArgumentKey = "C-u";
  434. key.negativeArgument1Key = "C--";
  435. key.negativeArgument2Key = "C-M--";
  436. key.negativeArgument3Key = "M--";
  437. key.suspendKey = "Not defined";
  438. // ================================= Hooks ================================= //
  439. hook.setHook('KeySnailInitialized', function () {
  440. ext.exec("shiitake-enable-style");
  441. });
  442. hook.setHook('KeyBoardQuit', function (aEvent) {
  443. ext.exec("hide-sidebar");
  444. let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
  445. gBrowser.focus();
  446. content.focus();
  447. command.closeFindBar();
  448. if (util.isCaretEnabled()) {
  449. command.resetMark(aEvent);
  450. } else {
  451. goDoCommand("cmd_selectNone");
  452. }
  453. key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
  454. });
  455. hook.addToHook('KeyBoardQuit', function (aEvent) {});
  456. hook.setHook('Unload', function () {
  457. util.getBrowserWindows().some(function (win) {
  458. if (win === window) {
  459. return false;
  460. }
  461. const ks = win.KeySnail;
  462. share.pluginUpdater = ks.getPluginUpdater(share.pluginUpdater.pluginsWithUpdate);
  463. ks.setUpPluginUpdaterDelegator();
  464. return true;
  465. });
  466. });
  467. // ============================= Key bindings ============================== //
  468. key.setGlobalKey('C-<right>', function () {
  469. gBrowser.mTabContainer.advanceSelectedTab(1, true);
  470. }, 'ひとつ右のタブへ');
  471. key.setGlobalKey('C-<left>', function () {
  472. gBrowser.mTabContainer.advanceSelectedTab(-1, true);
  473. }, 'ひとつ左のタブへ');
  474. key.setGlobalKey('C-<up>', function () {
  475. var browser = getBrowser();
  476. if (browser.mCurrentTab.previousSibling) {
  477. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1);
  478. } else {
  479. browser.moveTabTo(browser.mCurrentTab, browser.mTabContainer.childNodes.length - 1);
  480. }
  481. }, '選択中のタブを右へ');
  482. key.setGlobalKey('C-<down>', function () {
  483. var browser = getBrowser();
  484. if (browser.mCurrentTab.nextSibling) {
  485. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1);
  486. } else {
  487. browser.moveTabTo(browser.mCurrentTab, 0);
  488. }
  489. }, '選択中のタブを左へ');
  490. key.setGlobalKey('M-:', function (ev) {
  491. command.interpreter();
  492. }, 'JavaScript のコードを評価');
  493. key.setViewKey('D', function (ev, arg) {
  494. ext.exec("dig-url", arg, ev);
  495. }, 'dig url with selector', true);
  496. key.setViewKey('x', function (aEvent, aArg) {
  497. ext.select(aArg, aEvent);
  498. }, 'エクステ一覧');
  499. key.setViewKey(['t', 'm'], function (ev, arg) {
  500. if (window.loadURI) {
  501. loadURI("javascript:window.location='http://api.tweetmeme.com/visit?url='+window.location;");
  502. }
  503. }, 'open with tweetmeme');
  504. key.setViewKey(['t', 'w'], function (ev, arg) {
  505. ext.exec("twitter-client-tweet", arg, ev);
  506. }, 'つぶやく', true);
  507. key.setViewKey(['t', 'p'], function (ev, arg) {
  508. ext.exec("twitter-client-tweet-this-page", arg, ev);
  509. }, 'このページのタイトルと URL を使ってつぶやく', true);
  510. key.setViewKey('u', function () {
  511. undoCloseTab();
  512. }, '閉じたタブを元に戻す');
  513. key.setViewKey('g', function () {
  514. goDoCommand("cmd_scrollTop");
  515. }, 'ページ先頭へ移動');
  516. key.setViewKey('G', function () {
  517. goDoCommand("cmd_scrollBottom");
  518. }, 'ページ末尾へ移動');
  519. key.setViewKey('r', function (aEvent) {
  520. BrowserReload();
  521. }, '再読み込み');
  522. key.setViewKey('m', function (ev, arg) {
  523. _fi.toogle();
  524. }, 'fetchimiをトグル');
  525. key.setViewKey('d', function (ev, arg) {
  526. if (window.loadURI) {
  527. loadURI("javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=1,links=0,scrollbars=0,toolbar=0,width=550,height=585'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()");
  528. }
  529. }, 'deliciousでブックマーク');
  530. key.setViewKey('p', function (ev, arg) {
  531. if (window.loadURI) {
  532. loadURI("javascript:var%20b=document.body;var%20POSTEROUS___bookmarklet_domain='http://posterous.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src='http://posterous.com/javascripts/bookmarklet2.js');void(b.appendChild(z));}else{}");
  533. }
  534. }, 'posterousに投稿');
  535. key.setViewKey('SPC', function (ev, arg) {
  536. MultipleTabService.toggleSelection(gBrowser.mCurrentTab);
  537. gBrowser.mTabContainer.advanceSelectedTab(1, true);
  538. }, 'タブの選択をトグルして次のタブ');
  539. key.setViewKey('S-SPC', function (ev, arg) {
  540. MultipleTabService.toggleSelection(gBrowser.selectedTab);
  541. gBrowser.mTabContainer.advanceSelectedTab(-1, true);
  542. }, 'タブの選択をトグルして前のタブ');
  543. key.setViewKey('z', function (ev, arg) {
  544. ext.exec("keysnail-setting-menu", arg, ev);
  545. }, 'open keysnail setting menu', true);
  546. key.setViewKey('T', function (ev, arg) {
  547. ext.exec("google-itranslate", arg, ev);
  548. }, 'google itranslate', true);
  549. key.setViewKey('C-SPC', function (ev, arg) {
  550. MultipleTabService.toggleSelection(gBrowser.selectedTab);
  551. }, 'タブの選択をトグル');
  552. key.setViewKey('U', function (ev, arg) {
  553. ext.exec("list-closed-tabs", arg, ev);
  554. }, 'List closed tabs', true);
  555. key.setViewKey('e', function () {
  556. command.focusElement(command.elementsRetrieverTextarea, 0);
  557. }, '最初のインプットエリアへフォーカス', true);
  558. key.setViewKey('S', function (ev, arg) {
  559. if (window.loadURI) {
  560. loadURI("javascript:var%20b=document.body;var%20GR________bookmarklet_domain='https://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='https://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}");
  561. }
  562. }, 'google reader share');
  563. key.setViewKey('!', function (ev, arg) {
  564. shell.input();
  565. }, 'Command system');
  566. key.setViewKey('b', function (ev, arg) {
  567. BarTap.putOnTap(gBrowser.mCurrentTab, gBrowser);
  568. }, 'bartab put on tab');
  569. key.setViewKey('R', function () {
  570. BrowserReloadSkipCache();
  571. }, '更新(キャッシュを無視)');
  572. key.setViewKey('<backspace>', function () {
  573. BrowserBack();
  574. }, '戻る');
  575. key.setViewKey('S-<backspace>', function () {
  576. BrowserForward();
  577. }, '進む');
  578. key.setViewKey('q', function (ev, arg) {
  579. ext.exec("query-then-engine", arg, ev);
  580. }, 'enter search word and then select engine', true);
  581. key.setViewKey('/', function () {
  582. command.iSearchForward();
  583. }, 'インクリメンタル検索', true);
  584. key.setViewKey('?', function (ev) {
  585. command.iSearchForwardKs(ev);
  586. }, 'Emacs ライクなインクリメンタル検索', true);
  587. key.setViewKey('a', function (ev, arg) {
  588. allTabs.open();
  589. }, 'alltabs.open');
  590. key.setViewKey('<left>', function (ev) {
  591. goDoCommand("cmd_scrollPageUp");
  592. }, '一画面分スクロールアップ');
  593. key.setViewKey('<right>', function (ev) {
  594. goDoCommand("cmd_scrollPageDown");
  595. }, '一画面スクロールダウン');
  596. key.setViewKey([['<prior>'], ['<next>']], function (ev, arg) {
  597. return;
  598. }, 'ignore');
  599. key.setViewKey(':', function (ev, arg) {
  600. return !document.getElementById("keysnail-prompt").hidden &&
  601. document.getElementById("keysnail-prompt-textbox").focus();
  602. }, 'KeySnail のプロンプトへフォーカス', true);
  603. key.setViewKey('H', function (ev, arg) {
  604. ext.exec("open-hatebu-comment", arg, ev);
  605. }, 'hatebu', true);
  606. key.setViewKey('l', function (ev) {
  607. command.focusToById("urlbar");
  608. }, 'ロケーションバーへフォーカス', true);
  609. key.setViewKey('0', function (ev) {
  610. BrowserCloseTabOrWindow();
  611. }, 'タブ / ウィンドウを閉じる');
  612. key.setViewKey('C', function (ev, arg) {
  613. ext.exec("linksnail", arg, ev);
  614. }, 'LinkSnail', true);
  615. key.setEditKey('C-<tab>', function (ev) {
  616. command.walkInputElement(command.elementsRetrieverTextarea, true, true);
  617. }, '次のテキストエリアへフォーカス');
  618. key.setViewKey('I', function (ev, arg) {
  619. ext.exec('instapaper-post-page-with-comment', arg, ev);
  620. }, 'post page and comment', true);