<!DOCTYPE html>
<html ng-app=app lang="en">
<% include global/header.ejs %>
<!-- Inlined and minified below <script src="/javascripts/angular-textreplace.js"></script>-->
<script>angular.module("angular-highlight",[]).directive("highlight",function(){return{link:function(e,t,h){function i(e,t){for(var h=0;h<t.length;h++){var i=new RegExp(t[h].match,"gi");if(e.search(i)>-1)return t[h]}}h.highlightClass||(h.highlightClass="angular-highlight");var l=function(t,l){var r=i(t,e.replacement);if(r.highlight)a='<a href="/?q='+t+'" data-toggle="popover" class="'+h.highlightClass+'" title="'+r.replace+'" onmouseenter="$(this).tooltip(\'show\')">'+t+"</a>";else var a='<a href="/?q='+t+'" data-toggle="popover" title="'+r.replace+'" onmouseenter="$(this).tooltip(\'show\')">'+t+"</a>";return a},r=function(e){var t,h=e.length,i=[];for(t=0;t<h;t++)i.push(e[t].match.replace(new RegExp("^ | $","g"),""));return i};e.$watch("replacement",function(){if(!e.replacement||""==e.replacement)return t.html(e.highlight),!1;var h=r(e.replacement),i=new RegExp(h.join("|"),"gmi"),a=e.highlight.replace(i,l);t.html(a)})},replace:!1,scope:{highlight:"=",replacement:"="}}});</script>
<base href="/">
<% if (frontPopupEnable) { %>
  <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="discModal" id="onload">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">x</button>
          <h4 class="modal-title"><i class="fa fa-exclamation-circle"></i><%= frontPopupTitle %></h4>
        </div>
        <div class="modal-body">
        <%- frontPopupContent %>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default ok" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>
  <script>
    $(document).ready(function() {
      if ($.cookie("modal_cookie") == null) {
        $('#discModal').appendTo("body");
        function show_modal(){
          $('#discModal').modal();
        }
        window.setTimeout(show_modal, 3000);
        }
      $(".ok").click(function() {
        $.cookie('modal_cookie', 'true', { expires: 183, path: '/' });
      });
    });
  </script>
  <% } %>
</head>

<body id="home-body">

<% include global/menu.ejs %>

