Adding Clone button and ESC key event

This commit is contained in:
Fabian Stamm 2017-06-20 17:50:09 +02:00
parent 1116b1404f
commit 218834c175

View File

@ -140,7 +140,7 @@
}
$("#trackname").html(selected.displayName);
$("#trackfile").html(selected.file !==undefined ? selected.file : "");
var t = "<tr><th>ID</th><th>Stunde</th><th>Minute</th><th>Sekunde</th><th>Frame</th><th>ArtNet-Kanal</th><th>Art-Net Value</th><th>Edit</th><th>Del</th></tr>";
var t = "<tr><th>ID</th><th>Stunde</th><th>Minute</th><th>Sekunde</th><th>Frame</th><th>ArtNet-Kanal</th><th>Art-Net Value</th><th>Copy</th><th>Edit</th><th>Del</th></tr>";
var sorted = selected.triggers.sort((a, b)=>{
if(a.time.lmilliseconds < b.time.lmilliseconds) return -1;
if(a.time.lmilliseconds > b.time.lmilliseconds) return 1;
@ -155,6 +155,7 @@
t += "<td>" + e.time.lframe + "</td>"
t += "<td>" + e.art.subnet + "</td>"
t += "<td>" + e.art.value + "</td>"
t += "<td><button onclick='copy(\"" + e.id + "\")'><i class='fa fa-clone' aria-hidden='true'></i></button></td>"
t += "<td><button onclick='edit(\"" + e.id + "\")'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></button></td>"
t += "<td><button onclick='remove(\"" + e.id + "\")'><i class='fa fa-trash-o' aria-hidden='true'></i></button></td>"
t += "</tr>";
@ -180,6 +181,23 @@
$("#eval").val(el.art.value);
}
function copy(id) {
console.log("edit with id", id)
var el = undefined;
selected.triggers.forEach(e=>{
if(e.id === id){
el = e;
}
})
$("#eh").val(el.time.lhours);
$("#eh").focus();
$("#em").val(el.time.lminutes);
$("#es").val(el.time.lseconds);
$("#ef").val(el.time.lframe);
$("#esu").val(el.art.subnet);
$("#eval").val(el.art.value);
}
function remove(id) {
socket.emit("delete", {track:selected.id, id:id})
console.log("remove with id", id)
@ -219,6 +237,18 @@
function stopSequence(){
socket.emit("stop");
}
$(document).keyup(function(e) {
if (e.keyCode === 27) {
$("#eid").val("");
$("#eh").val("");
$("#em").val("");
$("#es").val("");
$("#ef").val("");
$("#esu").val("");
$("#eval").val("");
} // esc
});
</script>
</body>
</html>