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