-
Notifications
You must be signed in to change notification settings - Fork 97
/
demo.html
28 lines (22 loc) · 1.05 KB
/
demo.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hotkey | Demo</title>
</head>
<body>
<button onclick="alert('clicked button 1!')" data-hotkey-scope="text-area-1" data-hotkey="Control+d,Meta+d">press meta+d or ctrl+d in text area 1 to click button 1</button><br>
<textarea id="text-area-1" rows="4" cols="40">text area 1</textarea><br>
<button onclick="alert('clicked button 2!')" data-hotkey-scope="text-area-2" data-hotkey="Control+d,Meta+d">press meta+d or ctrl+d in text area 2 to click button 2</button><br>
<textarea id="text-area-2" rows="4" cols="40">text area 2</textarea><br>
<label><input data-hotkey="t" type="text">Press t to focus this field</label><br>
<label><input data-hotkey="r" type="checkbox">Press r to check/uncheck this checkbox</label><br>
<a href="#ok" data-hotkey="o k">Press <kbd>o k</kbd> click this link</a>
<script type="module">
import {install} from '../dist/index.js'
for (const el of document.querySelectorAll('[data-hotkey]')) {
install(el)
}
</script>
</body>
</html>