-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapplication.min.js
1 lines (1 loc) · 9.72 KB
/
application.min.js
1
var PriorityQueue=function(){function t(t){this.comparator=t,this.contents=[],this.sorted=!1}return t.prototype.sort=function(){return this.contents.sort(this.comparator),this.sotred=!0},t.prototype.push=function(t){return this.contents.push(t),this.sorted=!1},t.prototype.peek=function(t){return null==t&&(t=this.contents.length-1),this.sorted||this.sort(),this.contents[t]},t.prototype.pop=function(){return this.sorted||this.sort(),this.contents.pop()},t.prototype.size=function(){return this.contents.length},t.prototype.map=function(t){return this.contents.map(t)},t}(),MMCQ=function(){var f,s,h,B,u,l;function b(){this.maxIterations=1e3,this.fractByPopulations=.75}function t(t,o,e,n,r,s,i){this.r1=t,this.r2=o,this.g1=e,this.g2=n,this.b1=r,this.b2=s,this.histo=i}function o(){this.cboxes=new PriorityQueue(function(t,o){t=t.count()*t.volume(),o=o.count()*o.volume();return o<t?1:t<o?-1:0})}return b.rshift=8-(b.sigbits=5),B=function(t,o,e){return(t<<2*b.sigbits)+(o<<b.sigbits)+e},t.prototype.volume=function(t){return this._volume&&!t||(this._volume=(this.r2-this.r1+1)*(this.g2-this.g1+1)*(this.b2-this.b1+1)),this._volume},t.prototype.count=function(t){var o,e,n,r,s,i,c,a,h,u,l;if(!this._count_set||t){for(r=0,s=i=this.r1,h=this.r2;i<=h;s=i+=1)for(e=c=this.g1,u=this.g2;c<=u;e=c+=1)for(o=a=this.b1,l=this.b2;a<=l;o=a+=1)n=B(s,e,o),r+=this.histo[n]||0;this._count_set=!0,this._count=r}return this._count},t.prototype.copy=function(){return new t(this.r1,this.r2,this.g1,this.g2,this.b1,this.b2,this.histo)},t.prototype.average=function(t){var o,e,n,r,s,i,c,a,h,u,l,f,p,d,g;if(!this._average||t){for(i=1<<8-b.sigbits,e=r=a=h=0,c=u=this.r1,p=this.r2;u<=p;c=u+=1)for(n=l=this.g1,d=this.g2;l<=d;n=l+=1)for(o=f=this.b1,g=this.b2;f<=g;o=f+=1)s=B(c,n,o),h+=s=this.histo[s]||0,a+=s*(c+.5)*i,r+=s*(n+.5)*i,e+=s*(o+.5)*i;this._average=h?[~~(a/h),~~(r/h),~~(e/h)]:[~~(i*(this.r1+this.r2+1)/2),~~(i*(this.g1+this.g2+1)/2),~~(i*(this.b1+this.b2+1)/2)]}return this._average},t.prototype.contains=function(t){var o=t[0]>>b.rshift,e=t[1]>>b.rshift,t=t[2]>>b.rshift;return this.r1<=o&&o<=this.r2&&this.g1<=e&&e<=this.g2&&this.b1<=t&&t<=this.b2},f=t,o.prototype.push=function(t){return this.cboxes.push({cbox:t,color:t.average()})},o.prototype.palette=function(){return this.cboxes.map(function(t){return t.color})},o.prototype.size=function(){return this.cboxes.size()},o.prototype.map=function(t){var o,e=o=0,n=this.cboxes.size();if(o<n)return this.cboxes.peek(e).cbox.contains(t)?this.cboxes.peek(e).color:this.nearest(t)},o.prototype.cboxes=function(){return this.cboxes},o.prototype.nearest=function(t){for(var o,e,n,r=function(t){return t*t},s=1e9,i=n=0,c=this.cboxes.size();n<c;i=n+=1)(o=Math.sqrt(r(t[0]-this.cboxes.peek(i).color[0])+r(t[1]-this.cboxes.peek(i).color[1])+r(t[2]-this.cboxes.peek(i).color[2])))<s&&(s=o,e=this.cboxes.peek(i).color);return e},s=o,u=function(t){for(var o,e,n,r=new Array(1<<3*b.sigbits),s=0,i=t.length;s<i;s++)n=(e=t[s])[0]>>b.rshift,o=e[1]>>b.rshift,e=e[2]>>b.rshift,r[e=B(n,o,e)]=(r[e]||0)+1;return r},h=function(t,o){for(var e,n,r=1e6,s=0,i=1e6,c=0,a=1e6,h=0,u=0,l=t.length;u<l;u++)(n=(e=t[u])[0]>>b.rshift)<r?r=n:s<n&&(s=n),(n=e[1]>>b.rshift)<i?i=n:c<n&&(c=n),(e=e[2]>>b.rshift)<a?a=e:h<e&&(h=e);return new f(r,s,i,c,a,h,o)},l=function(t,f){var o,e,n,r,s,p,i,d,c,a,h,g,u,l,b,m,v,y,x,C,j,w,_,k,P,z,M,I,Q,F;if(f.count()){if(1===f.count())return[f.copy()];if(a=f.r2-f.r1+1,s=f.g2-f.g1+1,e=f.b2-f.b1+1,i=Math.max(a,s,e),g=0,d=[],p=[],i===a)for(c=u=f.r1,w=f.r2;u<=w;c=u+=1){for(h=0,r=l=f.g1,M=f.g2;l<=M;r=l+=1)for(o=b=f.b1,I=f.b2;b<=I;o=b+=1)h+=t[B(c,r,o)]||0;g+=h,d[c]=g}else if(i===s)for(r=m=f.g1,Q=f.g2;m<=Q;r=m+=1){for(h=0,c=v=f.r1,F=f.r2;v<=F;c=v+=1)for(o=y=f.b1,_=f.b2;y<=_;o=y+=1)h+=t[B(c,r,o)]||0;g+=h,d[r]=g}else for(o=x=f.b1,k=f.b2;x<=k;o=x+=1){for(h=0,c=C=f.r1,P=f.r2;C<=P;c=C+=1)for(r=j=f.g1,z=f.g2;j<=z;r=j+=1)h+=t[B(c,r,o)]||0;g+=h,d[o]=g}return d.forEach(function(t,o){return p[o]=g-t}),n=function(t){for(var o,e,n,r,s,i,c,a=t+"1",h=t+"2",u=c=f[a],l=f[h];c<=l;u=c+=1)if(d[u]>g/2){for(o=f.copy(),e=f.copy(),r=(s=u-f[a])<=(i=f[h]-u)?Math.min(f[h]-1,~~(u+i/2)):Math.max(f[a],~~(u-1-s/2));!d[r];)r++;for(n=p[r];!n&&d[r-1];)n=p[--r];return o[h]=r,e[a]=o[h]+1,[o,e]}},i===a?n("r"):i===s?n("g"):i===e?n("b"):void 0}},b.prototype.quantize=function(t,o){var i,e,c,n,r,a=this;if(!t.length||o<2||256<o)return console.log("invalid arguments"),!1;for(c=u(t),i=h(t,c),(n=new PriorityQueue(function(t,o){t=t.count(),o=o.count();return o<t?1:t<o?-1:0})).push(i),(t=function(t,o){for(var e,n,r=1,s=0;s<a.maxIterations;)if((i=t.pop()).count()){if(e=(n=l(c,i))[0],n=n[1],!e)return void console.log("cbox1 not defined; shouldn't happen");if(t.push(e),n&&(t.push(n),r++),o<=r)return;if(s++>a.maxIterations)return void console.log("infinite loop; perhaps too few pixels")}else t.push(i),s++})(n,this.fractByPopulations*o),r=new PriorityQueue(function(t,o){t=t.count()*t.volume(),o=o.count()*o.volume();return o<t?1:t<o?-1:0});n.size();)r.push(n.pop());for(t(r,o-r.size()),e=new s;r.size();)e.push(r.pop());return e},b}.call(this);(function(){function g(){}window.ColorExtract=(g.getColorMap=function(t,o,e,n,r,s){var i,c,a,h,u,l,f,p,d,g;for(null==s&&(s=8),a=t.getContext("2d").getImageData(o,e,n,r).data,h=[],d=(l=f=e)+r;f<d;l=f+=1)for(c=l*n*4,g=(u=p=o)+n;p<g;u=p+=1)h.push([a[i=c+4*u],a[1+i],a[2+i]]);return(new MMCQ).quantize(h,s)},g.colorDist=function(t,o){var e=function(t){return t*t};return e(t[0]-o[0])+e(t[1]-o[1])+e(t[2]-o[2])},g.extract=function(t,o,e){var n,r,s,i,c,a,h,u,l,f,p,d;for(o.width=25,o.height=25,o.getContext("2d").drawImage(t,0,0,o.width,o.height),(r=g.getColorMap(o,0,0,o.width,o.height,4).cboxes.map(function(t){return{count:t.cbox.count(),rgb:t.color}})).sort(function(t,o){return o.count-t.count}),n=r[0].rgb,(h=g.getColorMap(o,0,0,t.width,t.height,10).cboxes.map(function(t){return{count:t.cbox.count(),rgb:t.color}})).sort(function(t,o){return o.count-t.count}),l=u=0,p=h.length;l<p;l++)s=h[l],u<(i=g.colorDist(n,s.rgb))&&(u=i,c=s.rgb);for(f=u=0,d=h.length;f<d;f++)s=h[f],u<(i=g.colorDist(n,s.rgb))&&s.rgb!==c&&(u=i,a=s.rgb);return e({bgColor:(e=function(t){return"rgb("+t[0]+", "+t[1]+", "+t[2]+")"})(n),fgColor:e(c),fgColor2:e(a)})},g)}).call(this),function(c){var t=function(){return c("html").hasClass("editmode")};new LazyLoad({threshold:500,elements_selector:".js-lazyload",callback_loaded:function(t){c(t).closest(".js-content-item-box").removeClass("not-loaded with-error").addClass("is-loaded")}});c(".js-cart-btn").click(function(){c(this).data("product-id")&&Voog.ShoppingCart.addProductById(c(this).data("product-id"))});var o,e,n;window.site=c.extend(window.site||{},{initBlogPage:function(){},initArticlePage:function(){},initCommonPage:function(){handleFormFieldClick()},bindSiteSearch:function(t,o,e){t&&new VoogSearch(t,{per_page:10,lang:o,resultsContainer:c(".js-voog-search-modal-inner").get(0),sideclick:!0,mobileModeWidth:480,updateOnKeypress:!0,noResults:e})},handleProductPageContent:function(){var n,r,s,i;c(document).ready(function(){t()}),c(window).resize((n=function(){t()},r=25,function(){var t=this,o=arguments,e=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||n.apply(t,o)},r),e&&n.apply(t,o)}));var t=function(){var t=c(".js-product-gallery"),o=c(".js-content-item-box"),e=c(".js-product-content-right");1<=c(".js-buy-btn-content .edy-buy-button-container").length&&(c(window).width()<961?0===c(".js-buy-btn-content + .js-product-gallery").length&&e.append(t):0===c(".js-content-item-box + .js-product-gallery").length&&o.append(t))}}}),c(".content").on("mousedown",function(t){c(t.target).closest(".js-prevent-sideclick").length||(c(".js-popover").removeClass("expanded"),c(".js-image-settings-popover").toggleClass("active"))}),c(".js-menu-btn").click(function(t){t.stopPropagation(),c(this).toggleClass("open"),c(".js-menu-main").toggleClass("expanded"),c(".js-search-close-btn").hasClass("open")&&c(".js-search-close-btn").trigger("click")}),c(".js-menu-lang-btn").click(function(t){t.stopPropagation(),c(".js-menu-lang-popover").toggleClass("expanded")}),c(".js-search-open-btn").click(function(t){t.stopPropagation(),c(".js-menu-main").hasClass("expanded")&&(c(".js-menu-main").removeClass("expanded"),c(".js-menu-btn").removeClass("open")),c(this).addClass("open"),c("body").addClass("search-open"),c(".js-search-close-btn").addClass("open"),c(".js-search").addClass("active"),c(".js-search-inner").css({"margin-top":"-25px"}),c(".js-search-input").val("").focus()}),c(".js-search-close-btn").click(function(t){c(this).removeClass("open"),c("body").removeClass("search-open"),c(".js-search-open-btn").removeClass("open"),c(".js-search").removeClass("active")}),c(".js-search").click(function(t){t.stopPropagation()}),c(document).ready(function(){c(".comment-form").hasClass("form_with_errors")?c("html, body").scrollTop(c(".comment-form").offset().top):0<c("form").find(".form_error, .form_notice").length&&c("html, body").scrollTop(c(".form_error, .form_notice").closest("form").offset().top)}),searchForm=c(".js-search-form"),c(".js-search-input").focus(function(){searchForm.addClass("active")}).blur(function(){searchForm.removeClass("active")}),c(".js-search-form").on("submit",function(){searchModalHeight=c(".js-voog-search-modal").height(),c(".js-modal").css({top:"40px"})}),!1===t&&c.each(c(".content-formatted"),function(){c(this).hasClass("js-custom-content-formatted")||c(this).find("table").wrap('<div class="table-container overthrow"></div>')}),window.addEventListener("scroll",function(t){var o=c(".header_fixed").height();c(".t-sticky").css("top",c(".header_fixed").outerHeight()+32),window.scrollY>o?(c(".header_fixed:not(.relative)").addClass("scroll"),c("body").addClass("scroll")):(c(".header_fixed").removeClass("scroll"),c("body").removeClass("scroll"))}),!Modernizr.flexbox&&t&&(o=c(".js-header").width(),e=c(".js-header-right"),n=e.width(),e=parseInt(e.css("margin-left"))+1,c(".js-header-left").css("min-width",o-n-e))}(jQuery);