25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

1300 satır
41 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. // Original is at https://gist.github.com/Griever/62715
  13. ext.add("open-bookmarks-in-new-tab", function(){
  14. // this makes all clicks open in new tab.
  15. // return;
  16. // test if firefox 12
  17. if (12 > parseFloat(Cc['@mozilla.org/xre/app-info;1'].
  18. getService(Ci.nsIXULAppInfo).version)) {
  19. return;
  20. }
  21. // I cannot fully understand what happen but keysnail emit error
  22. // *after* initialization of firefox finished successfully and I assured
  23. // that new tabs open as I expect when clicking bookmarks, for example,
  24. // when I try to tweet using the twitter keysnail plugin, with error
  25. // message saying "whereToOpenLink is undefined.".
  26. // if no modifier key pressed open in new tab.
  27. try {
  28. var whereToOpenLink_org = new String(window.whereToOpenLink.toString());
  29. window.whereToOpenLink = eval(
  30. "(" +
  31. whereToOpenLink_org.replace(
  32. '{',
  33. '{ if(!e || ' +
  34. '(!e.ctrlKey && !e.shiftKey && !e.metaKey && ' +
  35. '!(e.altKKey && !ignoreAlt))) ' +
  36. 'return "tab";'
  37. ) +
  38. ")"
  39. );
  40. } catch (e if e instanceof TypeError) {
  41. return;
  42. }
  43. // This is useless because this makes reload open new tab.
  44. // window.whereToOpenLink = function(e, ib, ia){ return "tab"; };
  45. }, "open in new tab");
  46. // ext.exec("open-bookmarks-in-new-tab");
  47. //////////////////////////////////////
  48. //// sitelocalkeymap
  49. var local = {};
  50. plugins.options["site_local_keymap.local_keymap"] = local;
  51. function fake(k, i) function(){ key.feed(k, i); };
  52. function pass(k, i) [k, fake(k, i)];
  53. function ignore(k, i) [k, null];
  54. // ext.add("ext-name", function () {}, "ext description");
  55. // style.register("");
  56. // local["^http://"] = [['a', function(ev, arg){}],];
  57. ///////////////////////////////////////////
  58. //// firefox
  59. // style.register("#bookmarksPanel > hbox,#history-panel > hbox {" +
  60. // "display: none !important;}" +
  61. // " //#urlbar-container{max-width: 500px !important;}");
  62. // style.register( //not work
  63. // <><![CDATA[
  64. // input,textarea {
  65. // font-family: monospace !important;
  66. // }
  67. // ]]></>.toString()
  68. // );
  69. style.register(
  70. '@-moz-document ' +
  71. 'url-prefix(\"http://www.tumblr.com/\"), ' +
  72. 'url-prefix(\"https://www.tumblr.com/\") ' +
  73. '{ #pagination {' +
  74. 'position: fixed;' +
  75. 'bottom: 50px;' +
  76. 'right: 100px;' +
  77. 'padding-right: 0px !important' +
  78. '} }' , style.XHTML);
  79. ///////////////////////////////////
  80. //search engine
  81. plugins.options["search-url-list"] = [
  82. ["DuckDuckGo", "https://duckduckgo.com/?q=%q"],
  83. ["Bing", "http://bing.com/search?q=%q"],
  84. ["yatwitter search", "http://yats-data.com/yats/search?query=%q"],
  85. ["Yahoo Realtime",
  86. "http://realtime.search.yahoo.co.jp/search?rkf=1&ei=UTF-8&p=%q"],
  87. ["Twitter Search", "http://twitter.com/search?q=%q&lang=all"],
  88. ["Tospy", "http://topsy.com/s?allow_lang=ja&q=%q"],
  89. ["2ch syoboi.jp", "http://ff2ch.syoboi.jp/?q=%q"],
  90. ["2ch-ranking","http://2ch-ranking.net/search.php?q=%q&imp=and&order=time"],
  91. ["2ch ttsearch", "http://ttsearch.net/s2.cgi?k=%q&o=r"],
  92. ["I\'m feelig lucky!", "http://www.google.co.jp/search?q=%q&btnI=kudos"],
  93. ["Uncyclopedia", "http://ja.uncyclopedia.info/wiki/%q"],
  94. ["Wikipedia", "http://ja.wikipedia.org/wiki/%q"],
  95. ["nicovideo.jp", "http://www.nicovideo.jp/search/%q"],
  96. ["alc", "http://eow.alc.co.jp/%q/UTF-8/"],
  97. ["google map",
  98. "http://maps.google.co.jp/maps?hl=ja&q=%q&um=1&ie=UTF-8&sa=N&tab=wl"],
  99. ["Weblio", "http://www.weblio.jp/content_find?query=%q"],
  100. ["ShoutCast", "http://www.shoutcast.com/Internet-Radio/%q"],
  101. ["Delicious 10sr", "http://delicious.com/10sr/%q"],
  102. ["Open raw", "%r"]
  103. ];
  104. plugins.options["my-keysnail-bookmarks"] = [
  105. "twitter.com"
  106. ];
  107. // sitelocal keymap
  108. //////////////////////////////////////////
  109. // 2ch chaika
  110. // change chaika port every time firefox starts
  111. util.setIntPref("extensions.chaika.server_port.firefox",
  112. 8800 + Math.floor(Math.random() * 30));
  113. local["^http://127.0.0.1:88"] = [
  114. ['k', function(ev, arg){
  115. curl = window.content.location.href;
  116. kurl = curl.replace(/http:.*thread\/(.*\/).*/, "chaika://post/$1");
  117. window.content.location.href = kurl;
  118. }
  119. ]
  120. ];
  121. local["^http://w2.p2.2ch.net/p2/read.php"] = [
  122. ['k', function(ev, arg){
  123. var url = window.content.location.href;
  124. var pt = /host=(.*?)&bbs=(.*?)&key=(.*?)&ls=/ ;
  125. var result = url.match(pt);
  126. var k = format("chaika://post/http://%s/test/read.cgi/%s/%s/",
  127. result[1], result[2], result[3]);
  128. window.content.location.href = k;
  129. }
  130. ]
  131. ];
  132. /////////////////////////////////////////
  133. // feedly
  134. local["^https?://(www\.|cloud\.|)feedly\.com/"] = [
  135. ['d', null],
  136. ['j', null],
  137. ['k', null],
  138. ['n', null],
  139. ['p', null],
  140. ['o', null],
  141. ['b', null],
  142. ['S', null],
  143. ['s', null],
  144. ['?', null],
  145. ['r', null],
  146. ['g', null],
  147. // ['x', function(ev, arg){
  148. // ev.target.dispatchEvent(key.stringToKeyEvent("g", true));
  149. // }],
  150. // ['l', function(ev, arg){
  151. // var host = window.content.location.host;
  152. // if (host === "cloud.feedly.com" || host === "feedly.com") {
  153. // window.content.location.href = "http://" + host + "/#latest";
  154. // } else if (host === "www.feedly.com") {
  155. // window.content.location.href = "http://" + host + "/home#latest";
  156. // }
  157. // }],
  158. ['a', null],
  159. [['t', 'p'], function(ev, arg){
  160. ev.target.dispatchEvent(key.stringToKeyEvent("t", true));
  161. }],
  162. [['t', 'w'], function(ev, arg){
  163. ext.exec("twitter-client-tweet", arg, ev);
  164. }]
  165. ];
  166. /////////////////////////////////////////
  167. //nicovideo
  168. // local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [
  169. // ["i", function(ev, arg){ ext.exec("nicoinfo", arg); }],
  170. // ["p", function(ev, arg){ ext.exec("nicopause", arg); }],
  171. // // ["o", function(ev, arg){ ext.exec("nicommentvisible", arg); }],
  172. // ["m", function(ev, arg){ ext.exec("nicomute", arg); }],
  173. // [".", function(ev, arg){ ext.exec("nicovolumeIncrement", arg); }],
  174. // [",", function(ev, arg){ ext.exec("nicovolumeDecrement", arg); }],
  175. // ['f', function(ev, arg){
  176. // curl = window.content.location.href;
  177. // kurl = curl.replace(/nicovideo.jp/, "nicovideofire.jp");
  178. // window.content.location.href = kurl;
  179. // }
  180. // ]
  181. // ];
  182. /////////////////////////////////////////
  183. // tumblr/dashboard
  184. local["^http://www.tumblr.com/dashboard"] = [
  185. // ["C-<left>", function(ev, arg){
  186. // gBrowser.mTabContainer.advanceSelectedTab(-1, true);
  187. // }],
  188. // ["C-<right>", function(ev, arg){
  189. // gBrowser.mTabContainer.advanceSelectedTab(1, true);
  190. // }],
  191. ["<left>", function(ev, arg){
  192. window.content.location.href = "http://www.tumblr.com/dashboard";
  193. }],
  194. ["<right>", null],
  195. ["J", function(ev, arg){
  196. if (window.loadURI) {
  197. 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;}())");
  198. }
  199. }]
  200. ];
  201. ///////////////////////////////////////////
  202. // plugin option
  203. plugins.options["builtin_commands_ext.ext_list"] = [
  204. "focus-to-prompt",
  205. "open-url-from-clipboard",
  206. "restart-firefox"
  207. ];
  208. plugins.options["instapaper.close_after_post"] = true;
  209. plugins.options["instapaper.initial_comment_function"] = function(){
  210. var now = new Date();
  211. return "[" + now.toString() + "]";
  212. };
  213. //////////////////////////////////////////
  214. // yatc
  215. style.register("#keysnail-twitter-client-container{ display:none !important; }");
  216. plugins.options["twitter_client.popup_new_statuses"] = false;
  217. plugins.options["twitter_client.automatically_begin"] = false;
  218. plugins.options["twitter_client.automatically_begin_list"] = false;
  219. plugins.options["twitter_client.timeline_count_beginning"] = 0;
  220. plugins.options["twitter_client.timeline_count_every_updates"] = 0;
  221. plugins.options["twitter_client.tweet_keymap"] = {
  222. "C-RET" : "prompt-decide",
  223. "RET" : ""
  224. };
  225. plugins.options["twitter_client.jmp_id"] = "10sr";
  226. plugins.options["twitter_client.jmp_key"] =
  227. "R_c51f889a77cb4b4e993ed868f65083f5";
  228. plugins.options["twitter_client.use_jmp"] = true;
  229. ////////////////////////////////////////////
  230. // my exts and functions
  231. var autoSaveTabList = (function(){
  232. const PREF_PREFIX = "extensions.keysnail.plugins.autosavetablist.";
  233. const PREF_DSTDIR = "dstdir";
  234. const PREF_ENABLED = "enabled";
  235. // use plugin option to set
  236. var save_interval = 60 * 10;
  237. // "/" for unix system
  238. const DIR_DELIM = userscript.directoryDelimitter;
  239. function selectDirectory(title){
  240. // open dialog and return nsILocalFile object
  241. // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsILocalFile
  242. // this function blocks.
  243. var nsIFilePicker = Components.interfaces.nsIFilePicker;
  244. var fp = Components.classes["@mozilla.org/filepicker;1"].
  245. createInstance(nsIFilePicker);
  246. fp.init(window, title, nsIFilePicker.modeGetFolder);
  247. // block
  248. var res = fp.show();
  249. if (res !== nsIFilePicker.returnOK) {
  250. return null;
  251. }
  252. return fp.file;
  253. }
  254. function setup(){
  255. // set destination directory
  256. var dstdir = selectDirectory("Select Directory to Save Tab List");
  257. if (! dstdir) { return; }
  258. if (! dstdir.isWritable()) {
  259. display.notify("Directory is not writable");
  260. return;
  261. }
  262. util.setUnicharPref(PREF_PREFIX + PREF_DSTDIR, dstdir.path);
  263. }
  264. function genFileName(){
  265. function formatCurrent(){
  266. var d = new Date();
  267. function pad(n){
  268. return n < 10 ? '0' + n.toString() : n.toString()
  269. }
  270. return [
  271. d.getFullYear().toString(),
  272. pad(d.getMonth() + 1),
  273. pad(d.getDate()),
  274. "-",
  275. pad(d.getHours()),
  276. pad(d.getMinutes()),
  277. pad(d.getSeconds())
  278. ].join("");
  279. }
  280. return "tablist." + formatCurrent() + ".lst";
  281. }
  282. function getTabList(){
  283. // returns list of urls of current tabs.
  284. return [(function(){
  285. var browser = tab.linkedBrowser;
  286. var win = browser.contentWindow;
  287. // var title = tab.label;
  288. var url = win.location.href;
  289. return url;
  290. })() for each (tab in Array.slice(gBrowser.mTabContainer.childNodes))];
  291. // Array.slice is required?
  292. }
  293. function saveCurrentList(){
  294. var dstdir = util.getUnicharPref(PREF_PREFIX + PREF_DSTDIR);
  295. if (! dstdir) {
  296. display.showPopup("AutoSaveTabList",
  297. "Dest dir is not set yet. Run setup first");
  298. return;
  299. }
  300. var filename = genFileName();
  301. util.writeTextFile(
  302. getTabList().join("\n") + "\n",
  303. dstdir + userscript.directoryDelimiter + filename
  304. );
  305. display.showPopup("AutoSaveTabList",
  306. "Tab List saved: " + filename);
  307. }
  308. return {
  309. selectDirectory: selectDirectory,
  310. setup: setup,
  311. getTabList: getTabList,
  312. saveCurrentList: saveCurrentList
  313. };
  314. })();
  315. ext.add("astl-setup", autoSaveTabList.setup, "Auto save tab list - Setup");
  316. ext.add("astl-save-current", autoSaveTabList.saveCurrentList,
  317. "Auto save tab list - Save current list");
  318. var echoTabInfo = (function(){
  319. var currenttab;
  320. function _display(msg){
  321. display.prettyPrint(msg, {
  322. timeout: 1500,
  323. style: {
  324. "font-size": "18px",
  325. "font-family": "monospace"
  326. }
  327. });
  328. }
  329. function __display(msg){
  330. display.echoStatusBar(msg);
  331. }
  332. function echo(){
  333. var newtab = getBrowser().mCurrentTab;
  334. if (currenttab === newtab) {
  335. return;
  336. }
  337. currenttab = newtab;
  338. var len = getBrowser().tabs.length;
  339. var idx = currenttab._tPos;
  340. var title = window.content.document.title;
  341. var url = window.content.location.href;
  342. var doc = content ? content.document : document;
  343. var dBody = doc.body;
  344. if (dBody && !util.isFrameSetWindow(content)) {
  345. // if page has been prepared
  346. _display(
  347. "[" +
  348. (idx + 1).toString() + "/" +
  349. len.toString() + "] " +
  350. title + " <" +
  351. decodeURIComponent(url) + ">"
  352. );
  353. }
  354. }
  355. return {
  356. echo: echo
  357. };
  358. })();
  359. ext.add("open-remote-init-file", function(ev, arg){
  360. const URL = "https://raw.github.com/10sr/dotfiles/master/_keysnail.js";
  361. window.openUILinkIn(URL, "tab");
  362. }, "Open remote initialization file");
  363. var updateInitFile = (function(){
  364. const URL = "https://raw.github.com/10sr/dotfiles/master/_keysnail.js";
  365. // content/modules/userscript.js
  366. // copy file from aFile
  367. function placeFile(aFile, force) {
  368. var dstdir = util.getUnicharPref("extensions.keysnail.userscript.location");
  369. if (dstdir === "") {
  370. throw util.getLocaleString("failedToInstallFile", [aFile.leafName]) + " :: " + x;
  371. }
  372. try
  373. {
  374. // calc dir from path
  375. let destinationDir = util.openFile(dstdir);
  376. let destinationFile = util.openFile(dstdir);
  377. destinationFile.append(aFile.leafName);
  378. if (destinationFile.exists())
  379. {
  380. if (util.hashFile(aFile) === util.hashFile(destinationFile))
  381. {
  382. // no need to install this file
  383. return destinationFile;
  384. }
  385. let confirmed = force ||
  386. util.confirm(
  387. util.getLocaleString("overWriteConfirmationTitle"),
  388. util.getLocaleString("overWriteConfirmation",
  389. [destinationFile.path])
  390. );
  391. if (!confirmed) {
  392. throw util.getLocaleString("canceledByUser");
  393. }
  394. }
  395. aFile.moveTo(destinationDir, "");
  396. return destinationFile;
  397. }
  398. catch (x)
  399. {
  400. throw util.getLocaleString("failedToInstallFile",
  401. [aFile.leafName]) +
  402. " :: " + x;
  403. }
  404. }
  405. function updateFile() {
  406. util.httpGet(URL, false, function (req) {
  407. if (req.status !== 200) {
  408. util.message(req.responseText);
  409. }
  410. try {
  411. let name = util.getLeafNameFromURL(URL);
  412. let file = userscript.writeTextTmp(name, req.responseText);
  413. let installed = placeFile(file);
  414. util.message(installed.path + " installed");
  415. display.showPopup("update-init-file",
  416. installed.path + " installed")
  417. } catch (x) {
  418. util.message(
  419. "An error occured while installing required scripts :: " +
  420. x.message
  421. );
  422. display.showPopup(
  423. "update-init-file",
  424. "An error occured while installing required scripts :: " +
  425. x.message
  426. );
  427. }
  428. });
  429. }
  430. return {
  431. updateFile: updateFile
  432. };
  433. })();
  434. ext.add("update-init-file", updateInitFile.updateFile, "update init file");
  435. var importExportBookmarks = (function(){
  436. function getOrganizer(){
  437. // [How to call for Firefox bookmark dialog? - Stack Overflow]
  438. // (http://stackoverflow.com/questions/9158187/how-to-call-for-firefox-bookmark-dialog)
  439. Components.utils.import("resource://gre/modules/Services.jsm");
  440. var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
  441. if (!organizer) {
  442. // No currently open places window,
  443. // so open one with the specified mode.
  444. openDialog("chrome://browser/content/places/places.xul",
  445. "",
  446. "chrome,toolbar=yes,dialog=no,resizable",
  447. "AllBookmarks");
  448. return null;
  449. } else {
  450. return organizer;
  451. }
  452. }
  453. ext.add("export-bookmarks", function(ev, arg){
  454. var organizer = getOrganizer();
  455. if (organizer) {
  456. organizer.PlacesOrganizer.exportBookmarks();
  457. }
  458. }, "export bookmarks");
  459. ext.add("import-bookmarks", function(ev, arg){
  460. var organizer = getOrganizer();
  461. if (organizer) {
  462. organizer.PlacesOrganizer.importBookmarks();
  463. }
  464. }, "import bookmarks");
  465. return {
  466. getOrganizer: getOrganizer
  467. };
  468. })();
  469. ext.add("my-index-html", function(ev, arg){
  470. homepath = util.getEnv("HOME");
  471. file = ".index.html";
  472. if (homepath) {
  473. path = "file://" + homepath + "/" + file;
  474. window.openUILinkIn(path, "tab");
  475. }
  476. }, "open my index.html");
  477. ext.add("strong-fullscreen", function(){
  478. var elemids = [
  479. "navigator-toolbox"
  480. ];
  481. BrowserFullScreen();
  482. var isfullscreen = window.fullScreen;
  483. for(var i = 0; i < elemids.length; i++){
  484. var elem = document.getElementById(elemids[i]);
  485. if(elem){
  486. if(isfullscreen){
  487. elem.style.display = "none";
  488. }else{
  489. elem.style.display = null;
  490. }
  491. }
  492. }
  493. var tabs = document.getElementById("verticaltabs-box");
  494. if(tabs){
  495. var pref_key = "extensions.verticaltabs.width";
  496. var pref_key_bak = pref_key + "_bak";
  497. if(isfullscreen){
  498. var width_orig = util.getIntPref(pref_key);
  499. util.setIntPref(pref_key_bak, width_orig);
  500. util.setIntPref(pref_key, 0);
  501. tabs.setAttribute("width", "0");
  502. }else if(parseInt(tabs.getAttribute("width") || "") === 0){
  503. var width_bak = util.getIntPref(pref_key_bak);
  504. util.setIntPref(pref_key, width_bak);
  505. tabs.setAttribute("width", width_bak.toString());
  506. }
  507. }
  508. }, "go fullscreen with hiding toolbar and tabbar");
  509. ext.add("bookmark-delicious", function(){
  510. f= 'http://www.delicious.com/save?url=' +
  511. encodeURIComponent(window.content.location.href) +
  512. '&title=' + encodeURIComponent(document.title) +
  513. '&notes=' + encodeURIComponent(
  514. '' + (window.getSelection ?
  515. window.getSelection() : (
  516. document.getSelection ?
  517. document.getSelection() :
  518. document.selection.createRange().text))) + '&v=6&';
  519. a = function(){
  520. if(! window.open(
  521. f + 'noui=1&jump=doclose',
  522. 'deliciousuiv6',
  523. 'location=1,links=0,scrollbars=0,toolbar=0,width=710,height=660')){
  524. location.href = f + 'jump=yes';
  525. }
  526. };
  527. if(/Firefox/.test(navigator.userAgent)){
  528. setTimeout(a,0);
  529. }else{
  530. a();
  531. }
  532. }, "bookmark delicious");
  533. ext.add('view-page-source', function(){
  534. window.content.location.href = "view-source:" +
  535. window.content.location.href;
  536. }, 'view page source');
  537. ext.add('my-setpref', function(){
  538. util.setPrefs(
  539. {
  540. "browser.bookmarks.max_backups":0,
  541. "browser.cache.memory.capacity":16384,
  542. "browser.download.manager.closeWhenDone":true,
  543. "browser.download.useDownloadDir":false,
  544. "browser.fullscreen.autohide":false,
  545. "browser.search.openintab":true,
  546. "browser.sessionhistory.max_total_viewers":8,
  547. "browser.sessionstore.restore_on_demand":true,
  548. "browser.tabs.closeWindowWithLastTab":false,
  549. "browser.tabs.loadDivertedInBackground": true,
  550. "browser.urlbar.autocomplete.enabled":false,
  551. "browser.urlbar.trimURLs":false,
  552. "dom.disable_window_open_feature.location": false,
  553. "dom.max_script_run_time": 30,
  554. "extensions.chaika.bbsmenu.open_new_tab":true,
  555. "extensions.chaika.bbsmenu.open_single_click":false,
  556. "extensions.chaika.board.open_new_tab":true,
  557. "extensions.chaika.board.open_single_click":false,
  558. "extensions.foxage2ch.openThreadInTab":true,
  559. "extensions.saveimageinfolder.general-duplicatefilenamevalue":1,
  560. "extensions.saveimageinfolder.general-fileprefixvalue":
  561. "%yyyy%%MM%%dd%-%hh%%mm%%ss%_",
  562. "extensions.saveimageinfolder.usecache":true,
  563. "extensions.tabutils.openTabNext":1,
  564. "extensions.tabutils.styles.current":
  565. "{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#000000\",\"bgColor\":false,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}",
  566. "extensions.tabutils.styles.unread":
  567. "{\"bold\":false,\"italic\":false,\"underline\":false,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#CC0000\",\"bgColor\":false,\"bgColorCode\":\"undefined\",\"outline\":false,\"outlineColorCode\":\"undefined\"}",
  568. "extensions.tabutils.TFS_Enable":false,
  569. // Always select right tab on close
  570. "extensions.tabutils.selectOnClose":10,
  571. "extensions.yass.edgetype":0,
  572. "extensions.yass.selectedpreset":"red",
  573. "font.default.x-western":"sans-serif",
  574. "gecko.handlerService.schemes.mailto.1.name":"Gmail",
  575. "general.warnOnAboutConfig":false,
  576. "keyword.URL":"http://www.bing.com/search?q=",
  577. "browser.search.defaultenginename":"Bing",
  578. "browser.search.defaulturl":"http://www.bing.com/search?q=",
  579. "network.dns.disableIPv6":true,
  580. "refcontrol.actions":
  581. "@DEFAULT=@FORGE www.heartrails.com=@NORMAL www.pixiv.net=@NORMAL",
  582. "scrapbook.tabs.open":true
  583. }
  584. );
  585. if(/^Linux/.test(navigator.platform)){
  586. util.setPrefs(
  587. {
  588. "browser.cache.disk.parent_directory":"/tmp",
  589. "browser.cache.disk.capacity":524288
  590. }
  591. );
  592. }
  593. display.showPopup("Keysnail", "My prefs done.");
  594. }, 'my setpref');
  595. ext.add('auto-install-plugins', function(ev, arg){
  596. var urls = [
  597. 'https://raw.github.com/mooz/keysnail/master/plugins/yet-another-twitter-client-keysnail.ks.js',
  598. 'https://raw.github.com/mooz/keysnail/master/plugins/site-local-keymap.ks.js',
  599. 'https://raw.github.com/mooz/keysnail/master/plugins/hok.ks.js',
  600. 'https://github.com/mooz/keysnail/raw/master/plugins/builtin-commands-ext.ks.js',
  601. 'https://raw.github.com/azu/KeySnail-Plugins/master/JSReference/js-referrence.ks.js',
  602. 'https://raw.github.com/gongo/keysnail_plugin/master/linksnail.ks.js',
  603. 'https://raw.github.com/tkosaka/keysnail-plugin/master/nicontroller.ks.js',
  604. 'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js',
  605. 'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js',
  606. 'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js',
  607. 'https://raw.github.com/10sr/keysnail-plugin/master/pixiv_autojump.ks.js',
  608. 'https://raw.github.com/10sr/keysnail-plugin/master/list-current-urls.ks.js',
  609. 'https://gist.githubusercontent.com/10sr/1976942/raw/firefox-addon-manager.ks.js',
  610. 'https://gist.githubusercontent.com/958/1450594/raw/mstranslator.ks.js'
  611. ];
  612. function inst(a){
  613. if(a.length == 0){
  614. display.showPopup("auto-install-plugins",
  615. "All installation finished.");
  616. }else{
  617. var url = a.shift();
  618. var path = userscript.pluginDir +
  619. userscript.directoryDelimiter + url.match(/[^/]+$/)[0];
  620. if(plugins.context[path] === undefined){
  621. userscript.installPluginFromURL(url, function(){inst(a);});
  622. }else{
  623. inst(a);
  624. }
  625. }
  626. }
  627. inst(urls);
  628. }, 'Install plugins automatically if not installed yet.');
  629. ext.add('put-aside-this-page', function (ev, arg) {
  630. var n = getBrowser().mCurrentTab._tPos;
  631. getBrowser().moveTabTo(getBrowser().mCurrentTab, 0);
  632. if (n != 0) {
  633. getBrowser().selectedTab = getBrowser().mTabs[n];
  634. }
  635. }, 'put aside this page');
  636. ext.add('send-escape', function (ev, arg) {
  637. ev.target.dispatchEvent(key.stringToKeyEvent("ESC", true));
  638. }, 'escape');
  639. ext.add("open-hatebu-comment", function (ev, arg) {
  640. var url = window.content.location.href.replace(/^[^/]*\/\//, "");
  641. window.content.location.href = "http://b.hatena.ne.jp/entry/" + url;
  642. }, 'hatebu');
  643. // ext.add("focus-on-content", function(){
  644. // let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
  645. // gBrowser.focus();
  646. // content.focus();
  647. // }, "forcus on content");
  648. ext.add("hide-sidebar", function(){
  649. var sidebarBox = document.getElementById("sidebar-box");
  650. if (!sidebarBox.hidden) {
  651. toggleSidebar(sidebarBox.getAttribute("sidebarcommand"));
  652. }
  653. }, "hide-sidebar");
  654. ext.add("close-and-next-tab", function (ev, arg) {
  655. var n = getBrowser().mCurrentTab._tPos;
  656. getBrowser().removeCurrentTab();
  657. getBrowser().selectedTab = getBrowser().mTabs[n];
  658. }, "close and focus to next tab");
  659. //////////////////////////////////////
  660. //
  661. ext.add("restart-firefox-add-menu", function(){
  662. const XUL_NS =
  663. "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
  664. var cmdelm = document.createElementNS(XUL_NS, "command");
  665. cmdelm.setAttribute("id", "my_cmd_restartFirefoxKs");
  666. cmdelm.setAttribute("oncommand", "ext.exec('restart-firefox');");
  667. var commandset = document.getElementById("mainCommandSet");
  668. // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem"));
  669. commandset.appendChild(cmdelm);
  670. var menuelm = document.createElementNS(XUL_NS, "menuitem");
  671. menuelm.setAttribute("label", "Restart Firefox");
  672. menuelm.setAttribute("id", "my_menu_restartFirefoxKs");
  673. menuelm.setAttribute("command", "my_cmd_restartFirefoxKs");
  674. var menu = document.getElementById("menu_FilePopup");
  675. // menu.insertBefore(elm, menu.getElementById("menu_FileQuitItem"));
  676. menu.appendChild(menuelm);
  677. }, "add restart firefox menu");
  678. /////////////////////////////////////////
  679. // feed url
  680. ext.add("feed-add-to-feedly", function(){
  681. var url = window.content.location.href;
  682. window.content.location.href =
  683. "http://cloud.feedly.com/#subscription%2Ffeed%2F" +
  684. encodeURIComponent(url);
  685. }, "Add current feed to feedly");
  686. var feedUtils = (function(){
  687. var feedhandler = "http://cloud.feedly.com/#subscription%2Ffeed%2F%s";
  688. function getFeeds(){
  689. const doc = content.document;
  690. var feeds = [[e.getAttribute("title"), e.getAttribute("href")]
  691. for ([, e] in Iterator(doc.querySelectorAll([
  692. 'link[type="application/rss+xml"]',
  693. 'link[type="application/atom+xml"]'
  694. ])))];
  695. var uh = window.content.location.href.replace(/(.*?\/\/[^/]*)(\/.*)?/,
  696. "$1");
  697. for (i = 0; i < feeds.length; i++)
  698. if ( feeds[i][1].substr(0,1) == "/" ) feeds[i][1] = uh + feeds[i][1];
  699. // feeds.unshift([window.content.document.title,
  700. // window.content.location.href]);
  701. return feeds;
  702. };
  703. ext.add("copy-feed-url", function () {
  704. var feeds = getFeeds();
  705. if (! feeds.length) {
  706. display.echoStatusBar("No feed found.");
  707. return;
  708. }
  709. prompt.selector({
  710. message : "Select Feed",
  711. collection : feeds,
  712. callback : function (i) {
  713. if (i >= 0) {
  714. command.setClipboardText(feeds[i][1]);
  715. }
  716. }
  717. });
  718. }, "Copy url or feed url of current page");
  719. ext.add("open-feed", function () {
  720. var feeds = getFeeds();
  721. if (! feeds.length) {
  722. display.echoStatusBar("No feed found.");
  723. return;
  724. }
  725. prompt.selector({
  726. message : "Select Feed",
  727. collection : feeds,
  728. callback : function (i) {
  729. if (i < 0) {
  730. return;
  731. }
  732. var feedurl = feeds[i][1];
  733. if (feedhandler) {
  734. window.openUILinkIn(
  735. feedhandler.replace("%s", feedurl),
  736. "tab"
  737. );
  738. } else {
  739. window.openUILinkIn(feedurl, "tab");
  740. }
  741. }
  742. });
  743. }, "Copy url or feed url of current page");
  744. return {
  745. getFeeds: getFeeds
  746. };
  747. })();
  748. ///////////////////////////////////////
  749. // keysnail z menu
  750. ext.add("keysnail-setting-dialog", function(){
  751. KeySnail.openPreference();
  752. }, "keysnail setting dialog");
  753. ext.add("keysnail-plugin-manager", function(){
  754. userscript.openPluginManager();
  755. }, "keysnail plugin manager");
  756. ext.add("firefox-open-addon-manager", function(){
  757. BrowserOpenAddonsMgr();
  758. }, "firefox addon manager");
  759. ext.add("keysnail-reload-init-file", function(){
  760. userscript.reload();
  761. }, "keysnail reload init file");
  762. ext.add("keysnail-z-menu",function(){
  763. var list = [["keysnail-setting-dialog"],
  764. ["keysnail-plugin-manager"],
  765. ["firefox-open-addon-manager"],
  766. ["keysnail-reload-init-file"],
  767. // ["check-for-plugins-update"],
  768. ["restart-firefox"]
  769. ];
  770. prompt.selector(
  771. {
  772. message : "open setting dialog",
  773. collection : list,
  774. callback : function (i) {
  775. ext.exec(list[i][0]);
  776. }
  777. });
  778. },"open keysnail z menu");
  779. ///////////////////////////////////
  780. // search web
  781. ext.add("query-then-engine", function () {
  782. prompt.reader({
  783. message : "Search Word?:",
  784. group : "query_word",
  785. // completer : completer.matcher.header(share.friendsCache || []),
  786. initialInput : content.document.getSelection() || "",
  787. callback : function (q) {
  788. if (q) {
  789. prompt.selector({
  790. message : "search \"" + q + "\" with?",
  791. collection : plugins.options["search-url-list"],
  792. width : [20,80],
  793. callback : function (i) {
  794. getBrowser().selectedTab =
  795. getBrowser().addTab(
  796. plugins.options["search-url-list"][i][1].
  797. replace("%r",q).replace(
  798. "%q",encodeURIComponent(q)
  799. )
  800. )
  801. ;
  802. }
  803. });
  804. };
  805. }
  806. });
  807. }, "enter search word and then select engine");
  808. /////////////////////////////////////
  809. // closed tab list
  810. ext.add("list-closed-tabs", function () {
  811. const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
  812. var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(
  813. Ci.nsISessionStore
  814. );
  815. var json = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON);
  816. var closedTabs = [[tab.image || fav, tab.title, tab.url]
  817. for each (tab in json.decode(ss.getClosedTabData(window)))
  818. ];
  819. if (!closedTabs.length)
  820. return void display.echoStatusBar("No recently closed tab.", 2000);
  821. prompt.selector(
  822. {
  823. message : "select tab to undo:",
  824. collection : closedTabs,
  825. flags : [ICON | IGNORE, 0, 0],
  826. callback : function (i) { if (i >= 0) window.undoCloseTab(i); }
  827. });
  828. }, "List closed tabs");
  829. ///////////////////////////////
  830. // http://malblue.tumblr.com/post/349001250/tips-japanese-keysnail-github
  831. ext.add("list-tab-history", function () {
  832. const fav = "chrome://mozapps/skin/places/defaultFavicon.png";
  833. var tabHistory = [];
  834. var sessionHistory = getBrowser().webNavigation.sessionHistory;
  835. if (sessionHistory.count < 1)
  836. return void display.echoStatusBar("Tab history not exist", 2000);
  837. var curIdx = sessionHistory.index;
  838. for (var i = 0; i < sessionHistory.count; i++) {
  839. var entry = sessionHistory.getEntryAtIndex(i, false);
  840. if (!entry)
  841. continue;
  842. try {
  843. var iconURL = Cc["@mozilla.org/browser/favicon-service;1"]
  844. .getService(Ci.nsIFaviconService)
  845. .getFaviconForPage(entry.URI).spec;
  846. } catch (ex) {}
  847. tabHistory.push([iconURL || fav, entry.title, entry.URI.spec, i]);
  848. }
  849. for (var thIdx = 0; thIdx < tabHistory.length; thIdx++) {
  850. if (tabHistory[thIdx][3] == curIdx) break;
  851. }
  852. prompt.selector(
  853. {
  854. message : "select history in tab",
  855. collection : tabHistory,
  856. flags : [ICON | IGNORE, 0, 0, IGNORE | HIDDEN],
  857. header : ["Title", "URL"],
  858. initialIndex : thIdx,
  859. callback : function(i) {
  860. if (i >= 0)
  861. getBrowser().webNavigation.gotoIndex(tabHistory[i][3]);
  862. }
  863. });
  864. }, 'List tab history');
  865. //}}%PRESERVE%
  866. // ========================================================================= //
  867. // ========================= Special key settings ========================== //
  868. key.quitKey = "ESC";
  869. key.helpKey = "<f1>";
  870. key.escapeKey = "C-q";
  871. key.macroStartKey = "";
  872. key.macroEndKey = "";
  873. key.universalArgumentKey = "C-u";
  874. key.negativeArgument1Key = "C--";
  875. key.negativeArgument2Key = "C-M--";
  876. key.negativeArgument3Key = "M--";
  877. key.suspendKey = "Not defined";
  878. // ================================= Hooks ================================= //
  879. hook.setHook('KeyBoardQuit', function (aEvent) {
  880. // ext.exec("hide-sidebar");
  881. let(elem = document.commandDispatcher.focusedElement) elem && elem.blur();
  882. getBrowser().focus();
  883. content.focus();
  884. command.closeFindBar();
  885. if (util.isCaretEnabled()) {
  886. command.resetMark(aEvent);
  887. } else {
  888. goDoCommand("cmd_selectNone");
  889. }
  890. key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
  891. });
  892. hook.setHook('Unload', function () {
  893. util.getBrowserWindows().some(function (win) {
  894. if (win === window) {
  895. return false;
  896. }
  897. const ks = win.KeySnail;
  898. share.pluginUpdater = ks.getPluginUpdater(
  899. share.pluginUpdater.pluginsWithUpdate);
  900. ks.setUpPluginUpdaterDelegator();
  901. return true;
  902. });
  903. });
  904. hook.setHook('LocationChange', function (aNsURI) {
  905. echoTabInfo.echo();
  906. });
  907. // ============================= Key bindings ============================== //
  908. key.setGlobalKey('C-<up>', function () {
  909. var browser = getBrowser();
  910. if (browser.mCurrentTab.previousSibling) {
  911. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1);
  912. } else {
  913. browser.moveTabTo(browser.mCurrentTab,
  914. browser.mTabContainer.childNodes.length - 1);
  915. }
  916. }, '選択中のタブを右へ');
  917. key.setGlobalKey('C-<down>', function () {
  918. var browser = getBrowser();
  919. if (browser.mCurrentTab.nextSibling) {
  920. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1);
  921. } else {
  922. browser.moveTabTo(browser.mCurrentTab, 0);
  923. }
  924. }, '選択中のタブを左へ');
  925. key.setGlobalKey('<delete>', function (ev, arg) {
  926. let (elem = document.commandDispatcher.focusedElement) elem && elem.blur();
  927. getBrowser().focus();
  928. content.focus();
  929. }, 'コンテンツへフォーカス', true);
  930. key.setGlobalKey('<f11>', function (ev, arg) {
  931. ext.exec("strong-fullscreen", arg, ev);
  932. }, 'go fullscreen with hiding toolbar and tabbar', true);
  933. key.setGlobalKey('<end>', function (ev) {
  934. getBrowser().mTabContainer.advanceSelectedTab(1, true);
  935. }, 'ひとつ右のタブへ');
  936. key.setGlobalKey('<home>', function (ev) {
  937. getBrowser().mTabContainer.advanceSelectedTab(-1, true);
  938. }, 'ひとつ左のタブへ');
  939. key.setGlobalKey('<next>', function (ev) {
  940. let browser = getBrowser();
  941. if (browser.mCurrentTab.nextSibling) {
  942. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1);
  943. } else {
  944. browser.moveTabTo(browser.mCurrentTab, 0);
  945. }
  946. }, '選択中のタブを右へ');
  947. key.setGlobalKey('<prior>', function (ev) {
  948. let browser = getBrowser();
  949. if (browser.mCurrentTab.previousSibling) {
  950. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1);
  951. } else {
  952. browser.moveTabTo(browser.mCurrentTab, browser.mTabContainer.childNodes.length - 1);
  953. }
  954. }, '選択中のタブを左へ');
  955. key.setViewKey('0', function (ev) {
  956. BrowserCloseTabOrWindow();
  957. }, 'タブ / ウィンドウを閉じる');
  958. key.setViewKey('l', function (ev) {
  959. getBrowser().mTabContainer.advanceSelectedTab(1, true);
  960. }, 'ひとつ右のタブへ');
  961. key.setViewKey('h', function (ev) {
  962. getBrowser().mTabContainer.advanceSelectedTab(-1, true);
  963. }, 'ひとつ左のタブへ');
  964. key.setViewKey('o', function (ev, arg) {
  965. ext.exec("hok-start-foreground-mode", arg, ev);
  966. }, 'Start Hit a Hint foreground mode', true);
  967. key.setViewKey('c', function (ev) {
  968. command.interpreter();
  969. }, 'JavaScript のコードを評価');
  970. key.setViewKey('D', function (ev, arg) {
  971. ext.exec("dig-url", arg, ev);
  972. }, 'dig url with selector', true);
  973. key.setViewKey('x', function (aEvent, aArg) {
  974. ext.select(aArg, aEvent);
  975. }, 'エクステ一覧');
  976. key.setViewKey(['t', 'w'], function (ev, arg) {
  977. ext.exec("twitter-client-tweet", arg, ev);
  978. }, 'つぶやく', true);
  979. key.setViewKey(['t', 'p'], function (ev, arg) {
  980. ext.exec("twitter-client-tweet-this-page", arg, ev);
  981. }, 'このページのタイトルと URL を使ってつぶやく', true);
  982. key.setViewKey([['u'], ['S-SPC']], function (ev) {
  983. goDoCommand("cmd_scrollPageUp");
  984. }, '一画面分スクロールアップ');
  985. key.setViewKey('g', function () {
  986. goDoCommand("cmd_scrollTop");
  987. }, 'ページ先頭へ移動');
  988. key.setViewKey('G', function () {
  989. goDoCommand("cmd_scrollBottom");
  990. }, 'ページ末尾へ移動');
  991. key.setViewKey('r', function (aEvent) {
  992. BrowserReload();
  993. }, '再読み込み');
  994. key.setViewKey('z', function (ev, arg) {
  995. ext.exec("keysnail-z-menu", arg, ev);
  996. }, 'open keysnail setting menu', true);
  997. key.setViewKey('e', function () {
  998. command.focusElement(command.elementsRetrieverTextarea, 0);
  999. }, '最初のインプットエリアへフォーカス', true);
  1000. key.setViewKey('S', function (ev, arg) {
  1001. if (window.loadURI) {
  1002. 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{}");
  1003. }
  1004. }, 'google reader share');
  1005. key.setViewKey('!', function (ev, arg) {
  1006. shell.input();
  1007. }, 'Command system');
  1008. key.setViewKey('R', function () {
  1009. BrowserReloadSkipCache();
  1010. }, '更新(キャッシュを無視)');
  1011. key.setViewKey('<backspace>', function () {
  1012. BrowserBack();
  1013. }, '戻る');
  1014. key.setViewKey('S-<backspace>', function () {
  1015. BrowserForward();
  1016. }, '進む');
  1017. key.setViewKey('q', function (ev, arg) {
  1018. ext.exec("query-then-engine", arg, ev);
  1019. }, 'enter search word and then select engine', true);
  1020. key.setViewKey('/', function () {
  1021. command.iSearchForward();
  1022. }, 'インクリメンタル検索', true);
  1023. key.setViewKey('?', function (ev) {
  1024. command.iSearchForwardKs(ev);
  1025. }, 'Emacs ライクなインクリメンタル検索', true);
  1026. key.setViewKey('a', function (ev, arg) {
  1027. allTabs.open();
  1028. }, 'alltabs.open');
  1029. key.setViewKey([['d'], ['SPC']], function (ev) {
  1030. goDoCommand("cmd_scrollPageDown");
  1031. }, '一画面スクロールダウン');
  1032. key.setViewKey(':', function (ev, arg) {
  1033. return !document.getElementById("keysnail-prompt").hidden &&
  1034. document.getElementById("keysnail-prompt-textbox").focus();
  1035. }, 'KeySnail のプロンプトへフォーカス', true);
  1036. key.setViewKey('B', function (ev) {
  1037. var browser = getBrowser();
  1038. if (browser.mCurrentTab.previousSibling) {
  1039. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos - 1);
  1040. } else {
  1041. browser.moveTabTo(browser.mCurrentTab,
  1042. browser.mTabContainer.childNodes.length - 1);
  1043. }
  1044. }, '選択中のタブを左へ');
  1045. key.setViewKey('C', function (ev, arg) {
  1046. ext.exec("linksnail", arg, ev);
  1047. }, 'LinkSnail', true);
  1048. key.setViewKey('C-<backspace>', function (ev, arg) {
  1049. ext.exec("list-tab-history", arg, ev);
  1050. }, 'List tab history', true);
  1051. key.setViewKey('I', function (ev, arg) {
  1052. ext.exec("instapaper-post-page-with-comment", arg, ev);
  1053. }, 'post page and comment', true);
  1054. key.setViewKey('T', function (ev, arg) {
  1055. ext.exec("mstranslator-open-prompt", arg, ev);
  1056. }, 'MSTranslator - Open prompt', true);
  1057. key.setViewKey('f', function (ev, arg) {
  1058. ext.exec('strong-fullscreen', arg, ev);
  1059. }, 'go fullscreen with hiding toolbar and tabbar', true);
  1060. key.setViewKey('F', function (ev) {
  1061. var browser = getBrowser();
  1062. if (browser.mCurrentTab.nextSibling) {
  1063. browser.moveTabTo(browser.mCurrentTab, browser.mCurrentTab._tPos + 1);
  1064. } else {
  1065. browser.moveTabTo(browser.mCurrentTab, 0);
  1066. }
  1067. }, '選択中のタブを右へ');
  1068. key.setViewKey('U', function (ev, arg) {
  1069. ext.exec("list-closed-tabs", arg, ev);
  1070. }, 'List closed tabs', true);
  1071. key.setViewKey('j', function (ev) {
  1072. key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_DOWN, true);
  1073. }, '一行スクロールダウン');
  1074. key.setViewKey('k', function (ev) {
  1075. key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_UP, true);
  1076. }, '一行スクロールアップ');
  1077. key.setViewKey('p', function (ev, arg) {
  1078. ext.exec('pocket-add-current', arg, ev);
  1079. }, 'Add current page', true);
  1080. key.setViewKey('P', function (ev, arg) {
  1081. ext.exec('pocket-open-latest', arg, ev);
  1082. }, 'Open last saved page', true);
  1083. key.setEditKey('C-<tab>', function (ev) {
  1084. command.walkInputElement(command.elementsRetrieverTextarea, true, true);
  1085. }, '次のテキストエリアへフォーカス');
  1086. key.setEditKey('C-a', function (ev) {
  1087. command.beginLine(ev);
  1088. }, '行頭へ移動');
  1089. key.setEditKey('C-e', function (ev) {
  1090. command.endLine(ev);
  1091. }, '行末へ');
  1092. key.setEditKey('C-d', function (ev) {
  1093. goDoCommand("cmd_deleteCharForward");
  1094. }, '次の一文字削除');
  1095. key.setEditKey('C-b', function (ev) {
  1096. command.previousChar(ev);
  1097. }, '一文字左へ移動');
  1098. key.setEditKey('C-f', function (ev) {
  1099. command.nextChar(ev);
  1100. }, '一文字右へ移動');
  1101. key.setEditKey('C-h', function (ev) {
  1102. goDoCommand("cmd_deleteCharBackward");
  1103. }, '前の一文字を削除');
  1104. key.setEditKey('C-k', function (ev) {
  1105. command.killLine(ev);
  1106. }, 'カーソルから先を一行カット (Kill line)');
  1107. key.setEditKey('C-l', function (ev) {
  1108. command.recenter(ev);
  1109. }, 'カーソル位置が画面の中央へ来るようスクロール', true);
  1110. key.setEditKey('C-n', function (ev) {
  1111. command.nextLine(ev);
  1112. }, '一行下へ');
  1113. key.setEditKey('C-p', function (ev) {
  1114. command.previousLine(ev);
  1115. }, '一行上へ');
  1116. key.setEditKey('C-o', function (ev) {
  1117. command.openLine(ev);
  1118. }, '行を開く (Open line)');
  1119. key.setGlobalKey('C-<right>', function (ev) {
  1120. getBrowser().mTabContainer.advanceSelectedTab(1, true);
  1121. }, 'ひとつ右のタブへ');
  1122. key.setGlobalKey('C-<left>', function (ev) {
  1123. getBrowser().mTabContainer.advanceSelectedTab(-1, true);
  1124. }, 'ひとつ左のタブへ');