-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
95 lines (86 loc) · 4.96 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<script src="https://codad5.github.io/keybinder/lib/keybinder.js"></script>
<script src="lib/keybinder.beta.js"></script>
<h1>Key Binder</h1>
<div id="bcdiv"><strong>Press B+G: </strong></div>
<div id="scdiv"><strong>Press Shift+C: </strong></div>
<div id="spacediv"><strong>Press the SpaceBar: </strong></div>
<button type="button" class="stopStart">Stop</button>
<p>
<h2>To know your key Name Press the key and see combination below!</h2>
<ol id="keystrokehistory">
</ol>
</p>
<!-- <script type="module" src="./out/keybinder.js" rel="preload"></script> -->
<!-- <script src="./cdn/keybinder@1.0.0.js"></script> -->
<script defer>
var stopped = false
const keyController = new KeyBinder({
default_listener: 'keyup',
element: window,
// case_sensitive:true
}),
ksh = document.querySelector('#keystrokehistory')
// const ListenToKey = (key, data) => keyController.ListenToKey(key, data)
document.querySelector('.stopStart').addEventListener('click', (e) => {
!stopped ? keyController.stopListening() : keyController.continue(true)
stopped = !stopped
if(stopped) return e.target.innerHTML = 'start'
e.target.innerHTML = 'stop'
})
const ListenToKey = (key, ...data) => keyController.ListenToKey(key, ...data)
ListenToKey('B+G', () => console.log("bye"), () => {
console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
document.querySelector('#bcdiv').innerHTML += 'Your Called me ?'
})
ListenToKey('shift+c', () => {
console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
document.querySelector('#scdiv').innerHTML += 'Do you mean Ctrl+c? try Ctrl+c'
})
ListenToKey('shift+z', () => {
console.log('ending the controller listening')
keyController.stopListening()
stopped = !stopped
document.querySelector('#scdiv').innerHTML += 'No more Listening!'
if(stopped) return document.querySelector('.stopStart').innerHTML = 'start'
document.querySelector('.stopStart').innerHTML = 'stop'
})
ListenToKey('shift+enter','j+j', 'shift+v', (data) => {
console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
console.table({...data, element: 'Window'})
confirm('Do you need more information?')
})
ListenToKey('shift+space', 'space', (data) => {
// console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
document.querySelector('#spacediv').innerHTML += 'la'
document.querySelector('#keystrokehistory').innerHTML += `<li>Your combination is ${data.combination} </li>`
})
ListenToKey('shift+s', (data) => {
console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
})
ListenToKey('shift+meta', (data) => {
// console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
if(alert('Dont press the windows key again')) return
})
ListenToKey('ctrl+b', (data) => {
// console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
confirm('bold combination')
})
ListenToKey('arrowup', (data) => {
// console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
document.querySelector('#keystrokehistory').innerHTML += `<li>Your combination is ${data.combination} </li>`
if(confirm('arrowup combination')) window.clientInformation.wakeLock.request()
})
ListenToKey('***', (data) => {
// console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr', 'background:blue;color:white;width:100%;height:50px;font-size:20px;')
ksh.innerHTML += `<li>Your combination is ${data.combination} </li>`
console.table({...data, element:'Window'})
})
ListenToKey('alt+c', (data) => {
console.log('%cThanks for using this by https://github.com/codad5 && https://github.com/ptbysr',
'background:blue;color:white;width:100%;height:50px;font-size:20px;')
document.querySelector('#keystrokehistory').innerHTML = ``
console.table({...data, element:'Window'})
})
</script>
<script>
</script>