1/** 2 * Gridzy v1.3 3 * 4 * Copyright 2016, Helmut Wandl 5 */ 6 7var Gridzy=function(){"use strict";function e(e,t){var i="undefined"==typeof e.gridzy,n=i?this:e.gridzy,a=0;return e.gridzy=n,n._resetOptionParameters(),i?(n.id=++d,n.itemIdAutoIncrement=0,n._insertQueue={maxQueueTime:1e3,maxQuietTime:400,items:[],lastProcess:null,timer:null},n._forceRecalculateValues=!1,n._updateOptionParameters(t),n._allItems=[],n._validItems=[],n._validItemsOptWidthAll=0,n._validItemsOptionDesiredElementHeight=null,n._validItemsOptionHideBoxOnMissingImage=null,n._element=e,m.addClass(n._element,"gridzyMain"),n._container=document.createElement("div"),n._container.className="gridzyContainer",n._container.style.position="relative",n._container.style.padding="0",n._container.style.border="0",n._container.style.margin="0",n._container.style.display="block",m.prependChild(e,n._container),n.append(e.children),a=n._container.clientWidth,m.addEventListener(window,"resize",function(){n._container.clientWidth!==a&&(a=n._container.clientWidth,n.render())})):n.setOptions(t),n}var t=0,i=1,n=2,a=3,s=4,r=1,o=2,l=3,d=0,u=null,m={expectArray:function(e){return m.isArraylike(e)?e:[e]},isArraylike:function(e){return e.length===+e.length&&"string"!=typeof e},forceArrayObject:function(e){if(!e)return[];if("toArray"in Object(e))return e.toArray();for(var t=e.length||0,i=new Array(t);t--;)i[t]=e[t];return i},eachOfArray:function(e,t,i){var n;for(n=0;n<e.length;n++)i?t.apply(i,[e[n],n]):t(e[n],n)},domWalk:function(e,t){for(t(e),e=e.firstChild;e;)m.domWalk(e,t),e=e.nextSibling},prependChild:function(e,t){e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)},indexOfArray:Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var i=0,n=e.length;n>i;i++)if(i in e&&e[i]===t)return i;return-1},inArray:function(e,t){return-1!==m.indexOfArray(e,t)},getComputedStyle:window.getComputedStyle?function(e){return getComputedStyle(e)}:function(e){return e.currentStyle},addEventListener:document.addEventListener?function(e,t,i){e.addEventListener(t,i,!1)}:function(e,t,i){e.attachEvent("on"+t,function(t){i.apply(e,[t])})},addClass:document.createElement("div").classList?function(e,t){e.classList.add(t)}:function(e,t){e.className&&-1<e.className.search(new RegExp("(^|\\s+)"+t+"($|\\s+)"))||(e.className=(e.className+" "+t).replace(/\s+/," ").replace(/(^\s+|\s+$)/,""))},removeClass:document.createElement("div").classList?function(e,t){e.classList.remove(t)}:function(e,t){e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"($|\\s+)")," ").replace(/\s+/," ").replace(/(^\s+|\s+$)/,"")},expectNaturalImageSize:function(){var e,t,i=[];return t=function(){var t;for(t=0;t<i.length;t++)i[t].imgB.width&&i[t].imgB.height&&(void 0===i[t].img.naturalWidth&&(i[t].img.naturalWidth=i[t].imgB.width),void 0===i[t].img.naturalHeight&&(i[t].img.naturalHeight=i[t].imgB.height)),(i[t].img.naturalWidth&&i[t].img.naturalHeight||i[t].ready)&&(i[t].callback(i[t].img,!i[t].error),i.splice(t,1),t--);i.length||(clearInterval(e),e=null)},function(n,a){var s={img:n,callback:a||function(){},imgB:document.createElement("img"),ready:!1,error:!1};m.addEventListener(s.imgB,"load",function(){s.ready=!0}),m.addEventListener(s.imgB,"error",function(){s.ready=!0,s.error=!0}),s.imgB.src=s.img.src,i.push(s),e||(e=setInterval(t,0))}}(),processLazyLoading:function(){if(null!==u){for(var e,t,i,n=u.length,a=Math.max(document.documentElement.clientWidth,window.innerWidth||0),s=Math.max(document.documentElement.clientHeight,window.innerHeight||0),r=[],o=1.5;n--;)e=u[n].image.getBoundingClientRect(),t=e.right/(a+(e.right-e.left)),i=e.bottom/(s+(e.bottom-e.top)),t>1-o&&o>t&&i>1-o&&o>i&&r.push(u.splice(n,1)[0]);for(n=0;n<r.length;n++){m.addClass(r[n].item.element,"gridzyItemLoading"),r[n].item.element.appendChild(r[n].item.progressIndicator);try{r[n].image.naturalWidth=void 0,r[n].image.naturalHeight=void 0}catch(l){}r[n].image.src=r[n].src}}}};return e.prototype={setOptions:function(e){var t=this;t._updateOptionParameters(e),t.render(),m.processLazyLoading()},getOption:function(e){var t=this,i=null;switch(typeof t._options[e]){case"function":i=t._options[e](t);break;default:i=t._options[e]}return i},render:function(){var e,t,i,n=this,a=n._calculateGrid(),s=a.rows.length,r=n.getOption("autoFontSize");for(n._options.onBeforeRender(n);s--;)for(e=a.rows[s],i=e.items.length;i--;)t=e.items[i],t.element.style.cssText="position: absolute; width: "+t.displaySizeX+"px; height: "+e.displaySizeY+"px; left: "+t.displayPosX+"px; top: "+e.displayPosY+"px; font-size: "+(r?100*t.displaySizeX/t.size[0]+"%":"100%")+"; ";n._container.style.height=a.size[1]+"px",n._options.onRender(n)},append:function(e){var o,l=this;e=m.forceArrayObject(m.expectArray(e)),o=m.indexOfArray(e,l._container),o>-1&&e.splice(o,1),0===l._insertQueue.items.length&&(l._insertQueue.lastProcess=(new Date).getTime()),m.eachOfArray(e,function(e){e.style.display="block",e.style.visibility="hidden";var o={id:++l.itemIdAutoIncrement,progressIndicator:document.createElement("span"),element:document.createElement("span"),contentElement:e,size:[0,0],ratio:0,failures:!1,status:r,images:[],imagesStatus:[],imagesInfo:[]};m.addClass(o.progressIndicator,"gridzyItemProgressIndicator"),m.addClass(o.element,"gridzyItem"),m.addClass(o.element,"gridzyItemLoading"),o.element.appendChild(o.progressIndicator),o.element.style.position="absolute",o.element.style.visibility="hidden",m.domWalk(e,function(e){if("IMG"===e.nodeName){o.images.push(e);var t=e.getAttribute("width"),a=e.getAttribute("height"),s=e.getAttribute("data-gridzylazysrc"),r=e.getAttribute("src");!r&&s&&(t&&a?e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEHAAEALAAAAAABAAEAAAICTAEAOw==":(e.src=s,s=null)),o.imagesInfo.push({styleWidth:e.style.width,styleHeight:e.style.height,attributeWidth:t,attributeHeight:a,lazySrc:s}),null!==t&&null!==a&&parseInt(t)>0&&parseInt(a)>0?o.imagesStatus.push(n):o.imagesStatus.push(i)}}),m.eachOfArray(o.images,function(e,i){var n=function(){o.imagesStatus[i]=e.naturalWi
7dth?s:t,e.naturalWidth||m.expectNaturalImageSize(e,function(n,r){o.imagesStatus[i]=r&&e.naturalWidth?e.complete?s:a:t,l._onImageReady(o)}),l._onImageFinished(o)},r=function(){o.imagesStatus[i]=t,l._onImageFinished(o)};m.addEventListener(e,"load",n),m.addEventListener(e,"error",r),e.complete&&n(),o.imagesInfo[i].lazySrc||m.expectNaturalImageSize(e,function(n,r){o.imagesStatus[i]=r&&e.naturalWidth?e.complete?s:a:t,l._onImageReady(o)})}),l._allItems.push(o),l._container.appendChild(o.element),l._onImageReady(o),l._onImageFinished(o)})},_processInsertQueue:function(e){var t,i,n,a,s,r,o=this,d=o._insertQueue.lastProcess<(new Date).getTime()-o._insertQueue.maxQueueTime,u=[],c=[],g=o.getOption("preventInitialAnimation"),p=[];if(null!==o._insertQueue.timer&&(clearTimeout(o._insertQueue.timer),o._insertQueue.timer=null),e||d){for(t=o._insertQueue.items.shift();t;)c.push(t),m.prependChild(t.item.element,t.contentElement),t=o._insertQueue.items.shift();for(r=c.length;r--;)for(t=c[r],a=t.item.images.length;a--;)n=t.item.imagesInfo[a],n.attributeWidth||t.item.images[a].offsetWidth||!t.item.images[a].naturalWidth||(n.attributeWidth=t.item.images[a].naturalWidth),n.attributeHeight||t.item.images[a].offsetHeight||!t.item.images[a].naturalHeight||(n.attributeHeight=t.item.images[a].naturalHeight),(n.attributeWidth||n.attributeHeight)&&(s=m.getComputedStyle(t.item.images[a]),(parseInt(s.width)<40||"auto"===s.width||n.lazySrc)&&n.attributeWidth&&!n.styleWidth&&u.push({image:t.item.images[a],definition:"width",value:n.attributeWidth+"px"}),(parseInt(s.height)<40||"auto"===s.height||n.lazySrc)&&n.attributeHeight&&!n.styleHeight&&u.push({image:t.item.images[a],definition:"height",value:n.attributeHeight+"px"})),n.lazySrc&&p.push({item:t.item,image:t.item.images[a],src:n.lazySrc});for(i=u.length;i--;)u[i].image.style[u[i].definition]=u[i].value,u[i].image.style.display="none";for(document.body.offsetWidth,i=u.length;i--;)u[i].image.style.display="";for(r=c.length;r--;)t=c[r],t.item.size=[t.contentElement.offsetWidth,t.contentElement.offsetHeight],t.item.ratio=t.item.size[0]/t.item.size[1];for(i=u.length;i--;)u[i].image.style[u[i].definition]="";for(r=c.length;r--;)t=c[r],m.addClass(t.contentElement,"gridzyItemContent"),t.contentElement.style.width="100%",t.contentElement.style.height="100%",t.item.status=l;for(g&&(o._element.className=o._element.className.replace(/(^|\s)gridzyAnimated(\s|$)/,"$1gridzyAnimatedOnLoad$2")),o._forceRecalculateValues=!0,o.render(),g&&(document.body.offsetWidth,o._element.className=o._element.className.replace(/(^|\s)gridzyAnimatedOnLoad(\s|$)/,"$1gridzyAnimated$2")),r=c.length;r--;)t=c[r],t.item.element.style.visibility="",t.item.contentElement.style.visibility="";p.length&&o._addImagesToLazyLoadQueue(p),o._insertQueue.lastProcess=(new Date).getTime()}else o._insertQueue.timer=setTimeout(function(){o._processInsertQueue(!0)},o._insertQueue.maxQuietTime)},_addImagesToLazyLoadQueue:function(e){null===u&&e.length&&(u=[],m.addEventListener(window,"resize",m.processLazyLoading),m.addEventListener(window,"scroll",m.processLazyLoading)),u=u.concat(e),m.processLazyLoading()},_addToInsertQueue:function(e,t){this._insertQueue.items.push({contentElement:e,item:t}),this._processInsertQueue(!1)},_onImageFinished:function(e){var s=this,r=e.failures;m.inArray(e.imagesStatus,i)||m.inArray(e.imagesStatus,n)||m.inArray(e.imagesStatus,a)||(m.inArray(e.imagesStatus,t)&&(e.failures=!0),e.status===l&&r!==e.failures&&(s._forceRecalculateValues=!0,s.render()),m.removeClass(e.element,"gridzyItemLoading"),e.progressIndicator&&e.progressIndicator.parentNode&&e.progressIndicator.parentNode===e.element&&e.element.removeChild(e.progressIndicator))},_onImageReady:function(e){var n=this,a=e.failures;m.inArray(e.imagesStatus,t)?e.failures=!0:e.failures=!1,e.status===l&&a!==e.failures&&(n._forceRecalculateValues=!0,n.render()),e.status!==r||m.inArray(e.imagesStatus,i)||(e.status=o,n._addToInsertQueue(e.contentElement,e))},_resetOptionParameters:function(){this._options={spaceBetweenElements:1,desiredElementHeight:200,autoFontSize:!1,hideBoxOnMissingImage:!0,preventInitialAnimation:!1,onBeforeOptionsChanged:function(){},onOptionsChanged:function(){},onBeforeRender:function(){},onRender:function(){}}},_updateOptionParameters:function(e){var t=this;e=e||{},t._options.onBeforeOptionsChanged(t),"undefined"!=typeof e.spaceBetweenElements&&(t._options.spaceBetweenElements="function"==typeof e.spaceBetweenElements?e.spaceBetweenElements:+e.spaceBetweenElements),"undefined"!=typeof e.desiredElementHeight&&(t._options.desiredElementHeight="function"==typeof e.desiredElementHeight?e.desiredElementHeight:+e.desiredElementHeight),"undefined"!=typeof e.autoF
7ontSize&&(t._options.autoFontSize="function"==typeof e.autoFontSize?e.autoFontSize:!!e.autoFontSize),"undefined"!=typeof e.hideBoxOnMissingImage&&(t._options.hideBoxOnMissingImage="function"==typeof e.hideBoxOnMissingImage?e.hideBoxOnMissingImage:!!e.hideBoxOnMissingImage),"undefined"!=typeof e.preventInitialAnimation&&(t._options.preventInitialAnimation="function"==typeof e.preventInitialAnimation?e.preventInitialAnimation:!!e.preventInitialAnimation),"function"==typeof e.onBeforeOptionsChanged&&(t._options.onBeforeOptionsChanged=e.onBeforeOptionsChanged),"function"==typeof e.onOptionsChanged&&(t._options.onOptionsChanged=e.onOptionsChanged),"function"==typeof e.onBeforeRender&&(t._options.onBeforeRender=e.onBeforeRender),"function"==typeof e.onRender&&(t._options.onRender=e.onRender),t._options.onOptionsChanged(t)},_precalculateValues:function(e){var t,i=this,n=i._allItems,a=[],s=0,r=n.length,o=i.getOption("desiredElementHeight"),d=i.getOption("hideBoxOnMissingImage");if(!e||i._validItemsOptionDesiredElementHeight!==o||i._validItemsOptionHideBoxOnMissingImage!==d){for(;r--;)t=n[r],t.status===l&&(d&&t.failures?t.element.style.display="none":t.size[0]&&t.size[1]&&(t.element.style.display="",a.unshift(t),t.optWidth=o*t.size[0]/t.size[1],s+=t.optWidth));i._validItemsOptionDesiredElementHeight=o,i._validItemsOptionHideBoxOnMissingImage=d,i._validItems=a,i._validItemsOptWidthAll=s,i._forceRecalculateValues=!1}},_calculateGrid:function(){var e,t,i,n,a,s,r,o,l,d,u,m,c=this,g=c.getOption("spaceBetweenElements"),p=c._container.clientWidth,h=0,f={rows:[],size:[p,0]},y=f.rows,_=0,I=0;for(this._precalculateValues(!this._forceRecalculateValues),i=c._validItems,n=i.length,s=c._validItemsOptWidthAll,r=s/(Math.round((s+g*n)/(p+g))||1),e=n;e--;)a=i[e],h+a.optWidth/2>r*y.length&&y.unshift({displaySizeY:0,displayPosY:0,ratioAll:0,items:[]}),h+=a.optWidth,y[0].ratioAll+=a.ratio,y[0].items.unshift(a);for(o=y.length,u=null,e=0;o>e;e++){for(l=y[e],_=0,I=0,d=l.items.length,m=p-(d-1)*g,t=0;d>t;t++)a=l.items[t],a.displaySizeX=Math.round(a.ratio/l.ratioAll*m),a.displayPosX=_+t*g,_+=a.displaySizeX,t===d-1&&_!==m&&(a.displaySizeX+=m-_),I+=a.displaySizeX/a.ratio;l.displaySizeY=Math.round(I/d),l.displayPosY=u?u.displayPosY+u.displaySizeY+g:0,f.size[1]+=l.displaySizeY+(e?g:0),u=l}return f}},"undefined"!=typeof jQuery&&"undefined"!=typeof jQuery.fn&&(jQuery.fn.gridzy=function(t){return this.each(function(){jQuery(this).data("gridzy",new e(this,t))})}),e}();
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.