1(function(){var e,t;e=function(){function e(e,t){var n,r;if(this.options={target:"instafeed",get:"popular",resolution:"thumbnail",sortBy:"none",links:!0,mock:!1,useHttp:!1},"object"==typeof e)for(n in e)r=e[n],this.options[n]=r;this.context=null!=t?t:this,this.unique=this._genKey()}return e.prototype.hasNext=function(){return"string"==typeof this.context.nextUrl&&this.context.nextUrl.length>0},e.prototype.next=function(){return!!this.hasNext()&&this.run(this.context.nextUrl)},e.prototype.run=function(t){var n,r,i;if("string"!=typeof this.options.clientId&&"string"!=typeof this.options.accessToken)throw new Error("Missing clientId or accessToken.");if("string"!=typeof this.options.accessToken&&"string"!=typeof this.options.clientId)throw new Error("Missing clientId or accessToken.");return null!=this.options.before&&"function"==typeof this.options.before&&this.options.before.call(this),"undefined"!=typeof document&&null!==document&&(i=document.createElement("script"),i.id="instafeed-fetcher",i.src=t||this._buildUrl(),n=document.getElementsByTagName("head"),n[0].appendChild(i),r="instafeedCache"+this.unique,window[r]=new e(this.options,this),window[r].unique=this.unique),!0},e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;if("object"!=typeof e){if(null!=this.options.error&&"function"==typeof this.options.error)return this.options.error.call(this,"Invalid JSON data"),!1;throw new Error("Invalid JSON response")}if(200!==e.meta.code){if(null!=this.options.error&&"function"==typeof this.options.error)return this.options.error.call(this,e.meta.error_message),!1;throw new Error("Error from Instagram: "+e.meta.error_message)}if(0===e.data.length){if(null!=this.options.error&&"function"==typeof this.options.error)return this.options.error.call(this,"No images were returned from Instagram"),!1;throw new Error("No images were returned from Instagram")}if(null!=this.options.success&&"function"==typeof this.options.success&&this.options.success.call(this,e),this.context.nextUrl="",null!=e.pagination&&(this.context.nextUrl=e.pagination.next_url),"none"!==this.options.sortBy)switch(d="random"===this.options.sortBy?["","random"]:this.options.sortBy.split("-"),p="least"===d[0],d[1]){case"random":e.data.sort(function(){return.5-Math.random()});break;case"recent":e.data=this._sortBy(e.data,"created_time",p);break;case"liked":e.data=this._sortBy(e.data,"likes.count",p);break;case"commented":e.data=this._sortBy(e.data,"comments.count",p);break;default:throw new Error("Invalid option for sortBy: '"+this.options.sortBy+"'.")}if("undefined"!=typeof document&&null!==document&&!1===this.options.mock){if(a=e.data,null!=this.options.limit&&a.length>this.options.limit&&(a=a.slice(0,this.options.limit+1||9e9)),n=document.createDocumentFragment(),null!=this.options.filter&&"function"==typeof this.options.filter&&(a=this._filter(a,this.options.filter)),null!=this.options.template&&"string"==typeof this.options.template){for(i="",o="",l="",v=document.createElement("div"),m=0,b=a.length;m<b;m++)s=a[m],u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),o=this._makeTemplate(this.options.template,{model:s,id:s.id,link:s.link,image:u,caption:this._getObjectProperty(s,"caption.text"),likes:s.likes.count,comments:s.comments.count,location:this._getObjectProperty(s,"location.name")}),i+=o;for(v.innerHTML=i,S=[].slice.call(v.childNodes),g=0,w=S.length;g<w;g++)h=S[g],n.appendChild(h)}else for(y=0,E=a.length;y<E;y++)s=a[y],f=document.createElement("img"),u=s.images[this.options.resolution].url,this.options.useHttp||(u=u.replace("http://","//")),f.src=u,!0===this.options.links?(t=document.createElement("a"),t.href=s.link,t.appendChild(f),n.appendChild(t)):n.appendChild(f);document.getElementById(this.options.target).appendChild(n),r=document.getElementsByTagName("head")[0],r.removeChild(document.getElementById("instafeed-fetcher")),c="instafeedCache"+this.unique,window[c]=void 0;try{delete window[c]}catch(x){}}return null!=this.options.after&&"function"==typeof this.options.after&&this.options.after.call(this),!0},e.prototype._buildUrl=function(){var e,t,n;switch(e="https://api.instagram.com/v1",this.options.get){case"popular":t="media/popular";break;case"tagged":if("string"!=typeof this.options.tagName)throw new Error("No tag name specified. Use the 'tagName' option.");t="tags/"+this.options.tagName+"/media/recent";break;case"location":if("number"!=typeof this.options.locationId)throw new Error("No location specified. Use the 'locationId' option.");t="locations/"+this.options.locationId+"/media/recent";break;case"user":if("number"!=typeof this.options.userId)throw new Error("No user specified. Use the 'userId' option.");
1if("string"!=typeof this.options.accessToken)throw new Error("No access token. Use the 'accessToken' option.");t="users/"+this.options.userId+"/media/recent";break;default:throw new Error("Invalid option for get: '"+this.options.get+"'.")}return n=e+"/"+t,null!=this.options.accessToken?n+="?access_token="+this.options.accessToken:n+="?client_id="+this.options.clientId,null!=this.options.limit&&(n+="&count="+this.options.limit),n+="&callback=instafeedCache"+this.unique+".parse"},e.prototype._genKey=function(){var e;return""+(e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)})()+e()+e()+e()},e.prototype._makeTemplate=function(e,t){var n,r,i,s,o;for(r=/(?:\{{2})([\w\[\]\.]+)(?:\}{2})/,n=e;r.test(n);)i=n.match(r)[1],s=null!=(o=this._getObjectProperty(t,i))?o:"",n=n.replace(r,""+s);return n},e.prototype._getObjectProperty=function(e,t){var n,r;for(t=t.replace(/\[(\w+)\]/g,".$1"),r=t.split(".");r.length;){if(n=r.shift(),!(null!=e&&n in e))return null;e=e[n]}return e},e.prototype._sortBy=function(e,t,n){var r;return r=function(e,r){var i,s;return i=this._getObjectProperty(e,t),s=this._getObjectProperty(r,t),n?i>s?1:-1:i<s?1:-1},e.sort(r.bind(this)),e},e.prototype._filter=function(e,t){var n,r,i,s,o;for(n=[],i=function(e){if(t(e))return n.push(e)},s=0,o=e.length;s<o;s++)r=e[s],i(r);return n},e}(),t="undefined"!=typeof exports&&null!==exports?exports:window,t.Instafeed=e}).call(this);
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.