PageSourceSearch

https://zippykind.com/assets/v2/dispatch-ui.js?ver=1.5

js zippykind.com collected 2026-10-01 23:53:36 UTC 22,896 bytes, 680 lines download raw bytes

1if (typeof jQuery === "undefined") {
2    throw new Error("jQuery plugins need to be before this file");
3}
4
5$.DispatchSoftware = {};
6$.DispatchSoftware.options = {
7    colors: {
8        lightGreen: '#8BC34A',
9    },
10    leftSideBar: {
11        scrollColor: 'rgba(0,0,0,0.5)',
12        scrollWidth: '8px',
13        scrollAlwaysVisible: false,
14        scrollBorderRadius: '0',
15        scrollRailBorderRadius: '0',
16        scrollActiveItemWhenPageLoad: true,
17        breakpointWidth: 1190
18    },
19    dropdownMenu: {
20        effectIn: 'fadeIn',
21        effectOut: 'fadeOut'
22    }
23}
24
25/* Left Sidebar - Function =================================================================================================
26*  
27*/
28$.DispatchSoftware.leftSideBar = {
29    activate: function () {
30        var _this = this;
31        var $body = $('body');
32        var $overlay = $('.overlay');
33
34        //Close sidebar
35        $(window).click(function (e) {
36            var $target = $(e.target);
37            if (e.target.nodeName.toLowerCase() === 'i') { $target = $(e.target).parent(); }
38
39            if (!$target.hasClass('bars') && _this.isOpen() && $target.parents('#leftsidebar').length === 0) {
40                if (!$target.hasClass('js-right-sidebar')) $overlay.fadeOut();
41                $body.removeClass('overlay-open');
42            }
43        });
44
45        $.each($('.menu-toggle.toggled'), function (i, val) {
46            $(val).next().slideToggle(0);
47        });
48
49        //When page load
50        $.each($('.menu .list li.active'), function (i, val) {
51            var $activeAnchors = $(val).find('a:eq(0)');
52
53            $activeAnchors.addClass('toggled');
54            $activeAnchors.next().show();
55        });
56
57        //Collapse or Expand Menu
58        $('.menu-toggle').on('click', function (e) {
59            var $this = $(this);
60            var $content = $this.next();
61
62            if ($($this.parents('ul')[0]).hasClass('list')) {
63                var $not = $(e.target).hasClass('menu-toggle') ? e.target : $(e.target).parents('.menu-toggle');
64
65                $.each($('.menu-toggle.toggled').not($not).next(), function (i, val) {
66                    if ($(val).is(':visible')) {
67                        $(val).prev().toggleClass('toggled');
68                        $(val).slideUp();
69                    }
70                });
71            }
72
73            $this.toggleClass('toggled');
74            $content.slideToggle(320);
75        });
76
77        //Set menu height
78        _this.setMenuHeight();
79        _this.checkStatuForResize(true);
80        $(window).resize(function () {
81            _this.setMenuHeight();
82            _this.checkStatuForResize(false);
83        });
84
85        //Set Waves
86        Waves.attach('.menu .list a', ['waves-block']);
87        Waves.init();
88    },
89    setMenuHeight: function (isFirstTime) {
90        if (typeof $.fn.slimScroll != 'undefined') {
91            var configs = $.DispatchSoftware.options.leftSideBar;
92            var height = ($(window).height() - ($('.legal').outerHeight() + $('.user-info').outerHeight() + $('.navbar').innerHeight()));
93            var $el = $('.list');
94
95            $el.slimscroll({
96                height: height + "px",
97                color: configs.scrollColor,
98                size: configs.scrollWidth,
99                alwaysVisible: configs.scrollAlwaysVisible,
100                borderRadius: configs.scrollBorderRadius,
101                railBorderRadius: configs.scrollRailBorderRadius
102            });
103
104            //Scroll active menu item when page load, if option set = true
105		
106			if($('.menu .list li.active').exists()){
107				if ($.DispatchSoftware.options.leftSideBar.scrollActiveItemWhenPageLoad) {
108					var activeItemOffsetTop = $('.menu .list li.active')[0].offsetTop
109					if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' });
110				}
111			}
112		
113        }
114    },
115    checkStatuForResize: function (firstTime) {
116        var $body = $('body');
117        var $openCloseBar = $('.navbar .navbar-header .bars');
118        var width = $body.width();
119
120        if (firstTime) {
121            $body.find('.content, .sidebar').addClass('no-animate').delay(1000).queue(function () {
122                $(this).removeClass('no-animate').dequeue();
123            });
124        }
125
126        if (width < $.DispatchSoftware.options.leftSideBar.breakpointWidth) {
127            $body.addClass('ls-closed');
128            $openCloseBar.fadeIn();
129        }
130        else {
131            $body.removeClass('ls-closed');
132            $openCloseBar.fadeOut();
133        }
134    },
135    isOpen: function () {
136        return $('body').hasClass('overlay-open');
137    }
138};
139//==========================================================================================================================
140
141/* Right Sidebar - Function ================================================================================================
142*  
143*/
144$.DispatchSoftware.rightSideBar = {
145    activate: function () {
146        var _this = this;
147        var $sidebar = $('#rightsidebar');
148        var $overlay = $('.overlay');
149
150        //Close sidebar
151        $(window).click(function (e) {
152            var $target = $(e.target);
153            if (e.target.nodeName.toLowerCase() === 'i') { $target = $(e.target).parent(); }
154
155            if (!$target.hasClass('js-right-sidebar') && _this.isOpen() && $target.parents('#rightsidebar').length === 0) {
156                if (!$target.hasClass('bars')) $overlay.fadeOut();
157                $sidebar.removeClass('open');
158				$('.modal_map').removeClass('dashboard-narrow-view');
159            }
160        });
161
162        $('.js-right-sidebar').on('click', function () {
163            $sidebar.toggleClass('open');
164            if (_this.isOpen()) { $overlay.fadeIn(); } else { $overlay.fadeOut(); }
165        });
166    },
167    isOpen: function () {
168        return $('.right-sidebar').hasClass('open');
169    }
170}
171
172$.DispatchSoftware.rightSideBarRoutes = {
173    activate: function () {
174        var _this = this;
175        var $sidebar = $('#rightsidebar-routes');
176        var $overlay = $('.overlay');
177
178        //Close sidebar
179        $(window).click(function (e) {
180            var $target = $(e.target);
181            if (e.target.nodeName.toLowerCase() === 'i') { $target = $(e.target).parent(); }
182
183            if (!$target.hasClass('js-right-sidebar-routes') && _this.isOpen() && $target.parents('#rightsidebar-routes').length === 0) {
184                //if (!$target.hasClass('bars')) $overlay.fadeOut();
185                $sidebar.removeClass('open');
186				$('.modal_map').removeClass('dashboard-narrow-view');
187				$('#dashboard-lc-3 .hide-single-routes').addClass('hide');
188				$('#dashboard-lc-3 .show-single-routes').removeClass('hide');
189            }
190        });
191
192        $('.js-right-sidebar-routes').on('click', function () {
193            $sidebar.toggleClass('open');
194			// --- 09.04.26 (David): "The bottom panel overlaps the right sidebar, lets shorten
195			// the bottom panel width by 280px so that it doesn't overlap the right sidebar."
196			// This handler toggled `open` on the sidebar but never added dashboard-narrow-view --
197			// every other line in this file only ever REMOVES it. So opening the routes sidebar
198			// from its own button left the sidebar open with the class absent, and
199			// .custom-route-btns-wrap kept its full calc(100% - 280px) and ran underneath.
200			// MEASURED at 1601px wide: panel right edge 1601 without the class, 1321 with it,
201			// sidebar 1601-1881. The class is the map's "a 280px sidebar is showing" flag, so it
202			// belongs wherever that state changes. ---
203			$('.modal_map').toggleClass('dashboard-narrow-view', $sidebar.hasClass('open'));
204            //if (_this.isOpen()) { $overlay.fadeIn(); } else { $overlay.fadeOut(); }
205			
206			// Populate right side bar with all routes
207			var btn_id=$(this).attr("id");
208			dump('btn_id '+btn_id);
209			
210			
211			
212			if($('#dashboard-lc-3 .show-single-routes').hasClass('hide')){
213				$('.modal_map').removeClass('dashboard-narrow-view');
214				$('#dashboard-lc-3 .hide-single-routes').addClass('hide');
215				$('#dashboard-lc-3 .show-single-routes').removeClass('hide');
216			} else {
217				// 09.04.26 (David): show "Loading routes..." rather than leaving the panel
218				// asserting "No routes found" for the couple of seconds this takes.
219				if (typeof zkRoutesPanelLoading === 'function') zkRoutesPanelLoading();
220				callAjax("getDashboardRoutes","date="+$(".calendar_formated").val()+"&target=sidepanel");
221				$('#dashboard-lc-3 .show-single-routes').addClass('hide');
222				$('#dashboard-lc-3 .hide-single-routes').removeClass('hide');
223			}
224        });
225		
226    },
227    isOpen: function () {
228        return $('.right-sidebar-routes').hasClass('open');
229    }
230}
231
232//==========================================================================================================================
233
234/* Searchbar - Function ================================================================================================
235*  
236*/
237var $searchBar = $('.search-bar');
238$.DispatchSoftware.search = {
239    activate: function () {
240        var _this = this;
241
242        //Search button click event
243        $('.js-search').on('click', function () {
244            _this.showSearchBar();
245        });
246
247        //Close search click event
248        $searchBar.find('.close-search').on('click', function () {
249            _this.hideSearchBar();
250        });
251
252        //ESC key on pressed
253        $searchBar.find('input[type="text"]').on('keyup', function (e) {
254            if (e.keyCode == 27) {
255                _this.hideSearchBar();
256            }
257        });
258    },
259    showSearchBar: function () {
260        $searchBar.addClass('open');
261        $searchBar.find('input[type="text"]').focus();
262    },
263    hideSearchBar: function () {
264        $searchBar.removeClass('open');
265        $searchBar.find('input[type="text"]').val('');
266    }
267}
268//==========================================================================================================================
269
270/* Navbar - Function =======================================================================================================
271*  
272*/
273$.DispatchSoftware.navbar = {
274    activate: function () {
275        var $body = $('body');
276        var $overlay = $('.overlay');
277
278        //Open left sidebar panel
279        $('.bars').on('click', function () {
280            $body.toggleClass('overlay-open');
281            if ($body.hasClass('overlay-open')) { $overlay.fadeIn(); } else { $overlay.fadeOut(); }
282        });
283
284        //Close collapse bar on click event
285        $('.nav [data-close="true"]').on('click', function () {
286            var isVisible = $('.navbar-toggle').is(':visible');
287            var $navbarCollapse = $('.navbar-collapse');
288
289            if (isVisible) {
290                $navbarCollapse.slideUp(function () {
291                    $navbarCollapse.removeClass('in').removeAttr('style');
292                });
293            }
294        });
295    }
296}
297//==========================================================================================================================
298
299/* Input - Function ========================================================================================================
300*  
301*/
302$.DispatchSoftware.input = {
303    activate: function () {
304        //On focus event
305        $('.form-control').focus(function () {
306            $(this).parent().addClass('focused');
307        });
308
309        //On focusout event
310        $('.form-control').focusout(function () {
311            var $this = $(this);
312            if ($this.parents('.form-group').hasClass('form-float')) {
313                if ($this.val() == '') { $this.parents('.form-line').removeClass('focused'); }
314            }
315            else {
316                $this.parents('.form-line').removeClass('focused');
317            }
318        });
319
320        //On label click
321        $('body').on('click', '.form-float .form-line .form-label', function () {
322            $(this).parent().find('input').focus();
323        });
324
325        //Not blank form
326        $('.form-control').each(function () {
327            if ($(this).val() !== '') {
328                $(this).parents('.form-line').addClass('focused');
329            }
330        });
331    }
332}
333//==========================================================================================================================
334
335/* Form - Select - Function ================================================================================================
336*  
337*/
338$.DispatchSoftware.select = {
339    activate: function () {
340        if ($.fn.selectpicker) { $('select:not(.ms)').selectpicker(); }
341    }
342}
343//==========================================================================================================================
344
345/* DropdownMenu - Function =================================================================================================
346*  
347*/
348
349$.DispatchSoftware.dropdownMenu = {
350    activate: function () {
351        var _this = this;
352
353        $('.dropdown, .dropup, .btn-group').on({
354            "show.bs.dropdown": function () {
355                var dropdown = _this.dropdownEffect(this);
356                _this.dropdownEffectStart(dropdown, dropdown.effectIn);
357            },
358            "shown.bs.dropdown": function () {
359                var dropdown = _this.dropdownEffect(this);
360                if (dropdown.effectIn && dropdown.effectOut) {
361                    _this.dropdownEffectEnd(dropdown, function () { });
362                }
363            },
364            "hide.bs.dropdown": function (e) {
365                var dropdown = _this.dropdownEffect(this);
366                if (dropdown.effectOut) {
367                    e.preventDefault();
368                    _this.dropdownEffectStart(dropdown, dropdown.effectOut);
369                    _this.dropdownEffectEnd(dropdown, function () {
370                        dropdown.dropdown.removeClass('open');
371                    });
372                }
373            }
374        });
375
376        //Set Waves
377        Waves.attach('.dropdown-menu li a', ['waves-block']);
378        Waves.init();
379    },
380    dropdownEffect: function (target) {
381        var effectIn = $.DispatchSoftware.options.dropdownMenu.effectIn, effectOut = $.DispatchSoftware.options.dropdownMenu.effectOut;
382        var dropdown = $(target), dropdownMenu = $('.dropdown-menu', target);
383
384        if (dropdown.length > 0) {
385            var udEffectIn = dropdown.data('effect-in');
386            var udEffectOut = dropdown.data('effect-out');
387            if (udEffectIn !== undefined) { effectIn = udEffectIn; }
388            if (udEffectOut !== undefined) { effectOut = udEffectOut; }
389        }
390
391        return {
392            target: target,
393            dropdown: dropdown,
394            dropdownMenu: dropdownMenu,
395            effectIn: effectIn,
396            effectOut: effectOut
397        };
398    },
399    dropdownEffectStart: function (data, effectToStart) {
400        if (effectToStart) {
401            data.dropdown.addClass('dropdown-animating');
402            data.dropdownMenu.addClass('animated dropdown-animated');
403            data.dropdownMenu.addClass(effectToStart);
404        }
405    },
406    dropdownEffectEnd: function (data, callback) {
407        var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
408        data.dropdown.one(animationEnd, function () {
409            data.dropdown.removeClass('dropdown-animating');
410            data.dropdownMenu.removeClass('animated dropdown-animated');
411            data.dropdownMenu.removeClass(data.effectIn);
412            data.dropdownMenu.removeClass(data.effectOut);
413
414            if (typeof callback == 'function') {
415                callback();
416            }
417        });
418    }
419}
420//==========================================================================================================================
421
422/* Browser - Function ======================================================================================================
423*  
424*/
425var edge = 'Microsoft Edge';
426var ie10 = 'Internet Explorer 10';
427var ie11 = 'Internet Explorer 11';
428var opera = 'Opera';
429var firefox = 'Mozilla Firefox';
430var chrome = 'Google Chrome';
431var safari = 'Safari';
432
433$.DispatchSoftware.browser = {
434    activate: function () {
435        var _this = this;
436        var className = _this.getClassName();
437
438        if (className !== '') $('html').addClass(_this.getClassName());
439    },
440    getBrowser: function () {
441        var userAgent = navigator.userAgent.toLowerCase();
442
443        if (/edge/i.test(userAgent)) {
444            return edge;
445        } else if (/rv:11/i.test(userAgent)) {
446            return ie11;
447        } else if (/msie 10/i.test(userAgent)) {
448            return ie10;
449        } else if (/opr/i.test(userAgent)) {
450            return opera;
451        } else if (/chrome/i.test(userAgent)) {
452            return chrome;
453        } else if (/firefox/i.test(userAgent)) {
454            return firefox;
455        } else if (!!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/)) {
456            return safari;
457        }
458
459        return undefined;
460    },
461    getClassName: function () {
462        var browser = this.getBrowser();
463
464        if (browser === edge) {
465            return 'edge';
466        } else if (browser === ie11) {
467            return 'ie11';
468        } else if (browser === ie10) {
469            return 'ie10';
470        } else if (browser === opera) {
471            return 'opera';
472        } else if (browser === chrome) {
473            return 'chrome';
474        } else if (browser === firefox) {
475            return 'firefox';
476        } else if (browser === safari) {
477            return 'safari';
478        } else {
479            return '';
480        }
481    }
482}
483//==========================================================================================================================
484
485$.DispatchSoftware.rangeSlider = {
486    activate: function () {
487			
488		var $dashboard_brightness = $("#dashboard-brightness");
489
490		$dashboard_brightness.ionRangeSlider({
491			type: "single",
492			min: 0,
493			max: 90,
494			from: operatorSettings.dashboard_brightness?operatorSettings.dashboard_brightness*100:.0,
495			keyboard: true,
496			onStart: function (data) {
497				//dump("onStart");
498				//if(systemSettings.dashboard_brightness && dashboardMapBrightness)
499					//dashboardMapBrightness.setOptions({'fillOpacity': systemSettings.dashboard_brightness});
500			},
501			onChange: function (data) {
502				dump("onChange "+data.from);
503				var from = data.from;
504				if(data.from<10)
505					from='0'+data.from;
506				var changeOpacity = '.'+from;
507				dashboardMapBrightness.setOptions({'fillOpacity': changeOpacity});
508				
509			},
510			onFinish: function (data) {
511				dump("onFinish "+data.from);
512				var from = data.from;
513				if(data.from<10)
514					from='0'+data.from;
515				var changeOpacity = '.'+from;
516				updateOperatorOption('dashboard_brightness', changeOpacity);
517			},
518			onUpdate: function (data) {
519				dump("onUpdate");
520			}
521		});
522		/*
523		$dashboard_brightness.on("change", function () {
524			var $this = $(this),
525				value = $this.prop("value");
526			dump("Value: " + value);
527		});
528		*/
529	}
530}
531
532$.DispatchSoftware.notificationSounds = {
533    activate: function () {
534		ion.sound({
535				sounds: [
536					{
537						name: "update_ticket",
538						volume: notification_volume
539					}
540				],
541				path: site_url+"/assets/notification/sounds/",
542				preload: true,
543				multiplay: false
544			});
545	}
546}
547
548$(function () {
549    $.DispatchSoftware.browser.activate();
550    $.DispatchSoftware.leftSideBar.activate();
551    $.DispatchSoftware.rightSideBar.activate();
552	$.DispatchSoftware.rightSideBarRoutes.activate();
553    $.DispatchSoftware.navbar.activate();
554    $.DispatchSoftware.dropdownMenu.activate();
555    $.DispatchSoftware.input.activate();
556    $.DispatchSoftware.select.activate();
557    $.DispatchSoftware.search.activate();
558	if(!$('.login-body').exists()){
559	$.DispatchSoftware.rangeSlider.activate();
560	$.DispatchSoftware.notificationSounds.activate();
561	}
562	//setPerfectScroll();
563    activateNotificationAndTasksScroll();
564	setLeftMenuListHeightAndScroll(true)
565    setRightMenuListHeightAndScroll(true);
566    setSettingListHeightAndScroll(true);
567	$('[data-toggle="popover"]').popover();
568	
569    $(window).resize(function () {
570		setLeftMenuListHeightAndScroll(false)
571        setRightMenuListHeightAndScroll(false);
572        setSettingListHeightAndScroll(false);
573    });
574
575    setTimeout(function () { $('.page-loader-wrapper').fadeOut(); }, 50);
576	
577	
578});
579
580// Left menu
581function setLeftMenuListHeightAndScroll(isFirstTime) {
582    var height = $('#leftsidebar').height() - 175 /* height of tabs */;
583	$('.list_row li').css('margin-bottom','54px');
584    var $el = $('.list_row');
585
586    if (!isFirstTime){
587      $el.slimScroll({ destroy: true }).height('auto');
588      $el.parent().find('.slimScrollBar, .slimScrollRail').remove();
589    }
590
591    $el.slimscroll({
592        height: height + 'px',
593        color: 'rgba(0,0,0,0.5)',
594        size: '8px',
595        alwaysVisible: false,
596        borderRadius: '0',
597        railBorderRadius: '0'
598    });
599}
600
601//Right menu
602function setRightMenuListHeightAndScroll(isFirstTime) {
603    var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());
604    var $el = $('.right-menu');
605
606    if (!isFirstTime){
607      $el.slimScroll({ destroy: true }).height('auto');
608      $el.parent().find('.slimScrollBar, .slimScrollRail').remove();
609    }
610
611    $el.slimscroll({
612        height: height + 'px',
613        color: 'rgba(0,0,0,0.5)',
614        size: '8px',
615        alwaysVisible: false,
616        borderRadius: '0',
617        railBorderRadius: '0'
618    });
619}
620
621//Activate notification and ticket dropdown on top right menu
622function activateNotificationAndTasksScroll() {
623    $('.navbar-right .dropdown-menu .body .menu').slimscroll({
624        height: '254px',
625        color: 'rgba(0,0,0,0.5)',
626        size: '8px',
627        alwaysVisible: false,
628        borderRadius: '0',
629        railBorderRadius: '0'
630    });
631}
632
633//Setting tab content set height and show scroll
634function setSettingListHeightAndScroll(isFirstTime) {
635    var height = $(window).height() - ($('.navbar').innerHeight() + $('.right-sidebar .nav-tabs').outerHeight());
636    var $el = $('.right-sidebar .zippy-scroll');
637
638    if (!isFirstTime){
639      $el.slimScroll({ destroy: true }).height('auto');
640      $el.parent().find('.slimScrollBar, .slimScrollRail').remove();
641    }
642
643    $el.slimscroll({
644        height: height + 'px',
645        color: 'rgba(0,0,0,0.7)',
646        size: '10px',
647        alwaysVisible: false,
648        borderRadius: '0',
649        railBorderRadius: '0'
650    });
651}
652
653function toggleTraffic() {
654  if (trafficLayer.getMap() == null) {
655    trafficLayer.setMap(map.map);
656  } else {
657    trafficLayer.setMap(null);
658  }
659}
660
661function setTrafficLayer(state) {
662  if (state==1) {
663    trafficLayer.setMap(map.map);
664  } else {
665    trafficLayer.setMap(null);
666  }
667}
668
669function showAutoCloseTimerMessage(title, message, time) {
670    swal({
671        title: title,
672        text: message,
673        timer: time,
674        showConfirmButton: true
675    });
676}
677
678function showWithTitleMessage(title, message) {
679    swal(title, message);
680}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.