PageSourceSearch

https://www.fuenlan.es/wp-content/themes/inceptio/js/custom.js?ver=1.14

js fuenlan.es collected 2026-10-10 00:34:23 UTC 47,186 bytes, 1,195 lines download raw bytes

1// JavaScript Document
2
3/*global Modernizr */
4/*global ddlevelsmenu */
5/*global $f */
6
7/* ---------------------------------------------------------------------- */
8/* Utility Methods
9 /* ---------------------------------------------------------------------- */
10var Util = {
11
12    isIOS6: function () {
13        "use strict";
14        if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) {
15            if (/OS [6](.*) like Mac OS X/i.test(navigator.userAgent)) {
16                return true;
17            }
18        }
19        return false;
20    },
21
22    isOpera: function () {
23        "use strict";
24        return jQuery.browser.name === 'opera';
25    },
26
27    isIE: function () {
28        "use strict";
29        return jQuery.browser.name === 'msie';
30    },
31
32    isChrome: function () {
33        "use strict";
34        return jQuery.browser.name === 'chrome';
35    },
36
37    closeDDLevelsMenu: function (e, target) {
38        "use strict";
39        var close = true;
40        var subuls = ddlevelsmenu.topitems.nav;
41        if (subuls) {
42            jQuery.each(subuls, function (subul) {
43                if (jQuery(subul.parentNode).has(target).length > 0) {
44                    close = false;
45                }
46            });
47        }
48        if (close) {
49            subuls = ddlevelsmenu.subuls.nav;
50            if (subuls) {
51                jQuery.each(subuls, function (subul) {
52                    if (jQuery(subul).has(target).length > 0) {
53                        close = false;
54                    }
55                });
56            }
57        }
58        if (close) {
59            subuls = ddlevelsmenu.subuls.nav;
60            if (subuls) {
61                jQuery.each(subuls, function (subul) {
62                    if (subul && subul.parentNode) {
63                        ddlevelsmenu.hidemenu(subul.parentNode);
64                    }
65                });
66            }
67        }
68    }
69
70};
71
72/* ---------------------------------------------------------------------- */
73/* ImagePreloader: https://github.com/farinspace/jquery.imgpreload
74 /* ---------------------------------------------------------------------- */
75(function ($) {
76    "use strict";
77    // extend jquery (because i love jQuery)
78    $.imgpreload = function (imgs, settings) {
79        settings = $.extend({}
79, $.fn.imgpreload.defaults, (settings instanceof Function) ? {all: settings} : settings);
80
81        // use of typeof required
82        // https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Operators/Special_Operators/Instanceof_Operator#Description
83        if ('string' === typeof imgs) {
84            imgs = new Array(imgs);
85        }
86
87        var loaded = [];
88        $.each(imgs, function (i, elem) {
89            var img = new Image();
90            var url = elem;
91            var img_obj = img;
92            if ('string' !== typeof elem) {
93                url = $(elem).attr('src');
94                img_obj = elem;
95            }
96
97            $(img).bind('load error', function (e) {
98                loaded.push(img_obj);
99                $.data(img_obj, 'loaded', ('error' !== e.type));
100                if (settings.each instanceof Function) {
101                    settings.each.call(img_obj);
102                }
103                // http://jsperf.com/length-in-a-variable
104                if (loaded.length >= imgs.length && settings.all instanceof Function) {
105                    settings.all.call(loaded);
106                }
107
108                $(this).unbind('load error');
109            });
110
111            img.src = url;
112        });
113    };
114
115    $.fn.imgpreload = function (settings) {
116        $.imgpreload(this, settings);
117        return this;
118    };
119
120    $.fn.imgpreload.defaults = {
121        each: null, // callback invoked when each image in a group loads
122        all: null // callback invoked when when the entire group of images has loaded
123    };
124
125})(jQuery);
126/* ---------------------------------------------------------------------- */
127/* FlexSlider jQuery Initializer
128 /* ---------------------------------------------------------------------- */
129(function ($) {
130    "use strict";
131    $.fn.flexSliderInitializer = function (flexSliderObj) {
132        var animation = flexSliderObj.animation;
133        var sliderSelector = flexSliderObj.controlsContainer;
134        var sliders = $(sliderSelector);
135        var players;
136
137        if (sliders.length > 0) {
138            sliders.each(function () {
139                var sliderElement = this;
140                var sliderImages = $(sliderElement).find('img');
141                if (sliderImages.length > 0) {
142
143                    var firstImageSrc = $(sliderImages[0]).attr('src');
144                    if (Util.isIE()) {
145                        firstImageSrc += '?t=' + $.now();
146                    }
147
148                    $.imgpreload(firstImageSrc, function () {
149                        if (Util.isIE()) {
150                            $(sliderImages[0]).attr('src', firstImageSrc);
151                            initSlider(sliderElement);
152                        } else {
153                            initSlider(sliderElement);
154                        }
155                    });
156                }
157            });
158        }
159
160        function initSlider(sliderElement) {
161            var slider = $(sliderElement);
162            players = slider.find('iframe');
163
164            var sliderConfig = $.extend({}, {
165                smoothHeight: (animation === 'slide'),
166                pauseOnHover: true, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
167                video: (animation === 'slide'),
168                before: function () {
169                    pausePlayers();
170                }
171            }, flexSliderObj);
172            slider.fitVids().flexslider(sliderConfig);
173
174            // Swipe gestures support
175            if (Modernizr.touch && $().swipe) {
176                var next = slider.find('a.flex-next');
177                var prev = slider.find('a.flex-prev');
178
179                var doFlexSliderSwipe = function (e, dir) {
180                    var target = e.target;
181                    if (target.closest('a.flex-next') === 0 && target.closest('a.flex-prev') === 0) {
182                        if (dir.toLowerCase() === 'left') {
183                            next.trigger('click');
184                        }
185                        if (dir.toLowerCase() === 'right') {
186                            prev.trigger('click');
187                        }
188                    }
189                };
190
191                slider.swipe({
192                    swipeLeft: doFlexSliderSwipe,
193                    swipeRight: doFlexSliderSwipe,
194                    allowPageScroll: 'auto'
195                });
196            }
197        }
198
199        function pausePlayers() {
200            try {
201                if (players.length > 0 && window.$f) {
202                    players.each(function () {
203                        $f(this).api('pause');
204                    });
205                }
206            } catch (e) {
207            }
208        }
209
210    };
211
212})(jQuery);
213
214/* ---------------------------------------------------------------------- */
215/* Responsive Search
216 /* ---------------------------------------------------------------------- */
217(function ($) {
218    "use strict";
219
220    $.fn.responsiveSearch = function (op) {
221        var rs = $.fn.responsiveSearch;
222        var settings = $.extend({}, rs.defaults, op);
223        var searchInput = $(this);
224        var searchButton = $('#search-submit');
225
226        installListeners();
227
228        function setSearchInputVisible(display) {
229            if (display) {
230                searchInput.fadeIn(settings.animSpeed);
231            } else {
232                searchInput.fadeOut(settings.animSpeed);
233            }
234        }
235
236        function installListeners() {
237            searchButton.bind('click', function () {
238                var isSearchHidden = (searchInput.css('display') === 'none');
239                if (isSearchHidden) {
240                    setSearchInputVisible(true);
241                    return false;
242                } else if ($.trim(searchInput.val()) === '') {
243                    setSearchInputVisible(false);
244                    return false;
245                } else {
246                    return true;
247                }
248            });
249        }
250
251        rs.hide = function (target) {
252            if (target.id !== 'ix-s' && target.id !== 'search-submit') {
253                var isSearchVisible = (searchInput.css('display') !== 'none');
254                if (isSearchVisible) {
255                    setSearchInputVisible(false);
256                }
257            }
258        };
259
260        return rs;
261
262    };
263
264    var pcc = $.fn.responsiveSearch;
265    pcc.defaults = {
266        animSpeed: 500
267    };
268
269})(jQuery);
270
271// jQuery Initialization
272jQuery(document).ready(function ($) {
273        "use strict";
274
275        var bodyEl = $('body');
276
277        $.extend($.validator.messages, {
278            required: bodyEl.data('msgRequired'),
279            remote: bodyEl.data('msgRemote'),
280            email: bodyEl.data('msgEmail'),
281            url: bodyEl.data('msgUrl'),
282            date: bodyEl.data('msgDate'),
283            dateISO: bodyEl.data('msgDateiso'),
284            number: bodyEl.data('msgNumber'),
285            digits: bodyEl.data('msgDigits'),
286            creditcard: bodyEl.data('msgCreditcard'),
287            equalTo: bodyEl.data('msgEqualto'),
288            maxlength: $.validator.format(bodyEl.data('msgMaxlength')),
289            minlength: $.validator.format(bodyEl.data('msgMinlength')),
290            rangelength: $.validator.format(bodyEl.data('msgRangelength')),
291            range: $.validator.format(bodyEl.data('msgRange')),
292            max: $.validator.format(bodyEl.data('msgMax')),
293            min: $.validator.format(bodyEl.data('msgMin'))
294        });
295
296        /* ---------------------------------------------------------------------- */
297        /*	Detect Touch Device
298         /* ---------------------------------------------------------------------- */
299
300        if (Modernizr.touch) {
301            $("body").addClass("no-touch");
302        }
303
304        /* ---------------------------------------------------------------------- */
305        /* Fixes for Browsers
306         /* ---------------------------------------------------------------------- */
307
308        if (Util.isOpera()) {
309            $('.flexslider .slides > li').each(function () {
310                $(this).css('overflow', 'hidden');
311            });
312        }
313
314        /* ---------------------------------------------------------------------- */
315        /* jCarousel
316         /* ---------------------------------------------------------------------- */
317
318        var allCarousels = document.carouselSettings;
319
320        function resetCarouselPosition(carousel) {
321            if (carousel.data('resizing')) {
322                carousel.css('left', '0');
323            }
324        }
325
326        function getCarouselScrollCount() {
327            var windowWidth = $(window).width();
328            if (windowWidth < 480) {
329                return 1;
330            } else if (windowWidth < 768) {
331                return 2;
332            } else if (windowWidth < 960) {
333                return 3;
334            } else {
335                return 4;
336            }
337        }
338
339        function swipeCarousel(e, dir) {
340            var carouselParent = $(e.currentTarget).parents().eq(2);
341            if (dir.toLowerCase() === 'left') {
342                carouselParent.find('.jcarousel-next').trigger('click');
343            }
344            if (dir.toLowerCase() === 'right') {
345                carouselParent.find('.jcarousel-prev').trigger('click');
346            }
347        }
348
349        function initCarousel(carouselObj, bindGestures) {
350            var carouselSelector = carouselObj.selector;
351            var customSettings = carouselObj.customSettings;
352
353            var carousels = $(carouselSelector);
354            if (carousels.length > 0) {
355                carousels.each(function () {
356                    var carousel = $(this);
357                    var defaultSettings = {
358                        scroll: 1,
359                        visible: 1,
360                        wrap: "last",
361                        easing: "swing",
362                        itemVisibleInCallback: {
363                            onBeforeAnimation: resetCarouselPosition(carousel),
364                            onAfterAnimation: resetCarouselPosition(carousel)
365                        }
366                    };
367                    var settings = $.extend({}, defaultSettings, customSettings);
368                    settings.scroll = Math.min(getCarouselScrollCount(), settings.scroll);
369                    carousel.jcarousel(settings);
370                });
371
372                if (bindGestures && Modernizr.touch && $().swipe) {
373                    carousels.swipe({
374                        click: function (e, target) {
375                            $(target).trigger('click');
376                        },
377                        swipeLeft: swipeCarousel,
378                        swipeRight: swipeCarousel,
379                        allowPageScroll: 'auto'
380                    });
381                }
382            }
383        }
384
385        function resizeCarousel(carouselObj) {
386            var carousels = $(carouselObj.selector);
387            if (carousels.length > 0) {
388                carousels.each(function () {
389                    var carousel = $(this);
390                    var carouselChildren = carousel.children('li');
391                    var carouselItemWidth = carouselChildren.first().outerWidth(true);
392                    var newWidth = carouselChildren.length * carouselItemWidth + 100;
393                    if (carousel.width() !== newWidth) {
394                        carousel.css('width', newWidth).data('resizing', 'true');
395                        initCarousel(carouselObj, false);
396                        carousel.jcarousel('scroll', 1);
397                        var timer = window.setTimeout(function () {
398                            window.clearTimeout(timer);
399                            carousel.data('resizing', null);
400                        }, 600);
401                    }
402                });
403            }
404        }
405
406        function resizeAllCarousels() {
407            if ($().jcarousel && allCarousels) {
408                for (var i = 0; i < allCarousels.length; i++) {
409                    resizeCarousel(allCarousels[i]);
410                }
411            }
412        }
413
414        function initAllCarousels() {
415            if ($().jcarousel && allCarousels) {
416                for (var i = 0; i < allCarousels.length; i++) {
417                    initCarousel(allCarousels[i], true);
418                }
419            }
420        }
421
422        initAllCarousels();
423
424        /* ---------------------------------------------------------------------- */
425        /* Tiny Nav
426         /* ---------------------------------------------------------------------- */
427
428        if ($().tinyNav) {
429
430            $('html').addClass('js');
431            $("#navlist").tinyNav();
432
433        }
434
435        /* ---------------------------------------------------------------------- */
436        /* Responsive Search (must be placed after Tiny Nav)
437         /* ---------------------------------------------------------------------- */
438
439        var searchInput = $('#ix-s');
440        if (searchInput.length > 0) {
441            var responsiveSearchInstance = searchInput.responsiveSearch();
442        }
443
444        /* ---------------------------------------------------------------------- */
445        /* Responsive Video Embeds (must be called before the FlexSlider initialization)
446         /* ---------------------------------------------------------------------- */
447
448        function resizeVideoEmbed() {
449            if ($().fitVids) {
450                $(".entry-video").fitVids();
451            }
452        }
453
454        resizeVideoEmbed();
455
456        /* ---------------------------------------------------------------------- */
457        /* Flex Slider
458         /* ---------------------------------------------------------------------- */
459
460        function initAllFlexSliders() {
461            var slidersSettings = document.slidersSettings;
462            if (slidersSettings && slidersSettings.length > 0 && $().flexslider) {
463                for (var i = 0; i < slidersSettings.length; i++) {
464                    $().flexSliderInitializer(slidersSettings[i]);
465                }
466            }
467        }
468
469        initAllFlexSliders();
470
471        /* ---------------------------------------------------------------------- */
472        /* Lightbox
473         /* ---------------------------------------------------------------------- */
474
475        function swipeFancyBox(e, dir) {
476            var buttonBox = $('#fancybox-buttons');
477            var nextButton = buttonBox.find('.btnNext');
478            var prevButton = buttonBox.find('.btnPrev');
479            if (dir.toLowerCase() === 'left' && nextButton) {
480                nextButton.trigger('click');
481            }
482            if (dir.toLowerCase() === 'right' && prevButton) {
483                prevButton.trigger('click');
484            }
485        }
486
487        function calculateLightboxIFrameSize(origWidth, origHeight) {
488            var windowWidth = $(window).width();
489            if (windowWidth < origWidth * 1.3) {
490                var width = windowWidth * 0.75;
491                var height = (width * origHeight) / origWidth;
492                return {'width': width, 'height': height};
493            } else {
494                return false;
495            }
496        }
497
498        function lightbox() {
499            if ($().fancybox) {
500
501                /* Video in Lightbox */
502                $(".lightbox-video").each(function () {
503                    var $this = $(this);
504                    var origWidth = $this.data('width') ? $this.data('width') : 800;
505                    var origHeight = $this.data('height') ? $this.data('height') : 450;
506                    $this.fancybox({
507                        autoScale: false,
508                        transitionIn: 'none',
509                        transitionOut: 'none',
510                        title: this.title,
511                        width: origWidth,
512                        height: origHeight,
513                        type: 'iframe',
514                        fitToView: false,
515
516                        openEffect: 'fade',
517                        closeEffect: 'fade',
518                        nextEffect: 'fade',
519                        prevEffect: 'fade',
520                        arrows: !Modernizr.touch,
521                        helpers: {
522                            title: {
523                                type: 'inside'
524                            },
525                            buttons: {},
526                            media: {}
527                        },
528                        beforeShow: function () {
529                            var $this = this;
530                            var size = calculateLightboxIFrameSize(origWidth, origHeight);
531                            if (size) {
532                                $this.width = size.width;
533                                $this.height = size.height;
534                            }
535                        },
536                        onUpdate: function () {
537                            var $this = this;
538                            var size = calculateLightboxIFrameSize(origWidth, origHeight);
539                            if (size) {
540                                $this.width = size.width;
541                                $this.height = size.height;
542                            }
543                        },
544                        beforeLoad: function () {
545                            this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
546                        },
547                        afterShow: function () {
548                            if (Modernizr.touch && $().swipe) {
549                                var fancyBoxOuter = $('.fancybox-wrap');
550                                var isSwipeAdded = fancyBoxOuter.data('swipe') === 'true';
551                                if (!isSwipeAdded) {
552                                    fancyBoxOuter.data('swipe', 'true');
553                                    fancyBoxOuter.swipe({
554                                        click: function (e, target) {
555                                            $(target).trigger('click');
556                                        },
557                                        swipeLeft: swipeFancyBox,
558                                        swipeRight: swipeFancyBox,
559                                        allowPageScroll: 'auto'
560                                    });
561                                }
562                            }
563                        }
564                    });
565                });
566
567                /* Image in Lightbox */
568                var lightboxImages = [];
569                $(".lightbox").each(function () {
570                    var parent = $(this).parent();
571                    var add = true;
572                    if (parent && parent.hasClass('clone')) {
573                        add = false;
574                    }
575                    if (add) {
576                        lightboxImages.push(this);
577                    }
578                });
579
580                $(lightboxImages).fancybox({
581                    openEffect: 'fade',
582                    closeEffect: 'fade',
583                    nextEffect: 'fade',
584                    prevEffect: 'fade',
585                    arrows: !Modernizr.touch,
586                    helpers: {
587                        title: {
588                            type: 'inside'
589                        },
590                        buttons: {},
591                        media: {}
592                    },
593                    beforeLoad: function () {
594                        this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
595                    },
596                    afterShow: function () {
597                        if (Modernizr.touch && $().swipe) {
598                            var fancyBoxOuter = $('.fancybox-wrap');
599                            var isSwipeAdded = fancyBoxOuter.data('swipe') === 'true';
600                            if (!isSwipeAdded) {
601                                fancyBoxOuter.data('swipe', 'true');
602                                fancyBoxOuter.swipe({
603                                    click: function (e, target) {
604                                        $(target).trigger('click');
605                                    },
606                                    swipeLeft: swipeFancyBox,
607                                    swipeRight: swipeFancyBox,
608                                    allowPageScroll: 'auto'
609                                });
610                            }
611                        }
612                    }
613                });
614            }
615        }
616
617        lightbox();
618
619        /* ---------------------------------------------------------------------- */
620        /* Tooltips
621         /* ---------------------------------------------------------------------- */
622
623        if ($().tipsy) {
624
625            $('.clients img[title], .social-links a[title], .entry-slider img[title], .inc-tooltip[title]').tipsy({
626                fade: true,
627                gravity: $.fn.tipsy.autoNS,
628                offset: 3
629            });
630
631        }
632
633        /* ---------------------------------------------------------------------- */
634        /* Scroll to Top
635         /* ---------------------------------------------------------------------- */
636
637        if ($().UItoTop) {
638
639            $().UItoTop({
640                scrollSpeed: 400
641            });
642
643        }
644
645        /* ---------------------------------------------------------------------- */
646        /* Fix for YouTube Iframe Z-Index
647         /* ---------------------------------------------------------------------- */
648
649        $("iframe").each(function () {
650            var ifr_source = $(this).attr('src');
651            if (ifr_source) {
652                var wmode = "wmode=transparent";
653                if (ifr_source.indexOf('?') !== -1) {
654                    var getQString = ifr_source.split('?');
655                    var oldString = getQString[1];
656                    var newString = getQString[0];
657                    $(this).attr('src', newString + '?' + wmode + '&' + oldString);
658                }
659                else {
660                    $(this).attr('src', ifr_source + '?' + wmode);
661                }
662            }
663        });
664
665        /* ---------------------------------------------------------------------- */
666        /* Notification Boxes
667         /* ---------------------------------------------------------------------- */
668
669        $(".notification-close-info").click(function () {
670            $(this).parent().fadeOut("fast");
671            return false;
672        });
673
674        $(".notification-close-success").click(function () {
675            $(this).parent().fadeOut("fast");
676            return false;
677        });
678
679        $(".notification-close-warning").click(function () {
680            $(this).parent().fadeOut("fast");
681            return false;
682        });
683
684        $(".notification-close-error").click(function () {
685            $(this).parent().fadeOut("fast");
686            return false;
687        });
688
689        /* ---------------------------------------------------------------------- */
690        /* Tabs
691         /* ---------------------------------------------------------------------- */
692
693        if ($().tabs) {
694            $(".tabs").each(function () {
695                var settings = {};
696                var active = $(this).data('active');
697                if (active && $.isNumeric(active)) {
698                    settings.active = parseInt(active) - 1;
699                }
700
701                var heightStyle = $(this).data('heightStyle');
702                if (heightStyle) {
703                    settings.heightStyle = heightStyle;
704                }
705
706                var disabled = $(this).data('disabled');
707                if (disabled) {
708                    if ($.isNumeric(disabled)) {
709                        disabled = [parseInt(disabled) - 1];
710                    } else {
711                        disabled = $.map(disabled.split(','), function (value) {
712                            return parseInt(value, 10) - 1;
713                        });
714                    }
715                    settings.disabled = disabled;
716                }
717
718                $(this).tabs(settings);
719            });
720        }
721
722        /* ---------------------------------------------------------------------- */
723        /* Accordion & Toggle
724         /* ---------------------------------------------------------------------- */
725
726        if ($().accordion) {
727            $(".toggle").each(function () {
728                // for backwards compatibility
729                var active = $(this).data('id');
730                if (active && active === 'opened') {
731                    active = true;
732                } else {
733                    active = $(this).data('active');
734                }
735                if (active && (active === 'true' || active === true)) {
736                    active = 0;
737                } else {
738                    active = false;
739                }
740
741                var heightStyle = $(this).data('heightStyle');
742                if (!heightStyle) {
743                    heightStyle = 'content';
744                }
745
746                var disabled = $(this).data('disabled');
747                disabled = disabled && (disabled === 'true' || disabled === true);
748
749                $(this).accordion({header: '.toggle-title',
750                    collapsible: true,
751                    heightStyle: heightStyle,
752                    disabled: disabled,
753                    active: active});
754            });
755
756            $(".accordion").each(function () {
757                var heightStyle = $(this).data('heightStyle');
758                if (!heightStyle) {
759                    heightStyle = 'content';
760                }
761
762                var active = $(this).data('active');
763                if (active && $.isNumeric(active)) {
764                    active = parseInt(active) - 1;
765                } else {
766                    active = false;
767                }
768
769                var disabled = $(this).data('disabled');
770                disabled = disabled && (disabled === 'true' || disabled === true);
771
772                $(this).accordion({header: '.accordion-title',
773                    collapsible: true,
774                    heightStyle: heightStyle,
775                    disabled: disabled,
776                    active: active});
777            });
778        }
779
780        /* ---------------------------------------------------------------------- */
781        /* Shortcodes Settings
782         /* ---------------------------------------------------------------------- */
783
784        var shortcodesSettingsUtil = {
785
786            setSameHeightForPortfolioItems: function (selector) {
787                var items = $(selector);
788                if (items.length > 0) {
789                    var maxItemHeight = Math.max.apply(null, items.map(function () {
790                        return $(this).height();
791                    }).get());
792                    items.css('minHeight', maxItemHeight + 'px');
793                }
794            },
795
796            setSameHeightForIconBoxes: function () {
797                var scSettings = document.incShortcodesSettings;
798                if (scSettings && scSettings.sameIconBoxHeight && scSettings.sameIconBoxHeight === true) {
799                    var timer = window.setTimeout(function () {
800                        window.clearTimeout(timer);
801                        var iconBoxes = $('div.iconbox a');
802                        if (iconBoxes.length > 0) {
803                            var maxIconBoxesHeight = Math.max.apply(null, iconBoxes.map(function () {
804                                return $(this).height();
805                            }).get());
806                            iconBoxes.css('minHeight', maxIconBoxesHeight + 'px');
807                        }
808                    }, 500);
809                }
810            }
811        };
812
813        shortcodesSettingsUtil.setSameHeightForIconBoxes();
814
815        /* ---------------------------------------------------------------------- */
816        /* Portfolio Filter
817         /* ---------------------------------------------------------------------- */
818
819        function doIsotopeFilter(container, filter, selectedFilter) {
820            var $filterLinks = filter.find('a');
821            if ($().isotope) {
822                var isotopeFilter = '';
823                $filterLinks.each(function () {
824                    var selector = $(this).attr('data-filter');
825                    var link = window.location.href;
826                    var firstIndex = link.indexOf('filter=');
827                    if (firstIndex > 0) {
828                        var id = link.substring(firstIndex + 7, link.length);
829                        if ('.' + id === selector) {
830                            isotopeFilter = '.' + id;
831                        }
832                    }
833                });
834                if (isotopeFilter.length === 0 && selectedFilter.length > 0) {
835                    isotopeFilter = '.' + selectedFilter;
836                }
837                if (isotopeFilter.length > 0) {
838                    // initialize Isotope
839                    container.isotope({
840                        itemSelector: '.entry',
841                        filter: isotopeFilter
842                    });
843                    $filterLinks.each(function () {
844                        var $this = $(this);
845                        var selector = $this.attr('data-filter');
846                        if (selector === isotopeFilter) {
847                            if (!$this.hasClass('selected')) {
848                                filter.find('.selected').removeClass('selected');
849                                $this.addClass('selected');
850                            }
851                        }
852                    });
853                }
854
855                // filter items when filter link is clicked
856                $filterLinks.click(function () {
857                    var $this = $(this);
858                    var selector = $this.attr('data-filter');
859                    container.isotope({ itemSelector: '.entry', filter: selector });
860
861                    if (!$this.hasClass('selected')) {
862                        filter.find('.selected').removeClass('selected');
863                        $this.addClass('selected');
864                    }
865
866                    return false;
867                });
868
869            }
870        }
871
872        var postsGallerySettings = document.postsGallerySettings;
873        if (postsGallerySettings && postsGallerySettings.length > 0) {
874            $(postsGallerySettings).each(function () {
875                var container = $(this.containerSelector);
876                var filter = $(this.filterSelector);
877                var selectedFilter = this.selectedFilter;
878
879                $.imgpreload($(container).find('img'), function () {
880                    shortcodesSettingsUtil.setSameHeightForPortfolioItems('li.entry a.entry-meta');
881                    shortcodesSettingsUtil.setSameHeightForPortfolioItems('li.entry');
882                    doIsotopeFilter(container, filter, selectedFilter);
883                });
884            });
885        }
886
887
888        /* ---------------------------------------------------------------------- */
889        /* Form Validation
890         /* ---------------------------------------------------------------------- */
891
892        if ($().validate) {
893            $("#comment-form").validate();
894        }
895
896        var formSuccessNotificationTimeout = 5000; //5 seconds
897        var forErrorNotificationTimeout = 10000; //10 seconds
898        var formsSettings = document.formsSettings;
899        if (formsSettings && formsSettings.length > 0) {
900            $(formsSettings).each(function () {
901                var submitButtonId = this.submitButtonId;
902                var action = this.action;
903                var successBoxId = this.successBoxId;
904                var errorBoxId = this.errorBoxId;
905                $('#' + submitButtonId).click(function () {
906                    $('#' + successBoxId).hide();
907                    $('#' + errorBoxId).hide();
908                    return $(this).submitForm(action, function () {
909                        $('#' + successBoxId).css('display', '');
910                        if (formSuccessNotificationTimeout > 0) {
911                            var timer = window.setTimeout(function () {
912                                window.clearTimeout(timer);
913                                $('#' + successBoxId).fadeOut("slow");
914                            }, formSuccessNotificationTimeout);
915                        }
916                    }, function (jqXHR) {
917                        var errorMsgElement = $('#' + errorBoxId + '-p');
918                        var errorMessage = jqXHR.responseText;
919                        if (!errorMessage || errorMessage.length === 0) {
920                            errorMessage = errorMsgElement.data('default-msg');
921                        }
922                        if (errorMessage && errorMessage.length > 0) {
923                            errorMsgElement.html(errorMessage);
924                        }
925                        $('#' + errorBoxId).css('display', '');
926                        if (forErrorNotificationTimeout > 0) {
927                            var timer = window.setTimeout(function () {
928                                window.clearTimeout(timer);
929                                $('#' + errorBoxId).fadeOut("slow");
930                            }, forErrorNotificationTimeout);
931                        }
932                    });
933                });
934            });
935        }
936
937        /* ---------------------------------------------------------------------- */
938        /* Twitter Widget
939         /* ---------------------------------------------------------------------- */
940
941        if ($().tweet) {
942            $("div.tweet").each(function () {
943                try {
944                    var wrapper = $(this);
945                    var settings = {
946                        username: '',
947                        twitter_api_url: '',
948                        join_text: false,
949                        avatar_size: false, // you can activate the avatar
950                        count: 3, // number of tweets
951                        view_text: "view tweet on twitter",
952                        seconds_ago_text: "about %d seconds ago",
953                        a_minutes_ago_text: "about a minute ago",
954                        minutes_ago_text: "about %d minutes ago",
955                        a_hours_ago_text: "about an hour ago",
956                        hours_ago_text: "about %d hours ago",
957                        a_day_ago_text: "about a day ago",
958                        days_ago_text: "about %d days ago",
959                        template: "{avatar}{text}{join}{time}" // [string or function] template used to construct each tweet <li> - see code for available vars
960                    };
961
962                    var username = wrapper.data('username');
963                    if (typeof username !== 'undefined') {
964                        settings.username = username;
965                    }
966                    var proxy = wrapper.data('proxy');
967                    if (typeof proxy !== 'undefined') {
968                        settings.twitter_api_url = proxy;
969                    }
970   
970                 var count = wrapper.data('count');
971                    if (typeof count !== 'undefined') {
972                        settings.count = count;
973                    }
974
975                    wrapper.tweet(settings);
976                } catch (e) {
977                    console.log(e);
978                }
979            });
980        }
981
982        /* ---------------------------------------------------------------------- */
983        /* Flickr Widget
984         /* ---------------------------------------------------------------------- */
985
986        var flickrSettings = document.flickrSettings;
987        if (flickrSettings && $().jflickrfeed) {
988            $('.flickr-feed').jflickrfeed({
989                limit: flickrSettings.limit,
990                qstrings: {
991                    id: flickrSettings.id // Flickr ID (Flickr IDs can be found using this tool: http://idgettr.com/)
992                },
993                itemTemplate: '<li><a href="{{link}}" title="{{title}}" target="_blank"><img src="{{image_s}}" alt="{{title}}" /></a></li>'
994            });
995        }
996
997        /* ---------------------------------------------------------------------- */
998        /* jQuery UI
999         /* ---------------------------------------------------------------------- */
1000        if ($().datepicker) {
1001            $(".datepicker").datepicker();
1002        }
1003
1004        if ($().slider) {
1005            $("div.slider,div.inc-slider").each(function () {
1006                var wrapper = $(this);
1007                var settings = {};
1008
1009                var animate = wrapper.data('animate');
1010                if (typeof animate !== 'undefined') {
1011                    settings.animate = animate;
1012                }
1013                var disabled = wrapper.data('disabled');
1014                if (typeof disabled !== 'undefined') {
1015                    settings.disabled = disabled;
1016                }
1017                var max = wrapper.data('max');
1018                if (typeof max !== 'undefined') {
1019                    settings.max = max;
1020                }
1021                var min = wrapper.data('min');
1022                if (typeof min !== 'undefined') {
1023                    settings.min = min;
1024                }
1025                var orientation = wrapper.data('orientation');
1026                if (typeof orientation !== 'undefined') {
1027                    settings.orientation = orientation;
1028                }
1029                var range = wrapper.data('range');
1030                if (typeof range !== 'undefined') {
1031                    settings.range = range;
1032                }
1033                var step = wrapper.data('step');
1034                if (typeof step !== 'undefined') {
1035                    settings.step = step;
1036                }
1037                var value = wrapper.data('value');
1038                if (typeof value !== 'undefined') {
1039                    settings.value = value;
1040                }
1041                var values = wrapper.data('values');
1042                if (typeof values !== 'undefined') {
1043                    settings.values = values;
1044                }
1045
1046                wrapper.slider(settings);
1047            });
1048        }
1049
1050        /* ---------------------------------------------------------------------- */
1051        /* Google Maps
1052         /* ---------------------------------------------------------------------- */
1053
1054        var mapObjects = $('.map');
1055        if ($().gMap && mapObjects.length > 0) {
1056            mapObjects.each(function () {
1057                var lat = $(this).data('lat'); //uses data-lat attribute
1058                var lng = $(this).data('lng'); //uses data-lng attribute
1059                var addr = $(this).data('address'); //uses data-address attribute
1060                var zoom = $(this).data('zoom'); //uses data-zoom attribute
1061                var markers = {};
1062                if (addr) {
1063                    markers.address = addr;
1064                } else {
1065                    markers.latitude = lat;
1066                    markers.longitude = lng;
1067                }
1068
1069                $(this).gMap({ markers: [markers], zoom: zoom });
1070            });
1071
1072        }
1073
1074        function resizeGoogleMap() {
1075            if (mapObjects.length > 0) {
1076                mapObjects.each(function () {
1077                    var mapWidth = $(this).width();
1078                    var mapHeight = Math.round(mapWidth * 0.425);
1079                    $(this).height(mapHeight);
1080                });
1081            }
1082        }
1083
1084        resizeGoogleMap();
1085
1086        /* ---------------------------------------------------------------------- */
1087        /* Sticky Footer
1088         /* ---------------------------------------------------------------------- */
1089
1090        // Set minimum height so that the footer will stay at the bottom of the window even if there isn't enough content
1091        function setMinHeight() {
1092            var body = $('body');
1093            var wrap = $('#wrap');
1094            var content = $('#content');
1095            content.css('min-height', $(window).outerHeight(true) - ( body.outerHeight(true) - body.height() ) - ( wrap.outerHeight(true) - wrap.height() ) - $('#header').outerHeight(true) - $('#slider-home').outerHeight(true) - $('#page-title').outerHeight(true) - ( content.outerHeight(true) - content.height() ) - $('#footer').outerHeight(true));
1096        }
1097
1098        // Init
1099        setMinHeight();
1100
1101        // Window resize
1102        $(window).on('resize', function () {
1103            var timer = window.setTimeout(function () {
1104                window.clearTimeout(timer);
1105                setMinHeight();
1106                resizeAllCarousels();
1107                resizeGoogleMap();
1108            }, 30);
1109        });
1110
1111
1112        if (Modernizr.touch) {
1113            $(document).on('touchstart', function (e) {
1114                var target = e.target;
1115                if (responsiveSearchInstance) {
1116                    responsiveSearchInstance.hide(target);
1117                }
1118                Util.closeDDLevelsMenu(e, target);
1119                closeLanguageSwitcher(target);
1120            });
1121        } else {
1122            $(document).click(function (e) {
1123                Util.closeDDLevelsMenu(e, '');
1124                if (responsiveSearchInstance) {
1125                    responsiveSearchInstance.hide(e.target);
1126                }
1127                closeLanguageSwitcher(e.target);
1128            });
1129        }
1130
1131        /* ---------------------------------------------------------------------- */
1132        /* Language Switcher
1133         /* ---------------------------------------------------------------------- */
1134
1135        function openLanguageSwitcher() {
1136            if (languageSwitcher.length > 0) {
1137                languageSwitcherStatus = 'opening';
1138                languageSwitcher.animate({
1139                    left: '0px'
1140                }, 100, function () {
1141                    languageSwitcherStatus = 'opened';
1142                });
1143            }
1144        }
1145
1146        function closeLanguageSwitcher(target) {
1147            var $target = $(target);
1148            if (!$target.parents().hasClass("language-switcher") || $target.attr('id') === languageSwitcherThumb.attr('id')) {
1149                if (languageSwitcher.length > 0) {
1150                    languageSwitcherStatus = 'closing';
1151                    languageSwitcher.animate({
1152                        left: '-195px'
1153                    }, 100, function () {
1154                        languageSwitcherStatus = 'closed';
1155                    });
1156                }
1157            }
1158        }
1159
1160        function loadLanguageSwitcher() {
1161            if (languageSwitcher.length > 0) {
1162                languageSwitcher.show();
1163                languageSwitcherThumb.click(function (e) {
1164                    e.stopPropagation();
1165                    e.preventDefault();
1166                    if (languageSwitcherStatus === 'closed') {
1167                        openLanguageSwitcher();
1168                    } else if (languageSwitcherStatus === 'opened') {
1169                        closeLanguageSwitcher(languageSwitcherThumb);
1170                    }
1171                });
1172            }
1173        }
1174
1175        var languageSwitcher = $('#inc-language-switcher');
1176        var languageSwitcherThumb = $('#inc-language-switcher-thumb');
1177        var languageSwitcherStatus = 'closed';
1178        loadLanguageSwitcher();
1179
1180        /* ---------------------------------------------------------------------- */
1181        /* Style Switcher
1182         /* ---------------------------------------------------------------------- */
1183
1184        var windowWidth = $(window).width();
1185        if (windowWidth > 480) {
1186            if ($().styleSwitcher) {
1187                var styleSwitcher = $().styleSwitcher();
1188                styleSwitcher.loadStyleSwitcher();
1189                styleSwitcher.applySettings();
1190            }
1191        }
1192
1193    }
1194)
1195;

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.