(function(s,b){"use strict";var l=function(m,f){return E(m,f,l.options)};l.options={group:!0,thumbs:!0,down:!0,play:!0,zoom:!0,full:!0,exclude:".no-imgbox,.avatar,.img-icon,.avatar-badge"},l.swiper="",l.thumbs_swiper="",b.Miniimgbox=l;function E(m,f,n){var M="mini-imgbox imgbox",y="mini-imgbox",p="imgbox_data",u="#"+y,r=s(u),v=b.Miniimgbox,g=v.swiper,h=v.thumbs_swiper,d=s("body"),x=s(".nav-fixed header");n.group||(n.thumbs=!1),q();function q(){j(),n.exclude&&(m+=":not("+n.exclude+")");var e=f?f+" "+m:m;f=n.group?f:!1,setTimeout(function(){T(m,f)},1e3),d.data("imgbox-ison-"+e)||(d.on("click",e,function(){var i=s(this);W(i,f)}),d.data("imgbox-ison-"+e,!0))}function W(e,i){var t=R(e,i);if(t.slide){t.node_length>1?s(".imgbox-an .toggle-palay").show():s(".imgbox-an .toggle-palay").hide(),s(u+" .swiper-imgbox .swiper-wrapper").html(t.slide),n.thumbs&&s(u+" .swiper-thumbsbox .swiper-wrapper").html(t.thumbs);var a=~~e.attr("imgbox-index")||0;setTimeout(function(){n.thumbs&&h.update(),g.update(),g.slideTo(a,2),g.autoplay.stop(),L()},16),X(e)}}function R(e,i){var t=e.data(p);if(t)return t;var a=i?s(e.parents(i)[0]):{};if(a.length){var o=a.data(p);if(o&&o.node_length==C(a))return o}return w(e,a)}function C(e){return e.find(m).length}function T(e,i){i?s(i).each(function(){var t=s(this);t.data(p)||w(t.find(e).eq(0),t)}):s(e).each(function(){var t=s(this);t.data(p)||w(t,{})})}function w(e,i){var t={slide:"",thumbs:"",length:0};if(i.length){var a=0;i.find(m).each(function(o){o==0&&(a=0);var c=s(this);F(c)||(c.attr("imgbox-index",a),t.slide+=S(c),t.length=a+1,n.thumbs&&(t.thumbs+=G(c)),a++)}),t.node_length=C(i),i.data(p,t)}else!F(e)&&!e.find("img").length&&(t.slide=S(e),t.length=a,e.attr("imgbox-no-cache")||e.data(p,t));return t}function j(){if(!r.length){var e='
',i='',t=n.down?'':"";n.group&&(t+=n.play?'':"",n.thumbs&&(t+='',e+=i)),t+=n.zoom?'':"",t+=n.full?'':"",t+='',d.append('"),r=s(u),O(),I()}}function O(){var e=u+" .swiper-imgbox",i=~~((s(b).width()+1600)/600),t={};t.mousewheel={speed:10},t.speed=i*100,t.zoom={maxRatio:s(b).width()<769?3:2},t.autoplay={disableOnInteraction:!1},t.grabCursor=!0,t.navigation={nextEl:e+" .swiper-button-next",prevEl:e+" .swiper-button-prev"},t.keyboard={enabled:!0,onlyInViewport:!1},t.pagination={el:e+" .counter-con",type:"custom",renderCustom:function(a,o,c){return c>1?''+o+"/"+c+"":""}},n.thumbs&&n.group&&(D(),t.thumbs={swiper:h,autoScrollOffset:~~(i/1.6)}),v.swiper=g=new Swiper(e,t)}function D(){var e=u+" .swiper-thumbsbox",i={};i.watchSlidesVisibility=!0,i.navigation={nextEl:e+" .swiper-button-next",prevEl:e+" .swiper-button-prev"},i.slidesPerView="auto",i.freeMode=!0,i.freeModeSticky=!0,v.thumbs_swiper=h=new Swiper(e,i)}function I(){r.data("is_on")||(A(),r.on("click",".img-close,.imgbox-bg,.imgbox-an .icon-close",z),r.on("click",".imgbox-an .toggle-thumbs,.hide-but",function(){r.toggleClass("show-thumb")}),r.on("click",".imgbox-an .img-down",function(){var e=s(this),i=r.find(".swiper-imgbox .swiper-slide-active img"),t=i.attr("data-src")||i.attr("src"),a=t.substring(t.lastIndexOf("/")+1)||t;e.attr("href",t).attr("download",a)}),r.on("click",".imgbox-an .toggle-palay",function(){var e=s(this);e.hasClass("is-play")?g.autoplay.stop():g.autoplay.start(),e.toggleClass("is-play")}),r.on("click",".imgbox-an .toggle-zoom",function(){var e=s(this);g.zoom.toggle(),e.toggleClass("is-zoom")}),r.on("click",".imgbox-an .toggle-full",function(){document.fullscreenElement?k():P()}),r.data("is_on",!0))}function P(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen&&e.webkitRequestFullScreen(),s(u+" .imgbox-an .toggle-full .fa").removeClass("fa-expand").addClass("fa-compress"),s(u+".show").addClass("full-screen")}function k(){document.fullscreenElement&&(document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()),s(u+" .imgbox-an .toggle-full .fa").removeClass("fa-compress").addClass("fa-expand"),r.removeClass("full-screen")}function _(e){return e.indexOf("base64,")==-1&&e.length<300?e.replace(/(.*\/)(.*)(-\d+x\d+\.)(.*)/g,"$1$2.$4").replace(/\??x-oss-process(.*)/,""):e}function V(e){var i=e.offset(),t=i.top,a=i.left,o=s(document).scrollTop(),c=e.height(),H=e.width(),J=t-o+c/2,K=a+H/2;r.attr("style","--imgbox-origin-top:"+J+"px;--imgbox-origin-left:"+K+"px;")}function L(){var e=s(u+" .imgbox-an .toggle-thumbs,.hide-but");n.thumbs&&e.length&&(g.slides.length>1?e.show():(r.removeClass("show-thumb"),e.hide()))}function B(){var e=b.innerWidth;if(!e){var i=document.documentElement.getBoundingClientRect();e=i.right-Math.abs(i.left)}return document.body.clientWidth1},onIng:function(e,i,t,a){var o=(150-a)/80;o=o<1&&o>.2&&o,i.css("opacity",o)},inEnd:function(e,i){i.css({opacity:""})},onEnd:function(e,i){r.attr("style","--imgbox-origin-top:"+t+"px;--imgbox-origin-left:conter;");var t=i.height();i.css({transform:"translate3D(0px, "+t+"px, 0px)",transition:".2s linear",opacity:0}),setTimeout(z,150)}})}function S(e){var i=e.attr("src")||e.attr("box-img"),t=e.attr("data-src");if(!i&&!t)return"";var a=e.attr("data-full-url")||_(t||i),o='
',c='";return c}function G(e){var i=e.attr("data-src")||e.attr("src");if(!i)return"";var t='
',a=''+t+"
";return a}function F(e){var i=e.attr("data-src")||e.attr("src");if(!i)return!1;i=_(i);var t=e.parent("a");if(!t.length)return!1;var a=t.attr("box-img")||t.attr("href");return a=_(a),a&&(a.indexOf(i)==-1||i.indexOf(a)==-1)}}tbquire(["swiper"],function(){s("link#swiper").length||s("head").append(''),l.options.group=_win.imgbox_type==="group",l.options.thumbs=_win.imgbox_thumbs,l.options.down=_win.imgbox_down,l.options.play=_win.imgbox_play,l.options.zoom=_win.imgbox_zoom,l.options.full=_win.imgbox_full,l(".alone-imgbox-img,a[data-imgbox]"),l("img",".wp-posts-content"),l("img",".imgbox-container"),l(".box-img",".comment-content")})})(jQuery,window);