50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
|
import PopupController from '../../lib/popup-controller'
|
||
|
import ContentController from '../../lib/content-controller'
|
||
|
import RoomController from '../../lib/room-controller'
|
||
|
import ChannelController from '../../lib/channel-controller'
|
||
|
|
||
|
|
||
|
/* (1) Channel data gathering
|
||
|
---------------------------------------------------------*/
|
||
|
/* (1) Store route params */
|
||
|
window.initial_link = gs.get.router.history.current.params.link;
|
||
|
console.log(`[channel.URL] ${initial_link}`);
|
||
|
|
||
|
/* (2) Fetch channel data */
|
||
|
setTimeout(() => {
|
||
|
|
||
|
/* (3) Fetch data */
|
||
|
gs.get.channel.dump( require('../../mockup/api-channels.json') );
|
||
|
|
||
|
/* (4) Find if @link matches */
|
||
|
var redirect_id = null;
|
||
|
for( let c of gs.get.channel.list ){
|
||
|
|
||
|
if( c.link === window.initial_link ){
|
||
|
redirect_id = c.id;
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
/* (4) Emulate navigatation from URL */
|
||
|
console.log(`[restore.channel] ${redirect_id}`);
|
||
|
gs.get.channel.nav(redirect_id);
|
||
|
|
||
|
}, 500);
|
||
|
|
||
|
|
||
|
|
||
|
/* (2) Main components
|
||
|
---------------------------------------------------------*/
|
||
|
/* (1) Initialize popup management */
|
||
|
gs.set('popup', new PopupController());
|
||
|
|
||
|
/* (2) Initialize content management */
|
||
|
gs.set('content', new ContentController());
|
||
|
|
||
|
/* (3) Initialize rooms & room menu */
|
||
|
gs.set('room', new RoomController());
|
||
|
|
||
|
/* (4) Initialize channels & channel menu */
|
||
|
gs.set('channel', new ChannelController());
|