2017-02-09 01:52:37 +00:00
|
|
|
'use strict'
|
2016-08-20 21:20:53 +00:00
|
|
|
|
2017-05-21 22:58:19 +00:00
|
|
|
/* global siteLang */
|
2017-05-21 03:21:16 +00:00
|
|
|
/* eslint-disable no-new */
|
2017-03-27 02:07:40 +00:00
|
|
|
|
2017-04-01 21:07:01 +00:00
|
|
|
import $ from 'jquery'
|
2017-05-21 03:21:16 +00:00
|
|
|
import Vue from 'vue'
|
2017-05-21 20:43:58 +00:00
|
|
|
import VueResource from 'vue-resource'
|
2017-05-22 17:32:52 +00:00
|
|
|
import VueClipboards from 'vue-clipboards'
|
2017-05-21 20:43:58 +00:00
|
|
|
import store from './store'
|
2017-03-27 02:07:40 +00:00
|
|
|
import io from 'socket.io-client'
|
2017-05-21 03:21:16 +00:00
|
|
|
import i18next from 'i18next'
|
|
|
|
import i18nextXHR from 'i18next-xhr-backend'
|
|
|
|
import VueI18Next from '@panter/vue-i18next'
|
2017-04-01 21:07:01 +00:00
|
|
|
import 'jquery-smooth-scroll'
|
2017-04-30 04:05:00 +00:00
|
|
|
import 'jquery-sticky'
|
2017-02-10 01:24:28 +00:00
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
// ====================================
|
|
|
|
// Load Vue Components
|
|
|
|
// ====================================
|
|
|
|
|
2017-05-21 20:43:58 +00:00
|
|
|
import alertComponent from './components/alert.vue'
|
2017-05-21 03:21:16 +00:00
|
|
|
import anchorComponent from './components/anchor.vue'
|
|
|
|
import colorPickerComponent from './components/color-picker.vue'
|
|
|
|
import loadingSpinnerComponent from './components/loading-spinner.vue'
|
|
|
|
import searchComponent from './components/search.vue'
|
2017-05-21 22:58:19 +00:00
|
|
|
import treeComponent from './components/tree.vue'
|
2017-05-21 03:21:16 +00:00
|
|
|
|
2017-05-21 20:43:58 +00:00
|
|
|
import adminUsersCreateComponent from './modals/admin-users-create.vue'
|
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
import adminProfileComponent from './pages/admin-profile.component.js'
|
|
|
|
import adminSettingsComponent from './pages/admin-settings.component.js'
|
2017-05-22 01:30:34 +00:00
|
|
|
import sourceComponent from './pages/source.component.js'
|
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
|
|
|
// ====================================
|
|
|
|
|
2017-05-21 20:43:58 +00:00
|
|
|
Vue.use(VueResource)
|
2017-05-22 17:32:52 +00:00
|
|
|
Vue.use(VueClipboards)
|
2017-05-21 03:21:16 +00:00
|
|
|
Vue.use(VueI18Next)
|
|
|
|
|
|
|
|
i18next
|
|
|
|
.use(i18nextXHR)
|
|
|
|
.init({
|
|
|
|
backend: {
|
|
|
|
loadPath: '/js/i18n/{{lng}}.json'
|
|
|
|
},
|
|
|
|
lng: siteLang,
|
|
|
|
fallbackLng: siteLang
|
|
|
|
})
|
|
|
|
|
2017-04-01 21:07:01 +00:00
|
|
|
$(() => {
|
2017-02-10 01:24:28 +00:00
|
|
|
// ====================================
|
|
|
|
// Notifications
|
|
|
|
// ====================================
|
2016-08-28 15:27:05 +00:00
|
|
|
|
2017-02-09 01:52:37 +00:00
|
|
|
$(window).bind('beforeunload', () => {
|
2017-05-21 20:43:58 +00:00
|
|
|
store.dispatch('startLoading')
|
2017-02-09 01:52:37 +00:00
|
|
|
})
|
|
|
|
$(document).ajaxSend(() => {
|
2017-05-21 20:43:58 +00:00
|
|
|
store.dispatch('startLoading')
|
2017-02-09 01:52:37 +00:00
|
|
|
}).ajaxComplete(() => {
|
2017-05-21 20:43:58 +00:00
|
|
|
store.dispatch('stopLoading')
|
2017-02-09 01:52:37 +00:00
|
|
|
})
|
2016-08-28 01:46:10 +00:00
|
|
|
|
2017-02-10 01:24:28 +00:00
|
|
|
// ====================================
|
|
|
|
// Establish WebSocket connection
|
|
|
|
// ====================================
|
2016-09-05 04:39:59 +00:00
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
let socket = io(window.location.origin)
|
|
|
|
window.socket = socket
|
2016-09-05 04:39:59 +00:00
|
|
|
|
2017-05-21 03:21:16 +00:00
|
|
|
// ====================================
|
|
|
|
// Bootstrap Vue
|
|
|
|
// ====================================
|
|
|
|
|
|
|
|
const i18n = new VueI18Next(i18next)
|
|
|
|
new Vue({
|
|
|
|
components: {
|
2017-05-21 20:43:58 +00:00
|
|
|
alert: alertComponent,
|
2017-05-21 03:21:16 +00:00
|
|
|
adminProfile: adminProfileComponent,
|
|
|
|
adminSettings: adminSettingsComponent,
|
2017-05-21 20:43:58 +00:00
|
|
|
adminUsersCreate: adminUsersCreateComponent,
|
2017-05-21 03:21:16 +00:00
|
|
|
anchor: anchorComponent,
|
|
|
|
colorPicker: colorPickerComponent,
|
|
|
|
loadingSpinner: loadingSpinnerComponent,
|
2017-05-21 22:58:19 +00:00
|
|
|
search: searchComponent,
|
2017-05-22 01:30:34 +00:00
|
|
|
sourceView: sourceComponent,
|
2017-05-21 22:58:19 +00:00
|
|
|
tree: treeComponent
|
2017-05-21 20:43:58 +00:00
|
|
|
},
|
2017-05-21 03:21:16 +00:00
|
|
|
store,
|
|
|
|
i18n,
|
2017-05-21 20:43:58 +00:00
|
|
|
el: '#root',
|
|
|
|
mounted() {
|
2017-05-22 17:32:52 +00:00
|
|
|
$('a:not(.toc-anchor)').smoothScroll({ speed: 500, offset: -50 })
|
2017-05-21 20:43:58 +00:00
|
|
|
$('#header').sticky({ topSpacing: 0 })
|
|
|
|
$('.sidebar-pagecontents').sticky({ topSpacing: 15, bottomSpacing: 75 })
|
|
|
|
}
|
2017-05-21 03:21:16 +00:00
|
|
|
})
|
2017-02-09 01:52:37 +00:00
|
|
|
})
|