BookStack/resources/assets/js/global.js

43 lines
1003 B
JavaScript
Raw Normal View History

// Global jQuery Elements
$(function () {
// Notification hiding
$('.notification').click(function () {
$(this).fadeOut(100);
});
// Dropdown toggles
$('[data-dropdown]').dropDown();
// Chapter page list toggles
$('.chapter-toggle').click(function(e) {
e.preventDefault();
$(this).toggleClass('open');
2015-09-06 21:35:53 +08:00
$(this).closest('.chapter').find('.inset-list').slideToggle(180);
});
2015-10-08 06:17:48 +08:00
});
function elemExists(selector) {
return document.querySelector(selector) !== null;
}
// Vue JS elements
var Vue = require('vue');
Vue.use(require('vue-resource'));
2015-10-08 06:17:48 +08:00
// Vue Components
Vue.component('image-manager', require('./components/image-manager.vue'));
Vue.component('image-picker', require('./components/image-picker.vue'));
2015-10-08 06:17:48 +08:00
// Vue Controllers
if(elemExists('#book-dashboard')) {
new Vue(require('./pages/book-show'));
}
2015-10-08 06:17:48 +08:00
// Global Vue Instance
// Needs to be loaded after all components we want to use.
2015-10-08 06:17:48 +08:00
var app = new Vue({
el: '#app'
});