PageSourceSearch

https://jorisdelacour.fr/wp-content/themes/beach_apollo/js/script.js?ver=1.6.5

js jorisdelacour.fr collected 2026-10-08 16:42:00 UTC 47,681 bytes, 1,112 lines download raw bytes

1//if someone use prototype or other library
2//we better be safe :-)
3jQuery.noConflict();
4
5(function($, window, document){
6    /*global ApolloParams, Modernizr, debounce, throttle */
7    "use strict";
8
9
10    var A13,
11        $html       = $(document.documentElement),
12        body        = document.body,
13        $body       = $(body),
14        $window     = $(window),
15        G           = ApolloParams,
16        isTouch     = Modernizr.touch,
17        header, mid,//DOM elements
18
19        BP = [650]; //media queries break points
20
21
22    window.A13 = { //A13 = APOLLO 13
23        //run after DOM is loaded
24        onReady : function(){
25            if(typeof $.fn.masonry !== 'undefined'){
26                //add scroll bar to fix some delayed resize issues
27                $html.addClass('show-scroll');
28            }
29
30            //bind html elements to vars
31            mid = $('#mid');
32            header = $('#header');
33
34//            log ($window.width(), $window.height());
35
36            //bind resize
37            $window.resize(debounce(A13.layout.resize, 250));
38            $body.on('webfontsloaded', function(){ $window.resize(); });
39            A13.layout.set(); //set current size
40            A13.runPlugins();
41            A13.elementsActions.init();
42            A13.galleryView();
43            A13.worksOrGalleriesList();
44            A13.A13Slider();
45            A13.A13Scroller();
46            A13.A13FullWidthPhotos();
47            A13.FrontPageSlider();
48        },
49
50        layout : {
51            pointers : [],
52
53            size : 0,
54
55            add : function(f){
56                A13.layout.pointers.push(f);
57            },
58
59            set : function(){
60                var size = !window.getComputedStyle? null : getComputedStyle(body,':after').getPropertyValue('content'),
61                    width = $window.width(),
62                    index = (size === null)? -1 : size.indexOf("narrow"),
63                    to_return;
64
65                //if we can get value of current media query(normal desktop browsers)
66                if(index !== -1){
67                    to_return = parseInt(size.substr(index + 6), 10);
68                }
69                //most mobile browsers can't get above so we get normal window measure
70                else{
71                    to_return = width;
72                }
73
74                A13.layout.size = to_return;
75
76                return to_return;
77            },
78
79            resize : function(e){
80                //log ('go go resize callbacks!')
81                var A = A13.layout,
82                    size = A.set(),
83                    pointers = A.pointers;
84
85//                log ('window size: '+$window.width()+' X '+$window.height());
86//                log ('resize ', e.timeStamp);
87
88                //call each registered for resize function
89                for(var i = 0; i < pointers.length; i++){
90                    pointers[i].call(this, e, size);
91                }
92            }
93        },
94
95        runPlugins : function(){
96            //Resize iframe videos (YT, VIMEO)
97            $("div.post-media, div.real-content").fitVids();
98        },
99
100        elementsActions : {
101            init : function(){
102                var $e = A13.elementsActions;
103
104                /******* TOP MENU *********/
105                $e.topMenu();
106
107                /******* CLOSING PAGES TO VIEW BACKGROUND *********/
108                $e.hider();
109
110                /******* CHANGES HEADER STYLE DEPENDING ON AVAILABLE PLACE *********/
111                $e.header();
112
113                /******* TO TOP LINK *********/
114                $e.toTop();
115
116                /******* BLOG MASONRY *********/
117                $e.blogMasonry();
118
119                /******* Contact & Comment validation *********/
120                $e.formValidation();
121
122                /******* Tabs from short codes *********/
123                $e.shortCodeTabs();
124
125                /******* Lightbox *********/
126                $e.lightbox();
127
128            },
129
130            topMenu : function(){
131                var a = $('#access'),
132                    sub_menus = a.find('ul.sub-menu'),
133                    sub_parents = sub_menus.parent().addClass('parent'),
134                    menu = a.children('div.menu-container'),
135                    menu_list = menu.children(),
136                    menu_init = a.find('h3.assistive-text'),
137                    size = A13.layout.size,
138
139                    registerHover = function(){
140                        //Hover action
141                        sub_parents
142                            .hoverIntent({
143                                over: function(){
144                                    var _this = $(this);
145                                    //better homogeneity
146                                    _this.addClass('hovered');
147                                    //hide every menu that is open on same level
148                                    _this.siblings('li').has('ul').removeClass('hovered');
149                                },
150                                out: function(){
151                                    $(this).removeClass('hovered');
152                                },
153                                interval: 50,
154                                timeout: 500
155                            })
156                            .on('click.touchsub', function(e){
157                                if(parseFloat($(this).children('ul').css('opacity')) === 0){
158                                    //stop event to enable showing sub menu on touch devices
159                                    e.preventDefault();
160                                }
161                            });
162                    },
163
164                    unregisterHover = function(){
165                        //unbind hoverintent
166                        sub_parents
167                            .unbind("mouseenter")
168                            .unbind("mouseleave")
169                            .removeProp('hoverIntent_t')
170                            .removeProp('hoverIntent_s')
171                            .off('click.touchsub');
172                    },
173
174                    mobile_menu_toggle = function(){
175                        if(menu.hasClass('open')){
176                            menu.slideUp(200, function(){
177                                menu_list.hide();//helps with menu 'flicker' on IOS
178                            });
179                            menu.removeClass('open');
180                        }
181                        else{
182                            menu_list.show(); //helps with menu 'flicker' on IOS
183                            menu.slideDown(200);
184                            menu.addClass('open');
185                        }
186                    },
187
188                    mobile_submenu_toggle = function(e){
189                        var menu = $(this).children('ul');
190
191                        if(!menu.hasClass('open')){
192                            menu.slideDown(200);
193                            menu.addClass('open');
194                            e.preventDefault();
195                        }
196                    },
197
198                    //resize for menu
199                    layout = function(event, size){
200                        //if wide screen
201                        if(size > BP[0]){
202                            a.removeClass('touch');
203                            menu_init.off('.touch');
204                            //clean after touch menu
205                            menu.removeClass('open').attr('style','');
206                            menu_list.attr('style','');
207
208                            if(sub_menus.length){
209                                sub_parents.off('.touch');
210                                //clean after touch menu
211                                sub_menus.removeClass('open').attr('style','');
212                                registerHover();
213                            }
214                        }
215                        else{
216                            a.addClass('touch clearfix');
217                            //bind open menu
218                            //no double binds!
219                            menu_init.off('.touch');
220                            menu_init.on('click.touch', mobile_menu_toggle);
221
222                            if(sub_menus.length){
223                                unregisterHover();
224                                //bind open submenu
225                                //no double binds!
226                                sub_parents.off('.touch');
227                                sub_parents.on('click.touch', mobile_submenu_toggle);
228                            }
229                        }
230                    };
231
232                //register resize
233                A13.layout.add(layout);
234
235                //initial layout
236                layout({}, size);
237
238                //show menu
239                menu.addClass('loaded');
240            },
241
242            hider:  function(){
243                var C = $('#content'),
244                    bg = $('#bg-image');
245
246                //if static page with background, or contact page with map
247                if((bg.length && $body.hasClass('page')) || ($body.hasClass('contact-page') && $('#map-canvas').length)){
248                    $('<em class="hider" />')
249                        .appendTo(C)
250                        .click(function(){
251                            //content hidden
252                            if(C.hasClass('hideIt')){
253                                //collect normal dimensions
254                                var saveStyle = C.attr('style'),
255                                    width = C.attr('style','').removeClass('hideIt').css('visibility','hidden').width(),
256                                    height = C.height(),
257                                    pR = C.css('padding-right'),
258                                    pB = C.css('padding-bottom');
259
260                                C.attr('style',saveStyle).animate({width: width, height: height, paddingRight: pR, paddingBottom: pB},500,
261                                    function(){
262                                        C.attr('style',''); //just in case
263                                    });
264                            }
265                            //content visible
266                            else{
267                                C.css('overflow','hidden').animate({width: 0, height: 0, paddingRight: 0, paddingBottom: 0},500,
268                                    function(){
269                                        C.addClass('hideIt').css('overflow','');
270                                    });
271                            }
272                        });
273                }
274            },
275
276            header:  function(){
277                var H = $('#header'),
278                    HH = H.find('div.head'),
279                    F = $('#footer'),
280                    H_p = parseInt(H.css('padding-top'), 10),
281                    _class = 'no-space',
282                    logo = $('#logo').children(),
283
284                    enough_space = function(){
285                        if( H.hasClass(_class) ){
286                            H.removeClass(_class);
287                            $body.append(F);
288                        }
289                    },
290
291                    not_enough_space = function(){
292                        if( !H.hasClass(_class) ){
293                            H.addClass(_class);
294                            H.append(F);
295                        }
296                    },
297
298                    //resize function
299                    layout = function(event, size){
300                        if(size > BP[0]){
301                            if( $window.height() < ( H_p + HH.height() + F.outerHeight() ) ){
302                                not_enough_space();
303                            }
304                            else{
305                                enough_space();
306                            }
307                        }
308                        else{
309                            enough_space();
310                        }
311                    };
312
313                //register resize
314                A13.layout.add(layout);
315
316                //initial layout
317                layout({}, A13.layout.size);
318
319                //if img logo we need event for loading it
320                if(logo.is('img')){
321                    logo.load(function(){
322                        //inform about possible resize
323                        $body.trigger('logoLoaded');
324                    });
325                }
326
327                //measure again after logo is loaded
328                $body.on('logoLoaded', function(e){ layout(e, A13.layout.size); });
329            },
330
331            toTop : function(){
332                var tt = $('#to-top'),
333                    cb = function(){
334                        if ($window.scrollTop() > 100) {
335                            tt.css('opacity', 1);
336                        } else {
337                            tt.css('opacity', 0);
338                        }
339                    };
340
341                if(tt.length){
342                    cb(); //fire after refresh
343                    $window.scroll(debounce(cb, 250));
344                    // scroll body to 0px on click
345                    tt.click(function () {
346                        $('body,html').animate({
347                            scrollTop: 0
348                        }, 800);
349                        return false;
350                    });
351                }
352            },
353
354            blogMasonry : function(){
355                var $container = $('#masonry-parent');
356                if($container.length){
357                    A13.lazy({
358                        container        : $container,
359                        childrenSelector : 'div.archive-item'
360                    });
361                }
362            },
363
364            formValidation : function(){
365                //if enabled theme validation, then validate also comment form
366                var c_f_selector, c_f;
367                if($body.hasClass(G.validation_class)){
368                    c_f_selector = '#commentform, form[name="apollo-contact-form"]';
369                }
370                else{
371                    c_f_selector = 'form[name="apollo-contact-form"]';
372                }
373
374                c_f = $(c_f_selector);
375                if (c_f.length) {
376                    (function(){
377                        var info = c_f.find('div.form-info').click(function(){
378                                info.slideUp(300,function(){ info.removeClass('error'); });
379                            }),
380                            comment_submit = $('#comment-submit');
381
382                        //fix for not submitting form after check http://jibbering.com/faq/names/
383                        if(comment_submit.length){
384                            comment_submit.attr('name','othername');
385                        }
386
387                        c_f.submit(function(e){
388                            var form = $(this),
389                                error_number = 0,
390                                inputs = form.find('input[aria-required], textarea'), //only required fields
391                                captcha = form.find('input[name="cptch_number"]');
392
393                            //check if captcha is used
394                            if(captcha.length){ inputs = inputs.add(captcha); }
395
396                            //check every input for errors
397                            for(var item = 0; item < inputs.length; item++){
398                                var inp = inputs.eq(item),
399                                    inp_p = inp.parent();
400                                //scan for empty fields
401                                if( ! $.trim( inp.val()).length ){
402                                    inp_p.addClass('error');
403                                    error_number++;
404                                    continue;
405                                }
406
407                                //check e-mail field
408                                if( inp.is('#email') ){
409                                    var emailRegEx = /^[A-Z0-9._%+\-]+@[A-Z0-9.\-]+\.[A-Z]{2,4}$/i;
410                                    if (inp.val().search(emailRegEx) === -1) {
411                                        inp_p.addClass('error');
412                                        error_number++;
413                                        continue;
414                                    }
415                                }
416
417                                // everything ok
418                                inp.parent().removeClass('error');
419                            }
420
421                            //if there were some errors
422                            if( error_number > 0 ){
423                                e.preventDefault();
424                                //animate error text
425                                info.addClass('error').text(info.data('error-msg')).slideDown();
426                            }
427                            //no errors - normal submit
428                        });
429                    })(); // <---- call it instantly
430                }
431            },
432
433            shortCodeTabs : function(){
434                //tabs Container
435                var tC = $('div.tabsCell');
436
437                if(tC.length){
438                    var tabs = tC.find('div.tab_content').hide(),
439                        tabsOptions = tC.find('ul.tabs li'); //Hide all content
440
441                    //Default Action
442                    tabsOptions.filter(':first-child').addClass('active'); //Activate first tab
443                    tabs.filter(':first-child').show(); //Show first tab content
444
445                    //On Click Event
446                    tabsOptions.click(function(e) {
447                        e.preventDefault();
448
449                        var tab = $(this),
450                            parent = tab.parents('div.tabsCell').eq(0),
451                            activeTab = tab.find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
452
453                        if(tab.hasClass('active')){
454                            return;
455                        }
456
457                        tab.siblings().removeClass('active'); //Remove any "active" class
458                        tab.addClass('active'); //Add "active" class to selected tab
459                        parent.find('div.tab_content').hide(); //Hide all tab content
460                        parent.find(activeTab).fadeIn(); //Fade in the active content
461                    });
462                }
463            },
464
465            lightbox : function(elems){
466                //if no lightbox script do nothing
467                if(typeof $.jackBox !== 'undefined'){
468                    //if run only for some elements
469                    if(typeof elems !== 'undefined'){
470                        elems.not('.link') //not items that are marked as links
471                            .each(function(){ $(this).jackBox("newItem"); });
472                    }
473                    else{
474                        $('a.alpha-scope[data-group]').jackBox("init", {
475                            baseName: G.jsurl+"/jackbox",
476                            className: 'a.alpha-scope',
477                            defaultShareImage: G.defimgurl,
478                            showPageScrollbar: true,
479                            deepLinking: false,
480                            showInfoByDefault: true
481                        });
482                    }
483                }
484            }
485        },
486
487        galleryView : function(){
488            var $container = $('#a13-gallery').filter('.bricks');
489            if($container.length){
490                //em for cover
491                $container.find('a.g-item').append('<em class="cov" />');
492
493                A13.lazy({
494                    container        : $container,
495                    childrenSelector : 'a.g-item',
496                    imagesAlso       : true,
497                    afterAddCB       : A13.elementsActions.lightbox //adds lightbox for new item
498                });
499            }
500        },
501
502        worksOrGalleriesList : function(){
503            var $container = $('#a13-works, #a13-galleries');
504            if($container.length){
505                A13.lazy({
506                    container        : $container,
507                    childrenSelector : 'a.g-item',
508                    imagesAlso       : true,
509                    filter           : '#genre-filter'
510                });
511
512                //open item when it is tapped twice
513                $container.on('click', 'a.g-item',{}, function(e){
514                    var t = $(this);
515
516                    if(isTouch && !t.hasClass('touched')){
517                        e.preventDefault();//if clicked in link
518                        t.addClass('touched').siblings().removeClass('touched');
519                    }
520                });
521            }
522        },
523
524        A13Slider : function(){
525            var $container = $('#a13-gallery').filter('.slider');
526            if($container.length){
527                var images = [],
528                    items = $container.find('a.g-item'),
529                    i,item, type;
530
531                //collect data from item
532                for(i = 0; i < items.length; i++){
533                    item = items.eq(i);
534                    type = item.data('type');
535
536                    images.push({
537                        type:       type,
538                        image:      item.data('image'),
539                        title:      item.data('title'),
540                        desc:       $(item.data('description')).html(),
541                        autoplay:   item.data('autoplay'),
542                        movie_type: item.data('movie_type'),
543                        bg_color:   item.data('bg_color'),
544                        url:        type==='image' && item.hasClass('link')? item.attr('href') : false
545                    });
546                }
547
548                //call script
549                $.a13slider({
550                    parent                  :   $container.parent(),                // where will be embeded 
550slider
551                    autoplay				:	parseInt(G.autoplay, 10),			// Slider starts playing automatically
552                    random                  :   parseInt(G.random, 10),             // Randomize slide order (Ignores start slide)
553                    slide_interval          :   parseInt(G.slide_interval, 10),     // Time between transitions
554                    transition              :   parseInt(G.transition, 10),         // 0-None, 1-Fade, 2-Carousel
555                    transition_speed		:	parseInt(G.transition_speed, 10),   // Speed of transition
556                    fit_variant				:	parseInt(G.fit_variant, 10),        // 0-always, 1-landscape, 2-portrait, 3-when_needed
557                    slide_links             :   'blank',                            // type of slide links ('num', 'name', 'blank', false)
558                    slides                  :   images                              // Slideshow Images
559                });
560
561                //after collect remove all DOM elements
562                $container.remove();
563            }
564        },
565
566        A13Scroller : function(){
567            var $container = $('#a13-scroll-pan');
568            if($container.length){
569                var $tape		= $('#a13-work-slides'),
570                    $items      = $tape.children(),
571                    $images     = $items.find('img'),
572                    $images_number	= $images.length,
573                    arrows          = $('<div class="arr left" /><div class="arr right" />').appendTo($container),
574                    scroller_width	= 0,
575                    tempCounter     = 0,
576                    scrollSpeed     = 450,
577                    maxScroll       = 0, //left tape edge
578                    minScroll,           //right tape edge
579
580                    init = function(){
581                        config();
582                        initEvents();
583                        A13.removeLoader();
584                        $container.addClass('ready');
585                    },
586
587                    config = function(){
588                        //reset
589                        scroller_width = 0;
590
591                        //calculate width of all items
592                        $items.each(function(){
593//                            console.log(scroller_width, $(this).outerWidth(true));
594                            scroller_width += $(this).outerWidth(true);
595                        });
596                        $tape.css('width',scroller_width+'px');
597
598                        //setup min value
599                        minScroll = -(scroller_width - $container.width());
600                    },
601
602                    move = function(val){
603                        if(val < minScroll){ val = minScroll; }
604                        else if(val > maxScroll){ val = maxScroll; }
605
606                        //we turned off css transitions for touch devices, so scrolling with finger will work proper
607                        if(Modernizr.csstransitions && !isTouch){
608                            $tape.css({left : val + 'px'});
609                        }
610                        else{
611                            $tape.stop().animate({
612                                left : val + 'px'
613                            },600,'easeOutExpo');
614                        }
615                    },
616
617                    initEvents = function(){
618                        //slide as we scroll with the mouse
619                        $container
620                            //first for throttled function
621                            .mousewheel(throttle(function(e, delta) {
622                                move(parseInt($tape.css('left'), 10) + delta*scrollSpeed);
623                            }))
624                            //second for every call to not scroll page while using mouse over tape
625                            .mousewheel(function(e){e.preventDefault();});
626
627                        arrows.click(function(){
628                            var dir = $(this).hasClass('left')? 1 : -1;
629                            move(parseInt($tape.css('left'), 10) + dir*scrollSpeed);
630                        });
631
632                        //bind events
633                        if(isTouch){
634                            var $frame = $container,    //visible frame, parent of tape
635                                frameDOM = $frame[0],   //DOM element
636                                tape = $tape,           //moving part
637                                currentPosition,        //position of tray on start
638                                currentX,               //current position of finger
639                                startX,                 //where was finger at move start
640                                lastX,                  //last finger saved for comparison
641                                preLastDistance = 0,    //pre last distance, for edge cases
642                                lastT,                  //last time we checked distance
643                                threshold = 120,        //maximum time of no-move
644                                maxTapDistance = 7,
645                                multiplier = 5,
646                                now,
647
648                                //for checking if current move want get out of tape scope
649                                checkEdges = function(distance){
650                                    if(distance > 0){
651                                        return 0;
652                                    }
653                                    else if(distance < minScroll){
654                                        return minScroll;
655                                    }
656                                    return distance;
657                                },
658
659                                onTouchStart = function(e){
660                                    //do nothing
661                                    if($frame.hasClass('nomove') === true){
662                                        return;
663                                    }
664                                    if (e.touches.length === 1) {
665                                        //collect init data
666                                        lastT = Number(new Date());
667                                        lastX = startX = currentX = e.touches[0].pageX;
668                                        tape.stop(); //stop any animation
669                                        currentPosition = parseInt(tape.css('left'), 10);
670
671                                        //bind events for other work
672                                        frameDOM.addEventListener('touchmove', onTouchMove, false);
673                                        frameDOM.addEventListener('touchend', onTouchEnd, false);
674                                    }
675                                    //more fingers - we don't react
676                                    else{ e.preventDefault(); }
677                                },
678
679                                onTouchMove = function(e){
680                                    e.preventDefault();
681
682                                    currentX = e.touches[0].pageX;
683                                    now = Number(new Date());
684                                    //if it is time for new measure new distance
685                                    if(now - lastT > threshold){
686                                        preLastDistance = lastX - currentX;
687                                        lastT = now;
688                                        lastX = currentX;
689                                    }
690
691                                    //update position of tape
692                                    tape.css('left', checkEdges(parseInt(currentPosition - (startX - currentX), 10)) );
693                                },
694
695                                onTouchEnd = function(e){
696                                    var now = Number(new Date()),
697                                        time = now - lastT,
698                                        //calculate distance in full time cycle
699                                        lastDistance = parseInt(threshold/time * (lastX - currentX), 10),
700                                        ldAbs = Math.abs(lastDistance),
701                                        animationDistance = 0;
702
703                                    if(ldAbs > maxTapDistance * multiplier){
704                                        animationDistance = lastDistance;
705                                    }
706                                    else if(Math.abs(preLastDistance) > maxTapDistance && time < threshold){
707                                        animationDistance = preLastDistance;
708                                    }
709
710                                    //micro move we treat like tap
711                                    if(!(preLastDistance === 0 && ldAbs <= maxTapDistance)){
712                                        //it was NOT tap
713                                        //it was slide
714                                        e.preventDefault();
715
716                                        if(animationDistance !== 0){
717                                            tape.stop()
718                                                .animate({
719                                                    left : checkEdges(parseInt(tape.css('left'), 10) - animationDistance * multiplier)
720                                                }, 1000, 'easeOutSine');
721                                        }
722                                    }
723
724                                    // finish the touch by undoing the touch session
725                                    frameDOM.removeEventListener('touchmove', onTouchMove, false);
726                                    frameDOM.removeEventListener('touchend', onTouchEnd, false);
727                                    //clean after work
728                                    preLastDistance = currentX = startX = 0;
729                                };
730
731                            frameDOM.addEventListener('touchstart', onTouchStart, false);
732                        }
733                    },
734
735                    //resize function
736                    layout = function(){
737                        //reset
738                        scroller_width = 0;
739
740                        //reset widths
741                        $images.each(function() {
742                            var $img = $(this);
743                                $img.css('width','').css('width', $img.width());
744
745                            scroller_width += $img.outerWidth(true);
746                        });
747
748                        //new values
749                        $tape.css('width',scroller_width+'px');
750                        minScroll = -(scroller_width - $container.width());
751
752                        //check if out of bounds
753                        move(parseInt($tape.css('left'), 10));
754                    };
755
756                //register resize
757                A13.layout.add(layout);
758
759                //loader
760                A13.addLoader($container);
761
762                //preload the images
763                $images.each(function() {
764                    var $img = $(this);
765                    $('<img/>').load(function(){
766                        //counters odd issue when overflow:hidden; is enabled on container
767//                        console.log('set', $img.attr('src'),$img.width(), this.width);
768                        var width = $img.width();
769                        width = width === 0? this.width : width; //protection from wrong reading of width after load
770                        $img.css('width', width);
771
772                        ++tempCounter;
773                        //if last image is loaded start everything
774                        if(tempCounter === $images_number){ init(); }
775                    }).attr('src',$img.attr('src'));
776                });
777
778                //add interactive elements
779                $items.each(function(){
780                    var $t = $(this),
781                        dt = $t.data('title');
782
783                    $t.append('<i></i>'+(typeof dt === 'undefined' ? '' : '<em>'+dt+'</em>'));
784                });
785
786                //add items to lightbox
787                A13.elementsActions.lightbox($items);
788            }
789        },
790
791        A13FullWidthPhotos : function(){
792            var $container = $('#a13-full-photos');
793            if($container.length){
794                var $items  = $container.children();
795//                    $images = $items.find('img');
796
797                //add interactive elements
798                $items.append('<i></i>');
799
800                //add items to lightbox
801                A13.elementsActions.lightbox($items);
802            }
803        },
804
805        FrontPageSlider : function(){
806            if($body.hasClass('front-page-slider')){
807                var layout = function(event, size){
808                    var slider = $('#a13-revo-slider'),
809                        w_h = $window.height(),
810                        s_h = slider.height();
811
812//                console.log(w_h, s_h);
813                    if(size > BP[0] && w_h > s_h){
814                        slider.addClass('position').css('top', (w_h -s_h)/2);
815                    }
816                    else{
817                        slider.removeClass('position').css('top', '');
818                    }
819                };
820
821                //register resize
822                A13.layout.add(layout);
823
824                //initial layout
825                layout({}, A13.layout.size);
826            }
827        },
828
829        lazy : function(options){
830            options = $.extend( true, {}, {
831                container        : '',
832                childrenSelector : '',
833                imagesAlso       : false, /* Resize images in bricks also */
834                filter           : false, /* if false we are not using filter */
835                afterAddCB       : function(){}
836            }, options );
837
838            var $container          = options.container,
839                defWidth            = parseInt(G.brick_width, 10),
840                defMargin           = (typeof G.brick_margin === 'undefined')? 0 : parseInt(G.brick_margin, 10),
841                defHeight           = (typeof G.brick_height === 'undefined')? 0 : parseInt(G.brick_height, 10),
842                loadAll             = (typeof G.per_page === 'undefined')? 0 : parseInt(G.per_page, 10),
843                minLoad             = 2,
844                //copy all html to var and remove it from DOM
845                bricksSave          = $container.children().remove(),
846                bricksNo            = bricksSave.length,
847                $parent             = $container.parent(),
848                filter              = (options.filter === false)? '' : $(options.filter),
849                noImageResize       = (typeof $container.data('no-resize') !== 'undefined'),
850                _throttle,
851
852                countWidth = function(items){
853                    var space = $parent.width(),
854                        bricks = (items instanceof jQuery)? items : $container.children(),
855                        perRow = parseInt(space/defWidth, 10),
856                        fluidWidth, fluidHeight;
857
858                    if(perRow < 1){ perRow = 1; }
859                    fluidWidth = Math.floor((space - (perRow+1) * defMargin) / perRow);
860
861                    //or items will be wider then 1.2 of normal width
862                    if(fluidWidth > 1.2 * defWidth){
863                        perRow++;
864                        fluidWidth = Math.floor((space - (perRow+1) * defMargin) / perRow);
865                    }
866
867                    bricks.css('width', fluidWidth);
868
869//                    if(options.imagesAlso)
870//                        bricks.find('span').css('height','');
871
872                    //keep ratio of resize for height
873                    if(defHeight > 0){
874                        fluidHeight = Math.round(fluidWidth/defWidth * defHeight);
875                        bricks.css('height', fluidHeight);
876                    }
877                    //prepare img parent element for zooming effect
878                    if(options.imagesAlso){
879                        //defined height of brick
880                        if(noImageResize){
881                            bricks.find('i').css('height', fluidHeight);
882                        }
883                        else{
884                            bricks.find('i').each(function(){
885                                var t = $(this).css('height',''),
886                        
886            img = t.children().addClass('resize').css('height', 'auto'),
887                                    h = img.height();
888                                t.height(h);
889                                img.css('height', '').height(); //read of height just to break webkit flow in inserting DOM changes
890                                img.removeClass('resize');
891                            });
892                        }
893                    }
894
895                    return fluidWidth + defMargin;
896                },
897
898                bindLoadMore = function(){
899                    var load_more = $('<div class="navigation lazy"><a href="#" id="#load-more">'+ G.load_more +'</a></div>').insertAfter($container),
900                        action = function(e){
901                            if(typeof e !== 'undefined'){
902                                e.preventDefault();
903                            }
904
905                            //instant turn off event
906                            load_more.off('click');
907
908                            $window.off('.lazyload');
909                            load_more.slideUp(100, function(){load_more.remove();});
910                            loadTillViewIsFull();
911                        },
912
913                        cb = function(){
914                            var scrollPos = $window.scrollTop() + $window.height();
915
916                            if ($container.height() -  scrollPos < 250) {
917                                action();
918                            }
919                        };
920
921                    load_more.click(action);
922
923                    //on IOS throttle for scroll causes some JavaScript issues
924                    _throttle = isTouch? 'debounce' : 'throttle';
925                    $window.on('scroll.lazyload resize.lazyload', window[_throttle](cb, 150));
926                },
927
928                loadTillViewIsFull = function(){
929                    A13.addLoader(isTouch? mid : $body);
930
931                    var pointer = $container.data('pointer'),
932                        current = (typeof pointer === 'undefined')? 0 : parseInt(pointer, 10),
933                        improve = (current + minLoad > bricksNo)? bricksNo - current : minLoad,
934                        limit   = current + improve,
935                        $newElems;
936
937                    //create items html
938                    $newElems = bricksSave.slice(current,limit);
939
940                    //append items and position them
941                    $newElems
942                        .appendTo($container)
943                        .css({ opacity: 0 })
944                        .imagesLoaded(function(){
945                            //if load of initial elements
946                            if(current === 0){
947                                $newElems.addClass('ready'); // for enabling transition
948
949                                $container.masonry({
950                                    itemSelector : options.childrenSelector,
951                                    columnWidth : countWidth,
952                                    isAnimated: !Modernizr.csstransitions,
953                                    isFitWidth: true,
954                                    animationOptions: {
955                                        duration: 300,
956                                        easing: 'swing',
957                                        queue: false
958                                    }
959                                });
960
961                                //show elements
962                                $newElems.css({
963                                    opacity: 1
964                                });
965
966                                //show parent
967                                $container.addClass('loaded');
968
969                                //callback(lightbox)
970                                options.afterAddCB($newElems);
971                            }
972                            else{
973                                //resize items
974                                countWidth($newElems);
975                                //show
976                                $newElems.css({
977                                    opacity: 1, //show elements
978                                    top : $window.height() + $window.scrollTop() + 100 // for animation purpose(animate from bottom of screen
979                                });
980
981                                //READ of TOP property to break chain for chrome so it makes job proper!!!
982                                //probably chrome optimization error
983                                $newElems.css('top');
984
985                                $newElems.addClass('ready');
986
987                                //check if new elements match filter
988                                if(filter.length){
989                                    var genre = filter.find('li.selected').data('filter');
990                                    if(genre !== '__all'){
991                                        $newElems.hide().filter('[data-genre-'+genre+']').show();
992                                    }
993                                }
994
995                                //position
996                                $container.masonry( 'appended', $newElems, false );//false so it wont go in to setTimeout
997
998                                //callback(lightbox)
999                                options.afterAddCB($newElems);
1000                            }
1001
1002                            //save pointer
1003                            current = current+improve;
1004                            $container.data('pointer', current);
1005
1006                            //if loading only one set of items but to full
1007                            if(loadAll > 0){
1008                                if(current < bricksNo){
1009                                    loadTillViewIsFull();
1010                                }
1011                                else{
1012                                    A13.removeLoader();
1013                                }
1014                            }
1015                            else{
1016                                //load next items if there is space available and still some items to load
1017                                if(($container.height() < (2*$window.height() + $window.scrollTop())) && current < bricksNo){
1018                                    loadTillViewIsFull();
1019                                }
1020                                //bind scroll to load more items
1021                                else{
1022                                    A13.removeLoader();
1023
1024                                    //if we loaded all items
1025                                    if(current === bricksNo){ return; }
1026
1027                                    bindLoadMore();
1028                                }
1029                            }
1030                        });
1031                };
1032
1033            loadTillViewIsFull();
1034
1035            //filter bind
1036            if(filter.length){
1037                var label = filter.find('li.label'),
1038                    filters = filter.find('li').not(label);
1039
1040                label.click(function(){
1041                    filters.toggle(300);
1042                });
1043
1044                filters.click(function(e){
1045                    e.preventDefault();
1046
1047                    filters.removeClass('selected');
1048
1049                    var f = $(this).addClass('selected'),
1050                        genre = f.data('filter'),
1051                        allItems = $container.children(),
1052                        currentItems;
1053
1054                    if(genre === '__all'){ //__all so users will not overwrite this
1055                        allItems.show();
1056                    }
1057                    else{
1058                        currentItems = $container.children().filter('[data-genre-'+genre+']').show();
1059                        allItems.not(currentItems).hide();
1060                    }
1061
1062                    //masonry refresh layout
1063                    $container.masonry( 'option', { itemSelector : options.childrenSelector+':visible' }).masonry( 'reload' );
1064
1065                    //trigger scroll to load more elements if there is place
1066                    $window.trigger('scroll.lazyload');
1067                });
1068
1069            }
1070        },
1071
1072        addLoader : function(elem){
1073            if($('#loader').length){ return; }//there is some loader
1074
1075            var _in = (typeof elem !== 'undefined'),
1076                _appendTo = _in ? elem : $body;
1077            $('<div id="loader"'+( _in ? ' class="in"' : '')+' />').
1078                appendTo(_appendTo).hide().fadeIn();
1079        },
1080
1081        removeLoader : function(){
1082            var l = $body.find('#loader');
1083            l.fadeOut().promise().done(function(){l.remove();});
1084        },
1085
1086        setRGBA_n_RGB : function(el, style, color){
1087            if(typeof color === 'undefined' || !color.length){ return; }
1088
1089            //rgba conversion to rgb
1090            var reg = /\(\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+\.?\d*)\s*\)/,
1091                result = reg.exec(color),
1092                rgb = '';
1093            if(result !== null){
1094                rgb = 'rgb('+result[1]+','+result[2]+','+result[3]+')';
1095            }
1096
1097            //set color
1098            try {
1099                el.style[style] = color;
1100            }
1101            //browsers without RGBA support
1102            catch(e) {
1103                el.style[style] = rgb;
1104            }
1105        }
1106    };
1107
1108    //start Theme
1109    A13 = window.A13;
1110    $(document).ready(A13.onReady);
1111
1112})(jQuery, window, document);

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.