1(function($) 2{ 3 "use strict"; 4 5 // ------------------------------------------------------------------------------------------- 6 // Icongrid shortcode javascript 7 // ------------------------------------------------------------------------------------------- 8 9 $.fn.avia_sc_icongrid = function(options) 10 { 11 return this.each( function() 12 { 13 var icongrid_container = $( this ), 14 icongrid = icongrid_container.find( '.avia-icongrid' ), 15 icongrid_cards = icongrid.find( '.av-icon-cell-item' ), 16 icongrid_id = '#' + icongrid.attr( 'id' ), 17 min_height = icongrid_container.data( 'min-height' ), 18 methods = {}; 19 20 icongrid_cards.on( 'touchend', function( e ) 21 { 22 var current = $(this), 23 container = current.closest( '.avia-icongrid' ); 24 25 if( current.hasClass( 'avia-hover' ) ) 26 { 27 container.find( '.av-icon-cell-item' ).removeClass( 'avia-hover' ); 28 } 29 else 30 { 31 container.find( '.av-icon-cell-item' ).removeClass( 'avia-hover' ); 32 current.addClass( 'avia-hover' ); 33 } 34 35 var links = current.find( 'a' ); 36 37 if( links.length > 0 ) 38 { 39 links.off( 'touchend.aviaIconGridLink' ).on( 'touchend.aviaIconGridLink', function( e ) 40 { 41 e.preventDefault(); 42 43 var link = $( this ), 44 container = link.closest( '.av-icon-cell-item' ); 45 46 if( ! container.hasClass( 'avia-hover' ) ) 47 { 48 return; 49 } 50 51 e.stopImmediatePropagation(); 52 53 link.css( 'opacity', 0.5 ); 54 55 window.location.href = link.attr( 'href' ); 56 }); 57 } 58 59 e.preventDefault(); 60 e.stopImmediatePropagation(); 61 }); 62 63 if( icongrid.hasClass( 'avia_flip_force_close' ) ) 64 { 65 $( 'body' ).on( 'touchend', function( e ) 66 { 67 var flipboxes = $( '.avia-icongrid.avia_flip_force_close' ); 68 flipboxes.each( function() 69 { 70 var flipbox = $( this ); 71 72 flipbox.find( '.av-icon-cell-item' ).removeClass( 'avia-hover' ); 73 }); 74 }); 75 } 76 77 methods = 78 { 79 buildIconGrid: function () 80 { 81 this.setMinHeight( $( icongrid_id + ' li article' ) ); 82 }, 83 84 setMinHeight: function (els) 85 { 86 if( els.length < 2 ) 87 { 88 return; 89 } 90 91 var elsHeights = new Array(), 92 front = [], 93 back = []; 94 95 els.css( 'min-height', '0' ).each( function (i) 96 { 97 var current = $(this); 98 99 if( icongrid.hasClass( 'avia-icongrid-flipbox' ) ) 100 { 101 front = current.find( '.avia-icongrid-front .avia-icongrid-inner' ); 102 back = current.find( '.avia-icongrid-flipback .avia-icongrid-inner' ); 103 } 104 else 105 { 106 front = current.find( '.avia-icongrid-front .avia-icongrid-inner' ); 107 back = current.find( '.avia-icongrid-content' ); 108 109 // needed for reverse columns 110 elsHeights.push( current.outerHeight( true ) ); 111 } 112 113 if( front.length ) 114 { 115 elsHeights.push( front.outerHeight( true ) ); 116 } 117 118 if( back.length ) 119 { 120 elsHeights.push( back.outerHeight( true ) ); 121 } 122 }); 123 124 if( 'undefined' != typeof( min_height ) ) 125 { 126 var i = parseInt( min_height ); 127 if( ! isNaN( i ) ) 128 { 129 elsHeights.push( i ); 130 } 131 } 132 133 var largest = Math.max.apply( null, elsHeights ); 134 els.css( 'min-height', largest ); 135 136 if( icongrid.hasClass( 'avia-icongrid-tooltip' ) ) 137 { 138 var elWidth = els.first().outerWidth( true ); 139 if( largest > elWidth ) 140 { 141 els.css( 'min-height', elWidth ); 142 } 143 } 144 } 145 }; 146 147 methods.buildIconGrid(); 148 149 $(window).on( 'debouncedresize', function() 150 { 151 methods.buildIconGrid(); 152 }); 153 }); 154 }; 155 156}(jQuery));
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.