<div id="content" class="container-fluid" ng-cloak>
  
  <ng-view></ng-view>

  <!-- Template -->
  
  <script type="text/ng-template" id="/messages.html">
  <div ng-show="loading" class="loading"><i class="fa fa-spinner fa-spin"></i></div>
    <p></p>
    <div class="row">
      <% if (searchLocation === 'top') { %>
        <div class="row">
          <div class="col-xs-offset-1 col-xs-10">
          <form action="/" method="get">
            <div class="input-group">
              <input id="query" type="text" class="form-control" name="q" placeholder="Search" ng-model="query">
              <span class="input-group-btn">
                <button type="submit" class="btn btn-default" ng-disabled="!query" ng-class="{disabledLink: !query}"><i class="fa fa-fw fa-search"></i></button>
                <button ng-if="!hasQuery" ng-click="clearSearch()" class="btn btn-default" ng-class="{disabledLink: !query}" ng-disabled="!query"><i class="fa fa-fw fa-times"></i></button>
                <a ng-href="/" ng-if="hasQuery" class="btn btn-default"><i class="fa fa-fw fa-times"></i></a>
              </span>
            </div>
          </form>
          </div>
        </div>
      <% } %>
      <table class="table table-condensed table-hover table-striped valign">
        <thead class="thead-default">
          <tr>
            <th colspan="2">
                <div class="btn-group" data-toggle="buttons">
                  <button type="button" class="btn btn-default btn-sm" ng-click="updateData();" aria-label="Refresh" title="Refresh Messages"><i class="fa fa-refresh {{spinner}}" aria-hidden="true"></i></button>
                  <button type="button" ng-if="notificationSupport == true" class="btn btn-default btn-sm" ng-class="{active: notificationEnabled == 'true'}" ng-click="toggleNotifications();" aria-label="Notifications" title="Toggle Browser Notifications">
                    <i class="fa fa-bell" aria-hidden="true"></i></button>
                <span class="dropdown">
                  <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" title="Message Limit">{{init.limit}} <span class="caret"></span></button>
                  <ul class="dropdown-menu" role="menu" style="margin-top: 9px;">
                    <li ng-class="{disabled:init.limit == 10}"><a href="#" ng-click="setCookie('messageLimit', 10);">10</a></li>
                    <li ng-class="{disabled:init.limit == 20}"><a href="#" ng-click="setCookie('messageLimit', 20);">20</a></li>
                    <li ng-class="{disabled:init.limit == 50}"><a href="#" ng-click="setCookie('messageLimit', 50);">50</a></li>
                    <li ng-class="{disabled:init.limit == 100}"><a href="#" ng-click="setCookie('messageLimit', 100);">100</a></li>
                  </ul>
                </span>
                </div>
            </th>
            <% if (!hidesource || login) { %>
              <th class="noMobile noSmall" style="text-align: center;">Src</th>
            <% } %>
            <% if (!hidecapcode || login) { %>
              <th class="noMobile" style="text-align: center;">Capcode</th>
            <% } %>
            <th class="noMobile noSmall"></th>
            <th class="noMobile noSmall"></th>
            <th style="text-align: center;">Message
              <span ng-if="filter || hasQuery" class="pull-left" style="vertical-align: middle; padding-right: 10px;">
                  <strong>Filter:</strong> <a ng-href="/" style="margin-bottom: 3px;" class="btn btn-primary btn-xs">{{filter || origQuery}} <i class="fa fa-fw fa-times"></i></a>
              </span></th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="message in messages | filter: search">
            <td class="shrink noMobile noSmall">{{message.date}}</td>
            <td class="shrink">{{message.timestamp}}</td>
            <% if (!hidesource || login) { %>
              <td class="shrink noMobile noSmall clickable-td" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'source'" popover-trigger="'outsideClick'" style="background-color: {{message.color || 'grey'}}; text-align: center;">
                <span class="small" style="color: white; font-family: monospace;"><strong>{{message.source}}</strong></span>
              </td>
            <% } %>
            <% if (!hidecapcode || login) { %>
              <td class="shrink noMobile noSmall clickable-td" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'address'" popover-trigger="'outsideClick'" style="background-color: {{message.color || 'grey'}}; text-align: center;">
                <span class="small" style="color: white; font-family: monospace;"><strong>{{message.address}}</strong></span>
              </td>
            <% } %>
            <td class="shrink clickable-td" ng-if="message.agency" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'agency'" popover-trigger="'outsideClick'">
              <% if (iconsize == 'small') { %>
              <span class="fa-stack fa-fw" style="color: {{message.color || 'grey'}};">
              <% } else { %>
              <span class="fa-stack fa-lg fa-fw" style="color: {{message.color || 'grey'}};">
              <% } %>
                <i class="fa fa-circle fa-stack-2x"></i>
                <i ng-if="message.icon" class="fa fa-{{message.icon}} fa-stack-1x fa-inverse"></i>
                <i ng-if="!message.icon" class="fa fa-question fa-stack-1x fa-inverse"></i>
              </span>
              <strong style="vertical-align: middle;">{{message.agency || ''}}</strong>
            </td>
            <td class="shrink" ng-if="!message.agency">
              <% if (iconsize == 'small') { %>
              <span class="fa-stack fa-fw" style="color: {{message.color || 'grey'}};">
              <% } else { %>
              <span class="fa-stack fa-lg fa-fw" style="color: {{message.color || 'grey'}};">
              <% } %>
                <i class="fa fa-circle fa-stack-2x"></i>
                <i ng-if="message.icon" class="fa fa-{{message.icon}} fa-stack-1x fa-inverse"></i>
                <i ng-if="!message.icon" class="fa fa-question fa-stack-1x fa-inverse"></i>
              </span>
              <strong style="vertical-align: middle;"></strong>
            </td>
            <td class="shrink noMobile noSmall clickable-td" ng-if="user" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'alias'" popover-trigger="'outsideClick'">
              <span style="color: Maroon;">{{message.alias || 'Unknown'}}</span>
            </td>
            <td class="shrink noMobile noSmall" ng-if="!user">
              <span>{{message.alias || ''}}</span>
            </td>
            <td class="expand"><div highlight="message.message" replacement="init.replaceText" class="pagerMessage"></td>
        </tbody>
      </table>
      </div>
    <div class="row" ng-if="messages.length == 0">
      <div class="col-sm-8 col-sm-offset-2" style="text-align: center; vertical-align: middle;">
        <h4>No messages found!</h4>
        <div ng-if="hasQuery"><p>Consider broadening your search terms and try again.</p></div>
        <div ng-if="!hasQuery"><p>Have you loaded any message data yet?</p>
          <p>If you believe you reached this message by error, <a href="https://github.com/pagermon/pagermon/issues" target="_blank">log an issue.</a></p>
        </div>
      </div>
    </div>
    <% if (apisecurity) { %>
      <% if (!login) { %>
        <div class="row">
          <div class="col-sm-8 col-sm-offset-2" style="text-align: center; vertical-align: middle;">
            <h2>Secure Mode Enabled</h2>
            <h4>Please <a href="/login">sign in</a> to view messages</h4>
              <p>If you believe you reached this message by error, <a href="https://github.com/pagermon/pagermon/issues" target="_blank">log an issue.</a></p>
            </div>
          </div>
        </div>
      <% } %>
    <% } %>
    <% if (searchLocation === 'bottom' || typeof searchLocation == 'undefined') { %>
      <div class="row">
        <div class="col-xs-offset-1 col-xs-10">
        <form action="/" method="get">
          <div class="input-group">
            <input id="query" type="text" class="form-control" name="q" placeholder="Search" ng-model="query">
            <span class="input-group-btn">
              <button type="submit" class="btn btn-default" ng-disabled="!query" ng-class="{disabledLink: !query}"><i class="fa fa-fw fa-search"></i></button>
              <button ng-if="!hasQuery" ng-click="clearSeaarch()" class="btn btn-default" ng-class="{disabledLink: !query}" ng-disabled="!query"><i class="fa fa-fw fa-times"></i></button>
              <a ng-href="/" ng-if="hasQuery" class="btn btn-default"><i class="fa fa-fw fa-times"></i></a>
            </span>
          </div>
        </form>
        </div>
      </div>
    <% } %>
    <% include global/pagination.ejs %>

    </div>
  </script>
  
  <script type="text/ng-template" id="/messageDetails.html">
    <h1>{{ message.address }}</h1>
    note: <textarea>{{ message.message }}</textarea>
  </script>
  
  <script>
