From e7ed285298166bf0589f6a6d8e88000c60d5681b Mon Sep 17 00:00:00 2001 From: Humberto Alfonso Díaz Date: Fri, 5 Jul 2019 11:15:05 +0200 Subject: FUNCT Add buttons, fan speed and chair functionality --- src/js/buttons.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/js/buttons.js (limited to 'src/js/buttons.js') 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 -- cgit 1.2.3-korg