app.js 1.42 KB
Newer Older
1
'use strict'
2

3 4 5
/* global jQuery, _, io, Sticky, alertsData, Alerts */
/* eslint-disable spaced-comment */

6
jQuery(document).ready(function ($) {
7 8 9
  // ====================================
  // Scroll
  // ====================================
NGPixel's avatar
NGPixel committed
10

11 12 13 14
  $('a').smoothScroll({
    speed: 400,
    offset: -70
  })
15

16
  var sticky = new Sticky('.stickyscroll') // eslint-disable-line no-unused-vars
17

18 19 20
  // ====================================
  // Notifications
  // ====================================
21

22 23 24 25 26 27 28 29
  $(window).bind('beforeunload', () => {
    $('#notifload').addClass('active')
  })
  $(document).ajaxSend(() => {
    $('#notifload').addClass('active')
  }).ajaxComplete(() => {
    $('#notifload').removeClass('active')
  })
NGPixel's avatar
NGPixel committed
30

31 32 33 34 35 36
  var alerts = new Alerts()
  if (alertsData) {
    _.forEach(alertsData, (alertRow) => {
      alerts.push(alertRow)
    })
  }
37

38 39 40
  // ====================================
  // Establish WebSocket connection
  // ====================================
41

42
  var socket = io(window.location.origin) // eslint-disable-line no-unused-vars
43

44
  //=include components/search.js
45

46 47 48
  // ====================================
  // Pages logic
  // ====================================
49

50 51 52 53 54
  //=include pages/view.js
  //=include pages/create.js
  //=include pages/edit.js
  //=include pages/source.js
  //=include pages/admin.js
55
})
56

57 58 59 60
//=include helpers/form.js
//=include helpers/pages.js

//=include components/alerts.js
NGPixel's avatar
NGPixel committed
61

62
/* eslint-enable spaced-comment */