-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.keysnail.js
713 lines (543 loc) · 24.4 KB
/
.keysnail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
// ========================== KeySnail Init File =========================== //
// この領域は, GUI により設定ファイルを生成した際にも引き継がれます
// 特殊キー, キーバインド定義, フック, ブラックリスト以外のコードは, この中に書くようにして下さい
// ========================================================================= //
//{{%PRESERVE%
// wikipedia ゴロし
if (KeySnail.windowType === "navigator:browser")
{
var whiteList = [
// ["URL (RegExp)", ["k", "e", "y"]]
["http://twitter\.com/", ["f"]],
["http://wikipedia\.com/", ["j", "o"]]
];
window.addEventListener(
"DOMContentLoaded",
function (ev) {
let doc = ev.target;
if (!doc) return;
let inWhiteList = {};
let siteInfo = whiteList.reduce(function (a, r) (a || (RegExp(r[0]).test(doc.location) ? r : null)), null);
if (siteInfo)
for (let [, c] in Iterator(siteInfo[1]))
inWhiteList[c] = true;
let nodes = doc.evaluate('//*[@accesskey]', doc, null, 7, null);
for (let i = 0; i < nodes.snapshotLength; i++)
{
let node = nodes.snapshotItem(i);
if (inWhiteList[node.getAttribute("accesskey")])
continue;
let clone = node.cloneNode(true);
clone.removeAttribute('accesskey');
node.parentNode.replaceChild(clone, node);
}
}, false);
}
// (function () {
// function googleSuggest(word) {
// const domain = "com";
// const base = "http://www.google.%s/complete/search?output=toolbar&q=%s";
// let ep = util.format(base, domain, encodeURIComponent(word));
// let res = util.httpGet(ep);
// let matched = res.responseText.match("(<toplevel>.*</toplevel>)");
// if (!matched)
// return null;
// let xml = new XML(matched[1]);
// return [cs.suggestion.@data for each (cs in xml.CompleteSuggestion)];
// }
// function googleCompleter(args, extra) {
// let suggestions = googleSuggest(extra.query || "");
// return { collection : suggestions, origin : extra.whole.indexOf(extra.left) };
// }
// shell.add("udic", "Urban dictionary", function (args, extra) {
// const base = "http://www.urbandictionary.com/define.php?term=%s";
// util.setBoolPref("accessibility.browsewithcaret", false);
// gBrowser.loadOneTab(util.format(base, encodeURIComponent(args[0])),
// null, null, null, extra.bang);
// }, { bang: true, completer: googleCompleter });
// shell.add("goodic", M({ja: "Goo 辞書", en: "Goo dic"}), function (args, extra) {
// const base = "http://dictionary.goo.ne.jp/search.php?MT=%s&kind=all&mode=0&IE=UTF-8";
// util.setBoolPref("accessibility.browsewithcaret", false);
// gBrowser.loadOneTab(util.format(base, encodeURIComponent(args[0])),
// null, null, null, extra.bang);
// }, { bang: true, completer: googleCompleter });
// shell.add("weblio", M({ja: "Weblio", en: "Weblio"}), function (args, extra) {
// const base = "http://ejje.weblio.jp/content/%s";
// util.setBoolPref("accessibility.browsewithcaret", false);
// gBrowser.loadOneTab(util.format(base, encodeURIComponent(args[0])),
// null, null, null, extra.bang);
// }, { bang: true, completer: googleCompleter });
// })();
// key.defineKey([key.modes.VIEW, key.modes.CARET], 'm', function (ev, arg) {
// shell.input("weblio " + (content.getSelection() || ""));
// }, 'Lookup the meaning of the word');
plugins.options["kkk.sites"] = ["^https?://ja\\.wikipedia\\.org/"];
plugins.options["ril.keymap"] = {
// "C-z" : "prompt-toggle-edit-mode",
// "j" : "prompt-next-completion",
// "k" : "prompt-previous-completion",
// "g" : "prompt-beginning-of-candidates",
// "G" : "prompt-end-of-candidates",
// "D" : "prompt-cancel",
// // RILnail specific actions
// "o" : "open,c",
// "O" : "open-background,c",
// "d" : "delete"
};
plugins.options["K2Emacs.editor"] = "/Applications/EmacsClient.app";
plugins.options["K2Emacs.ext"] = "org";
plugins.options["K2Emacs.encode"] = "UTF-8";
plugins.options["K2Emacs.sep"] = "/";
plugins.options["history.max-results"] = 5000;
//}}%PRESERVE%
// ========================================================================= //
// ========================= Special key settings ========================== //
key.quitKey = "C-g";
key.helpKey = "<f1>";
key.escapeKey = "C-q";
key.macroStartKey = "<f3>";
key.macroEndKey = "<f4>";
key.universalArgumentKey = "C-u";
key.negativeArgument1Key = "C--";
key.negativeArgument2Key = "C-M--";
key.negativeArgument3Key = "C-M-m";
key.suspendKey = "<f12>";
// ================================= Hooks ================================= //
hook.setHook('KeyBoardQuit', function (aEvent) {
if (key.currentKeySequence.length) {
return;
}
command.closeFindBar();
var marked = command.marked(aEvent);
if (util.isCaretEnabled()) {
if (marked) {
command.resetMark(aEvent);
} else {
if ("blur" in aEvent.target) {
aEvent.target.blur();
}
gBrowser.focus();
_content.focus();
}
} else {
goDoCommand("cmd_selectNone");
}
if (KeySnail.windowType === "navigator:browser" && !marked) {
key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
}
});
hook.addToHook('KeyBoardQuit', function (aEvent) {
if (key.currentKeySequence.length) {
return;
}
command.closeFindBar();
var marked = command.marked(aEvent);
if (util.isCaretEnabled()) {
if (marked) {
command.resetMark(aEvent);
} else {
if ("blur" in aEvent.target) {
aEvent.target.blur();
}
gBrowser.focus();
_content.focus();
}
} else {
goDoCommand("cmd_selectNone");
}
if (KeySnail.windowType === "navigator:browser" && !marked) {
key.generateKey(aEvent.originalTarget, KeyEvent.DOM_VK_ESCAPE, true);
}
});
// ============================= Key bindings ============================== //
key.setGlobalKey([['C-M-r'], ['ESC', 'r']], function (ev) {
userscript.reload();
}, '設定ファイルを再読み込み', true);
key.setGlobalKey([['M-x'], ['ESC', 'x']], function (ev, arg) {
ext.select(arg, ev);
}, 'エクステ一覧表示', true);
key.setGlobalKey([['M-:'], ['ESC', ':']], function (ev) {
command.interpreter();
}, 'JavaScript のコードを評価', true);
key.setGlobalKey(['<f1>', 'b'], function (ev) {
key.listKeyBindings();
}, 'キーバインド一覧を表示');
key.setGlobalKey(['<f1>', 'F'], function (ev) {
openHelpLink("firefox-help");
}, 'Firefox のヘルプを表示');
key.setGlobalKey('C-m', function (ev) {
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_RETURN, true);
}, 'リターンコードを生成');
key.setGlobalKey(['C-x', 'l'], function (ev) {
command.focusToById("urlbar");
}, 'ロケーションバーへフォーカス', true);
key.setGlobalKey(['C-x', 'g'], function (ev) {
command.focusToById("searchbar");
}, '検索バーへフォーカス', true);
key.setGlobalKey(['C-x', 't'], function (ev) {
command.focusElement(command.elementsRetrieverTextarea, 0);
}, '最初のインプットエリアへフォーカス', true);
key.setGlobalKey(['C-x', 's'], function (ev) {
command.focusElement(command.elementsRetrieverButton, 0);
}, '最初のボタンへフォーカス', true);
key.setGlobalKey(['C-x', 'k'], function (ev) {
BrowserCloseTabOrWindow();
}, 'タブ / ウィンドウを閉じる');
key.setGlobalKey(['C-x', 'K'], function (ev) {
closeWindow(true);
}, 'ウィンドウを閉じる');
key.setGlobalKey(['C-x', 'n'], function (ev) {
OpenBrowserWindow();
}, 'ウィンドウを開く');
key.setGlobalKey(['C-x', 'C-c'], function (ev) {
goQuitApplication();
}, 'Firefox を終了', true);
key.setGlobalKey(['C-x', 'o'], function (ev, arg) {
command.focusOtherFrame(arg);
}, '次のフレームを選択');
key.setGlobalKey(['C-x', '1'], function (ev) {
window.loadURI(ev.target.ownerDocument.location.href);
}, '現在のフレームだけを表示', true);
key.setGlobalKey(['C-x', 'C-f'], function (ev) {
BrowserOpenFileWindow();
}, 'ファイルを開く', true);
key.setGlobalKey(['C-x', 'C-s'], function (ev) {
saveDocument(window.content.document);
}, 'ファイルを保存', true);
key.setGlobalKey(['C-x', 'C-b', 'C-b'], function (ev, arg) {
ext.exec("hateb-bookmark-this-page", arg, ev);
}, 'このページをはてなブックマークに追加');
key.setGlobalKey(['C-x', 'C-b', 'C-l'], function (ev, arg) {
ext.exec("list-hateb-items", arg, ev);
}, 'はてなブックマークのアイテムを一覧表示しジャンプ');
key.setGlobalKey(['C-x', 'C-b', 'C-c'], function (ev, arg) {
ext.exec("list-hateb-comments", arg, ev);
}, 'このページのはてなブックマークコメントを一覧表示');
key.setGlobalKey(['C-x', '.'], function (ev, arg) {
ext.exec("focus-to-content", arg, ev);
}, 'コンテンツへフォーカス', true);
key.setGlobalKey(['C-x', 'C-r'], function (ev, arg) {
ext.exec("ril-show-reading-list", arg, ev);
}, 'RIL - リストを表示', true);
key.setGlobalKey(['C-x', 'C-h'], function (ev, arg) {
ext.exec("history-show", arg, ev);
}, 'History - リストを表示', true);
key.setGlobalKey([['M-w'], ['ESC', 'w']], function (ev) {
command.copyRegion(ev);
}, '選択中のテキストをコピー', true);
key.setGlobalKey('C-s', function (ev) {
command.iSearchForwardKs(ev);
}, 'Emacs ライクなインクリメンタル検索', true);
key.setGlobalKey('C-r', function (ev) {
command.iSearchBackwardKs(ev);
}, 'Emacs ライクな逆方向インクリメンタル検索', true);
key.setGlobalKey(['C-c', 'u'], function (ev) {
undoCloseTab();
}, '閉じたタブを元に戻す');
key.setGlobalKey(['C-c', 'C-c', 'C-v'], function (ev) {
toJavaScriptConsole();
}, 'Javascript コンソールを表示');
key.setGlobalKey(['C-c', 'C-c', 'C-c'], function (ev) {
command.clearConsole();
}, 'Javascript コンソールの表示をクリア');
key.setGlobalKey(['C-c', 'i'], function (ev, arg) {
userscript.installPluginFromURL(window.content.document.location.href);
}, 'install-plugin-from-this-page');
key.setGlobalKey([['C-M-l'], ['ESC', 'l']], function (ev) {
getBrowser().mTabContainer.advanceSelectedTab(1, true);
}, 'ひとつ右のタブへ');
key.setGlobalKey([['C-M-h'], ['ESC', 'h']], function (ev) {
getBrowser().mTabContainer.advanceSelectedTab(-1, true);
}, 'ひとつ左のタブへ');
key.setGlobalKey('C-t', function (ev, arg) {
ext.exec("tanything", arg, ev);
}, 'タブを一覧表示', true);
key.setGlobalKey(['C-z', 'C-n'], function (ev, arg) {
ext.exec("tabgroup-next", arg, ev);
}, '右のグループを選択', true);
key.setGlobalKey(['C-z', 'C-p'], function (ev, arg) {
ext.exec("tabgroup-previous", arg, ev);
}, '左のグループを選択', true);
key.setGlobalKey(['C-z', 'C-c'], function (ev, arg) {
ext.exec("tabgroup-create", arg, ev);
}, '新しいグループを開く');
key.setGlobalKey(['C-z', 'C-k'], function (ev, arg) {
ext.exec("tabgroup-close", arg, ev);
}, '現在のグループを閉じる', true);
key.setGlobalKey(['C-z', 'g'], function (ev, arg) {
ext.exec("tabgroup-goto", arg, ev);
}, '指定した番号のグループへ移動', true);
key.setGlobalKey(['C-z', 'A'], function (ev, arg) {
ext.exec("tabgroup-group-nickname", arg, ev);
}, '現在のグループの名前を変更する', true);
key.setGlobalKey(['C-z', 'C-z'], function (ev, arg) {
ext.exec("tabgroup-goto-last-selected", arg, ev);
}, '直前のグループに移動', true);
key.setGlobalKey(['ESC', 'ESC'], function (ev, arg) {
ev.originalTarget.dispatchEvent(key.stringToKeyEvent("ESC", true));
}, 'ESC キーイベントを投げる');
key.setViewKey('m', function (ev, arg) {
shell.input("weblio " + (content.getSelection() || ""));
}, 'Lookup the meaning of the word');
key.setViewKey([['C-n'], ['j']], function (ev) {
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_DOWN, true);
}, '一行スクロールダウン');
key.setViewKey([['C-p'], ['k']], function (ev) {
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_UP, true);
}, '一行スクロールアップ');
key.setViewKey([['C-f'], ['.']], function (ev) {
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_RIGHT, true);
}, '右へスクロール');
key.setViewKey([['C-b'], [',']], function (ev) {
key.generateKey(ev.originalTarget, KeyEvent.DOM_VK_LEFT, true);
}, '左へスクロール');
key.setViewKey([['M-v'], ['b'], ['ESC', 'v']], function (ev) {
goDoCommand("cmd_scrollPageUp");
}, '一画面分スクロールアップ');
key.setViewKey([['C-v'], ['f']], function (ev) {
goDoCommand("cmd_scrollPageDown");
}, '一画面スクロールダウン');
key.setViewKey([['M-<'], ['g'], ['ESC', '<']], function (ev) {
goDoCommand("cmd_scrollTop");
}, 'ページ先頭へ移動', true);
key.setViewKey([['M->'], ['G'], ['ESC', '>']], function (ev) {
goDoCommand("cmd_scrollBottom");
}, 'ページ末尾へ移動', true);
key.setViewKey(':', function (ev, arg) {
shell.input(null, arg);
}, 'コマンドの実行', true);
key.setViewKey('R', function (ev) {
BrowserReload();
}, '更新', true);
key.setViewKey('B', function (ev) {
BrowserBack();
}, '戻る');
key.setViewKey('F', function (ev) {
BrowserForward();
}, '進む');
key.setViewKey(['C-x', 'h'], function (ev) {
goDoCommand("cmd_selectAll");
}, 'すべて選択', true);
key.setViewKey([['M-p'], ['ESC', 'p']], function (ev) {
command.walkInputElement(command.elementsRetrieverButton, true, true);
}, '次のボタンへフォーカスを当てる');
key.setViewKey([['M-n'], ['ESC', 'n']], function (ev) {
command.walkInputElement(command.elementsRetrieverButton, false, true);
}, '前のボタンへフォーカスを当てる');
key.setViewKey(['d', 'd'], function (ev) {
BrowserCloseTabOrWindow();
}, 'タブ / ウィンドウを閉じる');
key.setViewKey(['ESC', 'ESC'], function (ev, arg) {
ev.originalTarget.dispatchEvent(key.stringToKeyEvent("ESC", true));
}, 'ESC キーイベントを投げる');
key.setEditKey(['C-x', 'h'], function (ev) {
command.selectAll(ev);
}, '全て選択', true);
key.setEditKey([['C-x', 'u'], ['C-_']], function (ev) {
display.echoStatusBar("Undo!", 2000);
goDoCommand("cmd_undo");
}, 'アンドゥ');
key.setEditKey(['C-x', 'r', 'd'], function (ev, arg) {
command.replaceRectangle(ev.originalTarget, "", false, !arg);
}, '矩形削除', true);
key.setEditKey(['C-x', 'r', 't'], function (ev) {
prompt.read("String rectangle: ", function (aStr, aInput) {command.replaceRectangle(aInput, aStr);}, ev.originalTarget);
}, '矩形置換', true);
key.setEditKey(['C-x', 'r', 'o'], function (ev) {
command.openRectangle(ev.originalTarget);
}, '矩形行空け', true);
key.setEditKey(['C-x', 'r', 'k'], function (ev, arg) {
command.kill.buffer = command.killRectangle(ev.originalTarget, !arg);
}, '矩形キル', true);
key.setEditKey(['C-x', 'r', 'y'], function (ev) {
command.yankRectangle(ev.originalTarget, command.kill.buffer);
}, '矩形ヤンク', true);
key.setEditKey([['C-SPC'], ['C-@'], ['C-`']], function (ev) {
command.setMark(ev);
}, 'マークをセット', true);
key.setEditKey('C-o', function (ev) {
command.openLine(ev);
}, '行を開く (Open line)');
key.setEditKey('C-\\', function (ev) {
display.echoStatusBar("Redo!", 2000);
goDoCommand("cmd_redo");
}, 'リドゥ');
key.setEditKey('C-a', function (ev) {
command.beginLine(ev);
}, '行頭へ移動');
key.setEditKey('C-e', function (ev) {
command.endLine(ev);
}, '行末へ');
key.setEditKey('C-f', function (ev) {
command.nextChar(ev);
}, '一文字右へ移動');
key.setEditKey('C-b', function (ev) {
command.previousChar(ev);
}, '一文字左へ移動');
key.setEditKey([['M-f'], ['ESC', 'f']], function (ev) {
command.forwardWord(ev);
}, '一単語右へ移動');
key.setEditKey([['M-b'], ['ESC', 'b']], function (ev) {
command.backwardWord(ev);
}, '一単語左へ移動');
key.setEditKey('C-n', function (ev) {
command.nextLine(ev);
}, '一行下へ');
key.setEditKey('C-p', function (ev) {
command.previousLine(ev);
}, '一行上へ');
key.setEditKey('C-v', function (ev) {
command.pageDown(ev);
}, '一画面分下へ');
key.setEditKey([['M-v'], ['ESC', 'v']], function (ev) {
command.pageUp(ev);
}, '一画面分上へ');
key.setEditKey([['M-<'], ['ESC', '<']], function (ev) {
command.moveTop(ev);
}, 'テキストエリア先頭へ');
key.setEditKey([['M->'], ['ESC', '>']], function (ev) {
command.moveBottom(ev);
}, 'テキストエリア末尾へ');
key.setEditKey('C-d', function (ev) {
goDoCommand("cmd_deleteCharForward");
}, '次の一文字削除');
key.setEditKey('C-h', function (ev) {
goDoCommand("cmd_deleteCharBackward");
}, '前の一文字を削除');
key.setEditKey([['M-d'], ['ESC', 'd']], function (ev) {
command.deleteForwardWord(ev);
}, '次の一単語を削除');
key.setEditKey([['C-<backspace>'], ['M-<delete>'], ['ESC', '<delete>']], function (ev) {
command.deleteBackwardWord(ev);
}, '前の一単語を削除');
key.setEditKey([['M-u'], ['ESC', 'u']], function (ev, arg) {
command.wordCommand(ev, arg, command.upcaseForwardWord, command.upcaseBackwardWord);
}, '次の一単語を全て大文字に (Upper case)');
key.setEditKey([['M-l'], ['ESC', 'l']], function (ev, arg) {
command.wordCommand(ev, arg, command.downcaseForwardWord, command.downcaseBackwardWord);
}, '次の一単語を全て小文字に (Lower case)');
key.setEditKey([['M-c'], ['ESC', 'c']], function (ev, arg) {
command.wordCommand(ev, arg, command.capitalizeForwardWord, command.capitalizeBackwardWord);
}, '次の一単語をキャピタライズ');
key.setEditKey('C-k', function (ev) {
command.killLine(ev);
}, 'カーソルから先を一行カット (Kill line)');
key.setEditKey('C-y', command.yank, '貼り付け (Yank)');
key.setEditKey('C-M-y', command.yankPop, '古いクリップボードの中身を順に貼り付け (Yank pop)', true);
key.setEditKey([['M-y'], ['ESC', 'y']], function (ev) {
if (!command.kill.ring.length) {
return;
}
let (ct = command.getClipboardText()) (!command.kill.ring.length || ct != command.kill.ring[0]) &&
command.pushKillRing(ct);
prompt.selector({message: "Paste:", collection: command.kill.ring, callback: function (i) {if (i >= 0) {key.insertText(command.kill.ring[i]);}}});
}, '以前にコピーしたテキスト一覧から選択して貼り付け', true);
key.setEditKey('C-w', function (ev) {
goDoCommand("cmd_copy");
goDoCommand("cmd_delete");
command.resetMark(ev);
}, '選択中のテキストを切り取り (Kill region)', true);
key.setEditKey([['M-n'], ['ESC', 'n']], function (ev) {
command.walkInputElement(command.elementsRetrieverTextarea, true, true);
}, '次のテキストエリアへフォーカス');
key.setEditKey([['M-p'], ['ESC', 'p']], function (ev) {
command.walkInputElement(command.elementsRetrieverTextarea, false, true);
}, '前のテキストエリアへフォーカス');
key.setEditKey(['C-c', 'e'], function (ev, arg) {
ext.exec("edit_text", arg, ev);
}, '外部エディタで編集', true);
key.setEditKey(['ESC', 'ESC'], function (ev, arg) {
ev.originalTarget.dispatchEvent(key.stringToKeyEvent("ESC", true));
}, 'ESC キーイベントを投げる');
key.setCaretKey('m', function (ev, arg) {
shell.input("weblio " + (content.getSelection() || ""));
}, 'Lookup the meaning of the word');
key.setCaretKey([['C-a'], ['^']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectBeginLine") : goDoCommand("cmd_beginLine");
}, 'キャレットを行頭へ移動');
key.setCaretKey([['C-e'], ['$'], ['M->'], ['G'], ['ESC', '>']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectEndLine") : goDoCommand("cmd_endLine");
}, 'キャレットを行末へ移動');
key.setCaretKey([['C-n'], ['j']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectLineNext") : goDoCommand("cmd_scrollLineDown");
}, 'キャレットを一行下へ');
key.setCaretKey([['C-p'], ['k']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectLinePrevious") : goDoCommand("cmd_scrollLineUp");
}, 'キャレットを一行上へ');
key.setCaretKey([['C-f'], ['l']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectCharNext") : goDoCommand("cmd_scrollRight");
}, 'キャレットを一文字右へ移動');
key.setCaretKey([['C-b'], ['h'], ['C-h']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectCharPrevious") : goDoCommand("cmd_scrollLeft");
}, 'キャレットを一文字左へ移動');
key.setCaretKey([['M-f'], ['w'], ['ESC', 'f']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectWordNext") : goDoCommand("cmd_wordNext");
}, 'キャレットを一単語右へ移動');
key.setCaretKey([['M-b'], ['W'], ['ESC', 'b']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectWordPrevious") : goDoCommand("cmd_wordPrevious");
}, 'キャレットを一単語左へ移動');
key.setCaretKey([['C-v'], ['SPC']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectPageNext") : goDoCommand("cmd_movePageDown");
}, 'キャレットを一画面分下へ');
key.setCaretKey([['M-v'], ['b'], ['ESC', 'v']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectPagePrevious") : goDoCommand("cmd_movePageUp");
}, 'キャレットを一画面分上へ');
key.setCaretKey([['M-<'], ['g'], ['ESC', '<']], function (ev) {
ev.target.ksMarked ? goDoCommand("cmd_selectTop") : goDoCommand("cmd_scrollTop");
}, 'キャレットをページ先頭へ移動');
key.setCaretKey('J', function (ev) {
util.getSelectionController().scrollLine(true);
}, '画面を一行分下へスクロール');
key.setCaretKey('K', function (ev) {
util.getSelectionController().scrollLine(false);
}, '画面を一行分上へスクロール');
key.setCaretKey(',', function (ev) {
util.getSelectionController().scrollHorizontal(true);
goDoCommand("cmd_scrollLeft");
}, '左へスクロール');
key.setCaretKey('.', function (ev) {
goDoCommand("cmd_scrollRight");
util.getSelectionController().scrollHorizontal(false);
}, '右へスクロール');
key.setCaretKey('z', function (ev) {
command.recenter(ev);
}, 'キャレットの位置までスクロール');
key.setCaretKey([['C-SPC'], ['C-@'], ['C-`']], function (ev) {
command.setMark(ev);
}, 'マークをセット', true);
key.setCaretKey(':', function (ev, arg) {
shell.input(null, arg);
}, 'コマンドの実行', true);
key.setCaretKey('R', function (ev) {
BrowserReload();
}, '更新', true);
key.setCaretKey('B', function (ev) {
BrowserBack();
}, '戻る');
key.setCaretKey('F', function (ev) {
BrowserForward();
}, '進む');
key.setCaretKey(['C-x', 'h'], function (ev) {
goDoCommand("cmd_selectAll");
}, 'すべて選択', true);
key.setCaretKey('f', function (ev) {
command.focusElement(command.elementsRetrieverTextarea, 0);
}, '最初のインプットエリアへフォーカス', true);
key.setCaretKey([['M-p'], ['ESC', 'p']], function (ev) {
command.walkInputElement(command.elementsRetrieverButton, true, true);
}, '次のボタンへフォーカスを当てる');
key.setCaretKey([['M-n'], ['ESC', 'n']], function (ev) {
command.walkInputElement(command.elementsRetrieverButton, false, true);
}, '前のボタンへフォーカスを当てる');
key.setCaretKey(['ESC', 'ESC'], function (ev, arg) {
ev.originalTarget.dispatchEvent(key.stringToKeyEvent("ESC", true));
}, 'ESC キーイベントを投げる');
key.setGlobalKey('C-l', function (ev, arg) {
ext.exec("hok-start-foreground-mode", arg, ev);
}, 'HoK - リンクをフォアグラウンドで開く');
key.setGlobalKey(['C-x', 'C-l'], function (ev, arg) {
ext.exec("hok-start-background-mode", arg, ev);
}, 'HoK - リンクをバックグラウンドで開く', true);
key.setViewKey(';', function (aEvent, aArg) {
ext.exec("hok-start-extended-mode", aArg);
}, 'HoK - 拡張ヒントモード', true);