PageSourceSearch

https://www.woodenhottubsale.co.uk/wp-content/themes/maya/js/jquery.custom.js?ver=1.0

js woodenhottubsale.co.uk collected 2026-10-04 22:08:29 UTC 27,716 bytes, 743 lines download raw bytes

1function yiw_lightbox()
2{
3    jQuery('a.thumb.video, a.thumb.img').hover(
4
5        function()
6        {
7            jQuery('<a class="zoom">zoom</a>').appendTo(this).css({
8                dispay:'block',
9                opacity:0,
10                height:jQuery(this).children('img').height(),
11                width:jQuery(this).children('img').width(),
12                'top':jQuery(this).css('padding-top'),
13                'left':jQuery(this).css('padding-left'),
14                padding:0}).animate({opacity:0.4}, 500);
15        },
16
17        function()
18        {
19            jQuery('.zoom').fadeOut(500, function(){jQuery(this).remove()});
20        }
21    );
22
23    jQuery('.blog-elegant-right a, .blog-elegant a, .blog-small a').has('img').attr('rel','prettyPhoto');
24
25    if(jQuery.fn.prettyPhoto) {
26        jQuery("a[rel^='prettyPhoto'], .features-tab-content a[rel^='thumbnails']").prettyPhoto({
27            slideshow:5000,
28            theme: yiw_prettyphoto_style,
29            autoplay_slideshow:false,
30            deeplinking: false,
31            show_title:false
32        });
33    }
34}
35
36//emulate jquery live to preserve jQuery.live() call
37if( typeof jQuery.fn.live == 'undefined' ) {
38    jQuery.fn.live = function( types, data, fn ) {
39        jQuery( this.context ).on( types, this.selector, data, fn );
40        return this;
41    };
42}
43
44jQuery(document).ready(function($){
45
46    $('body').removeClass('no_js').addClass('yes_js');
47
48    var mobile_menu = function() {
49        if( $(window).width() < 767 && $('body').hasClass('responsive') ) {
50            $( '#nav > ul, #nav .menu > ul' ).mobileMenu({
51                subMenuDash : '-'
52            });
53
54            $( '#nav > ul, #nav .menu > ul' ).hide();
55        }
56    }
57    mobile_menu();
58
59    var show_dropdown = function()
60    {
61        var options;
62
63        containerWidth = $('#header').width();
64        marginRight = $('#nav ul.level-1 > li').css('margin-right');
65        submenuWidth = $(this).find('ul.sub-menu').outerWidth();
66        offsetMenuRight = $(this).position().left + submenuWidth;
67        leftPos = -18;
68
69        if ( offsetMenuRight > containerWidth )
70            options = { left:leftPos - ( offsetMenuRight - containerWidth ) };
71        else
72            options = {};
73
74        $('ul.sub-menu:not(ul.sub-menu li > ul.sub-menu), ul.children:not(ul.children li > ul.children)', this).css(options).stop(true, true).fadeIn(300);
75    }
76
77    var hide_dropdown = function()
78    {
79        $('ul.sub-menu:not(ul.sub-menu li > ul.sub-menu), ul.children:not(ul.children li > ul.children)', this).fadeOut(300);
80    }
81
82    $('#nav ul > li').hover( show_dropdown, hide_dropdown );
83
84    $('#nav ul > li').each(function(){
85        if( $('ul', this).length > 0 )
86            $(this).children('a').append('<span class="sf-sub-indicator"> &raquo;</span>').css({ paddingRight:parseInt($(this).children('a').css('padding-right'))+16 });
87    });
88
89    $('#nav li:not(.megamenu) ul.sub-menu li, #nav li:not(.megamenu) ul.children li').hover(
90        function()
91        {
92            if ( $(this).closest('.megamenu').length > 0 )
93                return;
94
95            var options;
96
97            containerWidth = $('#header').width();
98            containerOffsetRight = $('#header').offset().left + containerWidth;
99            submenuWidth = $('ul.sub-menu, ul.children', this).parent().width();
100            offsetMenuRight = $(this).offset().left + submenuWidth * 2;
101            leftPos = -10;
102
103            if ( offsetMenuRight > containerOffsetRight )
104                $(this).addClass('left');
105
106            $( this ).children( 'ul.sub-menu, ul.children' ).stop(true, true).fadeIn(300);
107        },
108
109        function()
110        {
111            if ( $(this).closest('.megamenu').length > 0 )
112                return;
113
114            $( this ).children( 'ul.sub-menu, ul.children' ).fadeOut(300);
115        }
116    );
117
118    /* megamenu check position */
119    $('#nav .megamenu').mouseover(function(){
120
121        var main_container_width = $('.inner').width();
122        var main_container_offset = $('.inner').offset();
123        var parent = $(this);
124        var megamenu = $(this).children('ul.sub-menu');
125        var width_megamenu = megamenu.outerWidth();
126        var position_megamenu = megamenu.offset();
127        var position_parent = parent.position();
128
129        var position_right_megamenu = position_parent.left + width_megamenu;
130
131        // adjust if the right position of megamenu is out of container
132        if ( position_right_megamenu > main_container_width ) {
133            megamenu.offset( { top:position_megamenu.top, left:main_container_offset.left + ( main_container_width - width_megamenu ) } );
134        }
135
136        //alert( 'width_megamenu = ' + width_megamenu + '; position_parent = top:' + position_parent.top + ', left:' + position_parent.left );
137        //alert( 'width_megamenu = ' + width_megamenu + '; left = ' + main_container_offset.left + ( main_container_width - width_megamenu ) );
138
139    });
140
141    if ( $('body').hasClass('isMobile') && ! $('body').hasClass('iphone') && ! $('body').hasClass('ipad') ) {
142        $('.menu-item').click(function( e ){
143            e.stopPropagation();
144            // Remove Link from item on level 1 for dropdown menu
145            $('li.megamenu > a, .dropdown > a, .menu-item-has-children > a' ).attr('href', '#');
146            var _submenu = $('.submenu', this);
147            if( _submenu.length ) {
148                e.preventDefault();
149                if( _submenu.is(':hidden') ) { show_dropdown( _submenu ); }
150                else { hide_dropdown( _submenu ); }
151            }
152        });
153    }
154
155    yiw_lightbox();
156
157    $("a.bookmark, a.bookmark-small").click(function(){
158        var bookmarkUrl = this.href;
159        var bookmarkTitle = this.title;
160
161        if ($.browser.mozilla) // For Mozilla Firefox Bookmark
162        {
163            window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
164        }
165        else if($.browser.msie || $.browser.webkit) // For IE Favorite
166        {
167            window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
168        }
169        else if($.browser.opera ) // For Opera Browsers
170        {
171            $(this).attr("href",bookmarkUrl);
172            $(this).attr("title",bookmarkTitle);
173            $(this).attr("rel","sidebar");
174            $(this).click();
175        }
176        else // for other browsers which does not support
177        {
178            alert('Please hold CTRL+D and click the link to bookmark it in your browser.');
179        }
180        return false;
181    });
182
183    // searchform on header    // autoclean labels
184    $elements = $('#header #s, .autoclear, input.autoclear');
185
186    $elements.each(function(){
187        if( $(this).val() != '' )
188            $(this).prev().css('display', 'none');
189    });
190    $elements.focus(function(){
191        if( $(this).val() == '' )
192            $(this).prev().css('display', 'none');
193    });
194    $elements.blur(function(){
195        if( $(this).val() == '' )
196            $(this).prev().css('display', 'block');
197    });
198
199    input_newsletter = $('.newsletter-section .text-field');
200
201    var prev_input_newsletter_val = null;
202
203    input_newsletter.focus(function() {
204        if( $( this ).val() != '') {
205            prev_input_newsletter_val = $( this ).val();
206            $( this ).val('');
207        }
208
209        input_newsletter.blur(function(){
210            if( $(this).val() == '' )
211                $(this).val(prev_input_newsletter_val);
212        });
213    });
214
215    $('a.socials, a.socials-small').tipsy({fade:true, gravity:'s'});
216
217    $('.toggle-content:not(.opened), .content-tab:not(.opened)').hide();
218    $('.tab-index a').click(function(){
219        $(this).parent().next().slideToggle(300, 'easeOutExpo');
220        $(this).parent().toggleClass('tab-opened tab-closed');
221        $(this).attr('title', ($(this).attr('title') == 'Close') ? 'Open' : 'Close');
222        return false;
223    });
224
225    // gallery hover
226    $(".gallery-wrap .internal_page_item .overlay").css({opacity:0});
227    $(".gallery-wrap .internal_page_item").live( 'mouseover mouseout', function(event){
228        if ( event.type == 'mouseover' ) $('.overlay', this).show().stop(true,false).animate({ opacity: 1 }, "fast");
229        if ( event.type == 'mouseout' )  $('.overlay', this).animate({ opacity: 0 }, "fast", function(){ $(this).hide() });
230    });
231
232    $('.tabs-container').yiw_tabs({
233        tabNav  : 'ul.tabs',
234        tabDivs : '.border-box'
235    });
236
237    $('#slideshow images img').show();
238
239
240    $(document).on({
241        mouseenter: function(){
242            if ( $(this).parent().parent().attr('id') == 'logo' || $(this).parent().parent().parent().parent().parent().attr('id') == 'slider' )
243                return;
244            $(this).stop().animate({opacity: 0.65}, 700);
245        },
246        mouseleave: function(){
247            $(this).stop().animate({opacity: 1});
248        }
249    }, 'a img');
250
251    // map tab
252    $('.header-map .tab-label').click(function(){
253        var mapWrap = $('#map-wrap');
254        var text = $(this).text();
255        var label = $(this);
256        var height = $('#map').height();
257
258        if ( $(window).height() - 100 < height )
259            height = $(window).height() - 100;
260
261        //console.log( text + ' - ' + header_map.tab_open + ' - ' + header_map.tab_close );
262
263        if ( $(this).hasClass('closed') ) {
264            mapWrap.show().animate({height:height}, 500, function(){
265                label.removeClass('closed').addClass('opened').text(header_map.tab_close);
266            });
267
268        } else if ( $(this).hasClass('opened') ) {
269            mapWrap.animate({height:0}, 500, function(){
270                $(this).hide();
271                label.removeClass('opened').addClass('closed').text(header_map.tab_open);
272            });
273        }
274
275        return false;
276    });
277
278    // add to cart hover
279    if ( ! $('body').hasClass('isMobile') ) {
280        var product_sel = '.products.ribbon li, .shop-ribbon .products:not(.traditional) li',
281            product = $(product_sel);
282
283        var product_animate = function(el) {
284            product_reset(el);
285            var product_buttons = $('.buttons', el);
286            var product_add_to_cart = $('.buttons .add-to-cart', el);
287            if ( product_add_to_cart.hasClass('added') || product_add_to_cart.hasClass('loading') ) return;
288            product_buttons.css({opacity:0}
288).css({opacity:1});
289            product_add_to_cart.css({top:product_add_to_cart.height()*-1}).stop().animate({top:0}, 'fast');
290        };
291
292        var product_reset = function(el) {
293            var product_buttons = $('.buttons', el);
294            var product_add_to_cart = $('.buttons .add-to-cart', el);
295            if ( product_add_to_cart.hasClass('added') || product_add_to_cart.hasClass('loading') ) return;
296            product_buttons.css({opacity:0, 'visibility':'visible', 'overflow':'hidden'}).height( product_add_to_cart.height() );
297            product_add_to_cart.stop().css({'position':'relative',top:product_add_to_cart.height()*-1});
298        };
299        product_reset(product);
300
301        $(document).on( 'hover', product_sel, function(e){
302            if ( e.type == 'mouseenter' ) {
303                product_animate(this);
304            } else if ( e.type == 'mouseleave' ) {
305                product_reset(this);
306            }
307        });
308    }
309
310    // product slider (? stato spostato sotto)
311//     $('.products-slider:not(.for-mobile) ul').jcarousel({
312//         auto: yiw_product_slider_interval,
313//         scroll: 1,
314//         wrap: 'last'
315//     });
316
317    var add_to_cart_clicked = false;
318
319    // add to cart click
320    $(document).on('click', '.add-to-cart', function(){
321        if (typeof yiw.loader != 'undefined') {
322            $(this).block({message: null, overlayCSS: {background: '#fff url(' + yiw.loader + ') no-repeat center', opacity: 0.3, cursor:'none'}});
323        }
324        else {
325            $(this).block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.3, cursor:'none'}});
326        }
327        add_to_cart_clicked = $(this);
328    });
329    $('body').on( 'added_to_cart', function(){
330        $('html, body').delay(500).animate({scrollTop:0}, 'slow');
331    } );
332
333    // compare button click
334    var product_compare, open_window = false;
335    $('.product .woo_bt_compare_this').on( 'click', function(){
336        open_window = true;
337        product_compare = $(this).parents('.product');
338        if (typeof yiw.loader != 'undefined') {
339            product_compare.block({message: null, overlayCSS: {background: '#fff url(' + yiw.loader + ') no-repeat center', opacity: 0.6, cursor:'none'}});
340        }
341        else {
342            product_compare.block({message: null, overlayCSS: {background: '#fff url(' + woocommerce_params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6, cursor:'none'}});
343        }
344    });
345
346    if( typeof woo_comparable_open_compare_type != 'undefined' ) {
347        $('body').on( 'woo_update_total_compare_list', function(){
348            product_compare.unblock();
349            if ( open_window && woo_comparable_open_compare_type == 'window' ) {
350                $(".woo_compare_button_go").trigger('click');
351            } else if ( woo_comparable_open_compare_type == 'new_page' ) {
352                // aprire pagina in una nuova scheda
353                var win=window.open(woo_compare_url, '_blank');
354                win.focus();
355            }
356        });
357        if ( woo_comparable_open_compare_type == 'new_page' ) {
358            $('.woo_compare_button_go a').on('click', function(){
359                var win=window.open(woo_compare_url, '_blank');
360                win.woocommerce_output_related_products().focus();
361            });
362        }
363    }
364});
365
366jQuery(window).load(function() {
367
368    $ = jQuery;
369
370    // slider
371    //if ( $("#slider ul").length > 0 ) {
372    if( typeof(yiw_slider_type) != 'undefined' ) {
373        if( yiw_slider_type == 'elegant' ) {
374            $("#slider ul").cycle({
375                easing  : yiw_slider_elegant_easing,
376                fx      : yiw_slider_elegant_fx,
377                speed   : yiw_slider_elegant_speed,
378                timeout : yiw_slider_elegant_timeout,
379                before  : function(currSlideElement, nextSlideElement, options, forwardFlag) {
380                    var width = parseInt( $('.slider-caption', currSlideElement).outerWidth() );
381                    var height = parseInt( $('.slider-caption', currSlideElement).outerHeight() );
382
383                    $('.caption-top', currSlideElement).animate({top:height*-1}, yiw_slider_elegant_caption_speed);
384                    $('.caption-bottom', currSlideElement).animate({bottom:height*-1}, yiw_slider_elegant_caption_speed);
385                    $('.caption-left', currSlideElement).animate({left:width*-1}, yiw_slider_elegant_caption_speed);
386                    $('.caption-right', currSlideElement).animate({right:width*-1}, yiw_slider_elegant_caption_speed);
387                },
388                after   : function(currSlideElement, nextSlideElement, options, forwardFlag) {
389                    $('.caption-top', nextSlideElement).animate({top:0}, yiw_slider_elegant_caption_speed);
390                    $('.caption-bottom', nextSlideElement).animate({bottom:0}, yiw_slider_elegant_caption_speed);
391                    $('.caption-left', nextSlideElement).animate({left:0}, yiw_slider_elegant_caption_speed);
392                    $('.caption-right', nextSlideElement).animate({right:0}, yiw_slider_elegant_caption_speed);
393                }
394            });
395        } else if( yiw_slider_type == 'cycle') {
396            $('#slider .images').cycle({
397                fx      : yiw_slider_cycle_fx,
398                speed   : yiw_slider_cycle_speed,
399                timeout : yiw_slider_cycle_timeout,
400                easing  : yiw_slider_cycle_easing,
401                pager   : '.pagination',
402                cleartype: true
403            });
404
405            $('#slider-pause').show();
406
407            $('#slider-pause').click(function(){
408                $('#slider .images').cycle('pause');
409                $(this).hide();
410                $('#slider-play').show();
411                return false;
412            });
413
414            $('#slider-play').click(function(){
415                $('#slider .images').cycle('resume');
416                $(this).hide();
417                $('#slider-pause').show();
418                return false;
419            });
420        } else if( yiw_slider_type == 'nivo') {
421            $('#slider .slider-images').nivoSlider({
422                effect       : yiw_slider_nivo_effect,
423                pauseTime    : yiw_slider_nivo_timeout,
424                animSpeed    : yiw_slider_nivo_animspeed,
425                directionNav : false
426            });
427        } else if( yiw_slider_type == 'unoslider' ) {
428            $('#slider ul').unoslider({
429                width       : yiw_slider_unoslider_width,
430                height      : yiw_slider_unoslider_height,
431                responsive  : yiw_slider_unoslider_responsive,
432                indicator   : yiw_slider_unoslider_indicator,
433                navigation  : yiw_slider_unoslider_navigation,
434                slideshow   : yiw_slider_unoslider_slideshow,
435                animation   : yiw_slider_unoslider_animation,
436                preset      : yiw_slider_unoslider_preset,
437                order       : 'random',
438                tooltip     : true
439            });
440        } else if ( yiw_slider_type == 'thumbnails' ) {
441            $("#slider .showcase").awShowcase(
442                {
443                    content_width           : yiw_slider_thumbnails_width,
444                    content_height          : yiw_slider_thumbnails_height + 72,
445                    show_caption            : 'onhover', /* onload/onhover/show */
446                    continuous              : true,
447                    buttons                 : false,
448                    auto                    : true,
449                    thumbnails              : true,
450                    transition              : yiw_slider_thumbnails_fx, /* hslide / vslide / fade */
451                    interval                : yiw_slider_thumbnails_timeout,
452                    transition_speed        : yiw_slider_thumbnails_speed,
453                    thumbnails_position     : 'outside-last', /* outside-last/outside-first/inside-last/inside-first */
454                    thumbnails_direction    : 'horizontal', /* vertical/horizontal */
455                    thumbnails_slidex       : 1 /* 0 = auto / 1 = slide one thumbnail / 2 = slide two thumbnails / etc. */
456                });
457        } else if ( yiw_slider_type == 'elastic' ) {
458            $('#slider.elastic').eislideshow({
459                easing		: 'easeOutExpo',
460                titleeasing	: 'easeOutExpo',
461                titlespeed	: 1200,
462                autoplay	: yiw_slider_elastic_autoplay,
463                slideshow_interval : yiw_slider_elastic_timeout,
464                speed       : yiw_slider_elastic_speed,
465                animation   : yiw_slider_elastic_animation
466// 				slidesLoaded: function() {
467//                     $('.ei-slider .ei-slider-loading').hide();
468//                 }
469            });
470        }
471    }
472
473    // product slider
474    if ( $('body').hasClass('rtl') ) {
475        if($.fn.jcarousel) {
476            jQuery('.products-slider:not(.for-mobile) ul').jcarousel({
477                auto: yiw_product_slider_interval,
478                scroll: 1,
479                wrap: 'last',
480                rtl: true
481            });
482        }
483    } else {
484        if($.fn.jcarousel) {
485            jQuery('.products-slider:not(.for-mobile) ul').jcarousel({
486                auto: yiw_product_slider_interval,
487                scroll: 1,
488                wrap: 'last'
489            });
490        }
491    }
492
493    $( '.features-tab-container' ).yiw_features_tab();
494
495});
496
497// features tab plugin
498(function($) {
499    $.fn.yiw_features_tab = function( options ) {
500        var config = {
501            'tabNav' : 'ul.features-tab-labels',
502            'tabDivs': 'div.features-tab-wrapper'
503        };
504
505        if( options ) $.extend( config, options );
506
507        this.each( function () {
508            var tabNav  = $( config.tabNav, this );
509            var tabDivs = $( config.tabDivs, this );
510            var labelNumber = tabNav.children( 'li' ).length;
511
512            tabDivs.children( 'div' ).hide();
513
514            var currentDiv = tabDivs.children( 'div' ).eq( tabNav.children( 'li.current-feature' ).index() );
515            currentDiv.show();
516
517            $( 'li', tabNav ).hover( function() {
518                if( !$( this ).hasClass( 'current-feature' ) ) {
519                    var currentDiv = tabDivs.children( 'div' ).eq( $( this ).index() );
520                    tabNav.children( 'li' ).removeClass( 'current-feature' );
521
522                    $( this ).addClass( 'current-feature' );
523
524                    tabDivs.children( 'div' ).hide().removeClass( 'current-feature' );
525                    currentDiv.fadeIn( 'slow' );
526
527//                    if( tabNav.height() >= ( tabDivs.parent( 'div' ).height() - 1 ) && labelNumber == ( $( this ).index() + 1 ) ) {
528//                        $( this ).css({
529//                            'border-bottom'                     : 'none',
530//                            'border-bottom-left-radius'         : '5px',
531//                            '-webkit-border-bottom-left-radius' : '5px',
532//                            '-moz-border-radius-bottomleft'     : '5px'
533//                        });
534//                    }
535
536                    //alert( tabNav.height() + '-' + ( tabDivs.parent( 'div' ).height() - 1 ) );
537                }
538            });
539
540        });
541    }
542})(jQuery);
543
544// tabs plugin
545(function($) {
546    $.fn.yiw_tabs = function(options) {
547        // valori di default
548        var config = {
549            'tabNav': 'ul.tabs',
550            'tabDivs': '.containers',
551            'currentClass': 'current'
552        };
553
554        if (options) $.extend(config, options);
555
556        if( typeof( config.tabNav ) == 'undefined' )
557        { return; }
558
559        this.each(function() {
560            var tabNav = $(config.tabNav, this);
561            var tabDivs = $(config.tabDivs, this);
562            var activeTab;
563            var maxHeight = 0;
564
565            if ( $('li.'+config.currentClass+' a', tabNav).length > 0 )
566                activeTab = '#' + $('li.'+config.currentClass+' a', tabNav).attr('href').split('#')[1];
567            else if(window.location.hash)
568                activeTab = window.location.hash;
569            else
570                activeTab = '#' + $('li:first-child a', tabNav).attr('href').split('#')[1];
571
572            $(activeTab).show().addClass('showing');
573            $(config.tabDivs).children('div').not('.showing').hide();
574            $('li a[href~="'+activeTab+'"]', tabNav).parents('li').addClass(config.currentClass);
575
576            $('a', tabNav).click(function(e){
577                e.preventDefault();
578                var id = '#' + $(this).attr('href').split('#')[1];
579                var thisLink = $(this);
580
581                $('li.'+config.currentClass, tabNav).removeClass(config.currentClass);
582                $(this).parents('li').addClass(config.currentClass);
583
584                $('.showing', tabDivs).fadeOut(200, function(){
585                    $(this).removeClass('showing');
586                    $(id).fadeIn(200).addClass('showing');
587                });
588
589                return false;
590            });
591        });
592    }
593})(jQuery);
594
595(function($) {
596
597    $.fn.sorted = function(customOptions) {
598        var options = {
599            reversed: false,
600            by: function(a) {
601                return a.text();
602            }
603        };
604
605        $.extend(options, customOptions);
606
607        $data = jQuery(this);
608        arr = $data.get();
609        arr.sort(function(a, b) {
610
611            var valA = options.by($(a));
612            var valB = options.by($(b));
613
614            if (options.reversed) {
615                return (valA < valB) ? 1 : (valA > valB) ? -1 : 0;
616            } else {
617                return (valA < valB) ? -1 : (valA > valB) ? 1 : 0;
618            }
619
620        });
621
622        return $(arr);
623
624    };
625
626})(jQuery);
627
628jQuery(function($) {
629
630    //yiw_lightbox();
631
632
633    var read_button = function(class_names) {
634
635        var r = {
636            selected: false,
637            type: 0
638        };
639
640        for (var i=0; i < class_names.length; i++) {
641
642            if (class_names[i].indexOf('selected-') == 0) {
643                r.selected = true;
644            }
645
646            if (class_names[i].indexOf('segment-') == 0) {
647                r.segment = class_names[i].split('-')[1];
648            }
649        };
650
651        return r;
652
653    };
654
655    var determine_sort = function($buttons) {
656        var $selected = $buttons.parent().filter('[class*="selected-"]');
657        return $selected.find('a').attr('data-value');
658    };
659
660    var determine_kind = function($buttons) {
661        var $selected = $buttons.parent().filter('[class*="selected-"]');
662        return $selected.find('a').attr('data-value');
663    };
664
665    var $preferences = {
666        duration: 500,
667        adjustHeight: 'auto'
668    }
669
670    var $list = jQuery('.gallery-wrap');
671    var $data = $list.clone();
672
673    var $controls = jQuery('.portfolio-categories, .gallery-categories');
674
675    $controls.each(function(i) {
676
677        var $control = jQuery(this);
678        var $buttons = $control.find('a');
679        var height_list = $list.height();
680
681        $('li:first-child', $control).addClass('selected');
682
683        $buttons.bind('click', function(e) {
684
685            var $button = jQuery(this);
686            var $button_container = $button.parent();
687            var button_properties = read_button($button_container.attr('class').split(' '));
688            var selected = button_properties.selected;
689            var button_segment = button_properties.segment;
690
691            if (!selected) {
692
693                $buttons.parent().removeClass();
694                $button_container.addClass('selected selected-' + button_segment).parent().children('li:first-child').addClass('first');
695
696                var sorting_type = determine_sort($controls.eq(1).find('a'));
697                var sorting_kind = determine_kind($controls.eq(0).find('a'));
698
699                if (sorting_kind == 'all') {
700                    var $filtered_data = $data.find('li');
701                } else {
702                    var $filtered_data = $data.find('li.' + sorting_kind);
703                }
704
705                var $sorted_data = $filtered_data.sorted({
706                    by: function(v) {
707                        return $(v).find('strong').text().toLowerCase();
708                    }
709                });
710
711                $list.quicksand($sorted_data, $preferences, function () {
712                    yiw_lightbox();
713
714                    var postsPerRow = ( $('.layout-sidebar-right').length > 0 || $('.layout-sidebar-left').length > 0 ) ? 3 : 4;
715
716                    $('.gallery-wrap li')
717                        .removeClass('group')
718                        .each(function(i){
719                            $(this).find('div')
720                                //.removeClass('internal_page_item_first')
721                                .removeClass('internal_page_item_last');
722
723                            if( (i % postsPerRow) == 0 ) {
724                                //$(this).addClass('group');
725                                //$(this).find('div').addClass('internal_page_item_first');
726                            } else if((i % postsPerRow) == 2) {
727                                $(this).find('div').addClass('internal_page_item_last');
728                            }
729                        });
730
731                    $('.gallery-wrap:first').css('height',0);
732
733                });
734
735            }
736
737            e.preventDefault();
738
739        });
740
741    });
742
743});

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.