Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

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