2018-03-21 17:44:27 +00:00
|
|
|
/* (1) Imports
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
/* (1) NPM libs */
|
|
|
|
import Vue from 'vue'
|
|
|
|
import VueRouter from 'vue-router'
|
|
|
|
import routes from './routes'
|
|
|
|
|
|
|
|
/* (2) Vues */
|
|
|
|
import wrapper from './vue/wrapper.vue'
|
|
|
|
|
|
|
|
/* (3) Data */
|
|
|
|
require('./common.js');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* (2) Initialisation
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
/* (1) Render view */
|
|
|
|
Vue.use(VueRouter);
|
|
|
|
new Vue({
|
|
|
|
el: '#vue',
|
|
|
|
router: gs.get.router,
|
|
|
|
render(h){ return h(wrapper); }
|
2018-03-21 19:25:01 +00:00
|
|
|
})
|
|
|
|
|
2018-03-21 22:34:45 +00:00
|
|
|
/* (2) Store route params */
|
|
|
|
window.initial_link = gs.get.router.history.current.params.link;
|
|
|
|
console.log(`[channel.URL] ${initial_link}`);
|
2018-03-21 21:54:24 +00:00
|
|
|
|
|
|
|
/* (3) Channel data gathering
|
|
|
|
---------------------------------------------------------*/
|
|
|
|
/* (1) Fetch channel data */
|
2018-03-21 22:34:45 +00:00
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
/* (2) Fetch data */
|
|
|
|
gs.get.channel.dump( require('./mockup/channels.json') );
|
|
|
|
|
|
|
|
/* (3) 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);
|
2018-03-21 21:54:24 +00:00
|
|
|
|
2018-03-21 22:34:45 +00:00
|
|
|
}, 500);
|