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