123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 'use strict'
- /* global alertsData */
- import $ from 'jquery'
- import _ from 'lodash'
- import io from 'socket.io-client'
- import Alerts from './components/alerts.js'
- import 'jquery-smooth-scroll'
- import 'jquery-sticky'
- $(() => {
- // ====================================
- // Scroll
- // ====================================
- $('a').smoothScroll({
- speed: 500,
- offset: -50
- })
- $('.stickyscroll').sticky({ topSpacing: 15, bottomSpacing: 75 })
- // ====================================
- // Notifications
- // ====================================
- $(window).bind('beforeunload', () => {
- $('#notifload').addClass('active')
- })
- $(document).ajaxSend(() => {
- $('#notifload').addClass('active')
- }).ajaxComplete(() => {
- $('#notifload').removeClass('active')
- })
- var alerts = new Alerts()
- if (alertsData) {
- _.forEach(alertsData, (alertRow) => {
- alerts.push(alertRow)
- })
- }
- // ====================================
- // Establish WebSocket connection
- // ====================================
- var socket = io(window.location.origin)
- require('./components/search.js')(socket)
- // ====================================
- // Pages logic
- // ====================================
- require('./pages/view.js')(alerts)
- require('./pages/all.js')(alerts, socket)
- require('./pages/create.js')(alerts, socket)
- require('./pages/edit.js')(alerts, socket)
- require('./pages/source.js')(alerts)
- require('./pages/history.js')(alerts)
- require('./pages/admin.js')(alerts)
- })
|