You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_keysnail.js 38 KiB

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