PageSourceSearch

https://campigir.com/backend/js/scripts/app.js

js campigir.com collected 2026-10-05 19:47:51 UTC 39,802 bytes, 1,082 lines download raw bytes

1/**
2Core script to handle the entire theme and core functions
3**/
4var App = function (asset_path,lang) {
5    var _path = asset_path;
6    // IE mode
7    var isRTL = false;
8    var isIE8 = false;
9    var isIE9 = false;
10    var isIE10 = false;
11
12    var sidebarWidth = 225;
13    var sidebarCollapsedWidth = 35;
14
15    var responsiveHandlers = [];
16
17    // theme layout color set
18    var layoutColorCodes = {
19        'blue': '#4b8df8',
20        'red': '#e02222',
21        'green': '#35aa47',
22        'purple': '#852b99',
23        'grey': '#555555',
24        'light-grey': '#fafafa',
25        'yellow': '#ffb848'
26    };
27    
28   
29
30    // To get the correct viewport width based on  http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
31    var _getViewPort = function () {
32        var e = window, a = 'inner';
33        if (!('innerWidth' in window)) {
34            a = 'client';
35            e = document.documentElement || document.body;
36        }
37        return {
38            width: e[a + 'Width'],
39            height: e[a + 'Height']
40        }
41    }
42
43    // initializes main settings
44    var handleInit = function (asset_path) {
45
46        if ($('body').css('direction') === 'rtl') {
47            isRTL = true;
48        }
49
50        isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);
51        isIE9 = !! navigator.userAgent.match(/MSIE 9.0/);
52        isIE10 = !! navigator.userAgent.match(/MSIE 10.0/);
53
54        if (isIE10) {
55            jQuery('html').addClass('ie10'); // detect IE10 version
56        }
57        
58        if (isIE10 || isIE9 || isIE8) {
59            jQuery('html').addClass('ie'); // detect IE10 version
60        }
61
62        /*
63          Virtual keyboards:
64          Also, note that if you're using inputs in your modal – iOS has a rendering bug which doesn't 
65          update the position of fixed elements when the virtual keyboard is triggered  
66        */
67        var deviceAgent = navigator.userAgent.toLowerCase();
68        if (deviceAgent.match(/(iphone|ipod|ipad)/)) {
69            $(document).on('focus', 'input, textarea', function () {
70                $('.header').hide();
71                $('.footer').hide();
72            });
73            $(document).on('blur', 'input, textarea', function () {
74                $('.header').show();
75                $('.footer').show();
76            });
77        }
78    }
79
80    var handleSidebarState = function () {
81        // remove sidebar toggler if window width smaller than 992(for tablet and phone mode)
82        var viewport = _getViewPort();
83        if (viewport.width < 992) {
84            $('body').removeClass("page-sidebar-closed");
85        }
86    }
87
88    // runs callback functions set by App.addResponsiveHandler().
89    var runResponsiveHandlers = function () {
90        // reinitialize other subscribed elements
91        for (var i in responsiveHandlers) {
92            var each = responsiveHandlers[i];
93            each.call();
94        }
95    }
96
97    // reinitialize the laypot on window resize
98    var handleResponsive = function () {
99        handleSidebarState();
100        handleSidebarAndContentHeight();
101        handleFixedSidebar();
102        runResponsiveHandlers();
103    }
104
105    // initialize the layout on page load
106    var handleResponsiveOnInit = function () {
107        handleSidebarState();
108        handleSidebarAndContentHeight();
109    }
110
111    // handle the layout reinitialization on window resize
112    var handleResponsiveOnResize = function () {
113        var resize;
114        if (isIE8) {
115            var currheight;
116            $(window).resize(function () {
117                if (currheight == document.documentElement.clientHeight) {
118                    return; //quite event since only body resized not window.
119                }
120                if (resize) {
121                    clearTimeout(resize);
122                }
123                resize = setTimeout(function () {
124                    handleResponsive();
125                }, 50); // wait 50ms until window resize finishes.                
126                currheight = document.documentElement.clientHeight; // store last body client height
127            });
128        } else {
129            $(window).resize(function () {
130                if (resize) {
131                    clearTimeout(resize);
132                }
133                resize = setTimeout(function () {
134                    handleResponsive();
135                }, 50); // wait 50ms until window resize finishes.
136            });
137        }
138    }
139
140    //* BEGIN:CORE HANDLERS *//
141    // this function handles responsive layout on screen size resize or mobile device rotate.
142
143    // Set proper height for sidebar and content. The content and sidebar height must be synced always.
144    var handleSidebarAndContentHeight = function () {
145        var content = $('.page-content');
146        var sidebar = $('.page-sidebar');
147        var body = $('body');
148        var height;
149
150        if (body.hasClass("page-footer-fixed") === true && body.hasClass("page-sidebar-fixed") === false) {
151            var available_height = $(window).height() - $('.footer').outerHeight();
152            if (content.height() < available_height) {
153                content.attr('style', 'min-height:' + available_height + 'px !important');
154            }
155        } else {
156            if (body.hasClass('page-sidebar-fixed')) {
157                height = _calculateFixedSidebarViewportHeight();
158            } else {
159                height = sidebar.height() + 20;
160            }
161            if (height >= content.height()) {
162                content.attr('style', 'min-height:' + height + 'px !important');
163            }
164        }
165    }
166
167    // Handle sidebar menu
168    var handleSidebarMenu = function () {
169        //jQuery('.arrow').removeClass("open");
170        jQuery('.page-sidebar').on('click', 'li > a', function (e) {
171            if ($(this).next().hasClass('sub-menu') == false) {
172                if ($('.btn-navbar').hasClass('collapsed') == false) {
173                    $('.btn-navbar').click();
174                }
175                return;
176            }
177
178            if ($(this).next().hasClass('sub-menu.always-open')) {
179                return;
180            }
181
182            var parent = $(this).parent().parent();
183            var the = $(this);
184
185            parent.children('li.open').children('a').children('.arrow').removeClass('open');
186            parent.children('li.open').children('.sub-menu').slideUp(200);
187            parent.children('li.open').removeClass('open');
188
189            var sub = jQuery(this).next();
190            var slideOffeset = -200;
191            var slideSpeed = 200;
192            
193            if (sub.is(":visible")) {
194                jQuery('.arrow', jQuery(this)).removeClass("open");
195                jQuery(this).parent().removeClass("open");
196                sub.slideUp(slideSpeed, function () {
197                    if ($('body').hasClass('page-sidebar-fixed') == false && $('body').hasClass('page-sidebar-closed') == false) {
198                        App.scrollTo(the, slideOffeset);
199                    }
200                    handleSidebarAndContentHeight();
201                });
202            } else {
203                jQuery('.arrow', jQuery(this)).addClass("open");
204                jQuery(this).parent().addClass("open");
205                sub.slideDown(slideSpeed, function () {
206                    if ($('body').hasClass('page-sidebar-fixed') == false && $('body').hasClass('page-sidebar-closed') == false) {
207                        App.scrollTo(the, slideOffeset);
208                    }
209                    handleSidebarAndContentHeight();
210                });
211            }
212
213            e.preventDefault();
214        });
215
216        // handle ajax links
217        jQuery('.page-sidebar').on('click', ' li > a.ajaxify', function (e) {
218            
219            e.preventDefault();
220            App.scrollTop();
221            
222            var url = $(this).attr("href");
223            var menuContainer = jQuery('.page-sidebar ul');
224            var pageContent = $('.page-content');
225            var pageContentBody = $('.page-content .page-content-body');
226
227            menuContainer.children('li.active').removeClass('active');
228            menuContainer.children('arrow.open').removeClass('open');
229
230            $(this).parents('li').each(function () {
231                $(this).addClass('active');
232                $(this).children('a > span.arrow').addClass('open');
233            });
234            $(this).parents('li').addClass('active');
235
236            App.blockUI(pageContent, false);
237
238            $.ajax({
239                type: "GET",
240                cache: false,
241                url: url,
242                dataType: "html",
243                success: function (res) {
244                    App.unblockUI(pageContent);
245                    pageContentBody.html(res);
246                    App.fixContentHeight(); // fix content height
247                    App.initAjax(); // initialize core stuff
248                },
249                error: function (xhr, ajaxOptions, thrownError) {
250                    pageContentBody.html('<h4>Could not load the requested content.</h4>');
251                    App.unblockUI(pageContent);
252                },
253                async: false
254            });
255        });
256    }
257
258    // Helper function to calculate sidebar height for fixed sidebar layout.
259    var _calculateFixedSidebarViewportHeight = function () {
260        var sidebarHeight = $(window).height() - $('.header').height() + 1;
261        if ($('body').hasClass("page-footer-fixed")) {
262            sidebarHeight = sidebarHeight - $('.footer').outerHeight();
263        }
264
265        return sidebarHeight;
266    }
267
268    // Handles fixed sidebar
269    var handleFixedSidebar = function () {
270        var menu = $('.page-sidebar-menu');
271
272        if (menu.parent('.slimScrollDiv').size() === 1) { // destroy existing instance before updating the height
273            menu.slimScroll({
274                destroy: true
275            });
276            menu.removeAttr('style');
277            $('.page-sidebar').removeAttr('style');
278        }
279
280        if ($('.page-sidebar-fixed').size() === 0) {
281            handleSidebarAndContentHeight();
282            return;
283        }
284
285        var viewport = _getViewPort();
286        if (viewport.width >= 992) {
287            var sidebarHeight = _calculateFixedSidebarViewportHe
287ight();
288
289            menu.slimScroll({
290                size: '7px',
291                color: '#a1b2bd',
292                opacity: .3,
293                position: isRTL ? 'left' : 'right',
294                height: sidebarHeight,
295                allowPageScroll: false,
296                disableFadeOut: false
297            });
298            handleSidebarAndContentHeight();
299        }
300    }
301
302    // Handles the sidebar menu hover effect for fixed sidebar.
303    var handleFixedSidebarHoverable = function () {
304        if ($('body').hasClass('page-sidebar-fixed') === false) {
305            return;
306        }
307
308        $('.page-sidebar').off('mouseenter').on('mouseenter', function () {
309            var body = $('body');
310
311            if ((body.hasClass('page-sidebar-closed') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) {
312                return;
313            }
314
315            body.removeClass('page-sidebar-closed').addClass('page-sidebar-hover-on');
316            $(this).addClass('page-sidebar-hovering');
317            $(this).animate({
318                width: sidebarWidth
319            }, 400, '', function () {
320                $(this).removeClass('page-sidebar-hovering');
321            });
322        });
323
324        $('.page-sidebar').off('mouseleave').on('mouseleave', function () {
325            var body = $('body');
326
327            if ((body.hasClass('page-sidebar-hover-on') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) {
328                return;
329            }
330
331            $(this).addClass('page-sidebar-hovering');
332            $(this).animate({
333                width: sidebarCollapsedWidth
334            }, 400, '', function () {
335                $('body').addClass('page-sidebar-closed').removeClass('page-sidebar-hover-on');
336                $(this).removeClass('page-sidebar-hovering');
337            });
338        });
339    }
340
341    // Handles sidebar toggler to close/hide the sidebar.
342    var handleSidebarToggler = function () {
343        var viewport = _getViewPort();
344        if ($.cookie('sidebar_closed') === '1' && viewport.width >= 992) {
345            $('body').addClass('page-sidebar-closed');
346        }
347
348        // handle sidebar show/hide
349        $('.page-sidebar').on('click', '.sidebar-toggler', function (e) {
350            var body = $('body');
351            var sidebar = $('.page-sidebar');
352
353            if ((body.hasClass("page-sidebar-hover-on") && body.hasClass('page-sidebar-fixed')) || sidebar.hasClass('page-sidebar-hovering')) {
354                body.removeClass('page-sidebar-hover-on');
355                sidebar.css('width', '').hide().show();
356                $.cookie('sidebar_closed', '0');
357                e.stopPropagation();
358                runResponsiveHandlers();
359                return;
360            }
361
362            $(".sidebar-search", sidebar).removeClass("open");
363
364            if (body.hasClass("page-sidebar-closed")) {
365                body.removeClass("page-sidebar-closed");
366                if (body.hasClass('page-sidebar-fixed')) {
367                    sidebar.css('width', '');
368                }
369                $.cookie('sidebar_closed', '0');
370            } else {
371                body.addClass("page-sidebar-closed");
372                $.cookie('sidebar_closed', '1');
373            }
374            runResponsiveHandlers();
375        });
376
377        // handle the search bar close
378        $('.page-sidebar').on('click', '.sidebar-search .remove', function (e) {
379            e.preventDefault();
380            $('.sidebar-search').removeClass("open");
381        });
382
383        // handle the search query submit on enter press
384        $('.page-sidebar').on('keypress', '.sidebar-search input', function (e) {
385            if (e.which == 13) {
386                $('.sidebar-search').submit();
387                return false; //<---- Add this line
388            }
389        });
390
391        // handle the search submit
392        $('.sidebar-search .submit').on('click', function (e) {
393            e.preventDefault();
394            if ($('body').hasClass("page-sidebar-closed")) {
395                if ($('.sidebar-search').hasClass('open') == false) {
396                    if ($('.page-sidebar-fixed').size() === 1) {
397                        $('.page-sidebar .sidebar-toggler').click(); //trigger sidebar toggle button
398                    }
399                    $('.sidebar-search').addClass("open");
400                } else {
401                    $('.sidebar-search').submit();
402                }
403            } else {
404                $('.sidebar-search').submit();
405            }
406        });
407    }
408
409    // Handles the horizontal menu
410    var handleHorizontalMenu = function () {
411        //handle hor menu search form toggler click
412        $('.header').on('click', '.hor-menu .hor-menu-search-form-toggler', function (e) {
413            if ($(this).hasClass('off')) {
414                $(this).removeClass('off');
415                $('.header .hor-menu .search-form').hide();
416            } else {
417                $(this).addClass('off');
418                $('.header .hor-menu .search-form').show();
419            }
420            e.preventDefault();
421        });
422
423        //handle hor menu search button click
424        $('.header').on('click', '.hor-menu .search-form .btn', function (e) {
425            $('.form-search').submit();
426            e.preventDefault();
427        });
428
429        //handle hor menu search form on enter press
430        $('.header').on('keypress', '.hor-menu .search-form input', function (e) {
431            if (e.which == 13) {
432                $('.form-search').submit();
433                return false;
434            }
435        });
436    }
437
438    // Handles the go to top button at the footer
439    var handleGoTop = function () {
440        /* set variables locally for increased performance */
441        jQuery('.footer').on('click', '.go-top', function (e) {
442            App.scrollTo();
443            e.preventDefault();
444        });
445    }
446
447    // Handles portlet tools & actions
448    var handlePortletTools = function () {
449        jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function (e) {
450            e.preventDefault();
451            jQuery(this).closest(".portlet").remove();
452        });
453
454        jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function (e) {
455            e.preventDefault();
456            var el = jQuery(this).closest(".portlet").children(".portlet-body");
457            App.blockUI(el);
458            window.setTimeout(function () {
459                App.unblockUI(el);
460            }, 1000);
461        });
462
463        jQuery('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function (e) {
464            e.preventDefault();
465            var el = jQuery(this).closest(".portlet").children(".portlet-body");
466            if (jQuery(this).hasClass("collapse")) {
467                jQuery(this).removeClass("collapse").addClass("expand");
468                el.slideUp(200);
469            } else {
470                jQuery(this).removeClass("expand").addClass("collapse");
471                el.slideDown(200);
472            }
473        });
474    }
475
476    // Handles custom checkboxes & radios using jQuery Uniform plugin
477    var handleUniform = function () {
478        if (!jQuery().uniform) {
479            return;
480        }
481        var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)");
482        if (test.size() > 0) {
483            test.each(function () {
484                if ($(this).parents(".checker").size() == 0) {
485                    $(this).show();
486                    $(this).uniform();
487                }
488            });
489        }
490    }
491
492    // Handles Bootstrap Accordions.
493    var handleAccordions = function () {
494        var lastClicked;
495        //add scrollable class name if you need scrollable panes
496        jQuery('body').on('click', '.accordion.scrollable .accordion-toggle', function () {
497            lastClicked = jQuery(this);
498        }); //move to faq section
499
500        jQuery('body').on('show.bs.collapse', '.accordion.scrollable', function () {
501            jQuery('html,body').animate({
502                scrollTop: lastClicked.offset().top - 150
503            }, 'slow');
504        });
505    }
506
507    // Handles Bootstrap Tabs.
508    var handleTabs = function () {
509        // fix content height on tab click
510        $('body').on('shown.bs.tab', '.nav.nav-tabs', function () {
511            //handleSidebarAndContentHeight();
512        });
513
514        //activate tab if tab id provided in the URL
515        if (location.hash) {
516            var tabid = location.hash.substr(1);
517            $('a[href="#' + tabid + '"]').click();
518        }
519    }
520
521    // Handles Bootstrap Modals.
522    var handleModals = function () {
523
524        // fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal
524-open class. 
525        $('body').on('hide.bs.modal', function () {
526           if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') == false) {
527              $('html').addClass('modal-open');
528           } else if ($('.modal:visible').size() <= 1) {
529              $('html').removeClass('modal-open');
530           }
531        });
532    }
533
534    // Handles Bootstrap Tooltips.
535    var handleTooltips = function () {
536       jQuery('.tooltips').tooltip();
537    }
538
539    // Handles Bootstrap Dropdowns
540    var handleDropdowns = function () {
541        /*
542          For touch supported devices disable the 
543          hoverable dropdowns - data-hover="dropdown"  
544        */
545        if (App.isTouchDevice()) {
546            $('[data-hover="dropdown"]').each(function(){
547                $(this).parent().off("hover");
548                $(this).off("hover");
549            });
550        }
551        /*
552          Hold dropdown on click  
553        */
554        $('body').on('click', '.dropdown-menu.hold-on-click', function (e) {
555            e.stopPropagation();
556        })
557    }
558
559    // Handle Hower Dropdowns
560    var handleDropdownHover = function () {
561        $('[data-hover="dropdown"]').dropdownHover();
562    }
563
564    // Handles Bootstrap Popovers
565
566    // last popep popover
567    var lastPopedPopover;
568
569    var handlePopovers = function () {
570        jQuery('.popovers').popover();
571
572        // close last poped popover
573
574        $(document).on('click.bs.popover.data-api', function (e) {
575            if (lastPopedPopover) {
576                lastPopedPopover.popover('hide');
577            }
578        });
579    }
580
581    // Handles scrollable contents using jQuery SlimScroll plugin.
582    var handleScrollers = function () {
583        $('.scroller').each(function () {
584            var height;
585            if ($(this).attr("data-height")) {
586                height = $(this).attr("data-height");
587            } else {
588                height = $(this).css('height');
589            }
590            /*$(this).slimScroll({
591                size: '7px',
592                color: '#a1b2bd',
593                position: isRTL ? 'left' : 'right',
594                height: height,
595                alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
596                railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
597                disableFadeOut: true
598            });*/
599        });
600    }
601
602    // Handles Image Preview using jQuery Fancybox plugin
603    var handleFancybox = function () {
604        if (!jQuery.fancybox) {
605            return;
606        }
607
608        if (jQuery(".fancybox-button").size() > 0) {
609            jQuery(".fancybox-button").fancybox({
610                groupAttr: 'data-rel',
611                prevEffect: 'none',
612                nextEffect: 'none',
613                closeBtn: true,
614                helpers: {
615                    title: {
616                        type: 'inside'
617                    }
618                }
619            });
620        }
621    }
622
623    // Fix input placeholder issue for IE8 and IE9
624    var handleFixInputPlaceholderForIE = function () {
625        //fix html5 placeholder attribute for ie7 & ie8
626        if (isIE8 || isIE9) { // ie8 & ie9
627            // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
628            jQuery('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () {
629
630                var input = jQuery(this);
631
632                if (input.val() == '' && input.attr("placeholder") != '') {
633                    input.addClass("placeholder").val(input.attr('placeholder'));
634                }
635
636                input.focus(function () {
637                    if (input.val() == input.attr('placeholder')) {
638                        input.val('');
639                    }
640                });
641
642                input.blur(function () {
643                    if (input.val() == '' || input.val() == input.attr('placeholder')) {
644                        input.val(input.attr('placeholder'));
645                    }
646                });
647            });
648        }
649    }
650
651    // Handle full screen mode toggle
652    var handleFullScreenMode = function () {
653        // mozfullscreenerror event handler
654
655        function launchFullScreen(element) {
656          if(element.requestFullScreen) {
657            element.requestFullScreen();
658          } else if(element.mozRequestFullScreen) {
659            element.mozRequestFullScreen();
660          } else if(element.webkitRequestFullScreen) {
661            element.webkitRequestFullScreen();
662          }
663        }
664
665        // Whack fullscreen
666        function cancelFullscreen() {
667          if(document.cancelFullScreen) {
668            document.cancelFullScreen();
669          } else if(document.mozCancelFullScreen) {
670            document.mozCancelFullScreen();
671          } else if(document.webkitCancelFullScreen) {
672            document.webkitCancelFullScreen();
673          }
674        }
675
676        // toggle full screen
677        function toggleFullScreen() {
678            if (!document.fullscreenElement && // alternative standard method
679                !document.mozFullScreenElement && 
680                !document.webkitFullscreenElement) { // current working methods
681                launchFullScreen(window);
682            } else {
683                cancelFullscreen();
684            }
685        }
686
687        $('#trigger_fullscreen').click(function () {
688            toggleFullScreen();
689        });
690    }
691
692    // Handle Select2 Dropdowns
693    var handleSelect2 = function() {
694        if (jQuery().select2) {
695            $('.select2me').select2({
696                placeholder: "Select",
697                allowClear: true
698            });
699        }
700    }
701
702    var handleResponsiveTables = function() {
703        $('.table-responsive-scrollable').each(function() {
704            var element = $(this);
705            if (element.data('scrollWrapper')) {
706                return; //exit if already initialized
707            }
708            // Create the wrapper element
709            var scrollWrapper = $('<div />', {
710                'class': 'table-scrollable',
711                'html': '<div />' // The inner div is needed for styling
712            }).insertBefore(element);
713            // Store a reference to the wrapper element
714            element.data('scrollWrapper', scrollWrapper);
715            // Move the scrollable element inside the wrapper element
716            element.appendTo(scrollWrapper.find('div'));
717            // Check if the element is wider than its parent and thus needs to be scrollable
718            if (element.outerWidth() > element.parent().outerWidth()) {
719                element.data('scrollWrapper').addClass('has-scroll');
720            }
721            // When the viewport size is changed, check again if the element needs to be scrollable
722            $(window).on('resize orientationchange', function() {
723                if (element.outerWidth() > element.parent().outerWidth()) {
724                    element.data('scrollWrapper').addClass('has-scroll');
725                } else {
726                    element.data('scrollWrapper').removeClass('has-scroll');
727                }
728            });
729        });
730    }
731
732    // Handle Theme Settings
733    var handleTheme = function () {
734
735        var panel = $('.theme-panel');
736
737        if ($('body').hasClass('page-boxed') == false) {
738            $('.layout-option', panel).val("fluid");
739        }
740
741        $('.sidebar-option', panel).val("default");
742        $('.header-option', panel).val("fixed");
743        $('.footer-option', panel).val("default");
744
745        //handle theme layout
746        var resetLayout = function () {
747            $("body").
748            removeClass("page-boxed").
749            removeClass("page-footer-fixed").
750            removeClass("page-sidebar-fixed").
751            removeClass("page-header-fixed");
752
753            $('.header > .header-inner').removeClass("container");
754
755            if ($('.page-container').parent(".container").size() === 1) {
756                $('.page-container').insertAfter('body > .clearfix');
757            }
758
759            if ($('.footer > .container').size() === 1) {
760                $('.footer').html($('.footer > .container').html());
761            } else if ($('.footer').parent(".container").size() === 1) {
762                $('.footer').insertAfter('.page-container');
763            }
764
765            $('body > .container').remove();
766        }
767
768        var lastSelectedLayout = '';
769
770        var setLayout = function () {
771
772            var layoutOption = $('.layout-option', panel).val();
773            var sidebarOption = $('.sidebar-option', panel).val();
774            var headerOption = $('.header-option', panel).val();
775            var footerOption = $('.footer-option', panel).val();
776
777            if (sidebarOption == "fixed" && headerOption == "default") {
778                alert('Default Header with Fixed Sidebar option is not supported. Proceed with Fixed Header with Fixed Sidebar.');
779                $('.header-option', panel).val("fixed");
780                $('.sidebar-option', panel).val("fixed");
781                sidebarOption = 'fixed';
782                headerOption = 'fixed';
783            }
784
785            resetLayout(); // reset layout to default state
786
787            if (layoutOption === "boxed") {
788                $("body").addClass("page-boxed");
789
790                // set header
791                $('.header > .header-inner').addClass("container");
792                var cont = $('body > .clearfix').after('<div class="container"></div>');
793
794                // set content
795                $('.page-container').appendTo('body > .container');
796
797                // set footer
798                if (footerOption === 'fixed') {
799                    $('.footer').html('<div class="container">' + $('.footer').html() + '</div>');
800                } else {
801                    $('.footer').appendTo('body > .container');
802                }
803            }
804
805            if (lastSelectedLayout != layoutOption) {
806                //layout changed, run responsive handler:
807                runResponsiveHandlers();
808            }
809            lastSelectedLayout = layoutOption;
810
811            //header
812            if (headerOption === 'fixed') {
813                $("body").addClass("page-header-fixed");
814                $(".header").removeClass("navbar-static-top").addClass("navbar-fixed-top");
815            } else {
816                $("body").removeClass("page-header-fixed");
817                $(".header").removeClass("navbar-fixed-top").addClass("navbar-static-top");
818            }
819
820            //sidebar
821            if (sidebarOption === 'fixed') {
822                $("body").addClass("page-sidebar-fixed");
823            } else {
824                $("body").removeClass("page-sidebar-fixed");
825            }
826
827            //footer 
828            if (footerOption === 'fixed') {
829                $("body").addClass("page-footer-fixed");
830            } else {
831                $("body").removeClass("page-footer-fixed");
832            }
833
834            handleSidebarAndContentHeight();
834 // fix content height            
835            handleFixedSidebar(); // reinitialize fixed sidebar
836            handleFixedSidebarHoverable(); // reinitialize fixed sidebar hover effect
837        }
838
839        // handle theme colors
840        var setColor = function (color) {
841            $('#style_color').attr("href", asset_path+"themes/" + color + ".css");
842            $.cookie('style_color', color);
843        }
844
845        $('.toggler', panel).click(function () {
846            $('.toggler').hide();
847            $('.toggler-close').show();
848            $('.theme-panel > .theme-options').show();
849        });
850
851        $('.toggler-close', panel).click(function () {
852            $('.toggler').show();
853            $('.toggler-close').hide();
854            $('.theme-panel > .theme-options').hide();
855        });
856
857        $('.theme-colors > ul > li', panel).click(function () {
858            var color = $(this).attr("data-style");
859            setColor(color);
860            $('ul > li', panel).removeClass("current");
861            $(this).addClass("current");
862        });
863
864        $('.layout-option, .header-option, .sidebar-option, .footer-option', panel).change(setLayout);
865
866        if ($.cookie('style_color')) {
867            setColor($.cookie('style_color'));
868        }
869    }
870
871    //* END:CORE HANDLERS *//
872
873    return {
874
875        //main function to initiate the theme
876        init: function (asset_path) {
877
878            //IMPORTANT!!!: Do not modify the core handlers call order.
879
880            //core handlers
881            handleInit(asset_path); // initialize core variables
882            handleResponsiveOnResize(); // set and handle responsive    
883            handleUniform(); // hanfle custom radio & checkboxes
884           // handleScrollers(); // handles slim scrolling contents 
885            //handleResponsiveOnInit(); // handler responsive elements on page load
886
887            //layout handlers
888            handleFixedSidebar(); // handles fixed sidebar menu
889            handleFixedSidebarHoverable(); // handles fixed sidebar on hover effect 
890            handleSidebarMenu(); // handles main menu
891            handleHorizontalMenu(); // handles horizontal menu
892            handleSidebarToggler(); // handles sidebar hide/show            
893            handleFixInputPlaceholderForIE(); // fixes/enables html5 placeholder attribute for IE9, IE8
894            handleGoTop(); //handles scroll to top functionality in the footer
895            handleTheme(); // handles style customer tool
896
897            //ui component handlers
898            handleFancybox() // handle fancy box
899            handleSelect2(); // handle custom Select2 dropdowns
900            handlePortletTools(); // handles portlet action bar functionality(refresh, configure, toggle, remove)
901            handleDropdowns(); // handle dropdowns
902            handleTabs(); // handle tabs
903            handleTooltips(); // handle bootstrap tooltips
904            handlePopovers(); // handles bootstrap popovers
905            handleAccordions(); //handles accordions 
906            handleModals(); // handle modals
907            handleResponsiveTables(); // handle responsive scrollable tables
908            handleFullScreenMode(); // handles full screen
909        },
910
911        //main function to initiate core javascript after ajax complete
912        initAjax: function () {
913            handleSelect2(); // handle custom Select2 dropdowns
914            handleDropdowns(); // handle dropdowns
915            handleTooltips(); // handle bootstrap tooltips
916            handlePopovers(); // handles bootstrap popovers
917            handleAccordions(); //handles accordions 
918            handleUniform(); // hanfle custom radio & checkboxes     
919            handleDropdownHover() // handles dropdown hover       
920            handleResponsiveTables(); // handle responsive scrollable tables
921        },
922
923        //public function to fix the sidebar and content height accordingly
924        fixContentHeight: function () {
925            handleSidebarAndContentHeight();
926        },
927
928        //public function to remember last opened popover that needs to be closed on click
929        setLastPopedPopover: function (el) {
930            lastPopedPopover = el;
931        },
932
933        //public function to add callback a function which will be called on window resize
934        addResponsiveHandler: function (func) {
935            responsiveHandlers.push(func);
936        },
937
938        // useful function to make equal height for contacts stand side by side
939        setEqualHeight: function (els) {
940            var tallestEl = 0;
941            els = jQuery(els);
942            els.each(function () {
943                var currentHeight = $(this).height();
944                if (currentHeight > tallestEl) {
945                    tallestColumn = currentHeight;
946                }
947            });
948            els.height(tallestEl);
949        },
950
951        // wrapper function to scroll(focus) to an element
952        scrollTo: function (el, offeset) {
953            pos = (el && el.size() > 0) ? el.offset().top : 0;
954            jQuery('html,body').animate({
955                scrollTop: pos + (offeset ? offeset : 0)
956            }, 'slow');
957        },
958
959        // function to scroll to the top
960        scrollTop: function () {
961            App.scrollTo();
962        },
963
964        // wrapper function to  block element(indicate loading)
965        blockUI: function (el, centerY) {
966            var el = jQuery(el);
967            if (el.height() <= 400) {
968                centerY = true;
969            }
970            el.block({
971                message: '<img src="/backend/imagens/ajax-loading.dif" align=""/>',
972                centerY: centerY != undefined ? centerY : true,
973                css: {
974                    top: '10%',
975                    border: 'none',
976                    padding: '2px',
977                    backgroundColor: 'none'
978                },
979                overlayCSS: {
980                    backgroundColor: '#000',
981                    opacity: 0.05,
982                    cursor: 'wait'
983                }
984            });
985        },
986
987        // wrapper function to  un-block element(finish loading)
988        unblockUI: function (el) {
989            jQuery(el).unblock({
990                onUnblock: function () {
991                    jQuery(el).removeAttr("style");
992                }
993            });
994        },
995
996        // initializes uniform elements
997        initUniform: function (els) {
998            if (els) {
999                jQuery(els).each(function () {
1000                    if ($(this).parents(".checker").size() == 0) {
1001                        $(this).show();
1002                        $(this).uniform();
1003                    }
1004                });
1005            } else {
1006                handleUniform();
1007            }
1008
1009        },
1010
1011        //wrapper function to update/sync jquery uniform checkbox & radios
1012        updateUniform: function (els) {
1013            $.uniform.update(els); // update the uniform checkbox & radios UI after the actual input control state changed
1014        },
1015
1016        //public function to initialize the fancybox plugin
1017        initFancybox: function () {
1018            handleFancybox();
1019        },
1020
1021        //public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
1022        getActualVal: function (el) {
1023            var el = jQuery(el);
1024            if (el.val() === el.attr("placeholder")) {
1025                return "";
1026            }
1027            return el.val();
1028        },
1029
1030        //public function to get a paremeter by name from URL
1031        getURLParameter: function (paramName) {
1032            var searchString = window.location.search.substring(1),
1033                i, val, params = searchString.split("&");
1034
1035            for (i = 0; i < params.length; i++) {
1036                val = params[i].split("=");
1037                if (val[0] == paramName) {
1038                    return unescape(val[1]);
1039                }
1040            }
1041            return null;
1042        },
1043
1044        // check for device touch support
1045        isTouchDevice: function () {
1046            try {
1047                document.createEvent("TouchEvent");
1048                return true;
1049            } catch (e) {
1050                return false;
1051            }
1052        },
1053
1054        // check IE8 mode
1055        isIE8: function () {
1056            return isIE8;
1057        },
1058
1059        // check IE9 mode
1060        isIE9: function () {
1061            return isIE9;
1062        },
1063
1064        //check RTL mode
1065        isRTL: function () {
1066            return isRTL;
1067        },
1068
1069        // get layout color code by color name
1070        getLayoutColorCode: function (name) {
1071            if (layoutColorCodes[name]) {
1072                return layoutColorCodes[name];
1073            } else {
1074                return '';
1075            }
1076        }
1077        
1078        
1079
1080    };
1081
1082}();

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.