mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-31 21:23:38 +08:00
Attempted move to webpack again
This commit is contained in:
@ -21,7 +21,6 @@ let componentMapping = {
|
||||
window.components = {};
|
||||
|
||||
let componentNames = Object.keys(componentMapping);
|
||||
initAll();
|
||||
|
||||
/**
|
||||
* Initialize components of the given name within the given element.
|
||||
@ -53,4 +52,6 @@ function initAll(parentElement) {
|
||||
}
|
||||
}
|
||||
|
||||
window.components.init = initAll;
|
||||
window.components.init = initAll;
|
||||
|
||||
export default initAll;
|
@ -1,6 +1,16 @@
|
||||
"use strict";
|
||||
require("babel-polyfill");
|
||||
require('./dom-polyfills');
|
||||
import "../sass/styles.scss"
|
||||
import "../sass/print-styles.scss"
|
||||
import "../sass/export-styles.scss"
|
||||
|
||||
import "babel-polyfill"
|
||||
import "./dom-polyfills"
|
||||
import "./pages/page-show"
|
||||
import Translations from "./translations"
|
||||
import vues from "./vues/vues"
|
||||
import components from "./components"
|
||||
|
||||
import Vue from "vue"
|
||||
import axios from "axios"
|
||||
|
||||
// Url retrieval function
|
||||
window.baseUrl = function(path) {
|
||||
@ -37,9 +47,6 @@ class EventManager {
|
||||
|
||||
window.$events = new EventManager();
|
||||
|
||||
const Vue = require("vue");
|
||||
const axios = require("axios");
|
||||
|
||||
let axiosInstance = axios.create({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name=token]').getAttribute('content'),
|
||||
@ -60,14 +67,13 @@ Vue.prototype.$events = window.$events;
|
||||
|
||||
// Translation setup
|
||||
// Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
|
||||
const Translations = require("./translations");
|
||||
let translator = new Translations(window.translations);
|
||||
window.trans = translator.get.bind(translator);
|
||||
window.trans_choice = translator.getPlural.bind(translator);
|
||||
|
||||
|
||||
require("./vues/vues");
|
||||
require("./components");
|
||||
// Load vues and components
|
||||
vues();
|
||||
components();
|
||||
|
||||
|
||||
//Global jQuery Config & Extensions
|
||||
@ -119,12 +125,11 @@ jQuery.expr[":"].contains = $.expr.createPseudo(function (arg) {
|
||||
};
|
||||
});
|
||||
|
||||
console.log('test');
|
||||
|
||||
// Detect IE for css
|
||||
if(navigator.userAgent.indexOf('MSIE')!==-1
|
||||
|| navigator.appVersion.indexOf('Trident/') > 0
|
||||
|| navigator.userAgent.indexOf('Safari') !== -1){
|
||||
document.body.classList.add('flexbox-support');
|
||||
}
|
||||
|
||||
// Page specific items
|
||||
require("./pages/page-show");
|
@ -16,10 +16,17 @@ let vueMapping = {
|
||||
|
||||
window.vues = {};
|
||||
|
||||
let ids = Object.keys(vueMapping);
|
||||
for (let i = 0, len = ids.length; i < len; i++) {
|
||||
if (!exists(ids[i])) continue;
|
||||
let config = vueMapping[ids[i]];
|
||||
config.el = '#' + ids[i];
|
||||
window.vues[ids[i]] = new Vue(config);
|
||||
}
|
||||
function load() {
|
||||
let ids = Object.keys(vueMapping);
|
||||
for (let i = 0, len = ids.length; i < len; i++) {
|
||||
if (!exists(ids[i])) continue;
|
||||
let config = vueMapping[ids[i]];
|
||||
config.el = '#' + ids[i];
|
||||
window.vues[ids[i]] = new Vue(config);
|
||||
}
|
||||
}
|
||||
|
||||
export default load;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user