1/* 2 * VERY TEMPORARY FIX 3 * 4 * Used to set inline container. We will drop this when we found a better solution. 5 */ 6( function( $ ) { 7 var inlineContainer = $( '.mkhb-col__container-inline' ); 8 9 if ( inlineContainer.length > 0 ) { 10 inlineContainer.css( 'opacity', '0' ); 11 12 // 1. Inline - Center Alignment. 13 $.each( inlineContainer, function( key, value ) { 14 var thisContainer = $( this ); 15 var thisChildren = thisContainer.children(); 16 17 // Stop, if the children is empty. 18 if ( thisChildren.length < 1 ) { 19 return; 20 } 21 22 // Variables declaration for inline container. 23 var inlineStatus = false; 24 var inlineContent = ''; 25 var inlineTypes = []; 26 inlineTypes['left'] = ''; 27 inlineTypes['center'] = ''; 28 inlineTypes['right'] = ''; 29 30 var countEls = thisChildren.length; 31 32 $.each( thisChildren, function( key, value ) { 33 elSel = $( this ); 34 35 // Reduce element numbers on each iteration. 36 --countEls; 37 38 var elMarkup = elSel[0].outerHTML; 39 40 // Default element display for empty rendered markup is inline. 41 var elDisplay = 'inline'; 42 var elAlign = 'left'; 43 44 // MANDATORY: Check rendered markup is not empty. 45 if ( elMarkup ) { 46 // MANDATORY: Check display is exist or not. 47 elDisplay = elSel.data( 'display' ) || 'block'; 48 } 49 50 // MANDATORY: If display is inline. 51 if ( 'inline' == elDisplay ) { 52 elAlign = elSel.data( 'align' ) || 'left'; 53 54 // Save element with inline to inlineTypes base on alignment. 55 inlineTypes[ elAlign ] += elMarkup; 56 57 // Clear recent markup. 58 elMarkup = ''; 59 inlineStatus = true; 60 } 61 62 // MANDATORY: If inline container exist, place all the elements, and close container. 63 if ( inlineStatus && ( 'block' == elDisplay || countEls <= 0 ) ) { 64 // Inline container is exist, place all the elements, and close container. 65 inlineContent += setInlineContainer( inlineTypes ); 66 67 // Close container and set inline_container is false (closed). 68 inlineStatus = false; 69 inlineTypes['left'] = ''; 70 inlineTypes['center'] = ''; 71 inlineTypes['right'] = ''; 72 } 73 74 inlineContent += elMarkup; 75 } ); 76 77 thisContainer.html( inlineContent ); 78 } ); 79 80 inlineContainer.css( 'opacity', '1' ); 81 } 82 83 function setInlineContainer( inlineElements ) { 84 // Default container. 85 leftContainer = '<div class="mkhb-col__container-inline__left">' + inlineElements['left'] + '</div>'; 86 rightContainer = '<div class="mkhb-col__container-inline__right">' + inlineElements['right'] + '</div>'; 87 centerContainer = '<div class="mkhb-col__container-inline__center">' + inlineElements['center'] + '</div>'; 88 89 // Remove center if it's empty. Also check both of left and right side. 90 if ( '' == inlineElements['center'] ) { 91 centerContainer = ''; 92 93 if ( '' == inlineElements['left'] ) { 94 leftContainer = ''; 95 } 96 97 if ( '' == inlineElements['right'] ) { 98 rightContainer = ''; 99 } 100 } 101 102 // Clear left and right when both of them are empty and center is not empty. 103 if ( '' == inlineElements['left'] && '' == inlineElements['right'] ) { 104 leftContainer = ''; 105 rightContainer = ''; 106 } 107 108 columnContent = '<div class="mkhb-col__container-inline__wrap">' + leftContainer + centerContainer + rightContainer + '</div>'; 109 110 return columnContent; 111 } 112})( 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.