您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

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