var app = angular.module('app', ['ngRoute', 'ngResource', 'ngCookies', 'angular-highlight', 'ui.bootstrap'])
    
    .factory('socket', function ($rootScope) {
      
    var socket = io({transports: ['websocket'], upgrade: false});
      return {
        open: function() {
          socket = io({transports: ['websocket'], upgrade: false});
          socket.open();
        },
        on: function (eventName, callback) {
          socket.on(eventName, function () {  
            var args = arguments;
            $rootScope.$apply(function () {
              callback.apply(socket, args);
            });
          });
        },
        emit: function (eventName, data, callback) {
          socket.emit(eventName, data, function () {
            var args = arguments;
            $rootScope.$apply(function () {
              if (callback) {
                callback.apply(socket, args);
              }
            });
          })
        },
        close: function () {
          socket.close();
        }
      };
    })
    
  
  .factory('adminSocket', function ($rootScope) {

    var adminSocket = io('/adminio', {transports: ['websocket'], upgrade: false});
      return {
        open: function() {
          adminSocket = io('/adminio', {transports: ['websocket'], upgrade: false});
          adminSocket.open();
        },
        on: function (eventName, callback) {
          adminSocket.on(eventName, function () {  
            var args = arguments;
            $rootScope.$apply(function () {
              callback.apply(adminSocket, args);
            });
          });
        },
        emit: function (eventName, data, callback) {
          adminSocket.emit(eventName, data, function () {
            var args = arguments;
            $rootScope.$apply(function () {
              if (callback) {
                callback.apply(adminSocket, args);
              }
            });
          })
        },
        close: function () {
          adminSocket.close();
        }
      };
    })
  
    .factory('Api', ['$resource',
     function($resource) {
      return {
        Messages: $resource('/api/messages/'),
        NewMessage: $resource('/api/messages/:id', {id: '@id'}),
        MessageSearch: $resource('/api/messageSearch/'),
        Agencies: $resource('/api/capcodes/agency')
      };
    }])
    

    .run(function($anchorScroll, $window) {
      // hack to scroll to top when navigating to new URLS but not back/forward
      var wrap = function(method) {
        var orig = $window.window.history[method];
        $window.window.history[method] = function() {
          var retval = orig.apply(this, Array.prototype.slice.call(arguments));
          $anchorScroll();
          return retval;
        };
      };
      wrap('pushState');
      wrap('replaceState');
    })
    
    // Controller
    // TODO: optimise this whole section, consider popping this entire controller out to a separate file
    .controller('MessageController', ['$scope', '$routeParams', 'Api', 'socket', 'adminSocket', '$cookies', '$location', '$window', function ($scope, $routeParams, Api, socket, adminSocket, $cookies, $location, $window) {
      // I hate ejs
      <% if(typeof user != 'undefined'){ %>
        $scope.user="<%=user%>";
      <% }else{ %>
        $scope.user="";
      <% } %>
      // get new message on socket event
      $scope.$on('$viewContentLoaded', function() {
      
    // register a new socket when scope changes and set Socket Typle

  //Manage the sockets
  //This is messy as hell, but it works
  //for some reason, socket opens both sockets, so the adminSocket is required to be closed after opening to prevent leaking data
  <% if (!apisecurity) { %>
    <% if (hidecapcode) { %>
      <% if (login) { %>
        var socketMode = adminSocket
        adminSocket.open();
      <% } else { %>
        var socketMode = socket
        socket.open();
        adminSocket.close()
        <% } %>
    <%} else { %>
      <% if (pdwmode) { %>
        <% if (login) { %>
          var socketMode = adminSocket
          adminSocket.open();
        <% } else { %>
          var socketMode = socket
          socket.open();
          adminSocket.close()
        <% } %>
      <% } else { %>
        var socketMode = socket
        socket.open();
        adminSocket.close()
      <% } %>
    <% } %>	
  <% } else { %>
    <% if (login) { %>
      var socketMode = adminSocket
      adminSocket.open();
      <% } else { %>
      var socketMode = socket
      socket.close();
      adminSocket.close();
      <% } %>
  <% } %>
  
    socketMode.on('messagePost', function(message) {
        // Send Browser Notifications  
    <% if (apisecurity) { %>
        <% if (login) { %>
        if ($scope.notificationEnabled == 'true') {
        if (!message.agency) {
          //Not showing messages for things that we don't know
        } else {
        
          notify("PagerMon - " +message.agency + " - " + message.alias,message.message);
        }
        }
        <% } %>
      <% } else { %>
        if ($scope.notificationEnabled == 'true') {
        if (!message.agency) {
          //Not showing messages for things that we don't know
        } else {
        
          notify("PagerMon - " +message.agency + " - " + message.alias,message.message);
        }
        }
       <% } %>
      
      
    
          // only bother getting the new message if we're on page 1
          if ($scope.init.currentPage === 1) {
            console.log('New Message ID: '+message.id + ' currentPage: '+$scope.init.currentPage);
            var datetime = moment.unix(message.timestamp);
            message.date = datetime.format("YYYY-MM-DD");
            message.timestamp = datetime.format("HH:mm");
          //  result.padAddress = $scope.padDigits(result.address,7);
          //  result.aliasMatch = result['MAX(capcodes.address)'];
            if ($routeParams.q || $routeParams.agency || $routeParams.address) {
              if ($routeParams.q) {
                var patt = new RegExp($routeParams.q, 'i');
                if (patt.test(message.message) || patt.test(message.agency) || patt.test(message.address) || patt.test(message.alias) || patt.test(message.source)) {
                  $scope.messages.unshift(message);
                  $scope.messages.pop();
                }
              }
              if ($routeParams.agency) {
                var patt = new RegExp($routeParams.agency, 'i');
                if (patt.test(message.agency)) {
                  $scope.messages.unshift(message);
                  $scope.messages.pop();
                }
              }
              if ($routeParams.address) {
                var patt = new RegExp($routeParams.address, 'i');
                if (patt.test(message.address) || patt.test(message.alias) || patt.test(message.source)) {
                  $scope.messages.unshift(message);
                  $scope.messages.pop();
                }
              }
            } else {
              $scope.messages.unshift(message);
              $scope.messages.pop();
            }
          }
        });	
      });
      
      // this should be popped out into a separate file
      $scope.updateData = function(page, query){
        // check if browser supports notifications
        if ("Notification" in window) {
          $scope.notificationSupport = true;
        }
        // spinner start
        $scope.spinner = 'fa-spin';
        $scope.loading = true;
        $scope.popoverEl = '';
        // get limit from cookiestore
        var curPage = page || $routeParams.page || '1';
        var limit = $cookies.get('messageLimit') || '';
        $scope.notificationEnabled = $cookies.get('notificationEnabled') || 'true';
        
        var queryObj = {};
            queryObj.page = curPage;
            queryObj.limit = limit;
            
        if ($routeParams.q || query) {
          $scope.query = query || $routeParams.q;
          $scope.origQuery = query || $routeParams.q;
          $scope.hasQuery = true;
          queryObj.q = query || $routeParams.q;
        } else {
          $scope.query = '';
          $scope.hasQuery = false;
        }
        
        if ($routeParams.agency || $routeParams.address) {
          $scope.filter = $routeParams.agency || $routeParams.address;
          $scope.hasQuery = true;
          if ($routeParams.agency) {
            queryObj.agency = $routeParams.agency;
          } else if ($routeParams.address) {
            queryObj.address = $routeParams.address;
          }
        }

        if (page) {
          // if page then we have been passed a page var directly to the updateData func, which means we clicked on a page change button
          // encoding everything prevents issues with some special chars
          var qArray = [];
          if (queryObj.q)
            qArray.push('q='+encodeURIComponent(queryObj.q));
          if (queryObj.address)
            qArray.push('address='+encodeURIComponent(queryObj.address));
          if (queryObj.agency)
            qArray.push('agency='+encodeURIComponent(queryObj.agency));
          if (queryObj.page > 1)
            qArray.push('page='+encodeURIComponent(queryObj.page));

          // default query string is "/" - this prevents the state from not passing on firefox
          var qString = '/';
          if (qArray.length > 0) {
            qString = '?'+qArray.join('&');
          }
          window.history.pushState('', '', qString);
        }
        
        if (queryObj.q || queryObj.agency || queryObj.address) {
          Api.MessageSearch.get(queryObj).$promise.then(function(results) {
            //console.log(results);
              results.init.currentPage++;
              var startPage, endPage;
              if (results.init.pageCount <= 10) {
                  // less than 10 total pages so show all
                  startPage = 1;
                  endPage = results.init.pageCount;
              } else {
                  // more than 10 total pages so calculate start and end pages
                  if (results.init.currentPage <= 6) {
                      startPage = 1;
                      endPage = 10;
                  } else if (results.init.currentPage + 4 >= results.init.pageCount) {
                      startPage = results.init.pageCount - 9;
                      endPage = results.init.pageCount;
                  } else {
                      startPage = results.init.currentPage - 5;
                      endPage = results.init.currentPage + 4;
                  }
              }
              var pages = $scope.range(startPage, endPage);
              results.init.pages = pages;
              $scope.init = results.init;
              angular.forEach(results.messages, function(result) {
                var datetime = moment.unix(result.timestamp);
                result.date = datetime.format("YYYY-MM-DD");
                result.timestamp = datetime.format("HH:mm");
                result.message = $scope.htmlEntities(result.message);
              //  result.padAddress = $scope.padDigits(result.address,7);
            //    result.aliasMatch = result['MAX(capcodes.address)'];
              });
              $scope.spinner = '';
              $scope.loading = false;
              $scope.messages = results.messages;
              // spinner end
          }, function(error) {
            console.log('Error on Api.MessageSearch.query!', error);
            $scope.spinner = '';
            $scope.loading = false;
          });
        } else {
          Api.Messages.get({page: curPage, limit: limit }).$promise.then(function(results) {
            //console.log(results);
            results.init.currentPage++;
            var startPage, endPage;
            if (results.init.pageCount <= 10) {
                // less than 10 total pages so show all
                startPage = 1;
                endPage = results.init.pageCount;
            } else {
                // more than 10 total pages so calculate start and end pages
                if (results.init.currentPage <= 6) {
                    startPage = 1;
                    endPage = 10;
                } else if (results.init.currentPage + 4 >= results.init.pageCount) {
                    startPage = results.init.pageCount - 9;
                    endPage = results.init.pageCount;
                } else {
                    startPage = results.init.currentPage - 5;
                    endPage = results.init.currentPage + 4;
                }
            }
            var pages = $scope.range(startPage, endPage);
            results.init.pages = pages;
            $scope.init = results.init;          
            angular.forEach(results.messages, function(result) {
              var datetime = moment.unix(result.timestamp);
              result.date = datetime.format("YYYY-MM-DD");
              result.timestamp = datetime.format("HH:mm");
              result.message = $scope.htmlEntities(result.message);
            //  result.padAddress = $scope.padDigits(result.address,7);
            //  result.aliasMatch = result['MAX(capcodes.address)'];
            });
            $scope.spinner = '';
            $scope.loading = false;
            $scope.messages = results.messages;
            // spinner end
          }, function(error) {
            console.log('Error on Api.Messages.query!', error);
            $scope.spinner = '';
            $scope.loading = false;
          });
        }
      };
      // run the updateData function on load
      $scope.updateData();
      
      // helper functions below
      $scope.range = function(min, max, step) {
          step = step || 1;
          var input = [];
          for (var i = min; i <= max; i += step) {
              input.push(i);
          }
          return input;
      };
      
      $scope.htmlEntities = function(str) {
          return String(str).replace(/&/g, '&amp;').replace(/</g, ' ').replace(/>/g, ' ').replace(/"/g, '&quot;');
      }
      
      $scope.padDigits = function(number, digits) {
          return Array(Math.max(digits - String(number).length + 1, 0)).join(0) + number;
      }
      
      $scope.setCookie = function(cookie, value) {
          var expireDate = new Date();
          expireDate.setDate(expireDate.getDate() + 30);
          $cookies.put(cookie, value, {'expires': expireDate});
          $scope.updateData($scope.init.currentPage);
      };

      $scope.toggleNotifications = function() {
          if ($scope.notificationEnabled == 'true') {
            $scope.setCookie('notificationEnabled', 'false');
          } else {
            $scope.setCookie('notificationEnabled', 'true');
            Notification.requestPermission(function (permission) {
              if (!('permission' in Notification)) {
                  Notification.permission = permission;
              }
            });
          }
      };
      
      $scope.clearSearch = function(){
        $scope.query = '';
      };
      
      // destroy socket when we navigate away
      $scope.$on('$destroy', function() {
        socket.close();
      });
      
    }])
    // Routes
    .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
      $routeProvider
        .when('/', {
          templateUrl: '/messages.html',
          controller: 'MessageController'
        })
        .when('/:page', {
          templateUrl: '/messages.html',
          controller: 'MessageController'
       });
      $locationProvider.html5Mode({ enabled: true, requireBase: false, rewriteLinks: false});
    }]);

function notify(notifyTitle,notifyMessage) {
    if (!("Notification" in window)) {
        console.log("This browser does not support desktop notification");
    }
    else if (Notification.permission === "granted") {
        var options = {
            body: notifyMessage,
            icon: '/favicon.ico'
        };
        var notification = new Notification(notifyTitle,options);
    }
    else if (Notification.permission !== 'denied') {
        Notification.requestPermission(function (permission) {
            if (!('permission' in Notification)) {
                Notification.permission = permission;
            }

            if (permission === "granted") {
                var options = {
                    body: notifyMessage,
                    icon: '/favicon.ico',
                };
                var notification = new Notification(notifyTitle,options);
            }
        });
    }
}
  </script>

</div>

<% include global/footer.ejs %>
