diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/buttons.js | 50 | ||||
-rw-r--r-- | src/js/chair.js | 19 | ||||
-rw-r--r-- | src/js/fan_speed.js | 10 |
3 files changed, 79 insertions, 0 deletions
diff --git a/src/js/buttons.js b/src/js/buttons.js new file mode 100644 index 0000000..3730d9f --- /dev/null +++ b/src/js/buttons.js @@ -0,0 +1,50 @@ +var buttons = { + ac: false, + auto: false, + circulation: false, + down: false, + up: false, + right: false, + rear: false, + front: false +}; + +module.exports = { + update: function() { + for( var button in buttons ) { + document.getElementById(button+'button').setAttribute('value', buttons[button]); + } + }, + ac: function() { + buttons.ac = !buttons.ac; + this.update(); + }, + auto: function() { + buttons.auto = !buttons.auto; + this.update(); + }, + circulation: function() { + buttons.circulation = !buttons.circulation; + this.update(); + }, + down: function() { + buttons.down = !buttons.down; + this.update(); + }, + up: function() { + buttons.up = !buttons.up; + this.update(); + }, + right: function() { + buttons.right = !buttons.right; + this.update(); + }, + rear: function() { + buttons.rear = !buttons.rear; + this.update(); + }, + front: function() { + buttons.front = !buttons.front; + this.update(); + } +}
\ No newline at end of file diff --git a/src/js/chair.js b/src/js/chair.js new file mode 100644 index 0000000..ceed88c --- /dev/null +++ b/src/js/chair.js @@ -0,0 +1,19 @@ +var left = 0; +var right = 0; + +module.exports = { + update_left: function() { + document.getElementById('LeftChair').setAttribute('value', left); + }, + left: function() { + left = (left + 1) % 3; + this.update_left(); + }, + update_right: function() { + document.getElementById('RightChair').setAttribute('value', right); + }, + right: function() { + right = (right + 1) % 3; + this.update_right(); + }, +}
\ No newline at end of file diff --git a/src/js/fan_speed.js b/src/js/fan_speed.js new file mode 100644 index 0000000..cc81fe0 --- /dev/null +++ b/src/js/fan_speed.js @@ -0,0 +1,10 @@ +module.exports = { + set: function(value) { + document.getElementById('FanSpeedProgress').value = value; + document.getElementById('FanSpeedInput').value = value; + }, + update: function( value ) { + this.set(value); + + } +}
\ No newline at end of file |