var ngSanitize = require('angular-sanitize');
require('angular-ui-sortable');
+// Url retrieval function
+window.baseUrl = function(path) {
+ let basePath = document.querySelector('meta[name="base-url"]').getAttribute('content');
+ if (basePath[basePath.length-1] === '/') basePath = basePath.slice(0, basePath.length-1);
+ if (path[0] === '/') path = path.slice(1);
+ return basePath + '/' + path;
+};
+
var ngApp = angular.module('bookStack', ['ngResource', 'ngAnimate', 'ngSanitize', 'ui.sortable']);
// Global Event System
};
window.Events = Events;
+
var services = require('./services')(ngApp, Events);
var directives = require('./directives')(ngApp, Events);
var controllers = require('./controllers')(ngApp, Events);
// Common jQuery actions
$('[data-action="expand-entity-list-details"]').click(function() {
- $('.entity-list.compact').find('p').slideToggle(240);
+ $('.entity-list.compact').find('p').not('.empty-text').slideToggle(240);
});
});
-
-function elemExists(selector) {
- return document.querySelector(selector) !== null;
-}
-
// Page specific items
require('./pages/page-show');