2017-02-09 01:52:37 +00:00
|
|
|
'use strict'
|
2016-08-20 21:20:53 +00:00
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
import Vue from 'vue'
|
2018-02-28 05:54:09 +00:00
|
|
|
import VueRouter from 'vue-router'
|
2017-05-22 17:32:52 +00:00
|
|
|
import VueClipboards from 'vue-clipboards'
|
2018-02-17 23:17:25 +00:00
|
|
|
import VueSimpleBreakpoints from 'vue-simple-breakpoints'
|
2017-10-09 04:16:08 +00:00
|
|
|
import VeeValidate from 'vee-validate'
|
2017-10-28 18:17:14 +00:00
|
|
|
import { ApolloClient } from 'apollo-client'
|
2018-01-28 05:40:25 +00:00
|
|
|
import { BatchHttpLink } from 'apollo-link-batch-http'
|
2017-10-28 18:17:14 +00:00
|
|
|
import { InMemoryCache } from 'apollo-cache-inmemory'
|
2018-03-06 01:53:24 +00:00
|
|
|
import VueApollo from 'vue-apollo'
|
2018-02-18 03:18:37 +00:00
|
|
|
import Vuetify from 'vuetify'
|
2018-02-25 20:54:35 +00:00
|
|
|
import Velocity from 'velocity-animate'
|
2018-02-03 21:48:25 +00:00
|
|
|
import Hammer from 'hammerjs'
|
2018-03-26 05:11:49 +00:00
|
|
|
import moment from 'moment'
|
|
|
|
import VueMoment from 'vue-moment'
|
2017-05-21 20:43:58 +00:00
|
|
|
import store from './store'
|
2017-12-24 05:34:47 +00:00
|
|
|
|
2017-09-25 03:22:33 +00:00
|
|
|
// ====================================
|
|
|
|
// Load Modules
|
|
|
|
// ====================================
|
|
|
|
|
2018-02-03 21:48:25 +00:00
|
|
|
import boot from './modules/boot'
|
2017-09-25 03:22:33 +00:00
|
|
|
import localization from './modules/localization'
|
2017-02-10 01:24:28 +00:00
|
|
|
|
2017-05-26 00:54:03 +00:00
|
|
|
// ====================================
|
|
|
|
// Load Helpers
|
|
|
|
// ====================================
|
|
|
|
|
|
|
|
import helpers from './helpers'
|
|
|
|
|
2017-10-01 03:47:14 +00:00
|
|
|
// ====================================
|
|
|
|
// Initialize Global Vars
|
|
|
|
// ====================================
|
|
|
|
|
2018-03-06 01:53:24 +00:00
|
|
|
window.WIKI = null
|
2018-02-03 21:48:25 +00:00
|
|
|
window.boot = boot
|
|
|
|
window.Hammer = Hammer
|
2017-10-01 03:47:14 +00:00
|
|
|
|
2017-09-25 03:22:33 +00:00
|
|
|
// ====================================
|
|
|
|
// Initialize Apollo Client (GraphQL)
|
|
|
|
// ====================================
|
|
|
|
|
2018-03-11 05:11:32 +00:00
|
|
|
const graphQLEndpoint = window.location.protocol + '//' + window.location.host + '/graphql'
|
2018-01-28 05:40:25 +00:00
|
|
|
|
2017-10-01 03:47:14 +00:00
|
|
|
window.graphQL = new ApolloClient({
|
2018-03-06 01:53:24 +00:00
|
|
|
link: new BatchHttpLink({
|
|
|
|
uri: graphQLEndpoint,
|
|
|
|
credentials: 'include'
|
|
|
|
}),
|
2017-10-28 18:17:14 +00:00
|
|
|
cache: new InMemoryCache(),
|
|
|
|
connectToDevTools: (process.env.node_env === 'development')
|
2017-09-25 03:22:33 +00:00
|
|
|
})
|
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
// ====================================
|
2017-05-21 20:43:58 +00:00
|
|
|
// Initialize Vue Modules
|
2017-05-21 03:21:16 +00:00
|
|
|
// ====================================
|
|
|
|
|
2018-03-17 02:51:56 +00:00
|
|
|
Vue.config.productionTip = false
|
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
Vue.use(VueRouter)
|
2018-03-06 01:53:24 +00:00
|
|
|
Vue.use(VueApollo)
|
2017-05-22 17:32:52 +00:00
|
|
|
Vue.use(VueClipboards)
|
2018-02-17 23:17:25 +00:00
|
|
|
Vue.use(VueSimpleBreakpoints)
|
2017-09-25 03:22:33 +00:00
|
|
|
Vue.use(localization.VueI18Next)
|
2017-05-26 04:12:38 +00:00
|
|
|
Vue.use(helpers)
|
2018-03-11 05:11:32 +00:00
|
|
|
Vue.use(VeeValidate, { events: '' })
|
2018-02-18 03:18:37 +00:00
|
|
|
Vue.use(Vuetify)
|
2018-03-26 05:11:49 +00:00
|
|
|
Vue.use(VueMoment, { moment })
|
2017-05-21 03:21:16 +00:00
|
|
|
|
2018-02-25 20:54:35 +00:00
|
|
|
Vue.prototype.Velocity = Velocity
|
|
|
|
|
2017-07-02 02:23:40 +00:00
|
|
|
// ====================================
|
|
|
|
// Register Vue Components
|
|
|
|
// ====================================
|
|
|
|
|
2018-02-28 05:54:09 +00:00
|
|
|
Vue.component('admin', () => import(/* webpackChunkName: "admin" */ './components/admin.vue'))
|
2018-02-11 05:20:17 +00:00
|
|
|
Vue.component('editor', () => import(/* webpackChunkName: "editor" */ './components/editor.vue'))
|
2018-02-03 21:48:25 +00:00
|
|
|
Vue.component('login', () => import(/* webpackMode: "eager" */ './components/login.vue'))
|
2018-03-03 06:32:58 +00:00
|
|
|
Vue.component('nav-header', () => import(/* webpackMode: "eager" */ './components/nav-header.vue'))
|
2018-01-28 18:34:37 +00:00
|
|
|
Vue.component('setup', () => import(/* webpackChunkName: "setup" */ './components/setup.vue'))
|
2017-07-02 02:23:40 +00:00
|
|
|
|
2018-02-03 21:48:25 +00:00
|
|
|
let bootstrap = () => {
|
2017-02-10 01:24:28 +00:00
|
|
|
// ====================================
|
|
|
|
// Notifications
|
|
|
|
// ====================================
|
2016-08-28 15:27:05 +00:00
|
|
|
|
2017-09-10 05:41:22 +00:00
|
|
|
window.addEventListener('beforeunload', () => {
|
2017-05-21 20:43:58 +00:00
|
|
|
store.dispatch('startLoading')
|
2017-02-09 01:52:37 +00:00
|
|
|
})
|
2016-09-05 04:39:59 +00:00
|
|
|
|
2018-03-06 01:53:24 +00:00
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: window.graphQL
|
|
|
|
})
|
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
// ====================================
|
|
|
|
// Bootstrap Vue
|
|
|
|
// ====================================
|
|
|
|
|
2017-09-25 03:22:33 +00:00
|
|
|
const i18n = localization.init()
|
2018-03-06 01:53:24 +00:00
|
|
|
window.WIKI = new Vue({
|
2018-01-28 18:34:37 +00:00
|
|
|
el: '#app',
|
2017-07-02 02:23:40 +00:00
|
|
|
components: {},
|
2018-01-28 18:34:37 +00:00
|
|
|
mixins: [helpers],
|
2018-03-06 01:53:24 +00:00
|
|
|
provide: apolloProvider.provide(),
|
2017-05-21 03:21:16 +00:00
|
|
|
store,
|
2018-02-03 21:48:25 +00:00
|
|
|
i18n
|
2017-05-21 03:21:16 +00:00
|
|
|
})
|
2017-10-29 05:30:46 +00:00
|
|
|
|
2018-02-03 21:48:25 +00:00
|
|
|
// ----------------------------------
|
|
|
|
// Dispatch boot ready
|
|
|
|
// ----------------------------------
|
|
|
|
|
|
|
|
window.boot.notify('vue')
|
|
|
|
|
2017-10-29 05:30:46 +00:00
|
|
|
// ====================================
|
|
|
|
// Load Icons
|
|
|
|
// ====================================
|
|
|
|
|
2018-02-24 22:35:56 +00:00
|
|
|
import(/* webpackChunkName: "icons" */ './svg/icons.svg').then(icons => {
|
2018-03-17 05:12:21 +00:00
|
|
|
document.body.insertAdjacentHTML('beforeend', icons.default)
|
2018-01-21 22:54:43 +00:00
|
|
|
})
|
2018-02-03 21:48:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
window.boot.onDOMReady(bootstrap)
|