diff --git a/assets/images/logo.svg b/assets/images/logo.svg new file mode 100644 index 0000000..bcb8dbd --- /dev/null +++ b/assets/images/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 67a0bff..9ad08ed 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -191,6 +191,7 @@ }, set: function() { app.controlling = { + title: this.group.name, selector: 'group_id', id: this.group.id, data: this.group.lights @@ -272,6 +273,7 @@ }, set: function() { app.controlling = { + title: this.data.label, selector: 'id', id: this.data.id, data: this.data diff --git a/index.html b/index.html index 7b1052f..114fa6b 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
- {{ controlling.label || controlling.name }} + {{ controlling.title }} LIFX Logout
diff --git a/js/app.js b/js/app.js index 6f82541..42e7e9a 100644 --- a/js/app.js +++ b/js/app.js @@ -1 +1 @@ -"use strict";!function(t){var e=!1,o=new Vue({el:"[vue-app]",data:{access_token:localStorage.getItem("lifx_access_token"),lights:[],groups:[],controlling:!1},mounted:function(){this.authenticate()},computed:{ordered_lights:function(){return _.orderBy(this.lights||[],"label")},ordered_groups:function(){return _.orderBy(this.groups||[],"name")}},methods:{authenticate:function(){var o=this;this.access_token?(localStorage.setItem("lifx_access_token",this.access_token),e=new Lifx(this.access_token),t(this.$el).addClass("loading"),e.list_lights().then(function(e){t(o.$el).removeClass("loading"),o.lights=e,o.group_builder()},function(e){t(o.$el).removeClass("loading"),e.error&&alert(e.error)})):(localStorage.removeItem("lifx_access_token"),e=!1)},logout:function(){localStorage.removeItem("lifx_access_token"),e=!1,location.reload()},group_builder:function(){var t=this,e=[];if(this.lights)for(var o=function(){var o=t.lights[i];o.group&&(r=_.findIndex(e,{id:o.group.id}),n={id:o.group.id,name:o.group.name,power:o.power,lights:_.values(_.filter(t.lights,function(t){return t.group.id===o.group.id}))},-1!==r?"on"===o.power&&(e[r].power="on"):e.push(n))},i=0;i=0){var i={index:o,data:this.lights[o]};return e?i[e]:i}return!!e&&null},update_group_lights:function(t,e){var o=this.get_group(t);if(o&&o.lights)for(var i=0;i=0){var i={index:o,data:this.lights[o]};return e?i[e]:i}return!!e&&null},update_group_lights:function(t,e){var o=this.get_group(t);if(o&&o.lights)for(var i=0;i