wikijs-fork/client/js/app.js

63 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-02-09 01:52:37 +00:00
'use strict'
/* global jQuery, _, io, Sticky, alertsData, Alerts */
/* eslint-disable spaced-comment */
2017-02-09 01:52:37 +00:00
jQuery(document).ready(function ($) {
// ====================================
// Scroll
// ====================================
2016-08-28 01:46:10 +00:00
2017-02-09 01:52:37 +00:00
$('a').smoothScroll({
speed: 400,
offset: -70
})
var sticky = new Sticky('.stickyscroll') // eslint-disable-line no-unused-vars
// ====================================
// Notifications
// ====================================
2016-08-28 15:27:05 +00:00
2017-02-09 01:52:37 +00:00
$(window).bind('beforeunload', () => {
$('#notifload').addClass('active')
})
$(document).ajaxSend(() => {
$('#notifload').addClass('active')
}).ajaxComplete(() => {
$('#notifload').removeClass('active')
})
2016-08-28 01:46:10 +00:00
2017-02-09 01:52:37 +00:00
var alerts = new Alerts()
if (alertsData) {
_.forEach(alertsData, (alertRow) => {
alerts.push(alertRow)
})
}
2016-08-24 01:09:09 +00:00
// ====================================
// Establish WebSocket connection
// ====================================
var socket = io(window.location.origin) // eslint-disable-line no-unused-vars
//=include components/search.js
// ====================================
// Pages logic
// ====================================
2016-08-28 15:27:05 +00:00
//=include pages/view.js
//=include pages/create.js
//=include pages/edit.js
//=include pages/source.js
//=include pages/admin.js
2017-02-09 01:52:37 +00:00
})
//=include helpers/form.js
//=include helpers/pages.js
//=include components/alerts.js
2016-09-05 18:11:51 +00:00
/* eslint-enable spaced-comment */