pikvm/pikvm#63: added loop mode for macro

This commit is contained in:
Devaev Maxim 2020-09-11 07:00:56 +03:00
parent 401263fea3
commit 9b3f197506
3 changed files with 30 additions and 1 deletions

View File

@ -354,6 +354,18 @@
</tr> </tr>
</table> </table>
<hr> <hr>
<table class="kv">
<tr>
<td>Infinite loop playback:</td>
<td colspan="2">
<div class="switch-box">
<input disabled type="checkbox" id="hid-recorder-loop-checkbox">
<label for="hid-recorder-loop-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
</div>
</td>
</tr>
</table>
<hr>
<input type="file" id="hid-recorder-new-script-file"> <input type="file" id="hid-recorder-new-script-file">
<div class="buttons buttons-row"> <div class="buttons buttons-row">
<button class="row50" disabled id="hid-recorder-upload">Upload script</button> <button class="row50" disabled id="hid-recorder-upload">Upload script</button>

View File

@ -22,6 +22,17 @@ li(class="right")
td(id="hid-recorder-events-count" class="value") 0 td(id="hid-recorder-events-count" class="value") 0
td #[sup #[i include delays]] td #[sup #[i include delays]]
hr hr
table(class="kv")
tr
td Infinite loop playback:
td(colspan="2")
div(class="switch-box")
input(disabled type="checkbox" id="hid-recorder-loop-checkbox")
label(for="hid-recorder-loop-checkbox")
span(class="switch-inner")
span(class="switch")
hr
input(type="file" id="hid-recorder-new-script-file") input(type="file" id="hid-recorder-new-script-file")
div(class="buttons buttons-row") div(class="buttons buttons-row")
button(disabled id="hid-recorder-upload" class="row50") Upload script button(disabled id="hid-recorder-upload" class="row50") Upload script

View File

@ -222,7 +222,11 @@ export function Recorder() {
} }
index += 1; index += 1;
} }
__stopProcess(); if ($("hid-recorder-loop-checkbox").checked) {
setTimeout(() => __runEvents(0));
} else {
__stopProcess();
}
}; };
var __refresh = function() { var __refresh = function() {
@ -241,6 +245,8 @@ export function Recorder() {
wm.switchEnabled($("hid-recorder-stop"), (__ws && (__play_timer || __recording))); wm.switchEnabled($("hid-recorder-stop"), (__ws && (__play_timer || __recording)));
wm.switchEnabled($("hid-recorder-play"), (__ws && !__recording && __events.length)); wm.switchEnabled($("hid-recorder-play"), (__ws && !__recording && __events.length));
wm.switchEnabled($("hid-recorder-clear"), (!__play_timer && !__recording && __events.length)); wm.switchEnabled($("hid-recorder-clear"), (!__play_timer && !__recording && __events.length));
wm.switchEnabled($("hid-recorder-loop-checkbox"), (__ws && !__recording));
wm.switchEnabled($("hid-recorder-upload"), (!__play_timer && !__recording)); wm.switchEnabled($("hid-recorder-upload"), (!__play_timer && !__recording));
wm.switchEnabled($("hid-recorder-download"), (!__play_timer && !__recording && __events.length)); wm.switchEnabled($("hid-recorder-download"), (!__play_timer && !__recording && __events.length));