Remove jquery from setDirLabel.

This commit is contained in:
mmcwilliams 2017-11-21 16:43:56 -05:00
parent 722d3701ac
commit c402e6e87d
1 changed files with 10 additions and 12 deletions

View File

@ -356,13 +356,14 @@
};
var setDirLabel = function (dir) {
'use strict';
const bwdLabel = document.getElementById('bwdLabel');
const fwdLabel = document.getElementById('fwdLabel');
if (dir) {
$('#bwdLabel').removeClass();
$('#fwdLabel').addClass('selected');
bwdLabel.classList.remove('selected')
fwdLabel.classList.add('selected')
} else {
$('#fwdLabel').removeClass();
$('#bwdLabel').addClass('selected');
fwdLabel.classList.remove('selected')
bwdLabel.classList.add('selected')
}
};
var incCounter = function (val) {
@ -389,7 +390,8 @@
};
</script>
<script>
var web = {};
'use strict'
const web = {};
web.frame = function () {
$.ajax({
method : 'POST',
@ -408,7 +410,7 @@
}
};
web.setDir = function () {
var dir = !document.getElementById('dir').checked;
const dir = !document.getElementById('dir').checked;
/*$.ajax({
method : 'POST',
url : '/dir',
@ -417,20 +419,18 @@
dataType : 'json',
success : web.setDirSuccess
});*/
var opts = {
const opts = {
method : 'POST',
body : { dir : dir}
};
fetch('/dir', opts).then(web.setDirSuccess);
};
web.setDirSuccess = function (res) {
'use strict';
STATE.dir = res.dir;
setDirLabel(res.dir);
console.log('setDir to ' + res.dir);
};
web.getState = function () {
'use strict';
$.ajax({
method : 'GET',
url : '/status',
@ -438,7 +438,6 @@
});
};
web.getStateSuccess = function (res) {
'use strict';
var exposure;
var scale;
if (res.frame.dir !== true) {
@ -479,7 +478,6 @@
};
web.setExposureSuccess = function (res) {
'use strict';
var exposure;
if (res.exposure < BOLEX.expected) {
res.exposure = BOLEX.expected;