BookStack/resources/assets/js/global.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

window.ZeroClipboard = require('zeroclipboard');
window.ZeroClipboard.config({
swfPath: '/ZeroClipboard.swf'
});
// 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 09:35:53 -04:00
$(this).closest('.chapter').find('.inset-list').slideToggle(180);
});
2015-10-07 18:17:48 -04:00
});
function elemExists(selector) {
return document.querySelector(selector) !== null;
}
// TinyMCE editor
if(elemExists('#html-editor')) {
var tinyMceOptions = require('./pages/page-form');
tinymce.init(tinyMceOptions);
}
// Vue JS elements
var Vue = require('vue');
Vue.use(require('vue-resource'));
2015-10-07 18:17:48 -04:00
// Vue Components
Vue.component('image-manager', require('./components/image-manager.vue'));
Vue.component('image-picker', require('./components/image-picker.vue'));
2015-10-07 18:17:48 -04:00
// Vue Controllers
if(elemExists('#book-dashboard')) {
new Vue(require('./pages/book-show'));
}
2015-10-07 18:17:48 -04:00
// Global Vue Instance
// Needs to be loaded after all components we want to use.
2015-10-07 18:17:48 -04:00
var app = new Vue({
el: '#app'
});