1(function(){var Instafeed;Instafeed=(function(){function Instafeed2(params,context){var option,value;if(this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"none",links:!0,mock:!1,useHttp:!1},typeof params=="object")for(option in params)value=params[option],this.options[option]=value;this.context=context!=null?context:this,this.unique=this._genKey()}return Instafeed2.prototype.hasNext=function(){return typeof this.context.nextUrl=="string"&&this.context.nextUrl.length>0},Instafeed2.prototype.next=function(){return this.hasNext()?this.run(this.context.nextUrl):!1},Instafeed2.prototype.run=function(url){var header,instanceName,script;if(typeof this.options.clientId!="string"&&typeof this.options.accessToken!="string")throw new Error("Missing clientId or accessToken.");if(typeof this.options.accessToken!="string"&&typeof this.options.clientId!="string")throw new Error("Missing clientId or accessToken.");return this.options.before!=null&&typeof this.options.before=="function"&&this.options.before.call(this),typeof document!="undefined"&&document!==null&&(script=document.createElement("script"),script.id="instafeed-fetcher",script.src=url||this._buildUrl(),header=document.getElementsByTagName("head"),header[0].appendChild(script),instanceName="instafeedCache"+this.unique,window[instanceName]=new Instafeed2(this.options,this),window[instanceName].unique=this.unique),!0},Instafeed2.prototype.parse=function(response){var anchor,childNodeCount,childNodeIndex,childNodesArr,e,eMsg,fragment,header,htmlString,httpProtocol,i,image,imageObj,imageString,imageUrl,images,img,imgHeight,imgOrient,imgUrl,imgWidth,instanceName,j,k,len,len1,len2,node,parsedLimit,reverse,sortSettings,targetEl,tmpEl;if(typeof response!="object"){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}if(response.meta.code!==200){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,response.meta.error_message),!1;throw new Error("Error from Instagram: "+response.meta.error_message)}if(response.data.length===0){if(this.options.error!=null&&typeof this.options.error=="function")return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram")}if(this.options.success!=null&&typeof this.options.success=="function"&&this.options.success.call(this,response),this.context.nextUrl="",response.pagination!=null&&(this.context.nextUrl=response.pagination.next_url),this.options.sortBy!=="none")switch(this.options.sortBy==="random"?sortSettings=["","random"]:sortSettings=this.options.sortBy.split("-"),reverse=sortSettings[0]==="least",sortSettings[1]){case"random":response.data.sort(function(){return .5-Math.random()});break;case"recent":response.data=this._sortBy(response.data,"created_time",reverse);break;case"liked":response.data=this._sortBy(response.data,"likes.count",reverse);break;case"commented":response.data=this._sortBy(response.data,"comments.count",reverse);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.")}if(typeof document!="undefined"&&document!==null&&this.options.mock===!1){if(images=response.data,parsedLimit=parseInt(this.options.limit,10),this.options.limit!=null&&images.length>parsedLimit&&(images=images.slice(0,parsedLimit)),fragment=document.createDocumentFragment(),this.options.filter!=null&&typeof this.options.filter=="function"&&(images=this._filter(images,this.options.filter)),this.options.template!=null&&typeof this.options.template=="string"){for(htmlString="",imageString="",imgUrl="",tmpEl=document.createElement("div"),i=0,len=images.length;i<len;i++){if(image=images[i],imageObj=image.images[this.options.resolution],typeof imageObj!="object")throw eMsg="No image found for resolution: "+this.options.resolution+".",new Error(eMsg);imgWidth=imageObj.width,imgHeight=imageObj.height,imgOrient="square",imgWidth>imgHeight&&(imgOrient="landscape"),imgWidth<imgHeight&&(imgOrient="portrait"),imageUrl=imageObj.url,httpProtocol=window.location.protocol.indexOf("http")>=0,httpProtocol&&!this.options.useHttp&&(imageUrl=imageUrl.replace(/https?:\/\//,"//")),imageString=this._makeTemplate(this.options.template,{model:image,id:image.id,link:image.link,type:image.type,image:imageUrl,width:imgWidth,height:imgHeight,orientation:imgOrient,caption:this._getObjectProperty(image,"caption.text"),likes:image.likes.count,comments:image.comments.count,location:this._getObjectProperty(image,"location.name")}
1),htmlString+=imageString}for(tmpEl.innerHTML=htmlString,childNodesArr=[],childNodeIndex=0,childNodeCount=tmpEl.childNodes.length;childNodeIndex<childNodeCount;)childNodesArr.push(tmpEl.childNodes[childNodeIndex]),childNodeIndex+=1;for(j=0,len1=childNodesArr.length;j<len1;j++)node=childNodesArr[j],fragment.appendChild(node)}else for(k=0,len2=images.length;k<len2;k++){if(image=images[k],img=document.createElement("img"),imageObj=image.images[this.options.resolution],typeof imageObj!="object")throw eMsg="No image found for resolution: "+this.options.resolution+".",new Error(eMsg);imageUrl=imageObj.url,httpProtocol=window.location.protocol.indexOf("http")>=0,httpProtocol&&!this.options.useHttp&&(imageUrl=imageUrl.replace(/https?:\/\//,"//")),img.src=imageUrl,this.options.links===!0?(anchor=document.createElement("a"),anchor.href=image.link,anchor.appendChild(img),fragment.appendChild(anchor)):fragment.appendChild(img)}if(targetEl=this.options.target,typeof targetEl=="string"&&(targetEl=document.getElementById(targetEl)),targetEl==null)throw eMsg='No element with id="'+this.options.target+'" on page.',new Error(eMsg);targetEl.appendChild(fragment),header=document.getElementsByTagName("head")[0],header.removeChild(document.getElementById("instafeed-fetcher")),instanceName="instafeedCache"+this.unique,window[instanceName]=void 0;try{delete window[instanceName]}catch(_error){e=_error}}return this.options.after!=null&&typeof this.options.after=="function"&&this.options.after.call(this),!0},Instafeed2.prototype._buildUrl=function(){var base,endpoint,final;switch(base="https://api.instagram.com/v1",this.options.get){case"popular":endpoint="media/popular";break;case"tagged":if(!this.options.tagName)throw new Error("No tag name specified. Use the 'tagName' option.");endpoint="tags/"+this.options.tagName+"/media/recent";break;case"location":if(!this.options.locationId)throw new Error("No location specified. Use the 'locationId' option.");endpoint="locations/"+this.options.locationId+"/media/recent";break;case"user":if(!this.options.userId)throw new Error("No user specified. Use the 'userId' option.");endpoint="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.")}return final=base+"/"+endpoint,this.options.accessToken!=null?final+="?access_token="+this.options.accessToken:final+="?client_id="+this.options.clientId,this.options.limit!=null&&(final+="&count="+this.options.limit),final+="&callback=instafeedCache"+this.unique+".parse",final},Instafeed2.prototype._genKey=function(){var S4;return S4=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},""+S4()+S4()+S4()+S4()},Instafeed2.prototype._makeTemplate=function(template,data){var output,pattern,ref,varName,varValue;for(pattern=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,output=template;pattern.test(output);)varName=output.match(pattern)[1],varValue=(ref=this._getObjectProperty(data,varName))!=null?ref:"",output=output.replace(pattern,function(){return""+varValue});return output},Instafeed2.prototype._getObjectProperty=function(object,property){var piece,pieces;for(property=property.replace(/\[(\w+)\]/g,".$1"),pieces=property.split(".");pieces.length;)if(piece=pieces.shift(),object!=null&&piece in object)object=object[piece];else return null;return object},Instafeed2.prototype._sortBy=function(data,property,reverse){var sorter;return sorter=function(a,b){var valueA,valueB;return valueA=this._getObjectProperty(a,property),valueB=this._getObjectProperty(b,property),reverse?valueA>valueB?1:-1:valueA<valueB?1:-1},data.sort(sorter.bind(this)),data},Instafeed2.prototype._filter=function(images,filter){var filteredImages,fn,i,image,len;for(filteredImages=[],fn=function(image2){if(filter(image2))return filteredImages.push(image2)},i=0,len=images.length;i<len;i++)image=images[i],fn(image);return filteredImages},Instafeed2})(),(function(root,factory){return typeof define=="function"&&define.amd?define([],factory):typeof module=="object"&&module.exports?module.exports=factory():root.Instafeed=factory()})(this,function(){return Instafeed})}).call(this); 2//# sourceMappingURL=/cdn/shop/t/3/assets/instafeed.js.map?v=114964710496723769721476481443
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.