1/** 2 * Spin Base JS 3 * Created by Alvin Bakker for Spin Internet Media 4 * Copyright 2016 5 */ 6 7var currentTallest = 0; 8var currentRowStart = 0; 9var rowDivs = new Array(); 10 11var Base; 12 13Base = { 14 init: function(cl) { 15 Base.setEqualHeight(cl); 16 Base.bindUIActions(); 17 $(window).resize(function() { 18 Base.setEqualHeight(cl); 19 }); 20 }, 21 22 setHeight: function(el, newHeight) { 23 el.data("originalHeight", (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight"))); 24 el.height(newHeight); 25 }, 26 27 setHeightToRatio: function(element) { 28 if (element) { 29 element.each(function(){ 30 var ratio = $(this).attr('data-ratio'); 31 if(ratio) { 32 var part = ratio.split(':'); 33 var w = parseInt(part[0]); 34 var h = parseInt(part[1]); 35 36 var srcW = $(this).width(); 37 $(this).height((srcW / w) * h); 38 } 39 }); 40 } 41 }, 42 43 getOriginalHeight: function(el) { 44 return (el.data("originalHeight") == undefined) ? (el.height()) : (el.data("originalHeight")); 45 }, 46 47 setEqualHeight: function(cl) { 48 $('.'+cl).each(function() { 49 var $el = $(this); 50 var topPosition = $el.position().top; 51 52 /** 53 * force first element to not have top = 0 54 */ 55 if(currentRowStart == 0) currentRowStart = topPosition; 56 57 if (currentRowStart != topPosition) { 58 for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { 59 Base.setHeight(rowDivs[currentDiv], currentTallest); 60 } 61 rowDivs.length = 0; 62 currentRowStart = topPosition; 63 currentTallest = Base.getOriginalHeight($el); 64 rowDivs.push($el); 65 } else { 66 rowDivs.push($el); 67 currentTallest = (currentTallest < Base.getOriginalHeight($el)) ? (Base.getOriginalHeight($el)) : (currentTallest); 68 } 69 }); 70 for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { 71 Base.setHeight(rowDivs[currentDiv], currentTallest); 72 } 73 }, 74 75 bindUIActions: function () { 76 77 } 78 79};
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.