[init.channels | vue.menu] renamed channel.active to channel.current

This commit is contained in:
xdrm-brackets 2018-03-21 20:27:34 +01:00
parent ee0191280e
commit 4fb99407f4
2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@
gs.set('channel', {}); gs.set('channel', {});
/* (2) Set default active channel */ /* (2) Set default active channel */
gs.get.channel.active = null; gs.get.channel.current = null;
/* (3) Initialize list */ /* (3) Initialize list */
gs.get.channel.list = [ gs.get.channel.list = [
@ -40,7 +40,7 @@ gs.get.channel.nav = function(channel_id=null){
gs.get.router.push(`/channel/${channel.label}`); gs.get.router.push(`/channel/${channel.label}`);
/* (4) Update active element */ /* (4) Update active element */
this.active = channel.id; this.current = channel.id;
/* (5) Log channel */ /* (5) Log channel */
console.log(`[channel.current] ${channel.label}`); console.log(`[channel.current] ${channel.label}`);
@ -95,12 +95,12 @@ gs.get.channel.get = function(channel_id=null){
/* (1) Get @active channel /* (1) Get @active channel
---------------------------------------------------------*/ ---------------------------------------------------------*/
/* (1) If @active is set */ /* (1) If @active is set */
if( !isNaN(this.active) ){ if( !isNaN(this.current) ){
/* (2) Return matching id in list */ /* (2) Return matching id in list */
for( let c of this.list ){ for( let c of this.list ){
if( c.id === this.active ) if( c.id === this.current )
return c; // exit point return c; // exit point
} }
@ -121,7 +121,7 @@ gs.get.channel.get = function(channel_id=null){
if( c.label === label ){ if( c.label === label ){
this.active = c.id; // set @active this.current = c.id; // set @active
return c; // exit point return c; // exit point
} }
@ -141,7 +141,7 @@ gs.get.channel.get = function(channel_id=null){
return c; // exit point return c; // exit point
/* (2) Return default: if ID not found */ /* (2) Return default: if ID not found */
this.active = this.list[0].id; this.current = this.list[0].id;
return this.list[0]; return this.list[0];
} }

View File

@ -9,7 +9,7 @@
<!-- Channel List --> <!-- Channel List -->
<span v-for='c in gs.channel.list' <span v-for='c in gs.channel.list'
@click='gs.channel.nav(c.id);' @click='gs.channel.nav(c.id);'
:class='c.id == gs.channel.active ? `channel active` : `channel`' :class='c.id == gs.channel.current ? `channel active` : `channel`'
:data-sub='c.sub' :data-sub='c.sub'
:data-special='c.id == -1?1:0' :data-special='c.id == -1?1:0'
:data-add='c.add' :data-add='c.add'