vendor: 4,116 bytes, lines 1-146
1(function(window, factory){ 2if(typeof define=='function'&&define.amd){ 3define(factory); 4}else if(typeof module=='object'&&module.exports){ 5module.exports=factory(); 6}else{ 7window.Colcade=factory(); 8}}(window, function factory(){ 9function Colcade(element, options){ 10element=getQueryElement(element); 11if(element&&element.colcadeGUID){ 12var instance=instances[ element.colcadeGUID ]; 13instance.option(options); 14return instance; 15} 16this.element=element; 17this.options={}; 18this.option(options); 19this.create(); 20} 21var proto=Colcade.prototype; 22proto.option=function(options){ 23this.options=extend(this.options, options); 24}; 25var GUID=0; 26var instances={}; 27proto.create=function(){ 28this.errorCheck(); 29var guid=this.guid=++GUID; 30this.element.colcadeGUID=guid; 31instances[ guid ]=this; 32this.reload(); 33this._windowResizeHandler=this.onWindowResize.bind(this); 34this._loadHandler=this.onLoad.bind(this); 35window.addEventListener('resize', this._windowResizeHandler); 36this.element.addEventListener('load', this._loadHandler, true); 37}; 38proto.errorCheck=function(){ 39var errors=[]; 40if(!this.element){ 41errors.push('Bad element: ' + this.element); 42} 43if(!this.options.columns){ 44errors.push('columns option required: ' + this.options.columns); 45} 46if(!this.options.items){ 47errors.push('items option required: ' + this.options.items); 48} 49if(errors.length){ 50throw new Error('[Colcade error] ' + errors.join('. ')); 51}}; 52proto.reload=function(){ 53this.updateColumns(); 54this.updateItems(); 55this.layout(); 56}; 57proto.updateColumns=function(){ 58this.columns=querySelect(this.options.columns, this.element); 59}; 60proto.updateItems=function(){ 61this.items=querySelect(this.options.items, this.element); 62}; 63proto.getActiveColumns=function(){ 64return this.columns.filter(function(column){ 65var style=getComputedStyle(column); 66return style.display!='none'; 67}); 68}; 69proto.layout=function(){ 70this.activeColumns=this.getActiveColumns(); 71this._layout(); 72}; 73proto._layout=function(){ 74this.columnHeights=this.activeColumns.map(function(){ 75return 0; 76}); 77this.layoutItems(this.items); 78}; 79proto.layoutItems=function(items){ 80items.forEach(this.layoutItem, this); 81}; 82proto.layoutItem=function(item){ 83var minHeight=Math.min.apply(Math, this.columnHeights); 84var index=this.columnHeights.indexOf(minHeight); 85this.activeColumns[ index ].appendChild(item); 86this.columnHeights[ index ] +=item.offsetHeight||1; 87}; 88proto.append=function(elems){ 89var items=this.getQueryItems(elems); 90this.items=this.items.concat(items); 91this.layoutItems(items); 92}; 93proto.prepend=function(elems){ 94var items=this.getQueryItems(elems); 95this.items=items.concat(this.items); 96this._layout(); 97}; 98proto.getQueryItems=function(elems){ 99elems=makeArray(elems); 100var fragment=document.createDocumentFragment(); 101elems.forEach(function(elem){ 102fragment.appendChild(elem); 103}); 104return querySelect(this.options.items, fragment); 105}; 106proto.measureColumnHeight=function(elem){ 107var boundingRect=this.element.getBoundingClientRect(); 108this.activeColumns.forEach(function(column, i){ 109if(!elem||column.contains(elem)){ 110var lastChildRect=column.lastElementChild.getBoundingClientRect(); 111this.columnHeights[ i ]=lastChildRect.bottom - boundingRect.top; 112}}, this); 113}; 114proto.onWindowResize=function(){ 115clearTimeout(this.resizeTimeout); 116this.resizeTimeout=setTimeout(function(){ 117this.onDebouncedResize(); 118}.bind(this), 100); 119}; 120proto.onDebouncedResize=function(){ 121var activeColumns=this.getActiveColumns(); 122var isSameLength=activeColumns.length==this.activeColumns.length; 123var isSameColumns=true; 124this.activeColumns.forEach(function(column, i){ 125isSameColumns=isSameColumns&&column==activeColumns[i]; 126}); 127if(isSameLength&&isSameColumns){ 128return; 129} 130this.activeColumns=activeColumns; 131this._layout(); 132}; 133proto.onLoad=function(event){ 134this.measureColumnHeight(event.target); 135}; 136proto.destroy=function(){ 137this.items.forEach(function(item){ 138this.element.appendChild(item); 139}, this); 140window.removeEventListener('resize', this._windowResizeHandler); 141this.element.removeEventListener('load', this._loadHandler, true); 142delete this.element.colcadeGUID; 143delete instances[ this.guid ]; 144}; 145docReady(function(){ 146var dataElems=querySelect('[data-colcade]');
147dataElems.forEach(htmlInit); 148}); 149function htmlInit(elem){ 150var attr=elem.getAttribute('data-colcade'); 151var attrParts=attr.split(','); 152var options={}; 153attrParts.forEach(function(part){ 154var pair=part.split(':'); 155var key=pair[0].trim(); 156var value=pair[1].trim(); 157options[ key ]=value; 158}); 159new Colcade(elem, options); 160} 161Colcade.data=function(elem){ 162elem=getQueryElement(elem); 163var id=elem&&elem.colcadeGUID; 164return id&&instances[ id ]; 165}; 166Colcade.makeJQueryPlugin=function($){ 167$=$||window.jQuery; 168if(!$){ 169return; 170} 171$.fn.colcade=function(arg0 ){ 172if(typeof arg0=='string'){ 173var args=Array.prototype.slice.call(arguments, 1); 174return methodCall(this, arg0, args); 175} 176plainCall(this, arg0); 177return this; 178}; 179function methodCall($elems, methodName, args){ 180var returnValue; 181$elems.each(function(i, elem){ 182var colcade=$.data(elem, 'colcade'); 183if(!colcade){ 184return; 185} 186var value=colcade[ methodName ].apply(colcade, args); 187returnValue=returnValue===undefined ? value:returnValue; 188}); 189return returnValue!==undefined ? returnValue:$elems; 190} 191function plainCall($elems, options){ 192$elems.each(function(i, elem){ 193var colcade=$.data(elem, 'colcade'); 194if(colcade){ 195colcade.option(options); 196colcade.layout(); 197}else{ 198colcade=new Colcade(elem, options); 199$.data(elem, 'colcade', colcade); 200}}); 201}}; 202Colcade.makeJQueryPlugin(); 203function extend(a, b){ 204for(var prop in b){ 205a[ prop ]=b[ prop ]; 206} 207return a; 208} 209function makeArray(obj){ 210var ary=[]; 211if(Array.isArray(obj)){ 212ary=obj; 213}else if(obj&&typeof obj.length=='number'){ 214for(var i=0; i < obj.length; i++){ 215ary.push(obj[i]); 216}}else{ 217ary.push(obj); 218} 219return ary; 220} 221function querySelect(selector, elem){ 222elem=elem||document; 223var elems=elem.querySelectorAll(selector); 224return makeArray(elems); 225} 226function getQueryElement(elem){ 227if(typeof elem=='string'){ 228elem=document.querySelector(elem); 229} 230return elem; 231} 232function docReady(onReady){ 233if(document.readyState=='complete'){ 234onReady(); 235return; 236} 237document.addEventListener('DOMContentLoaded', onReady); 238} 239return Colcade; 240})); 241var objectFitImages=function(){"use strict";function t(t,e){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='"+t+"' height='"+e+"'%3E%3C/svg%3E"}function e(t){if(t.srcset&&!p&&window.picturefill){var e=window.picturefill._;t[e.ns]&&t[e.ns].evaled||e.fillImg(t,{reselect:!0}),t[e.ns].curSrc||(t[e.ns].supported=!1,e.fillImg(t,{reselect:!0})),t.currentSrc=t[e.ns].curSrc||t.src}}function i(t){for(var e,i=getComputedStyle(t).fontFamily,r={};null!==(e=u.exec(i));)r[e[1]]=e[2];return r}function r(e,i,r){var n=t(i||1,r||0);b.call(e,"src")!==n&&h.call(e,"src",n)}function n(t,e){t.naturalWidth?e(t):setTimeout(n,100,t,e)}function c(t){var c=i(t),o=t[l];if(c["object-fit"]=c["object-fit"]||"fill",!o.img){if("fill"===c["object-fit"])return;if(!o.skipTest&&f&&!c["object-position"])return}if(!o.img){o.img=new Image(t.width,t.height),o.img.srcset=b.call(t,"data-ofi-srcset")||t.srcset,o.img.src=b.call(t,"data-ofi-src")||t.src,h.call(t,"data-ofi-src",t.src),t.srcset&&h.call(t,"data-ofi-srcset",t.srcset),r(t,t.naturalWidth||t.width,t.naturalHeight||t.height),t.srcset&&(t.srcset="");try{s(t)}catch(t){window.console&&console.warn("https://bit.ly/ofi-old-browser")}}e(o.img),t.style.backgroundImage='url("'+(o.img.currentSrc||o.img.src).replace(/"/g,'\\"')+'")',t.style.backgroundPosition=c["object-position"]||"center",t.style.backgroundRepeat="no-repeat",t.style.backgroundOrigin="content-box",/scale-down/.test(c["object-fit"])?n(o.img,function(){o.img.naturalWidth>t.width||o.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=c["object-fit"].replace("none","auto").replace("fill","100% 100%"),n(o.img,function(e){r(t,e.naturalWidth,e.naturalHeight)})}function s(t){var e={get:function(e){return t[l].img[e?e:"src"]},set:function(e,i){return t[l].img[i?i:"src"]=e,h.call(t,"data-ofi-"+i,e),c(t),e}};Object.defineProperty(t,"src",e),Object.defineProperty(t,"currentSrc",{get:function(){return e.get("currentSrc")}}),Object.defineProperty(t,"srcset",{get:function(){return e.get("srcset")},set:function(t){return e.set(t,"srcset")}})}function o(){function t(t,e){return t[l]&&t[l].img&&("src"===e||"srcset"===e)?t[l].img:t}d||(HTMLImageElement.prototype.getAttribute=function(e){return b.call(t(this,e),e)},HTMLImageElement.prototype.setAttribute=function(e,i){return h.call(t(this,e),e,String(i))})}function a(t,e){var i=!y&&!t;if(e=e||{},t=t||"img",d&&!e.skipTest||!m)return!1;"img"===t?t=document.getElementsByTagName("img"):"string"==typeof t?t=document.querySelectorAll(t):"length"in t||(t=[t]);for(var r=0;r<t.length;r++)t[r][l]=t[r][l]||{skipTest:e.skipTest},c(t[r]);i&&(document.body.addEventListener("load",function(t){"IMG"===t.target.tagName&&a(t.target,{skipTest:e.skipTest})},!0),y=!0,t="img"),e.watchMQ&&window.addEventListener("resize",a.bind(null,t,{skipTest:e.skipTest}))}var l="bfred-it:object-fit-images",u=/(object-fit|object-position)\s*:\s*([-.\w\s%]+)/g,g="undefined"==typeof Image?{style:{"object-position":1}}:new Image,f="object-fit"in g.style,d="object-position"in g.style,m="background-size"in g.style,p="string"==typeof g.currentSrc,b=g.getAttribute,h=g.setAttribute,y=!1;return a.supportsObjectFit=f,a.supportsObjectPosition=d,o(),a}();
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.