Added ply checks

This commit is contained in:
Igor Nurullaev
2019-09-05 17:01:14 +03:00
parent 424a845da0
commit cc370555c7
2 changed files with 31 additions and 10 deletions

View File

@@ -174,11 +174,19 @@ function setStartTime() {
}
function takeOff() {
sendCommandToSelected('takeoff');
if (table.getSelectedRows().length > 0) {
askPermission('Are you sure you want to take off this copters?', function () {
sendCommandToSelected('takeoff');
});
}
}
function flipCopters() {
sendCommandToSelected('flip');
if (table.getSelectedRows().length > 0) {
askPermission('Are you sure you want to flip this copters?', function () {
sendCommandToSelected('flip');
});
}
}
function land() {
@@ -224,11 +232,24 @@ function emLand() {
}
function startAnimation() {
spinner.style.display = 'inline-block';
setTimeout(function () {
let req = new XMLHttpRequest();
req.open('POST', '/start_animation', false);
req.send();
spinner.style.display = 'none';
}, 20);
askPermission('Are you sure you want to start animation?', function () {
spinner.style.display = 'inline-block';
setTimeout(function () {
let req = new XMLHttpRequest();
req.open('POST', '/start_animation', false);
req.send();
spinner.style.display = 'none';
}, 20);
});
}
function askPermission(text, func) {
Ply.dialog("confirm",
{},
text
).done(function (e) {
if (e.state) {
func();
}
});
}

View File

@@ -11,7 +11,7 @@
<script lang="js" src="/static/js/jquery.min.js"></script>
<script lang="js" src="/static/js/popper.min.js"></script>
<script lang="js" src="/static/js/bootstrap.min.js"></script>
<!--<script lang="js" src="/static/js/ply.js"></script>-->
<script lang="js" src="/static/js/ply.js"></script>
<script lang="js" src="/static/js/tabulator.min.js"></script>
</head>
<body>