2018-02-08 19:06:40 +01:00
|
|
|
import Vue from 'vue';
|
|
|
|
import List from './List.vue';
|
2018-02-19 20:23:05 +01:00
|
|
|
import DetailView from './DetailView.vue';
|
2018-02-08 19:06:40 +01:00
|
|
|
import Router from 'vue-router';
|
|
|
|
|
|
|
|
Vue.use(Router);
|
|
|
|
|
|
|
|
let router = new Router({
|
|
|
|
mode: 'history',
|
|
|
|
routes: [
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
redirect: "/oe3"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/:channel',
|
|
|
|
name: 'List',
|
|
|
|
component: List,
|
|
|
|
props: true,
|
2018-02-19 20:23:05 +01:00
|
|
|
children: [
|
|
|
|
{path: '/:channel/song/:songId', component: DetailView, name: 'DetailView'}
|
|
|
|
]
|
2018-02-08 19:06:40 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '*',
|
|
|
|
redirect: '/'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2018-02-20 14:12:32 +01:00
|
|
|
function trackPageView() {
|
|
|
|
Vue.nextTick(function () {
|
|
|
|
_paq.push(['setDocumentTitle', document.title]);
|
|
|
|
_paq.push(['trackPageView']);
|
|
|
|
_paq.push(['enableLinkTracking']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-02-08 19:06:40 +01:00
|
|
|
router.afterEach((to, from) => {
|
2018-02-09 22:57:07 +01:00
|
|
|
_paq.push(['setCustomUrl', to.fullPath]);
|
2018-02-20 14:12:32 +01:00
|
|
|
_paq.push(['setGenerationTimeMs', 0]);
|
2018-02-09 22:57:07 +01:00
|
|
|
if (from.matched.length !== 0 && from.fullPath !== "/") {
|
|
|
|
_paq.push(['setReferrerUrl', from.fullPath]);
|
2018-02-20 14:12:32 +01:00
|
|
|
trackPageView();
|
|
|
|
} else {
|
|
|
|
setTimeout(trackPageView, 500); // first page load has to finish loading channels before title is set
|
2018-02-09 22:57:07 +01:00
|
|
|
}
|
|
|
|
|
2018-02-08 19:06:40 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
export default router;
|