-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (76 loc) · 3.44 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<style>
.block {
width: 100px;
height: 100px;
background-color: red;
}
.big-btn {
width: 200px;
height: 200px;
margin-left: 320px;
background-color: skyblue;
border-radius: 10px;
}
</style>
</head>
<body>
<script type="module">
import { shortcuts, pluginKey, pluginClick } from '/src/main.js'
const options = {
onShortcut ( shortcut, { context, note }) {
console.log ( '-- RESULTS --->' )
console.log ( 'Shortcut', shortcut )
console.log ( 'Context:', context )
if ( note ) console.log ( 'Note:', note )
} // onShortcut func.
}
const short = shortcuts ( options );
short.enablePlugin( pluginKey )
short.enablePlugin( pluginClick )
short.load ( { general : {
'key:q' : [ () => console.log('Q was clicked') ]
, 'key:r,o,s' : () => console.log ( 'ROS was clicked' )
, 'click:left-2' : () => console.log ( 'Mouse left click 2' )
, 'key:r' : [
({isWaiting}) => {
if ( !isWaiting() ) {
console.log ( 'R was clicked' )
}
}
]
, 'key:shift+w' : [
({wait, end, ignore, isWaiting, note }) => {
console.log ( 'HIT a shift + w')
ignore ()
if ( isWaiting () ) {
end ()
console.log('END')
}
else {
console.log('WAIT')
wait ()
}
},
({end}) => {
console.log ( 'W' )
setTimeout ( end, 3000 )
}
]
}
})
short.changeContext ( 'general' )
short.setNote ( 'some' )
</script>
<div class="block" data-click="red-block">
<span>hello</span>
</div>
<button class="big-btn" data-click="mega-button" draggable>Mega button</button>
</body>
</html>