-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSurfingkeysSetting.js
More file actions
758 lines (697 loc) · 20.3 KB
/
SurfingkeysSetting.js
File metadata and controls
758 lines (697 loc) · 20.3 KB
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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
const {
aceVimMap,
mapkey,
imap,
iunmap,
imapkey,
getClickableElements,
vmapkey,
map,
unmap,
unmapAllExcept,
cmap,
addSearchAlias,
removeSearchAlias,
tabOpenLink,
readText,
Clipboard,
Front,
Hints,
Visual,
RUNTIME,
} = api;
// ---- Settings ----
Hints.setCharacters('asdfgyuiowertnm');
settings.scrollStepSize = 140;
settings.hintAlign = 'left';
// settings.aceKeybindings = 'emacs'
settings.nextLinkRegex = /((forward|>>|next|次[のへ]|→)+)/i;
settings.prevLinkRegex = /((back|<<|prev(ious)?|前[のへ]|←)+)/i;
settings.historyMUOrder = false;
settings.theme = `
#sk_status, #sk_find {
font-size: 12pt;
}
#sk_omnibarSearchResult .highlight {
background: #f9ec89;
}
`;
// ---- Utils ----
const unmapKeys = (keys) => keys.forEach((key) => unmap(key));
const iunmapKeys = (keys) => keys.forEach((key) => iunmap(key));
const escapeMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/',
'`': '`',
'=': '=',
};
const escapeForAlias = (str) =>
String(str).replace(/[&<>"'`=/]/g, (s) => escapeMap[s]);
const createSuggestionItem = (html, props = {}) => {
const li = document.createElement('li');
li.innerHTML = html;
return { html: li.outerHTML, props };
};
const padZero = (txt) => `0${txt}`.slice(-2);
const formatDate = (date, format = 'YYYY/MM/DD hh:mm:ss') =>
format
.replace('YYYY', date.getFullYear())
.replace('MM', padZero(date.getMonth() + 1))
.replace('DD', padZero(date.getDate()))
.replace('hh', padZero(date.getHours()))
.replace('mm', padZero(date.getMinutes()))
.replace('ss', padZero(date.getSeconds()));
const sendArrowKey = (direction) => {
const keyCodes = {
ArrowUp: 38,
ArrowDown: 40,
ArrowLeft: 37,
ArrowRight: 39,
};
const target = document.activeElement || document.body;
target.dispatchEvent(
new KeyboardEvent('keydown', {
key: direction,
code: direction,
keyCode: keyCodes[direction],
bubbles: true,
}),
);
};
const tabOpenBackground = (url) =>
RUNTIME('openLink', {
tab: {
tabbed: true,
active: false,
},
url,
});
// ---- Maps ----
map('>_r', 'r');
map('>_E', 'E');
map('>_R', 'R');
map('>_S', 'S');
map('S', 'sg'); // 選択したテキストまたはクリップボードからググる
map('r', 'gf'); // 別タブで開く
map('H', '>_S'); // back in history
map('L', 'D'); // forward in history
map('h', 'E'); // previousTab
map('l', '>_R'); // nextTab
map('R', '>_r'); // reload
map('{', '[[');
map('}', ']]');
mapkey('[', '#1Send ArrowLeft', () => sendArrowKey('ArrowLeft'));
mapkey(']', '#1Send ArrowRight', () => sendArrowKey('ArrowRight'));
map('<Ctrl-[>', '<Esc>');
iunmap(':'); // disable emoji
// disable vim binding in insert mode
iunmapKeys([
'<Ctrl-a>',
'<Ctrl-e>',
'<Ctrl-f>',
'<Ctrl-b>',
'<Ctrl-k>',
'<Ctrl-y>',
]);
// disable proxy
unmapKeys([';cp', ';pa', ';pb', ';pc', ';pd', ';ps', ';ap']);
// ---- Search ----
removeSearchAlias('b');
removeSearchAlias('w');
// hatena tag
addSearchAlias(
'th',
'hatena tag',
'https://b.hatena.ne.jp/q/{0}?safe=on&sort=recent&date_range=5y&target=tag&users=3',
);
// Twitter
addSearchAlias(
'x',
'Twitter',
'https://x.com/search?q=',
's',
'https://x.com/i/search/typeahead.json?count=10&filters=true&q=',
(response) =>
JSON.parse(response.text).topics.map((v) =>
createSuggestionItem(v.topic, {
url: `https://x.com/search?q=${encodeURIComponent(v.topic)}`,
}),
),
);
mapkey('otw', '#8Open Search with alias tw', function () {
Front.openOmnibar({ type: 'SearchEngine', extra: 'tw' });
});
addSearchAlias('xf', 'Twitter フォロワーのみ', 'https://x.com/search?pf=on&q=');
// Google jp 3ヶ月以内
addSearchAlias(
'3',
'Google 3ヶ月以内',
'https://www.google.co.jp/search?q={0}&tbs=qdr:m3,lr:lang_1ja&lr=lang_ja',
);
// Yahoo!リアルタイム検索
addSearchAlias(
'r',
'Yahoo!リアルタイム検索',
'https://search.yahoo.co.jp/realtime/search?p=',
);
// Wikipedia jp
addSearchAlias(
'wi',
'Wikipedia',
'https://ja.wikipedia.org/w/index.php?search=',
);
// MDN
addSearchAlias('mdn', 'MDN', 'https://developer.mozilla.org/ja/search?q=');
// npm
addSearchAlias(
'npm',
'npm',
'https://www.npmjs.com/search?q=',
's',
'https://api.npms.io/v2/search/suggestions?size=20&q=',
(response) =>
JSON.parse(response.text).map((s) => {
let flags = '';
let desc = '';
let stars = '';
let score = '';
if (s.package.description) {
desc = escapeForAlias(s.package.description);
}
if (s.score && s.score.final) {
score = Math.round(Number(s.score.final) * 5);
stars = '⭐'.repeat(score) + '☆'.repeat(5 - score);
}
if (s.flags) {
Object.keys(s.flags).forEach((f) => {
flags += `[<span style='color:#ff4d00'>⚑</span> ${escapeForAlias(
f,
)}] `;
});
}
return createSuggestionItem(
`
<div>
<style>.title>em { font-weight: bold; }</style>
<div class="title">${s.highlight}</div>
<div>
<span style="font-size:1.5em;line-height:1em">${stars}</span>
<span>${flags}</span>
</div>
<div>${desc}</div>
</div>
`,
{ url: s.package.links.npm },
);
}),
);
// Amazon jp
addSearchAlias(
'am',
'Amazon',
'https://www.amazon.co.jp/s?k=',
's',
'https://completion.amazon.co.jp/search/complete?method=completion&search-alias=aps&mkt=6&q=',
(response) => JSON.parse(response.text)[1],
);
// Amazon jp Kindle
addSearchAlias(
'k',
'Amazon Kindle',
'https://www.amazon.co.jp/s?i=digital-text&k=',
's',
'https://completion.amazon.co.jp/search/complete?method=completion&search-alias=aps&mkt=6&q=',
(response) => JSON.parse(response.text)[1],
);
// alc
addSearchAlias('alc', 'alc', 'https://eow.alc.co.jp/search?q=');
mapkey('oa', '#8Open Search with alias a', function () {
Front.openOmnibar({ type: 'SearchEngine', extra: 'alc' });
});
// mercari
addSearchAlias('me', 'mercari', 'https://www.mercari.com/jp/search/?keyword=');
// ---- Mapkeys ----//
const copyTitleAndUrl = (format) => {
const text = format
.replace('%URL%', location.href)
.replace('%TITLE%', document.title);
Clipboard.write(text);
};
const copyHtmlLink = () => {
const clipNode = document.createElement('a');
const range = document.createRange();
const sel = window.getSelection();
clipNode.setAttribute('href', location.href);
clipNode.innerText = document.title;
document.body.appendChild(clipNode);
range.selectNode(clipNode);
sel.removeAllRanges();
sel.addRange(range);
document.execCommand('copy', false, null);
document.body.removeChild(clipNode);
Front.showBanner('Ritch Copied: ' + document.title);
};
mapkey('cm', '#7Copy title and link to markdown', () => {
copyTitleAndUrl('[%TITLE%](%URL%)');
});
mapkey('cM', '#7Copy all tabs to markdown', () => {
RUNTIME('getTabs', { queryInfo: { currentWindow: true } }, (response) => {
const tabUrls = response.tabs
.map((tab) => `- [${tab.title}](${tab.url})`)
.join('\n');
Clipboard.write(tabUrls);
});
});
mapkey('ct', '#7Copy title and link to textile', () => {
copyTitleAndUrl('"%TITLE%":%URL%');
});
mapkey('ch', '#7Copy title and link to human readable', () => {
copyTitleAndUrl('%TITLE% / %URL%');
});
mapkey('cb', '#7Copy title and link to scrapbox', () => {
copyTitleAndUrl('[%TITLE% %URL%]');
});
mapkey('ca', '#7Copy title and link to href', () => {
copyTitleAndUrl('<a href="%URL%">%TITLE%</a>');
});
mapkey('cp', '#7Copy title and link to plantuml', () => {
copyTitleAndUrl('[[%URL% %TITLE%]]');
});
mapkey('cr', '#7Copy rich text link', () => {
copyHtmlLink();
});
mapkey('co', '#7Copy title and link to org', () => {
copyTitleAndUrl('[[%URL%][%TITLE%]]');
});
mapkey('cO', '#7Copy all tabs to org', () => {
RUNTIME('getTabs', { queryInfo: { currentWindow: true } }, (response) => {
const tabUrls = response.tabs
.map((tab) => `- [[${tab.url}][${tab.title}]]`)
.join('\n');
Clipboard.write(tabUrls);
});
});
// 8: Omnibar
// 9: Visual Mode
// 10: vim-like marks
// 11: Settings
// 12: Chrome URLs
mapkey('gS', '#12Open Chrome settings', () =>
tabOpenLink('chrome://settings/'),
);
// 13: Proxy
// 14: Misc
const createAiQuery = () => {
const title = document.title;
const url = window.location.href;
const query = `${title} ${url} を日本語で要約してください。
要約には以下の要素を含めてください:
- **主要なポイント** - ページの重要な情報や主張をいくつか箇条書きで示してください。
- **具体例やケーススタディ** - 記載されている例やケーススタディがあれば、それも箇条書きに含めてください。
- **結論や推奨事項** - ページで示されている結論や推奨事項を簡潔にまとめてください。
- **重要なデータや統計** - ページ中の特筆すべきデータや統計があればその要点を示してください。
`;
return encodeURIComponent(query);
};
mapkey('=f', '#14summarize With Felo AI', () => {
tabOpenBackground(`https://felo.ai/search?q=${createAiQuery()}`);
});
mapkey('=o', '#14summarize With OpenAI ChatGPT', () => {
tabOpenBackground(`https://chatgpt.com/?q=${createAiQuery()}`);
});
mapkey('=c', '#14summarize With Anthropic Claude', () => {
tabOpenBackground(`https://claude.ai/new?q=${createAiQuery()}`);
});
mapkey('=p', '#14summarize With PerplexityAI', () => {
tabOpenBackground(`https://www.perplexity.ai/?q=${createAiQuery()}`);
});
mapkey('=g', '#14summarize With Gemini', () => {
tabOpenBackground(`https://gemini.google.com/app?q=${createAiQuery()}`);
});
const createTranslateQuery = () => {
const title = document.title;
const url = window.location.href;
const query = `${title} ${url} を日本語に翻訳してください。
専門用語は適切な訳語を使用し、コードブロックはそのまま保持してください。
`;
return encodeURIComponent(query);
};
mapkey('=t', '#14translate With Gemini', () => {
tabOpenBackground(
`https://gemini.google.com/app?q=${createTranslateQuery()}`,
);
});
unmap(';t');
mapkey(';t', '#14google translate', () => {
const selection = window.getSelection().toString();
if (selection === '') {
// 文字列選択してない場合はページ自体を翻訳にかける
tabOpenLink(
`https://translate.google.com/translate?js=n&sl=auto&tl=ja&u=${window.location.href}`,
);
} else {
// 選択している場合はそれを翻訳する
tabOpenLink(
`https://translate.google.com/?sl=auto&tl=ja&text=${encodeURI(
selection,
)}`,
);
}
});
mapkey(';b', '#14hatena bookmark', () => {
const { location } = window;
let url = location.href;
if (location.href.startsWith('https://app.getpocket.com/read/')) {
url = decodeURIComponent(
document
.querySelector('header a')
.getAttribute('href')
.replace('https://getpocket.com/redirect?url=', ''),
);
}
if (url.startsWith('http:')) {
tabOpenBackground(
`http://b.hatena.ne.jp/entry/${url.replace('http://', '')}`,
);
return;
}
if (url.startsWith('https:')) {
tabOpenBackground(
`http://b.hatena.ne.jp/entry/s/${url.replace('https://', '')}`,
);
return;
}
throw new Error('はてなブックマークに対応していないページ');
});
mapkey(';G', '#14魚拓', () => {
tabOpenLink(`https://megalodon.jp/?url=${location.href}`);
});
// org
const escapeChars = ['(', ')', "'"];
const escapeForOrg = (text) => {
let _text = text;
escapeChars.forEach((char) => {
_text = _text.replaceAll(char, escape(char));
});
return _text;
};
const getUrl = (path, query) => {
const queryString = Object.entries(query)
.map(
([key, value]) =>
`${encodeURIComponent(key)}=${escapeForOrg(encodeURIComponent(value))}`,
)
.join('&');
return [path, queryString].join('?');
};
const orgCapture = (template) => {
const url = getUrl('org-protocol://capture', {
template,
url: window.location.href,
title: document.title.replace(/\|/g, '-'),
body: window.getSelection(),
});
console.log(`orgCapture: ${url}`);
window.location.href = url;
};
const orgRoamCapture = (template, option = {}) => {
const url = getUrl('org-protocol://roam-ref', {
template,
ref: window.location.href,
title: document.title,
body: window.getSelection(),
releaseDate: '',
creator: '',
...option,
});
console.log(`orgRoamCapture: ${url}`);
window.location.href = url;
};
mapkey(',m', '#14org-capture memo', () => {
orgCapture('M');
});
mapkey(',t', '#14org-capture todo', () => {
orgCapture('T');
});
mapkey(',l', '#14org-capture read it later', () => {
orgCapture('L');
});
mapkey(',r', '#14org-roam-capture ref', () => {
orgRoamCapture('r');
});
mapkey(',z', '#14org-roam-capture Resonance Calendar)', () => {
switch (window.location.hostname) {
case 'booklog.jp': {
let [, releaseDate] = document
.querySelector('.item-area-info')
.innerText.match(/\/ (.*?発売)/);
orgRoamCapture('z', {
title: document.querySelector('.item-area-info-title').innerText,
ref:
location.origin +
document
.querySelector('.item-area-info-title a')
.getAttribute('href'),
type: 'Book',
creator: document.querySelector('.author-link').innerText,
releaseDate,
});
return;
}
case 'www.amazon.co.jp': {
const url = `https://www.amazon.co.jp/dp/${
document.querySelectorAll("[name='ASIN'], [name='ASIN.0']")[0].value
}`;
orgRoamCapture('z', {
title: document.querySelector('#productTitle').innerText,
ref: url,
type: 'Book',
creator: document.querySelector('.author a').innerText,
releaseDate: document.querySelector(
'#rpi-attribute-book_details-publication_date > div.a-section.a-spacing-none.a-text-center.rpi-attribute-value > span',
).innerText,
});
return;
}
case 'www.youtube.com': {
orgRoamCapture('z', { type: 'Video' });
return;
}
default:
orgRoamCapture('z', { type: 'Web' });
}
});
mapkey('=q', '#14Delete query', () => {
location.href = location.href.replace(/\?.*/, '');
});
mapkey('=h', '#14Delete hash', () => {
location.href = location.href.replace(/\#.*/, '');
});
// 15: Insert Mode
// ---- qmarks ----
const qmarksMapKey = (prefix, urls, newTab) => {
const openLink = (link, newTab) => () => {
RUNTIME('openLink', {
tab: { tabbed: newTab },
url: link,
});
};
for (const key in urls) {
mapkey(prefix + key, `qmark: ${urls[key]}`, openLink(urls[key], newTab));
}
};
const qmarksUrls = {
m: 'https://mail.google.com/mail/u/0/',
h: 'http://b.hatena.ne.jp/hush_in/hotentry',
i: 'https://www.instapaper.com/u',
x: 'https://x.com/',
b: 'https://bsky.app/',
y: 'https://www.youtube.com/',
};
unmap('gn');
qmarksMapKey('gn', qmarksUrls, true);
qmarksMapKey('gO', qmarksUrls, false);
// --- Site-specific mappings ---
const clickElm = (selector) => () => document.querySelector(selector).click();
if (window.location.href.startsWith('https://docs.google.com/presentation/')) {
const target = document.getElementById('docs-chrome');
const focusDoc = () => {
// ページ送り後に何故かフォーカスが about:blank のページに飛ぶので、フォーカスを当て直す
setTimeout(() => {
target.focus();
}, 10);
};
focusDoc();
mapkey(']', 'next page', () => {
sendArrowKey('ArrowRight');
focusDoc();
});
mapkey('[', 'prev page', () => {
sendArrowKey('ArrowLeft');
focusDoc();
});
}
if (window.location.href.startsWith('https://drive.google.com/file/d/')) {
const goToPage = (pageNumber) => {
const input = document.querySelector('input');
console.log(`ページ ${pageNumber} にジャンプします...`, input);
if (!input) {
console.error('ページ番号入力欄が見つかりません');
return;
}
const enterEvent = new KeyboardEvent('keydown', {
key: 'Enter',
code: 'Enter',
keyCode: 13,
bubbles: true,
});
// ページ要素をクリックしていないと1回ではページ送りできないので、2回実行する
for (let i = 0; i < 2; i++) {
input.select();
input.value = pageNumber.toString();
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(enterEvent);
}
console.log(`ページ ${pageNumber} にジャンプしました`);
};
// 現在のページ数を取得
const getCurrentPage = () => {
const input = document.querySelector('input');
return input ? parseInt(input.value) : null;
};
// 総ページ数を取得
const getTotalPages = () => {
const input = document.querySelector('input');
const parentDiv = input.parentElement;
const grandParentDiv = parentDiv?.parentElement;
// スラッシュ(/)の次の兄弟要素を探す
const children = Array.from(grandParentDiv.children);
const slashIndex = children.findIndex(
(child) => child.textContent.trim() === '/',
);
const pageCountDiv = children[slashIndex + 1];
return pageCountDiv ? parseInt(pageCountDiv.textContent) : null;
};
// 次のページへ
const nextPage = () => {
const current = getCurrentPage();
const total = getTotalPages();
if (current && total && current < total) {
return goToPage(current + 1);
}
console.log('これが最後のページです');
};
// 前のページへ
const prevPage = () => {
const current = getCurrentPage();
if (current && current > 1) {
return goToPage(current - 1);
}
console.log('これが最初のページです');
};
mapkey(']', 'next page', nextPage);
mapkey('[', 'prev page', prevPage);
}
if (window.location.hostname === 'booklog.jp') {
mapkey(']', 'next page', clickElm('#modal-review-next'));
mapkey('[', 'prev page', clickElm('#modal-review-prev'));
mapkey('d', '読み終わった', clickElm('#status3'));
mapkey('R', 'Read by Kindle', () =>
RUNTIME('openLink', {
tab: { tabbed: true },
url: `https://read.amazon.co.jp/?asin=${document
.querySelector('.item-area-info-title a')
.getAttribute('href')
.replace(/.*\//, '')}`,
}),
);
}
if (window.location.hostname === 'www.amazon.co.jp') {
mapkey('=s', '#14URLを短縮', () => {
location.href = `https://www.amazon.co.jp/dp/${
document.querySelectorAll("[name='ASIN'], [name='ASIN.0']")[0].value
}`;
});
}
if (
/^https:\/\/b.hatena.ne.jp\/.*\/hotentry\?date/.test(window.location.href)
) {
const moveDate = (diff) => () => {
const url = new URL(window.location.href);
const dateTxt = url.searchParams.get('date');
const [_, yyyy, mm, dd] = dateTxt.match(/(....)(..)(..)/);
const date = new Date(
parseInt(yyyy, 10),
parseInt(mm, 10) - 1,
parseInt(dd, 10) + diff,
);
url.searchParams.set('date', formatDate(date, 'YYYYMMDD'));
location.href = url.href;
};
mapkey(']', 'next date', moveDate(1));
mapkey('[', 'prev date', moveDate(-1));
}
// Video Speed Controller keys
const videoSpeedKeys = ['d', 's', 'z', 'x', 'r', 'g', 'v'];
if (
['mail.google.com', 'x.com', 'feedly.com', 'www.figma.com/file'].some(
(domain) => window.location.href.startsWith(`https://${domain}`),
)
) {
unmapKeys([
'j',
'k',
'o',
'E',
'R',
'd',
'u',
'T',
'f',
'F',
'C',
'x',
'S',
'H',
'L',
'[',
']',
// 'cm',
// 'co',
// 'ch',
// ',t',
// ',m',
]);
}
if (
['www.amazon.co.jp/gp/video', 'www.netflix.com/watch'].some((domain) =>
window.location.href.startsWith(`https://${domain}`),
)
) {
// Video Speed Controller
unmapKeys(videoSpeedKeys);
}
if (
['www.youtube.com'].some((domain) =>
window.location.href.startsWith(`https://${domain}`),
)
) {
map('C', 'c');
// Video Control, Video Speed Controller
unmapKeys([...videoSpeedKeys, 'h', 'j', 'k', 'l', 'f', 't']);
}
if (
['docs.google.com/document/'].some((url) =>
window.location.href.startsWith(`https://${url}`),
)
) {
unmapAllExcept([]);
}
// click `Save` button to make above settings to take effect.
// refs.
// * https://github.com/b0o/surfingkeys-conf
// * https://github.com/ncaq/surfingkeys-ncaq