54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
/* (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); }
|
|
})
|
|
|
|
/* (2) Store route params */
|
|
window.initial_link = gs.get.router.history.current.params.link;
|
|
console.log(`[channel.URL] ${initial_link}`);
|
|
|
|
/* (3) Channel data gathering
|
|
---------------------------------------------------------*/
|
|
/* (1) Fetch channel data */
|
|
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);
|
|
|
|
}, 500); |