1mwColumns = { 2 3 selectWidget : mwResponsive.pageBlock + ':visible, DIV.' + mwResponsive.classPlaceholder, // Shortcut to common page widget selector. 4 selectWrap : 'DIV.mwColumns', // Columns wrapper selector. 5 widgets : false, // Shortcut to column widgets on page. 6 7 /** //** ----= init =--------------------------------------------------------------------------------------\**//** \ 8 * 9 * Initiates responsive columns math on page. 10 * 11 \**//** -------------------------------------------------------------------= by Mr.V!T @ Morad Media Inc. =----/** //**/ 12 init : function () { 13 14 var $this = this; 15 16 // Currently no need to update heights outside of liveEd 17 if ( typeof(mwLiveEd) == 'undefined' ) 18 return; 19 20 $this.updateRowsData(); 21 22 // Not using own resize even when liveEd is available 23 if ( typeof(mwLiveEd) != 'undefined' ) 24 return; 25 26 // Giving small initial pause, to catch with onload events 27 setTimeout( function () { 28 $this.setRowHeights(); 29 }, 1); 30 31 jQuery(window).resize( function ($e) { 32 $this.setRowHeights(); 33 }); //FUNC jQuery.resize 34 35 }, //FUNC init 36 37 /** //** ----= updateRowsData =------------------------------------------------------------------------------\**//** \ 38 * 39 * Searches for columns widgets on page and stores results. 40 * 41 \**//** -------------------------------------------------------------------= by Mr.V!T @ Morad Media Inc. =----/** //**/ 42 updateRowsData : function () { 43 var $this = this; 44 45 // Searching for wrappers - those represent columns widgets 46 // Inside each searching nearest areas, not proceeding deeper in blocks 47 // Storing areas found in block jQuery object 48 $this.widgets = jQuery($this.selectWrap).each( function () { 49 var $w = jQuery(this); 50 this.areas = $w.findExclude(mwResponsive.pageArea, mwResponsive.pageBlock); 51 }); // jQuery each widget 52 53 // Doing initial update 54 $this.setRowHeights(); 55 56 }, //FUNC updateRowsData 57 58 /** //** ----= setRowHeights =------------------------------------------------------------------------------\**//** \ 59 * 60 * Forces heights on child widgets. This results into a fancy grid, when all widgets and their borders are aligned 61 * propertly. 62 * 63 \**//** -------------------------------------------------------------------= by Mr.V!T @ Morad Media Inc. =----/** //**/ 64 setRowHeights : function ($noTimeout) { 65 66 var $this = this; 67 68 // Skipping if happen too early 69 if ( !$this.widgets ) 70 return; 71 72 // Looping through all widgets and updating each individually 73 $this.widgets.each( function () { 74 75 var $wrap = jQuery(this); 76 var $areas = this.areas; 77 78 // First - loosing height on wrapper and all child blocks, to get updated heights 79 $wrap.height(''); 80 81 // Currently not updating block heights 82 // $areas.children($this.selectWidget).height(''); 83 84 // No need to mess with heights when liveEd is disabled 85 if ( typeof(mwLiveEd) != 'undefined' && mwLiveEd.Disabled ) 86 return; 87 88 // Heights calculation might happen immideately if height forsed by own resize, 89 // or should be done with timout if happend from global event 90 // Thus wrapping this as helper funciton 91 var $heightsMath = function () { 92 93 // Fixing wrap height, to allow columns to use 100% height 94 $wrap.height( $wrap.height() ); 95 96 // Currently blocks height calculation is not used at all, 97 // as causes more troubles than actual usage 98 return; 99 100 // Can't proceed areas lock in case template used 101 // Results are little too unpredictable to attempt to calculate correct heights 102 if ( $wrap.is('.template') ) 103 return; 104 105 // Choosing tallest area, and using it's height to setup others 106 // All blocks in children area are always in column, so it's safe to calculate this way 107 var $height = $areas.maxHeight(); 108 109 // Looping thgought all areas inside, and all widgets inside, calculating summary heights 110 // Adding remaining height to last block 111 $areas.each( function () { 112 113 // Will count delta from total height 114 var $delta = $height; 115 116 var $children = jQuery(this).children($this.selectWidget); 117 $children.each( function () { 118 $delta -= jQuery(this).outerHeight(); 119 }); //jQuery each block 120 121 // Adding delta to last block in area
122 var $last = $children.last(); 123 $last.height( $last.height() + $delta ); 124 // $last.css('min-height', $last.height() + $delta); 125 126 }); //jQuery each area 127 128 } //FUNC $heightsMath 129 130 // Need to give small timeout for browser to rerender, and have fresh heights 131 // But can be skipped if doing own resizing as cols already have updated heights 132 /**/ 133 $heightsMath(); 134 /*/ 135 if ( $noTimeout ) 136 $heightsMath(); 137 else 138 setTimeout($heightsMath , 1); 139 /**/ 140 141 }); //jQuery each block 142 143 }, //FUNC setRowHeights 144 145} //OBJECT mwColumns 146 147jQuery( function () { 148 mwColumns.init(); 149}); //jQuery.onLoad
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.