Files
firefly-iii/frontend/src/bootstrap.js

64 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-07-03 05:59:36 +02:00
/*
* bootstrap.js
2021-04-02 22:33:31 +02:00
* Copyright (c) 2021 james@firefly-iii.org
2020-07-03 05:59:36 +02:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2021-01-16 04:20:28 +01:00
// // imports
2020-06-14 19:24:23 +02:00
import Vue from 'vue';
import VueI18n from 'vue-i18n'
import * as uiv from 'uiv';
// export jquery for others scripts to use
window.$ = window.jQuery = require('jquery');
2020-06-14 19:24:23 +02:00
// axios
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
// CSRF
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
2020-06-21 18:29:23 +02:00
// locale
let localeToken = document.head.querySelector('meta[name="locale"]');
if (localeToken) {
2020-11-12 07:11:15 +01:00
localStorage.locale = localeToken.content;
2020-06-21 18:29:23 +02:00
} else {
2020-11-12 07:11:15 +01:00
localStorage.locale = 'en_US';
2020-06-21 18:29:23 +02:00
}
// admin stuff
2020-06-14 19:24:23 +02:00
require('jquery-ui');
2020-11-07 20:13:06 +01:00
require('bootstrap'); // bootstrap CSS?
2021-04-02 22:33:31 +02:00
require('admin-lte/dist/js/adminlte');
2020-06-14 19:24:23 +02:00
require('overlayscrollbars');
2020-12-22 17:22:50 +01:00
2020-06-14 19:24:23 +02:00
// vue
window.vuei18n = VueI18n;
2020-12-22 17:22:50 +01:00
window.uiv = uiv;
2020-06-14 19:24:23 +02:00
Vue.use(vuei18n);
Vue.use(uiv);
2020-12-22 17:22:50 +01:00
window.Vue = Vue;