PageSourceSearch

https://www.tourezi.com/metronic/assets/global/scripts/app.js?v=638423213307610204

js tourezi.com collected 2026-09-26 00:05:08 UTC 38,527 bytes, 1,020 lines download raw bytes

1/**
2Core script to handle the entire theme and core functions
3**/
4var App = function() {
5
6    // IE mode
7    var isRTL = false;
8    var isIE8 = false;
9    var isIE9 = false;
10    var isIE10 = false;
11
12    var resizeHandlers = [];
13
14    var assetsPath = '../assets/';
15
16    var globalImgPath = 'global/img/';
17
18    var globalPluginsPath = 'global/plugins/';
19
20    var globalCssPath = 'global/css/';
21
22    // theme layout color set
23
24    var brandColors = {
25        'blue': '#89C4F4',
26        'red': '#F3565D',
27        'green': '#1bbc9b',
28        'purple': '#9b59b6',
29        'grey': '#95a5a6',
30        'yellow': '#F8CB00'
31    };
32
33    // initializes main settings
34    var handleInit = function() {
35
36        if ($('body').css('direction') === 'rtl') {
37            isRTL = true;
38        }
39
40        isIE8 = !!navigator.userAgent.match(/MSIE 8.0/);
41        isIE9 = !!navigator.userAgent.match(/MSIE 9.0/);
42        isIE10 = !!navigator.userAgent.match(/MSIE 10.0/);
43
44        if (isIE10) {
45            $('html').addClass('ie10'); // detect IE10 version
46        }
47
48        if (isIE10 || isIE9 || isIE8) {
49            $('html').addClass('ie'); // detect IE10 version
50        }
51    };
52
53    // runs callback functions set by App.addResponsiveHandler().
54    var _runResizeHandlers = function() {
55        // reinitialize other subscribed elements
56        for (var i = 0; i < resizeHandlers.length; i++) {
57            var each = resizeHandlers[i];
58            each.call();
59        }
60    };
61
62    var handleOnResize = function() {
63        var windowWidth = $(window).width();
64        var resize;
65        if (isIE8) {
66            var currheight;
67            $(window).resize(function() {
68                if (currheight == document.documentElement.clientHeight) {
69                    return; //quite event since only body resized not window.
70                }
71                if (resize) {
72                    clearTimeout(resize);
73                }
74                resize = setTimeout(function() {
75                    _runResizeHandlers();
76                }, 50); // wait 50ms until window resize finishes.                
77                currheight = document.documentElement.clientHeight; // store last body client height
78            });
79        } else {
80            $(window).resize(function() {
81                if ($(window).width() != windowWidth) {
82                    windowWidth = $(window).width();
83                    if (resize) {
84                        clearTimeout(resize);
85                    }
86                    resize = setTimeout(function() {
87                        _runResizeHandlers();
88                    }, 50); // wait 50ms until window resize finishes.
89                }
90            });
91        }
92    };
93
94    // Handles portlet tools & actions
95    var handlePortletTools = function() {
96        // handle portlet remove
97        $('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function(e) {
98            e.preventDefault();
99            var portlet = $(this).closest(".portlet");
100
101            if ($('body').hasClass('page-portlet-fullscreen')) {
102                $('body').removeClass('page-portlet-fullscreen');
103            }
104
105            portlet.find('.portlet-title .fullscreen').tooltip('destroy');
106            portlet.find('.portlet-title > .tools > .reload').tooltip('destroy');
107            portlet.find('.portlet-title > .tools > .remove').tooltip('destroy');
108            portlet.find('.portlet-title > .tools > .config').tooltip('destroy');
109            portlet.find('.portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip('destroy');
110
111            portlet.remove();
112        });
113
114        // handle portlet fullscreen
115        $('body').on('click', '.portlet > .portlet-title .fullscreen', function(e) {
116            e.preventDefault();
117            var portlet = $(this).closest(".portlet");
118            if (portlet.hasClass('portlet-fullscreen')) {
119                $(this).removeClass('on');
120                portlet.removeClass('portlet-fullscreen');
121                $('body').removeClass('page-portlet-fullscreen');
122                portlet.children('.portlet-body').css('height', 'auto');
123            } else {
124                var height = App.getViewPort().height -
125                    portlet.children('.portlet-title').outerHeight() -
126                    parseInt(portlet.children('.portlet-body').css('padding-top')) -
127                    parseInt(portlet.children('.portlet-body').css('padding-bottom'));
128
129                $(this).addClass('on');
130                portlet.addClass('portlet-fullscreen');
131                $('body').addClass('page-portlet-fullscreen');
132                portlet.children('.portlet-body').css('height', height);
133            }
134        });
135
136        $('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function(e) {
137            e.preventDefault();
138            var el = $(this).closest(".portlet").children(".portlet-body");
139            var url = $(this).attr("data-url");
140            var error = $(this).attr("data-error-display");
141            if (url) {
142                App.blockUI({
143                    target: el,
144                    animate: true,
145                    overlayColor: 'none'
146                });
147                $.ajax({
148                    type: "GET",
149                    cache: false,
150                    url: url,
151                    dataType: "html",
152                    success: function(res) {
153                        App.unblockUI(el);
154                        el.html(res);
155                        App.initAjax() // reinitialize elements & plugins for newly loaded content
156                    },
157                    error: function(xhr, ajaxOptions, thrownError) {
158                        App.unblockUI(el);
159                        var msg = 'Error on reloading the content. Please check your connection and try again.';
160                        if (error == "toastr" && toastr) {
161                            toastr.error(msg);
162                        } else if (error == "notific8" && $.notific8) {
163                            $.notific8('zindex', 11500);
164                            $.notific8(msg, {
165                                theme: 'ruby',
166                                life: 3000
167                            });
168                        } else {
169                            alert(msg);
170                        }
171                    }
172                });
173            } else {
174                // for demo purpose
175                App.blockUI({
176                    target: el,
177                    animate: true,
178                    overlayColor: 'none'
179                });
180                window.setTimeout(function() {
181                    App.unblockUI(el);
182                }, 1000);
183            }
184        });
185
186        // load ajax data on page init
187        $('.portlet .portlet-title a.reload[data-load="true"]').click();
188
189        $('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function(e) {
190            e.preventDefault();
191            var el = $(this).closest(".portlet").children(".portlet-body");
192            if ($(this).hasClass("collapse")) {
193                $(this).removeClass("collapse").addClass("expand");
194                el.slideUp(200);
195            } else {
196                $(this).removeClass("expand").addClass("collapse");
197                el.slideDown(200);
198            }
199        });
200    };
201    
202    // Handlesmaterial design checkboxes
203    var handleMaterialDesign = function() {
204
205        // Material design ckeckbox and radio effects
206        $('body').on('click', '.md-checkbox > label, .md-radio > label', function() {
207            var the = $(this);
208            // find the first span which is our circle/bubble
209            var el = $(this).children('span:first-child');
210              
211            // add the bubble class (we do this so it doesnt show on page load)
212            el.addClass('inc');
213              
214            // clone it
215            var newone = el.clone(true);  
216              
217            // add the cloned version before our original
218            el.before(newone);  
219              
220            // remove the original so that it is ready to run on next click
221            $("." + el.attr("class") + ":last", the).remove();
222        }); 
223
224        if ($('body').hasClass('page-md')) { 
225            // Material design click effect
226            // credit where credit's due; http://thecodeplayer.com/walkthrough/ripple-click-effect-google-material-design       
227            var element, circle, d, x, y;
228            $('body').on('click', 'a.btn, button.btn, input.btn, label.btn', function(e) { 
229                element = $(this);
230      
231                if(element.find(".md-click-circle").length == 0) {
232                    element.prepend("<span class='md-click-circle'></span>");
233                }
234                    
235                circle = element.find(".md-click-circle");
236                circle.removeClass("md-click-animate");
237                
238                if(!circle.height() && !circle.width()) {
239                    d = Math.max(element.outerWidth(), element.outerHeight());
240                    circle.css({height: d, width: d});
241                }
242                
243                x = e.pageX - element.offset().left - circle.width()/2;
244                y = e.pageY - element.offset().top - circle.height()/2;
245                
246                circle.css({top: y+'px', left: x+'px'}).addClass("md-click-animate");
247
248                setTimeout(function() {
249                    circle.remove();      
250                }, 1000);
251            });
252        }
253
254        // Floating labels
255        var handleInput = function(el) {
256            if (el.val() != "") {
257                el.addClass('edited');
258            } else {
259                el.removeClass('edited');
260            }
261        } 
262
263        $('body').on('keydown', '.form-md-floating-label .form-control', function(e) { 
264            handleInput($(this));
265        });
266        $('body').on('blur', '.form-md-floating-label .form-control', function(e) { 
267            handleInput($(this));
268        });        
269
270        $('.form-md-floating-label .form-control').each(function(){
271            if ($(this).val().length > 0) {
272                $(this).addClass('edited');
273            }
274        });
275    }
276
277    // Handles custom checkboxes & radios using jQuery iCheck plugin
278    var handleiCheck = function() {
279        if (!$().iCheck) {
280            return;
281        }
282
283        $('.icheck').each(function() {
284            var checkboxClass = $(this).attr('data-checkbox') ? $(this).attr('data-checkbox') : 'icheckbox_minimal-grey';
285            var radioClass = $(this).attr('data-radio') ? $(this).attr('data-radio') : 'iradio_minimal-grey';
286
287            if (checkboxClass.indexOf('_line') > -1 || radioClass.indexOf('_line') > -1) {
288                $(this).iCheck({
289                    checkboxClass: checkboxClass,
290                    radioClass: radioClass,
291                    insert: '<div class="icheck_line-icon"></div>' + $(this).attr("data-label")
292                });
293            } else {
294                $(this).iCheck({
295                    checkboxClass: checkboxClass,
296                    radioClass: radioClass
297                });
298            }
299        });
300    };
301
302    // Handles Bootstrap switches
303    var handleBootstrapSwitch = function() {
304        if (!$().bootstrapSwitch) {
305            return;
306        }
307        $('.make-switch').bootstrapSwitch();
308    };
309
310    // Handles Bootstrap confirmations
311    var handleBootstrapConfirmation = function() {
312        if (!$().confirmation) {
313            return;
314        }
315        $('[data-toggle=confirmation]').confirmation({ btnOkClass: 'btn btn-sm btn-success', btnCancelClass: 'btn btn-sm btn-danger'});
316    }
317    
318    // Handles Bootstrap Accordions.
319    var handleAccordions = function() {
320        $('body').on('shown.bs.collapse', '.accordion.scrollable', function(e) {
321            App.scrollTo($(e.target));
322        });
323    };
324
325    // Handles Bootstrap Tabs.
326    var handleTabs = function() {
327        //activate tab if tab id provided in the URL
328        if (encodeURI(location.hash)) {
329            var tabid = encodeURI(location.hash.substr(1));
330            $('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function() {
331                var tabid = $(this).attr("id");
332                $('a[href="#' + tabid + '"]').click();
333            });
334            $('a[href="#' + tabid + '"]').click();
335        }
336
337        if ($().tabdrop) {
338            $('.tabbable-tabdrop .nav-pills, .tabbable-tabdrop .nav-tabs').tabdrop({
339                text: '<i class="fa fa-ellipsis-v"></i>&nbsp;<i class="fa fa-angle-down"></i>'
340            });
341        }
342    };
343
344    // Handles Bootstrap Modals.
345    var handleModals = function() {        
346        // fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal
346-open class. 
347        $('body').on('hide.bs.modal', function() {
348            if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') === false) {
349                $('html').addClass('modal-open');
350            } else if ($('.modal:visible').size() <= 1) {
351                $('html').removeClass('modal-open');
352            }
353        });
354
355        // fix page scrollbars issue
356        $('body').on('show.bs.modal', '.modal', function() {
357            if ($(this).hasClass("modal-scroll")) {
358                $('body').addClass("modal-open-noscroll");
359            }
360        });
361
362        // fix page scrollbars issue
363        $('body').on('hidden.bs.modal', '.modal', function() {
364            $('body').removeClass("modal-open-noscroll");
365        });
366
367        // remove ajax content and remove cache on modal closed 
368        $('body').on('hidden.bs.modal', '.modal:not(.modal-cached)', function () {
369            $(this).removeData('bs.modal');
370        });
371    };
372
373    // Handles Bootstrap Tooltips.
374    var handleTooltips = function() {
375        // global tooltips
376        $('.tooltips').tooltip();
377
378        // portlet tooltips
379        $('.portlet > .portlet-title .fullscreen').tooltip({
380            trigger: 'hover',
381            container: 'body',
382            title: 'Fullscreen'
383        });
384        $('.portlet > .portlet-title > .tools > .reload').tooltip({
385            trigger: 'hover',
386            container: 'body',
387            title: 'Reload'
388        });
389        $('.portlet > .portlet-title > .tools > .remove').tooltip({
390            trigger: 'hover',
391            container: 'body',
392            title: 'Remove'
393        });
394        $('.portlet > .portlet-title > .tools > .config').tooltip({
395            trigger: 'hover',
396            container: 'body',
397            title: 'Settings'
398        });
399        $('.portlet > .portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip({
400            trigger: 'hover',
401            container: 'body',
402            title: 'Collapse/Expand'
403        });
404    };
405
406    // Handles Bootstrap Dropdowns
407    var handleDropdowns = function() {
408        /*
409          Hold dropdown on click  
410        */
411        $('body').on('click', '.dropdown-menu.hold-on-click', function(e) {
412            e.stopPropagation();
413        });
414    };
415
416    var handleAlerts = function() {
417        $('body').on('click', '[data-close="alert"]', function(e) {
418            $(this).parent('.alert').hide();
419            $(this).closest('.note').hide();
420            e.preventDefault();
421        });
422
423        $('body').on('click', '[data-close="note"]', function(e) {
424            $(this).closest('.note').hide();
425            e.preventDefault();
426        });
427
428        $('body').on('click', '[data-remove="note"]', function(e) {
429            $(this).closest('.note').remove();
430            e.preventDefault();
431        });
432    };
433
434    // Handle textarea autosize 
435    var handleTextareaAutosize = function() {
436        if (typeof(autosize) == "function") {
437            autosize(document.querySelector('textarea.autosizeme'));
438        }
439    }
440
441    // Handles Bootstrap Popovers
442
443    // last popep popover
444    var lastPopedPopover;
445
446    var handlePopovers = function() {
447        $('.popovers').popover();
448
449        // close last displayed popover
450
451        $(document).on('click.bs.popover.data-api', function(e) {
452            if (lastPopedPopover) {
453                lastPopedPopover.popover('hide');
454            }
455        });
456    };
457
458    // Handles scrollable contents using jQuery SlimScroll plugin.
459    var handleScrollers = function() {
460        App.initSlimScroll('.scroller');
461    };
462
463    // Handles Image Preview using jQuery Fancybox plugin
464    var handleFancybox = function() {
465        if (!jQuery.fancybox) {
466            return;
467        }
468
469        if ($(".fancybox-button").size() > 0) {
470            $(".fancybox-button").fancybox({
471                groupAttr: 'data-rel',
472                prevEffect: 'none',
473                nextEffect: 'none',
474                closeBtn: true,
475                helpers: {
476                    title: {
477                        type: 'inside'
478                    }
479                }
480            });
481        }
482    };
483
484    // Handles counterup plugin wrapper
485    var handleCounterup = function() {
486        if (!$().counterUp) {
487            return;
488        }
489
490        $("[data-counter='counterup']").counterUp({
491            delay: 10,
492            time: 1000
493        });
494    };
495
496    // Fix input placeholder issue for IE8 and IE9
497    var handleFixInputPlaceholderForIE = function() {
498        //fix html5 placeholder attribute for ie7 & ie8
499        if (isIE8 || isIE9) { // ie8 & ie9
500            // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
501            $('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function() {
502                var input = $(this);
503
504                if (input.val() === '' && input.attr("placeholder") !== '') {
505                    input.addClass("placeholder").val(input.attr('placeholder'));
506                }
507
508                input.focus(function() {
509                    if (input.val() == input.attr('placeholder')) {
510                        input.val('');
511                    }
512                });
513
514                input.blur(function() {
515                    if (input.val() === '' || input.val() == input.attr('placeholder')) {
516                        input.val(input.attr('placeholder'));
517                    }
518                });
519            });
520        }
521    };
522
523    // Handle Select2 Dropdowns
524    var handleSelect2 = function() {
525        if ($().select2) {
526            $.fn.select2.defaults.set("theme", "bootstrap");
527            $('.select2me').select2({
528                placeholder: "Select",
529                width: 'auto', 
530                allowClear: true
531            });
532        }
533    };
534
535    // handle group element heights
536   var handleHeight = function() {
537       $('[data-auto-height]').each(function() {
538            var parent = $(this);
539            var items = $('[data-height]', parent);
540            var height = 0;
541            var mode = parent.attr('data-mode');
542            var offset = parseInt(parent.attr('data-offset') ? parent.attr('data-offset') : 0);
543
544            items.each(function() {
545                if ($(this).attr('data-height') == "height") {
546                    $(this).css('height', '');
547                } else {
548                    $(this).css('min-height', '');
549                }
550
551                var height_ = (mode == 'base-height' ? $(this).outerHeight() : $(this).outerHeight(true));
552                if (height_ > height) {
553                    height = height_;
554                }
555            });
556
557            height = height + offset;
558
559            items.each(function() {
560                if ($(this).attr('data-height') == "height") {
561                    $(this).css('height', height);
562                } else {
563                    $(this).css('min-height', height);
564                }
565            });
566
567            if(parent.attr('data-related')) {
568                $(parent.attr('data-related')).css('height', parent.height());
569            }
570       });       
571    }
572    
573    //* END:CORE HANDLERS *//
574
575    return {
576
577        //main function to initiate the theme
578        init: function() {
579            //IMPORTANT!!!: Do not modify the core handlers call order.
580
581            //Core handlers
582            handleInit(); // initialize core variables
583            handleOnResize(); // set and handle responsive    
584
585            //UI Component handlers     
586            handleMaterialDesign(); // handle material design       
587            handleiCheck(); // handles custom icheck radio and checkboxes
588            handleBootstrapSwitch(); // handle bootstrap switch plugin
589            handleScrollers(); // handles slim scrolling contents 
590            handleFancybox(); // handle fancy box
591            handleSelect2(); // handle custom Select2 dropdowns
592            handlePortletTools(); // handles portlet action bar functionality(refresh, configure, toggle, remove)
593            handleAlerts(); //handle closabled alerts
594            handleDropdowns(); // handle dropdowns
595            handleTabs(); // handle tabs
596            handleTooltips(); // handle bootstrap tooltips
597            handlePopovers(); // handles bootstrap popovers
598            handleAccordions(); //handles accordions 
599            handleModals(); // handle modals
600            handleBootstrapConfirmation(); // handle bootstrap confirmations
601            handleTextareaAutosize(); // handle autosize textareas
602            handleCounterup(); // handle counterup instances
603
604            //Handle group element heights
605            this.addResizeHandler(handleHeight); // handle auto calculating height on window resize
606
607            // Hacks
608            handleFixInputPlaceholderForIE(); //IE8 & IE9 input placeholder issue fix
609        },
610
611        //main function to initiate core javascript after ajax complete
612        initAjax: function() {
613            //handleUniform(); // handles custom radio & checkboxes     
614            handleiCheck(); // handles custom icheck radio and checkboxes
615            handleBootstrapSwitch(); // handle bootstrap switch plugin
616            handleScrollers(); // handles slim scrolling contents 
617            handleSelect2(); // handle custom Select2 dropdowns
618            handleFancybox(); // handle fancy box
619            handleDropdowns(); // handle dropdowns
620            handleTooltips(); // handle bootstrap tooltips
621            handlePopovers(); // handles bootstrap popovers
622            handleAccordions(); //handles accordions 
623            handleBootstrapConfirmation(); // handle bootstrap confirmations
624        },
625
626        //init main components 
627        initComponents: function() {
628            this.initAjax();
629        },
630
631        //public function to remember last opened popover that needs to be closed on click
632        setLastPopedPopover: function(el) {
633            lastPopedPopover = el;
634        },
635
636        //public function to add callback a function which will be called on window resize
637        addResizeHandler: function(func) {
638            resizeHandlers.push(func);
639        },
640
641        //public functon to call _runresizeHandlers
642        runResizeHandlers: function() {
643            _runResizeHandlers();
644        },
645
646        // wrApper function to scroll(focus) to an element
647        scrollTo: function(el, offeset) {
648            var pos = (el && el.size() > 0) ? el.offset().top : 0;
649
650            if (el) {
651                if ($('body').hasClass('page-header-fixed')) {
652                    pos = pos - $('.page-header').height();
653                } else if ($('body').hasClass('page-header-top-fixed')) {
654                    pos = pos - $('.page-header-top').height();
655                } else if ($('body').hasClass('page-header-menu-fixed')) {
656                    pos = pos - $('.page-header-menu').height();
657                }
658                pos = pos + (offeset ? offeset : -1 * el.height());
659            }
660
661            $('html,body').animate({
662                scrollTop: pos
663            }, 'slow');
664        },
665
666        initSlimScroll: function(el) {
667            if (!$().slimScroll) {
668                return;
669            }
670
671            $(el).each(function() {
672                if ($(this).attr("data-initialized")) {
673                    return; // exit
674                }
675
676                var height;
677
678                if ($(this).attr("data-height")) {
679                    height = $(this).attr("data-height");
680                } else {
681                    height = $(this).css('height');
682                }
683
684                $(this).slimScroll({
685                    allowPageScroll: true, // allow page scroll when the element scroll is ended
686                    size: '7px',
687                    color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'),
688                    wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
689                    railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'),
690                    position: isRTL ? 'left' : 'right',
691                    height: height,
692                    alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
693                    railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
694                    disableFadeOut: true
695                });
696
697                $(this).attr("data-initialized", "1");
698            });
699        },
700
701        destroySlimScroll: function(el) {
702            if (!$().slimScroll) {
703                return;
704            }
705
706            $(el).each(function() {
707                if ($(this).attr("data-initialized") === "1") { // destroy existing instance before updating the height
708                    $(this).removeAttr("data-initialized");
709                    $(this).removeAttr("style");
710
711                    var attrList = {};
712
713                    // store the custom attribures so later we will reassign.
714                    if ($(this).attr("data-handle-color")) {
715                        attrList["data-handle-color"] = $(this).attr("data-handle-color");
716                    }
717                    if ($(this).attr("data-wrapper-class")) {
718                        attrList["data-wrapper-class"] = $(this).attr("data-wrapper-class");
719                    }
720                    if ($(this).attr("data-rail-color")) {
721                        attrList["data-rail-color"] = $(this).attr("data-rail-color");
722                    }
723                    if ($(this).attr("data-always-visible")) {
724                        attrList["data-always-visible"] = $(this).attr("data-always-visible");
725                    }
726                    if ($(this).attr("data-rail-visible")) {
727                        attrList["data-rail-visible"] = $(this).attr("data-rail-visible");
728                    }
729
730                    $(this).slimScroll({
731                        wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
732                        destroy: true
733                    });
734
735                    var the = $(this);
736
737                    // reassign custom attributes
738                    $.each(attrList, function(key, value) {
739                        the.attr(key, value);
740                    });
741
742                }
743            });
744        },
745
746        // function to scroll to the top
747        scrollTop: function() {
748            App.scrollTo();
749        },
750
751        // wrApper function to  block element(indicate loading)
752        blockUI: function(options) {
753            options = $.extend(true, {}, options);
754            var html = '';
755            if (options.animate) {
756                html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '">' + '<div class="block-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' + '</div>';
757            } else if (options.iconOnly) {
758                html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""></div>';
759            } else if (options.textOnly) {
760                html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><span>&nbsp;&nbsp;' + (options.message ? options.message : 'LOADING...') + '</span></div>';
761            } else {
762                html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""><span>&nbsp;&nbsp;' + (options.message ? options.message : 'LOADING...') + '</span></div>';
763            }
764
765            if (options.target) { // element blocking
766                var el = $(options.target);
767                if (el.height() <= ($(window).height())) {
768                    options.cenrerY = true;
769                }
770                el.block({
771                    message: html,
772                    baseZ: options.zIndex ? options.zIndex : 1000,
773                    centerY: options.cenrerY !== undefined ? options.cenrerY : false,
774                    css: {
775                        top: '10%',
776                        border: '0',
777                        padding: '0',
778                        backgroundColor: 'none'
779                    },
780                    overlayCSS: {
781                        backgroundColor: options.overlayColor ? options.overlayColor : '#555',
782                        opacity: options.boxed ? 0.05 : 0.1,
783                        cursor: 'wait'
784                    }
785                });
786            } else { // page blocking
787                $.blockUI({
788                    message: html,
789                    baseZ: options.zIndex ? options.zIndex : 1000,
790                    css: {
791                        border: '0',
792                        padding: '0',
793                        backgroundColor: 'none'
794                    },
795                    overlayCSS: {
796                        backgroundColor: options.overlayColor ? options.overlayColor : '#555',
797                        opacity: options.boxed ? 0.05 : 0.1,
798                        cursor: 'wait'
799                    }
800                });
801            }
802        },
803
804        // wrApper function to  un-block element(finish loading)
805        unblockUI: function(target) {
806            if (target) {
807                $(target).unblock({
808                    onUnblock: function() {
809                        $(target).css('position', '');
810                        $(target).css('zoom', '');
811                    }
812                });
813            } else {
814                $.unblockUI();
815            }
816        },
817
818        startPageLoading: function(options) {
819            if (options && options.animate) {
820                $('.page-spinner-bar').remove();
821                $('body').append('<div class="page-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>');
822            } else {
823                $('.page-loading').remove();
824                $('body').append('<div class="page-loading"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif"/>&nbsp;&nbsp;<span>' + (options && options.message ? options.message : 'Loading...') + '</span></div>');
825            }
826        },
827
828        stopPageLoading: function() {
829            $('.page-loading, .page-spinner-bar').remove();
830        },
831
832        alert: function(options) {
833
834            options = $.extend(true, {
835                container: "", // alerts parent container(by default placed after the page breadcrumbs)
836                place: "append", // "append" or "prepend" in container 
837                type: 'success', // alert's type
838                message: "", // alert's message
839                close: true, // make alert closable
840                reset: true, // close all previouse alerts first
841                focus: true, // auto scroll to the alert after shown
842                closeInSeconds: 0, // auto close after defined seconds
843                icon: "" // put icon before the message
844            }, options);
845
846            var id = App.getUniqueID("App_alert");
847
848            var html = '<div id="' + id + '" class="custom-alerts alert alert-' + options.type + ' fade in">' + (options.close ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>' : '') + (options.icon !== "" ? '<i class="fa-lg fa fa-' + options.icon + '"></i>  ' : '') + options.message + '</div>';
849
850            if (options.reset) {
851                $('.custom-alerts').remove();
852            }
853
854            if (!options.container) {
855                if ($('.page-fixed-main-content').size() === 1) {
856                    $('.page-fixed-main-content').prepend(html);
857                } else if (($('body').hasClass("page-container-bg-solid") || $('body').hasClass("page-content-white")) && $('.page-head').size() === 0) {
858                    $('.page-title').after(html);
859                } else {
860                    if ($('.page-bar').size() > 0) {
861                        $('.page-bar').after(html);
862                    } else {
863                        $('.page-breadcrumb, .breadcrumbs').after(html);
864                    }
865                }
866            } else {
867                if (options.place == "append") {
868                    $(options.container).append(html);
869                } else {
870                    $(options.container).prepend(html);
871                }
872            }
873
874            if (options.focus) {
875                App.scrollTo($('#' + id));
876            }
877
878            if (options.closeInSeconds > 0) {
879                setTimeout(function() {
880                    $('#' + id).remove();
881                }, options.closeInSeconds * 1000);
882            }
883
884            return id;
885        },
886
887        //public function to initialize the fancybox plugin
888        initFancybox: function() {
889            handleFancybox();
890        },
891
892        //public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
893        getActualVal: function(el) {
894            el = $(el);
895            if (el.val() === el.attr("placeholder")) {
896                return "";
897            }
898            return el.val();
899        },
900
901        //public function to get a paremeter by name from URL
902        getURLParameter: function(paramName) {
903            var searchString = window.location.search.substring(1),
904                i, val, params = searchString.split("&");
905
906            for (i = 0; i < params.length; i++) {
907                val = params[i].split("=");
908                if (val[0] == paramName) {
909                    return unescape(val[1]);
910                }
911            }
912            return null;
913        },
914
915        // check for device touch support
916        isTouchDevice: function() {
917            try {
918                document.createEvent("TouchEvent");
919                return true;
920            } catch (e) {
921                return false;
922            }
923        },
924
925        // To get the correct viewport width based on  http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
926        getViewPort: function() {
927            var e = window,
928                a = 'inner';
929            if (!('innerWidth' in window)) {
930                a = 'client';
931                e = document.documentElement || document.body;
932            }
933
934            return {
935                width: e[a + 'Width'],
936                height: e[a + 'Height']
937            };
938        },
939
940        getUniqueID: function(prefix) {
941            return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime());
942        },
943
944        // check IE8 mode
945        isIE8: function() {
946            return isIE8;
947        },
948
949        // check IE9 mode
950        isIE9: function() {
951            return isIE9;
952        },
953
954        //check RTL mode
955        isRTL: function() {
956            return isRTL;
957        },
958
959        // check IE8 mode
960        isAngularJsApp: function() {
961            return (typeof angular == 'undefined') ? false : true;
962        },
963
964        getAssetsPath: function() {
965            return assetsPath;
966        },
967
968        setAssetsPath: function(path) {
969            assetsPath = path;
970        },
971
972        setGlobalImgPath: function(path) {
973            globalImgPath = path;
974        },
975
976        getGlobalImgPath: function() {
977            return assetsPath + globalImgPath;
978        },
979
980        setGlobalPluginsPath: function(path) {
981            globalPluginsPath = path;
982        },
983
984        getGlobalPluginsPath: function() {
985            return assetsPath + globalPluginsPath;
986        },
987
988        getGlobalCssPath: function() {
989            return assetsPath + globalCssPath;
990        },
991
992        // get layout color code by color name
993        getBrandColor: function(name) {
994            if (brandColors[name]) {
995                return brandColors[name];
996            } else {
997                return '';
998            }
999        },
1000
1001        getResponsiveBreakpoint: function(size) {
1002            // bootstrap responsive breakpoints
1003            var sizes = {
1004                'xs' : 480,     // extra small
1005                'sm' : 768,     // small
1006                'md' : 992,     // medium
1007                'lg' : 1200     // large
1008            };
1009
1010            return sizes[size] ? sizes[size] : 0; 
1011        }
1012    };
1013
1014}();
1015
1016//<!-- END THEME LAYOUT SCRIPTS -->
1017
1018jQuery(document).ready(function() {    
1019   App.init(); // init metronic core componets
1020});

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.