2015-10-10 13:57:52 -04:00
|
|
|
window.ZeroClipboard = require('zeroclipboard');
|
|
|
|
window.ZeroClipboard.config({
|
|
|
|
swfPath: '/ZeroClipboard.swf'
|
|
|
|
});
|
2015-10-08 18:49:18 -04:00
|
|
|
|
|
|
|
// Global jQuery Elements
|
2015-09-03 11:51:10 -04:00
|
|
|
$(function () {
|
|
|
|
|
2015-09-03 14:05:45 -04:00
|
|
|
// Notification hiding
|
2015-09-03 11:51:10 -04:00
|
|
|
$('.notification').click(function () {
|
|
|
|
$(this).fadeOut(100);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Dropdown toggles
|
|
|
|
$('[data-dropdown]').dropDown();
|
|
|
|
|
2015-09-03 14:05:45 -04:00
|
|
|
// 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-09-03 14:05:45 -04:00
|
|
|
});
|
|
|
|
|
2015-10-07 18:17:48 -04:00
|
|
|
});
|
|
|
|
|
2015-10-08 18:49:18 -04:00
|
|
|
function elemExists(selector) {
|
|
|
|
return document.querySelector(selector) !== null;
|
|
|
|
}
|
|
|
|
|
2015-10-10 13:57:52 -04:00
|
|
|
// TinyMCE editor
|
|
|
|
if(elemExists('#html-editor')) {
|
|
|
|
var tinyMceOptions = require('./pages/page-form');
|
|
|
|
tinymce.init(tinyMceOptions);
|
|
|
|
}
|
|
|
|
|
2015-10-08 18:49:18 -04:00
|
|
|
// Vue JS elements
|
|
|
|
var Vue = require('vue');
|
|
|
|
Vue.use(require('vue-resource'));
|
2015-10-07 18:17:48 -04:00
|
|
|
|
|
|
|
// Vue Components
|
2015-10-08 18:49:18 -04:00
|
|
|
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
|
|
|
|
2015-10-08 18:49:18 -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
|
2015-10-08 18:49:18 -04:00
|
|
|
// 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'
|
2015-09-03 11:51:10 -04:00
|
|
|
});
|