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

_keysnail.js 41 KiB

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