-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.html
650 lines (625 loc) · 44.3 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
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
<!DOCTYPE html>
<html>
<head>
<title>Much Programming Core</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU"
crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.16/css/uikit.min.css" />
<link rel="stylesheet" href="css/muchpc.css?3.0" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.16/js/uikit.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.0.0-rc.16/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.15.0/vuedraggable.min.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body>
<div class="background" id="app" uk-height-viewport="expand">
<div class="page uk-box-shadow-large">
<nav class="uk-navbar-container uk-box-shadow-medium" uk-navbar>
<div class="uk-navbar-left">
<a class="uk-navbar-item uk-logo">TsFreddie's MPC</a>
<!-- <span>Locale <i class="fas fa-question-circle" uk-tooltip="Determines how keys are displayed. Won't affect keycode assigned."></i> :</span>
<div class="key-form-custom" uk-form-custom style="margin-left: 5px;">
<select class="uk-select uk-form-width-medium" v-model="locale" @change="(e) => {changeLocale(e.target.value);}">
<option v-for="(locale, key) in keyLocales" v-bind:value="key">{{ locale.name }}</option>
</select>
<button class="uk-button uk-button-default" type="button" tabindex="-1">
<span>{{ keyLocales[locale].name }}</span>
<span uk-icon="icon: chevron-down"></span>
</button>
</div> -->
</div>
<div class="uk-navbar-right">
<div class="uk-navbar-item">Profile: </div>
<div class="uk-navbar-item">
<div class="uk-subnav uk-subnav-pill">
<li @click="active_profile = 0" :class="{'uk-active': active_profile == 0}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">L0</a></li>
<li @click="active_profile = 1" :class="{'uk-active': active_profile == 1}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">L1</a></li>
<li @click="active_profile = 2" :class="{'uk-active': active_profile == 2}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">L2</a></li>
<li @click="active_profile = 3" :class="{'uk-active': active_profile == 3}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">L3</a></li>
</div>
</div>
</div>
</nav>
<div class="uk-padding-small uk-text-right">
<button class="uk-button-small uk-button-default uk-box-shadow-small" @click="openFile(importFile)">Load JSON</button>
<button class="uk-button-small uk-button-default uk-box-shadow-small" @click="exportFile()">Save JSON</button>
<button class="uk-button-small uk-button-primary uk-box-shadow-small" @click="generateOld()" uk-tooltip="The binary generation code directly from Vortexgear">Generate Binary (Vortex)</button>
<button class="uk-button-small uk-button-primary uk-box-shadow-small" @click="generate()" uk-tooltip="My custom solution, might fix some problems">Generate Binary (Custom)</button>
</div>
<div id="container" class="uk-padding uk-padding-remove-top">
<div class="core">
<div class="led" :class="ledClass"></div>
<div class="row" v-for="(keys, index) in rows" :row="index">
<div v-for="key in keys" class="key-border key"
:class="['key-'+key.type, {selected: selected_key == key}]"
@click='selected_key = key; UIkit.tab("#tabs").show(2)'>
<div class="key-container">
<span class="key-legend-main" v-html="keyDef[key.profiles[active_profile].bind].legend"></span>
<span class="key-legend-pn color-pn" v-html="key.profiles[active_profile].bind!='0' && key.profiles[active_profile].bind==key.profiles[active_profile].pn ? '\<i class=\'far fa-clone\'\>\</i\>' : keyDef[key.profiles[active_profile].pn].legend">
</span>
</div>
<span class="key-legend-fn1 color-fn1" v-html="key.profiles[active_profile].bind!='0' && key.profiles[active_profile].bind==key.profiles[active_profile].fn1 ? '\<i class=\'far fa-clone\'\>\</i\>' : keyDef[key.profiles[active_profile].fn1].legend">
</span>
<span class="key-legend-fn color-fn" v-html="key.profiles[active_profile].bind!='0' && key.profiles[active_profile].bind==key.profiles[active_profile].fn ? '\<i class=\'far fa-clone\'\>\</i\>' : keyDef[key.profiles[active_profile].fn].legend">
</span>
</div>
</div>
</div>
<div class="uk-column-1-2 uk-margin">
<div class="macro-limit">
<span>Macro Limit </span>
<span><i class="fas fa-question-circle" uk-tooltip="MPC firmware has a hard limit of 20 macros per profile."></i></span>
<span>:</span>
<span>{{currentProfileNumMacro}}/20</span>
<progress class="uk-progress" :value="currentProfileNumMacro" max="20" :class="{'progress-danger': currentProfileNumMacro > 20}"></progress>
</div>
<div class="memory-limit">
<span>Memory Usage </span>
<span><i class="fas fa-question-circle" uk-tooltip="Preferred binary size is 8KB"></i></span>
<span>:</span>
<span>{{memoryUsage}}/8192 Bytes</span>
<progress class="uk-progress" :value="memoryUsage" max="8192" :class="{'progress-danger': memoryUsage > 8192}"></progress>
</div>
</div>
<div v-if="currentProfileNumMacro > 20" class="uk-alert-danger" uk-alert>
<b>Macro limit excceded!</b> You can safely apply the layout, but not all of your macros are guaranteed to work.
</div>
<div v-if="memoryUsage > 8192" class="uk-alert-danger" uk-alert>
<b>Memory usage excceded!</b> Some of your macros might not work. Usually the macros in L3 will stop working. Based on my testing, out of range key settings seem to work just fine.
</div>
<ul id="tabs" uk-tab>
<li><a><i class="fas fa-info-circle"></i></a></li>
<li><a>Macros</a></li>
<li><a>Key Settings</a></li>
<li><a>Toolbox</a></li>
</ul>
<ul class="uk-switcher uk-margin">
<li>
<h4>Programming Tool for Vortex CORE <span class="uk-text-meta"> Such Core, Much Programming</span></h4>
<p>
<a class="uk-button uk-button-primary" target="_blank" href="CORE_MPC%20firmware.exe">MPC
firmware</a>
<a class="uk-button uk-button-default" target="_blank" href="MPC_instruction_CORE.pdf">Manual</a>
</p>
<a class="github-button" target="_blank" href="https://github.com/tsfreddie" data-size="large" aria-label="Follow @TsFreddie on GitHub">Follow
@TsFreddie</a>
<h4>Changelog <button class="uk-button uk-button-default uk-button-small" uk-toggle="target: #old-changelog; animation: uk-animation-fade" type="button">History</button></h4>
<div class="uk-margin">
<div class="uk-card uk-card-body uk-box-shadow-medium uk-card-secondary uk-card-small">
<h3 class="uk-card-title">v3.0</h3>
<ul>
<li><b>Added a custom binary generation procedure (The "Custom" Button). </b>
<ul>
<li>
Please let me know which one works or doesn't work for you on <a target="_blank" href="https://github.com/TsFreddie/much-programming-core/issues">Github</a>
</li>
</ul>
</li>
<li><b>Macro editor update</b>
<ul>
<li>Now it is possible to create macro from keybinding window.</li>
<li>Added experimental keys to macros.</li>
<li>Added buttons to quickly set all key event intervals in a macro.</li>
</ul>
</li>
<li><b>Minor fixes and changes:</b>
<ul>
<li>Updated keys with more descriptive labels</li>
<li>Allows more keys to be changed: Fn can now be swapped with other modifiers</li>
<li>Fixed the size of macro buttons in Firefox</li>
<li>Added a memory usage indicator</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="uk-child-width-1-2" id="old-changelog" uk-grid hidden>
<div>
<div class="uk-card uk-card-body uk-box-shadow-large uk-card-small">
<h3 class="uk-card-title">v2.9</h3>
<ul>
<li>Added F13 to F24.</li>
<li>Added experimental keys which allows you to use all avaliable keycodes in the firmware.</li>
<li>Added a macro limit indicator.</li>
</ul>
</div>
</div>
<div>
<div class="uk-card uk-card-body uk-box-shadow-large uk-card-small">
<h3 class="uk-card-title">v2.8</h3>
Fixed the clamp function of the repeat setting in macro editor.
</div>
</div>
<div>
<div class="uk-card uk-card-body uk-box-shadow-large uk-card-small">
<h3 class="uk-card-title">v2.7</h3>
Fixed a keycode of B key on FN1 layer.
</div>
</div>
<div>
<div class="uk-card uk-card-body uk-box-shadow-large uk-card-small">
<h3 class="uk-card-title">v2.6</h3>
Fixed a problem where L0~L3 key cause errors while saving macros.
</div>
</div>
</div>
<h4>Frequently asked questions</h4>
<ul class="uk-list uk-list-striped">
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-apply; animation: uk-animation-fade">How
do I apply my layout?</a>
<div id="faq-apply" class="uk-padding-small" hidden>
<p>
Short version: <br>1.Unplug your keyboard<br>2.Hold both Fn and D keys<br>3.plug
in your keyboard, and a drive will appear on you computer.<br>4.copy the layout
file into the drive. <br>5.make sure there are only 1 file in the drive. <br>6.unplug
your keyboard.<br>7.wait 3 seconds before plugging your keyboard in.
</p>
<p>* Fn key is the fouth key from the right on the bottom row.</p>
<p>
If you still don't know how to apply the layout, you may want to read the
offical manual.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-keep; animation: uk-animation-fade">Do
I keep my layout if I flash the MPC firmware?</a>
<div id="faq-keep" class="uk-padding-small" hidden>
<p>
No. Your layout will be wiped when you flash the MPC firmware.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-lspace; animation: uk-animation-fade">My
left space key acts like a Fn modifier after I flashed the firmware.</a>
<div id="faq-lspace" class="uk-padding-small" hidden>
<p>
There is a bug in the firmware that caused this. To fix it, simply apply a
layout file from this tool. I fixed it for you in this tool.
</p>
<p>
To get technical, each key have another code, vortexgear named it ktm code
(Key-to-modifier code I guess), that allows that key to acts like Pn/Fn/Fn1
modifiers. However, vortexgear assigned a value of 0 to the left space key. So,
when no modifier is swaped, they default to value 0. As the result, the left
space is bind with Fn by default. In fact, in the official MPC tool, if you
only set Fn in Func.key change, the left space bar will become Fn1 instead. To
fix that in the offical tool, you need to set every modifier key to release the
left space key for remapping.
</p>
<p>
Nonetheless, you don't need to worry about any of that, this tool automatically
generate the fix in the binary file.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-mpc; animation: uk-animation-fade">What's
different in MPC firmware?</a>
<div id="faq-mpc" class="uk-padding-small" hidden>
<p>
You lose the ability of on-board programming.
</p>
<p>
You can change more keys. For example, you aren't allowed to change Fn + T on
the original firmware.
</p>
<p>
You can change the default profile (L0) using this tool. (The offical tool
won't let you.)
</p>
<p>
You cannot swap Fn Modifier with another key. (You can, but there is a bug in
the firmware that won't let you rebind the R_Win key. Due to this reason, you
aren't allowed to rebind Fn key in this tool.)
</p>
<p>
You gain another programmable layer: Pn layer. I recommend to make more use of
the Pn layer instead of Fn due to the fact that you can't change the location
of Fn key. And that way you don't lose the ability to switch layer.
</p>
<p>
You lose the Caplock indicator.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-profile-key; animation: uk-animation-fade">Can
I rebind Fn + M, <, > and Shift?</a>
<div id="faq-profile-key" class="uk-padding-small" hidden>
<p>
Yes, you can. The official manual stated that you cannot rebind those key
combination. However, that is NOT true, you can totally rebind those.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-blub; animation: uk-animation-fade">What
is <i class="fas fa-lightbulb"></i> ?</a>
<div id="faq-blub" class="uk-padding-small" hidden>
<p>
Believe or not, Vortex CORE MPC firmware do have RGB control.
This maybe due to the fact that there is a unreleased RGB version of CORE, and
both version share the same firmware.
</p>
<p>
So the <i class="fas fa-lightbulb"></i> icon indicates there is a RGB control
function mapped to that key in Pn layer. You probably won't need them if you
have a regular CORE. In that case, you can unmap all RGB control in the
toolbox.
</p>
<p>
That being said, there is a single RGB light in a regular CORE: THE CAPLOCK
INDICATOR! Sadly, this means, the MPC firmware does not have a real Caplock
indicator.
Instead, the indicator light is controled by RGB settings.
</p>
</div>
</li>
<li>
<a class="uk-link-heading" uk-toggle="target: #faq-clone; animation: uk-animation-fade">What
is <i class="far fa-clone"></i> ?</a>
<div id="faq-clone" class="uk-padding-small" hidden>
<p>
This icon simply means you have the same keybind on a layer as the keybind on
the key itself.
</p>
<p>
You might find it handy on modifier keys, when you need shift to act like shift
in all layers.
</p>
</div>
</li>
</ul>
<p class="uk-text-meta">
This project is NOT affiliated with, funded, or in any way associated with Vortexgear with
the exception of following: <br>
Binary format is designed by Vortexgear. <br>
MPC firmware and manual is provided and hosted by Vortexgear. <br>
</p>
</li>
<li>
<div class="uk-child-width-1-2" uk-grid>
<div>
<button class="uk-button uk-button-small uk-button-primary" @click="newMacro()"><i class="fas fa-plus"></i> New</button>
<button class="uk-button uk-button-small uk-button-default" uk-tooltip="Import macros from JSON file."
@click="openFile(importMacros)"><i class="far fa-file"></i> Import</button>
</div>
<div>
<span class="uk-align-right uk-text-meta">You can bind macros in Key Settings.</span>
</div>
</div>
<div class="uk-child-width-1-4" uk-grid>
<div v-for="(macro, index) in macros">
<div class="uk-card uk-card-small uk-card-default uk-card-body uk-visible-toggle">
<div class="uk-text-meta">
<i class="fas fa-sync-alt"></i>
<span v-if="macro.type == 1">Once</span>
<span v-if="macro.type == 2">Until release</span>
<span v-if="macro.type == 3">Toggle</span>
<span v-if="macro.type == 4">{{ macro.repeats }} times</span>
</div>
<div class="macro-title uk-text-lead">{{ macro.title }}</div>
<ul class="uk-iconnav uk-position-top-right uk-invisible-hover">
<li><a @click="editMacro(index)"><i class="fas fa-pen-square uk-text-large uk-text-primary"></i></a></li>
</ul>
<div>
<div v-for="code in previewMacro(macro).slice(0,6)"
class="key-border key small fk-1x1 key-non-interactive">
<div class="key-container">
<div class="key-legend-main" v-html="keyDef[code].legend"></div>
</div>
</div>
<span v-if="previewMacro(macro).length > 6" class="macro-more">+{{ previewMacro(macro).length-6 }}</span>
</div>
</div>
</div>
</div>
</li>
<li>
<div v-if="!selected_key" class="uk-alert-primary" uk-alert>
Please select a key.
</div>
<div v-else class="uk-column-1-2">
<p>
<span>Base Key: </span>
<button class="uk-button uk-button-default" @click="bindKey(0)">{{
keyDef[currentKeyProfile.bind].name }}</button>
</p>
<p><span class="color-fn">Fn Layer: </span> <button class="uk-button uk-button-default"
@click="bindKey(2)">{{ keyDef[currentKeyProfile.fn].name }}</button></p>
<p><span class="color-pn">Pn Layer: </span> <button class="uk-button uk-button-default"
@click="bindKey(1)">{{ keyDef[currentKeyProfile.pn].name }}</button></p>
<p><span class="color-fn1">Fn1 Layer: </span> <button class="uk-button uk-button-default"
@click="bindKey(3)">{{ keyDef[currentKeyProfile.fn1].name }}</button></p>
</div>
</li>
<li>
<div class="uk-column-1-2">
<p v-for="(shortcut, index) in shortcuts"><button class="uk-button uk-button-default"
@click="UIkit.modal.confirm('Are you sure?').then(function(){shortcut();}, function(){});">{{
index }}</button></p>
</div>
</li>
</ul>
</div>
</div>
<div id="key-selector-modal" class="key-selector uk-flex-top uk-modal-container" uk-modal>
<div v-if="selected_key" class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">
<div v-if="selected_key.locked && selected_key_layer == 0" class="fullKeyboard">
<div class="fk-title">
<span class="uk-alert-primary uk-align-right" uk-alert>
This key can only be a modifier.
</span>
<span class="uk-text-lead">
<span v-if="this.selected_key_layer" :class='currentKeyLayerColor'>{{currentKeyLayerPrefix}}</span>
<span v-if="this.selected_key_layer"> + </span>
<span v-html="'[ ' + keyDef[currentKeyCode].legend + ' ]'"></span>
<span style="color: #888888"><i class="fas fa-long-arrow-alt-right"></i></span>
<span>{{ keyDef[binding_key].name }}</span>
</span>
</div>
<div class="row" v-for="(keys, index) in fullKeyboard" :row="index">
<div v-for="key in keys" v-if="key.code == 'FN' || key.code == 'PN' || key.code == 'FN1'"
class="key-border key small"
@click="binding_key=key.code" :class="['fk-'+key.type, {selected: binding_key == key.code}]">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
</div>
</div>
<div v-else class="fullKeyboard">
<div class="fk-title">
<span v-if="isUnbindable(currentKeyDefault) && currentKeyDefault == currentKeyBind" class="uk-alert-primary uk-align-right" uk-alert>
If you change this key, it will lose the ability to {{ unbindableDesc(currentKeyDefault) }}.
</span>
<span v-if="binding_key=='FN' || binding_key=='FN1' || binding_key=='PN'" class="uk-alert-primary uk-align-right" uk-alert>
If you set this key as a modifier, pn/fn/fn1 layers on this key might not work.
</span>
<span class="uk-text-lead">
<span v-if="this.selected_key_layer" :class='currentKeyLayerColor'>{{currentKeyLayerPrefix}}</span>
<span v-if="this.selected_key_layer"> + </span>
<span v-html="'[ ' + keyDef[currentKeyCode].legend + ' ]'"></span>
<span style="color: #888888"><i class="fas fa-long-arrow-alt-right"></i></span>
<span>{{ keyDef[binding_key].name }}</span>
</span>
</div>
<div class="row" v-for="(keys, index) in fullKeyboard" :row="index">
<div v-for="key in keys" v-if="key.code == null" :class="['fk-space', 'fk-'+key.type]"></div>
<div v-else-if="selected_key_layer != 0 && key.code != 'FN' && key.code != 'PN' && key.code != 'FN1'"
class="key-border key small"
@click="binding_key=key.code" :class="['fk-'+key.type, {selected: binding_key == key.code}]">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
<div v-else-if="selected_key_layer == 0 && (key.code == 'FN' || key.code == 'PN' || key.code == 'FN1') && currentProfileNumModifier(key.code) >= 4"
class="key-border key small"
:class="['fk-'+key.type, {selected: binding_key == key.code}]"
uk-tooltip="You can not set a modifier onto more than 4 keys"
>
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
<div v-else-if="selected_key_layer == 0 && (key.code == 'FN' || key.code == 'PN' || key.code == 'FN1')"
class="key-border key small"
@click="binding_key=key.code" :class="['fk-'+key.type, {selected: binding_key == key.code}]">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
<div v-else-if="selected_key_layer == 0 && (key.code != 'FN' && key.code != 'PN' && key.code != 'FN1')"
class="key-border key small"
@click="binding_key=key.code" :class="['fk-'+key.type, {selected: binding_key == key.code}]">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
<div v-else :class="['fk-space', 'fk-'+key.type]"></div>
</div>
</div>
<div v-if="!selected_key.locked || selected_key_layer != 0" class="uk-margin" uk-overflow-auto>
<div class="uk-inline">
<div class="macro-selection-border uk-box-shadow-medium uk-box-shadow-hover-large uk-padding-small"
@click="newMacro(true)">
<div class="uk-text-meta">
<i class="fas fa-plus"></i>
<span>Create</span>
</div>
<div class="macro-title uk-text-lead">New Macro</div>
</div>
</div>
<div v-for="(macro, index) in macros" class="uk-inline">
<div class="macro-selection-border uk-box-shadow-medium uk-box-shadow-hover-large uk-padding-small"
:class="{'uk-card-primary':binding_key == 'Macro' && binding_macro == macro.id }"
@click="binding_key = 'Macro'; binding_macro = macro.id">
<div class="uk-text-meta">
<i class="fas fa-sync-alt"></i>
<span v-if="macro.type == 1">Once</span>
<span v-if="macro.type == 2">Until release</span>
<span v-if="macro.type == 3">Toggle</span>
<span v-if="macro.type == 4">{{ macro.repeats }} times</span>
</div>
<div class="macro-title uk-text-lead">{{ macro.title }}</div>
<div>
<div v-for="code in previewMacro(macro).slice(0,6)"
class="key-border key small fk-1x1 key-non-interactive">
<div class="key-container">
<div class="key-legend-main" v-html="keyDef[code].legend"></div>
</div>
</div>
<span v-if="previewMacro(macro).length > 6" class="macro-more">+{{ previewMacro(macro).length-6 }}</span>
</div>
</div>
</div>
</div>
<div class="uk-margin">
<button class="uk-button uk-button-primary" @click="confirmBind()">Confirm</button>
<button class="uk-button uk-button-secondary" :disabled="binding_key==currentKeyDefault" @click="binding_key=currentKeyDefault">Default</button>
<button class="uk-button uk-button-default uk-modal-close">Cancel</button>
<div class="uk-align-right">
<div v-if="isUnbindable(currentKeyDefault)" class="key-border key small fk-1x1" :class="{selected: binding_key == currentKeyDefault}"
@click="binding_key = currentKeyDefault;" uk-tooltip="There are no keycodes for this function. You can use this key to restore its original function.">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[currentKeyDefault].legend"></span>
</div>
</div>
</div>
<div v-if="!selected_key.locked || selected_key_layer != 0" class="key-form-custom" uk-form-custom uk-tooltip="All other keycodes that are not listed above.">
<select class="uk-select uk-form-width-medium" v-model="binding_key">
<option v-for="key in hiddenKeyCode" v-bind:value="key">0x{{key}}: {{ keyDef[key].name }}</option>
</select>
<div class="key-border key small fk-1x1" :class="{selected: hiddenKeyCode.indexOf(binding_key) >= 0}">
<div class="key-container">
<div class="key-legend-main">
<span><i class="fas fa-flask"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="macro-modal" class="key-selector uk-flex-top uk-modal-container" uk-modal>
<div v-if="editing_macro" class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">
<div>
<div style="margin-left: 20px; margin-right: 20px">
Name
<input class="uk-input uk-form-width-large" type="text" @change="editing_macro.title=$event.target.value" :value="editing_macro.title"
style="margin-left: 5px;"
:class="{'uk-form-danger': editing_macro.title.length == 0}" placeholder="Macro Name" autofocus>
<div class="uk-align-right">
<button v-if="!new_macro" @click="removeMacro()" class="uk-button uk-button-danger">Delete</button>
</div>
</div>
<div class="uk-subnav uk-subnav-pill" style="margin: 20px">
Type
<li @click="editing_macro.type = 1" :class="{'uk-active': editing_macro.type == 1}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">Once</a></li>
<li @click="editing_macro.type = 2" :class="{'uk-active': editing_macro.type == 2}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">Until Release</a></li>
<li @click="editing_macro.type = 3" :class="{'uk-active': editing_macro.type == 3}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">Toggle</a></li>
<li @click="editing_macro.type = 4" :class="{'uk-active': editing_macro.type == 4}"><a
class="uk-box-shadow-small uk-box-shadow-hover-medium">Repeat</a></li>
<input v-if="editing_macro.type == 4"
:value="editing_macro.repeats" type="text"
@change="setRepeats($event)"
class="uk-input uk-form-width-medium uk-form-small uk-form-width-xsmall repeats-input"
>
</div>
</div>
<div class="fullKeyboard">
<div class="row" v-for="(keys, index) in fullKeyboard" :row="index">
<div v-for="key in keys" class="key-border key small" v-if="key.code!=null && key.code != 'FN' && key.code != 'PN' && key.code != 'FN1' && key.code != '0'"
@click="newEvent(key.code)" :class="['fk-'+key.type]">
<div class="key-container">
<div class="key-legend-main">
<span v-html="keyDef[key.code].legend"></span>
</div>
</div>
</div>
<div v-else :class="['fk-space', 'fk-'+key.type]"></div>
</div>
</div>
<draggable v-model="editing_macro.events" id="macro-list" class="uk-margin macro-event-list" :options="{handle: '.macro-event', animation: 200}" uk-overflow-auto>
<div v-for="(event, index) in editing_macro.events" class="macro-event-container" :uk-tooltip="hiddenKeyCode.indexOf(event.code) < 0 ? false : keyDef[event.code].name">
<div class="macro-event uk-visible-toggle" :class="{down: event.event == 1, up: event.event == 0}">
<div class="key-container" style="width: 12mm">
<div class="key-legend-main" v-html="keyDef[event.code].legend"></div>
<a class="uk-invisible-hover uk-text-danger" @click="removeEvent(index)"><i class="fas fa-minus-circle"></i></a>
<span style="margin-left: 9px">
<i v-if="event.event == 1" class="fas fa-caret-square-down"></i>
<i v-if="event.event == 0" class="far fa-caret-square-up"></i>
</span>
</div>
</div>
<div class="macro-interval-container">
<input :value="event.timer+'ms'" type="text"
@change="setTimer(event, $event)"
class="macro-interval uk-text-meta"
:class="{'long': event.timer > 1000}"
:style="{ width: 40+60*Math.min(event.timer, 1000)/1000 + 'px' }"
>
</div>
</div>
</draggable>
<div class="uk-margin">
<button class="uk-button uk-button-primary" :disabled="editing_macro.title.length == 0 || editing_macro.events.length ==0" @click="saveMacro()">SAVE</button>
<button class="uk-button uk-button-default" :class="[{'uk-button-danger': new_macro}]" @click="cancelMacro()">Cancel</button>
<span class="uk-margin uk-text-meta">You can drag each key event to change its order.</span>
<div class="uk-align-right">
<div v-for="i in [1, 10, 15, 100, 250, 500]" class="key-border key small fk-1x1" @click="setAllTimer(i)" :uk-tooltip="'Set all interval to '+i+'ms'">
<div class="key-container">
<div class="key-legend-main">
<span style="font-size: 11px;">{{i}}ms</span>
</div>
</div>
</div>
<div class="key-form-custom" uk-form-custom uk-tooltip="All other keycodes that are not listed above.">
<select class="uk-select uk-form-width-medium" @change="(e) => {newEvent(e.target.value); e.target.value = null;}">
<option v-for="key in hiddenKeyCode" v-bind:value="key" :selected='false'>0x{{key}}: {{ keyDef[key].name }}</option>
</select>
<div class="key-border key small fk-1x1">
<div class="key-container">
<div class="key-legend-main">
<span><i class="fas fa-flask"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<input id="importFile" type="file" hidden>
</div>
<script src="js/muchpc.js?3.0.2"></script>
</body>
</html>