2017-06-28 10:45:41 +00:00
|
|
|
// The Vue build version to load with the `import` command
|
|
|
|
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
|
|
import Vue from 'vue'
|
|
|
|
import App from './App'
|
2017-06-28 15:05:30 +00:00
|
|
|
// simport page from './page.js'
|
2017-06-28 10:45:41 +00:00
|
|
|
|
2017-06-28 15:05:30 +00:00
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
2017-06-28 21:20:28 +00:00
|
|
|
var $ = (window.info || window.alert('Something is wrong, please refresh!'))
|
2017-06-28 10:45:41 +00:00
|
|
|
|
2017-06-28 15:05:30 +00:00
|
|
|
// TODO: keep this here?
|
2017-06-28 21:20:28 +00:00
|
|
|
document.title = $.req.name
|
2017-06-28 15:05:30 +00:00
|
|
|
|
|
|
|
// TODO: keep this here?
|
|
|
|
window.addEventListener('popstate', (event) => {
|
|
|
|
event.preventDefault()
|
|
|
|
event.stopPropagation()
|
|
|
|
|
2017-06-28 21:20:28 +00:00
|
|
|
$.req.kind = ''
|
|
|
|
$.listing.selected.length = 0
|
|
|
|
$.listing.selected.multiple = false
|
2017-06-28 15:05:30 +00:00
|
|
|
|
|
|
|
let request = new window.XMLHttpRequest()
|
|
|
|
request.open('GET', event.state.url, true)
|
|
|
|
request.setRequestHeader('Accept', 'application/json')
|
|
|
|
|
|
|
|
request.onload = () => {
|
|
|
|
if (request.status === 200) {
|
2017-06-28 21:20:28 +00:00
|
|
|
$.req = JSON.parse(request.responseText)
|
2017-06-28 15:05:30 +00:00
|
|
|
document.title = event.state.name
|
|
|
|
} else {
|
|
|
|
console.log(request.responseText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
request.onerror = (error) => { console.log(error) }
|
|
|
|
request.send()
|
|
|
|
})
|
2017-06-28 10:45:41 +00:00
|
|
|
|
|
|
|
/* eslint-disable no-new */
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
|
|
|
template: '<App/>',
|
|
|
|
components: { App }
|
|
|
|
})
|