Former-commit-id: c1c1881302a241fdc7140e6aabeb9b49977bd7c6 [formerly 84bb454c2f34baffd9dfa91645b8aff149e52620] [formerly 29e258c7a16db1ca8a3fde7c5e4e3cffc47899a6 [formerly 84ddad027f]]
Former-commit-id: 0018a51df5bc801b783a3ffe17d9f33c504ce094 [formerly 0072c425cd4754e38f30007ab9f5272ea4b40370]
Former-commit-id: d298f006e58ef9e4987def4bc354818062b30fcd
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
// 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'
|
|
// simport page from './page.js'
|
|
|
|
Vue.config.productionTip = false
|
|
|
|
var $ = (window.info || window.alert('Something is wrong, please refresh!'))
|
|
|
|
// TODO: keep this here?
|
|
document.title = $.req.name
|
|
|
|
// TODO: keep this here?
|
|
window.addEventListener('popstate', (event) => {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
|
|
$.req.kind = ''
|
|
$.listing.selected.length = 0
|
|
$.listing.selected.multiple = false
|
|
|
|
let request = new window.XMLHttpRequest()
|
|
request.open('GET', event.state.url, true)
|
|
request.setRequestHeader('Accept', 'application/json')
|
|
|
|
request.onload = () => {
|
|
if (request.status === 200) {
|
|
$.req = JSON.parse(request.responseText)
|
|
document.title = event.state.name
|
|
} else {
|
|
console.log(request.responseText)
|
|
}
|
|
}
|
|
|
|
request.onerror = (error) => { console.log(error) }
|
|
request.send()
|
|
})
|
|
|
|
/* eslint-disable no-new */
|
|
new Vue({
|
|
el: '#app',
|
|
template: '<App/>',
|
|
components: { App }
|
|
})
|