]> BookStack Code Mirror - bookstack/blob - resources/assets/js/index.js
Update entities.php
[bookstack] / resources / assets / js / index.js
1 // Global Polyfills
2 import "./services/dom-polyfills"
3
4 // Url retrieval function
5 window.baseUrl = function(path) {
6     let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
7     if (basePath[basePath.length-1] === '/') basePath = basePath.slice(0, basePath.length-1);
8     if (path[0] === '/') path = path.slice(1);
9     return basePath + '/' + path;
10 };
11
12 // Set events and http services on window
13 import Events from "./services/events"
14 import Http from "./services/http"
15 let httpInstance = Http();
16 window.$http = httpInstance;
17 window.$events = new Events();
18
19 // Translation setup
20 // Creates a global function with name 'trans' to be used in the same way as Laravel's translation system
21 import Translations from "./services/translations"
22 let translator = new Translations(window.translations);
23 window.trans = translator.get.bind(translator);
24 window.trans_choice = translator.getPlural.bind(translator);
25
26 // Load in global UI helpers and libraries including jQuery
27 import "./services/global-ui"
28
29 // Set services on Vue
30 import Vue from "vue"
31 Vue.prototype.$http = httpInstance;
32 Vue.prototype.$events = window.$events;
33
34 // Load vues and components
35 import vues from "./vues/vues"
36 import components from "./components"
37 vues();
38 components();
Morty Proxy This is a proxified and sanitized view of the page, visit original site.