/* Do not modify this file directly. It is compiled from other files. */ /* jshint onevar:false, smarttabs:true */ !function(e){function i(){this.galleries=[],this.findAndSetupNewGalleries()}function t(e){this.gallery=e,this.addCaptionEvents(),this.resize(),this.gallery.removeClass("tiled-gallery-unresized")}function n(i){function t(){i.resizeAll(),n&&o(t)}var n=!1,r=null;e(window).resize(function(){clearTimeout(r),n||o(t),n=!0,r=setTimeout(function(){n=!1},15)})}function r(i){e(window).resize(function(){i.resizeAll()})}i.prototype.findAndSetupNewGalleries=function(){var i=this;e(".tiled-gallery.tiled-gallery-unresized").each(function(){i.galleries.push(new t(e(this)))})},i.prototype.resizeAll=function(){e.each(this.galleries,function(e,i){i.resize()})},t.prototype.resizeableElementsSelector=".gallery-row, .gallery-group, .tiled-gallery-item img",t.prototype.addCaptionEvents=function(){this.gallery.find(".tiled-gallery-caption").hide(),this.gallery.find(".tiled-gallery-item").hover(function(){e(this).find(".tiled-gallery-caption").stop(!0,!0).slideDown("fast")},function(){e(this).find(".tiled-gallery-caption").stop(!0,!0).slideUp("fast")})},t.prototype.getExtraDimension=function(e,i,t){if("horizontal"===t){var n="border"===i?"borderLeftWidth":i+"Left",r="border"===i?"borderRightWidth":i+"Right";return(parseInt(e.css(n),10)||0)+(parseInt(e.css(r),10)||0)}if("vertical"===t){var o="border"===i?"borderTopWidth":i+"Top",a="border"===i?"borderBottomWidth":i+"Bottom";return(parseInt(e.css(o),10)||0)+(parseInt(e.css(a),10)||0)}return 0},t.prototype.resize=function(){var i=this.gallery.data("original-width"),t=this.gallery.parent().width(),n=Math.min(1,t/i),r=this;this.gallery.find(this.resizeableElementsSelector).each(function(){var i=e(this),t=r.getExtraDimension(i,"margin","horizontal"),o=r.getExtraDimension(i,"margin","vertical"),a=r.getExtraDimension(i,"padding","horizontal"),l=r.getExtraDimension(i,"padding","vertical"),s=r.getExtraDimension(i,"border","horizontal"),d=r.getExtraDimension(i,"border","vertical"),c=i.data("original-width")+a+s+t,h=i.data("original-height")+l+d+o;i.width(Math.floor(n*c)-t).height(Math.floor(n*h)-o)})};var o=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;e(document).ready(function(){var t=new i;e("body").on("post-load",function(e,i){"string"==typeof i&&"resize"===i?t.resizeAll():t.findAndSetupNewGalleries()}),e(document).on("page-rendered.wpcom-newdash",function(){t.findAndSetupNewGalleries()}),window.chrome&&o?n(t):r(t),"undefined"!=typeof wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(e){wp.isJetpackWidgetPlaced(e,"gallery")&&t.findAndSetupNewGalleries()})})}(jQuery);