(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports&&typeof module!='undefined'&&module.exports?module.exports=t(e,require("eventEmitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(this,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function c(e){this.img=e}function f(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var c=r[o];this.addImage(c)}}},s.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),c.prototype=new t,c.prototype.check=function(){var e=v[this.img.src]||new f(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},c.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return f.prototype=new t,f.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
jQuery(document).ready(function (){
jQuery.easing['jswing']=jQuery.easing['swing'];
jQuery.extend(jQuery.easing, {
def: 'easeOutQuad',
swing: function (e, t, n, r, i){
return jQuery.easing[jQuery.easing.def](e, t, n, r, i);
},
easeInQuad: function (e, t, n, r, i){
return r * (t /=i) * t + n;
},
easeOutQuad: function (e, t, n, r, i){
return -r * (t /=i) * (t - 2) + n;
},
easeInOutQuad: function (e, t, n, r, i){
if((t /=i / 2) < 1) return (r / 2) * t * t + n;
return (-r / 2) * (--t * (t - 2) - 1) + n;
},
easeInCubic: function (e, t, n, r, i){
return r * (t /=i) * t * t + n;
},
easeOutCubic: function (e, t, n, r, i){
return r * ((t=t / i - 1) * t * t + 1) + n;
},
easeInOutCubic: function (e, t, n, r, i){
if((t /=i / 2) < 1) return (r / 2) * t * t * t + n;
return (r / 2) * ((t -=2) * t * t + 2) + n;
},
easeInQuart: function (e, t, n, r, i){
return r * (t /=i) * t * t * t + n;
},
easeOutQuart: function (e, t, n, r, i){
return -r * ((t=t / i - 1) * t * t * t - 1) + n;
},
easeInOutQuart: function (e, t, n, r, i){
if((t /=i / 2) < 1) return (r / 2) * t * t * t * t + n;
return (-r / 2) * ((t -=2) * t * t * t - 2) + n;
},
easeInQuint: function (e, t, n, r, i){
return r * (t /=i) * t * t * t * t + n;
},
easeOutQuint: function (e, t, n, r, i){
return r * ((t=t / i - 1) * t * t * t * t + 1) + n;
},
easeInOutQuint: function (e, t, n, r, i){
if((t /=i / 2) < 1) return (r / 2) * t * t * t * t * t + n;
return (r / 2) * ((t -=2) * t * t * t * t + 2) + n;
},
easeInSine: function (e, t, n, r, i){
return -r * Math.cos((t / i) * (Math.PI / 2)) + r + n;
},
easeOutSine: function (e, t, n, r, i){
return r * Math.sin((t / i) * (Math.PI / 2)) + n;
},
easeInOutSine: function (e, t, n, r, i){
return (-r / 2) * (Math.cos((Math.PI * t) / i) - 1) + n;
},
easeInExpo: function (e, t, n, r, i){
return t==0 ? n:r * Math.pow(2, 10 * (t / i - 1)) + n;
},
easeOutExpo: function (e, t, n, r, i){
return t==i ? n + r:r * (-Math.pow(2, (-10 * t) / i) + 1) + n;
},
easeInOutExpo: function (e, t, n, r, i){
if(t==0) return n;
if(t==i) return n + r;
if((t /=i / 2) < 1) return (r / 2) * Math.pow(2, 10 * (t - 1)) + n;
return (r / 2) * (-Math.pow(2, -10 * --t) + 2) + n;
},
easeInCirc: function (e, t, n, r, i){
return -r * (Math.sqrt(1 - (t /=i) * t) - 1) + n;
},
easeOutCirc: function (e, t, n, r, i){
return r * Math.sqrt(1 - (t=t / i - 1) * t) + n;
},
easeInOutCirc: function (e, t, n, r, i){
if((t /=i / 2) < 1) return (-r / 2) * (Math.sqrt(1 - t * t) - 1) + n;
return (r / 2) * (Math.sqrt(1 - (t -=2) * t) + 1) + n;
},
easeInElastic: function (e, t, n, r, i){
var s=1.70158;
var o=0;
var u=r;
if(t==0) return n;
if((t /=i)==1) return n + r;
if(!o) o=i * 0.3;
if(u < Math.abs(r)){
u=r;
var s=o / 4;
} else var s=(o / (2 * Math.PI)) * Math.asin(r / u);
return -(u * Math.pow(2, 10 * (t -=1)) * Math.sin(((t * i - s) * 2 * Math.PI) / o)) + n;
},
easeOutElastic: function (e, t, n, r, i){
var s=1.70158;
var o=0;
var u=r;
if(t==0) return n;
if((t /=i)==1) return n + r;
if(!o) o=i * 0.3;
if(u < Math.abs(r)){
u=r;
var s=o / 4;
} else var s=(o / (2 * Math.PI)) * Math.asin(r / u);
return u * Math.pow(2, -10 * t) * Math.sin(((t * i - s) * 2 * Math.PI) / o) + r + n;
},
easeInOutElastic: function (e, t, n, r, i){
var s=1.70158;
var o=0;
var u=r;
if(t==0) return n;
if((t /=i / 2)==2) return n + r;
if(!o) o=i * 0.3 * 1.5;
if(u < Math.abs(r)){
u=r;
var s=o / 4;
} else var s=(o / (2 * Math.PI)) * Math.asin(r / u);
if(t < 1) return -0.5 * u * Math.pow(2, 10 * (t -=1)) * Math.sin(((t * i - s) * 2 * Math.PI) / o) + n;
return u * Math.pow(2, -10 * (t -=1)) * Math.sin(((t * i - s) * 2 * Math.PI) / o) * 0.5 + r + n;
},
easeInBack: function (e, t, n, r, i, s){
if(s==undefined) s=1.70158;
return r * (t /=i) * t * ((s + 1) * t - s) + n;
},
easeOutBack: function (e, t, n, r, i, s){
if(s==undefined) s=1.70158;
return r * ((t=t / i - 1) * t * ((s + 1) * t + s) + 1) + n;
},
easeInOutBack: function (e, t, n, r, i, s){
if(s==undefined) s=1.70158;
if((t /=i / 2) < 1) return (r / 2) * t * t * (((s *=1.525) + 1) * t - s) + n;
return (r / 2) * ((t -=2) * t * (((s *=1.525) + 1) * t + s) + 2) + n;
},
easeInBounce: function (e, t, n, r, i){
return r - jQuery.easing.easeOutBounce(e, i - t, 0, r, i) + n;
},
easeOutBounce: function (e, t, n, r, i){
if((t /=i) < 1 / 2.75){
return r * 7.5625 * t * t + n;
}else if(t < 2 / 2.75){
return r * (7.5625 * (t -=1.5 / 2.75) * t + 0.75) + n;
}else if(t < 2.5 / 2.75){
return r * (7.5625 * (t -=2.25 / 2.75) * t + 0.9375) + n;
}else{
return r * (7.5625 * (t -=2.625 / 2.75) * t + 0.984375) + n;
}},
easeInOutBounce: function (e, t, n, r, i){
if(t < i / 2) return jQuery.easing.easeInBounce(e, t * 2, 0, r, i) * 0.5 + n;
return jQuery.easing.easeOutBounce(e, t * 2 - i, 0, r, i) * 0.5 + r * 0.5 + n;
},
});
});
(function ($){
$.ggPrettyPhoto={ version: '3.1.6' };
var settings,
theRel,
galleryRegExp,
isSet,
pp_images,
pp_titles,
pp_descriptions,
set_position,
rel_index,
$pp_pic_holder,
$ppt,
$pp_overlay,
currentGalleryPage,
toInject,
classname,
img_src,
thumbnail,
$pp_gallery,
$pp_gallery_li,
itemWidth,
contentHeight,
contentwidth,
projectedTop,
movie_width,
movie_height,
imgPreloader,
skipInjection,
nextImage,
prevImage,
resized,
$pp_details,
detailsHeight,
$pp_title,
titleHeight,
imageWidth,
imageHeight,
fitting,
navWidth,
itemsPerPage,
totalPage,
galleryWidth,
fullGalleryWidth,
goToPage,
slide_speed,
slide_to,
doresize,
scroll_pos;
$.fn.ggPrettyPhoto=function (pp_settings){
var ppTranslationVar=pp_settings.ppTranslates||{},
markupHtml;
if(typeof pp_settings.isShowAttributes=='undefined'){
pp_settings.isShowAttributes=false;
}
if(pp_settings.isShowAttributes){
if(typeof pp_settings.attributesPosition=='undefined'){
pp_settings.attributesPosition='right';
}
if(typeof pp_settings.attributesWidth=='undefined'){
pp_settings.attributesWidth='200';
}
var attributesHtml='<div class="pp_attributes_container" style="width:' + pp_settings.attributesWidth + 'px"><div id="ppCustomAttributes"></div>';
if(pp_settings.isShowButtonLink){
attributesHtml +='<div id="ppAttributeButton"><a target="_blank" href="#" style="' + pp_settings.buttonLinkStyle + '"></a></div>';
}
attributesHtml +='</div>';
}
markupHtml =
'<div class="pp_pic_holder">' +
'<div class="ppt">&nbsp;</div>' +
'<div class="pp_top">' +
'<div class="pp_left"></div>' +
'<div class="pp_middle"></div>' +
'<div class="pp_right"></div>' +
'</div>' +
'<div class="pp_content_container">' +
'<div class="pp_left">' +
'<div class="pp_right">' +
'<div class="pp_content">' +
'<div class="pp_loaderIcon"></div>' +
'<div class="pp_fade">' +
'<a href="#" class="pp_expand" title="' +
ppTranslationVar['cExpandStr'] +
'">' +
ppTranslationVar['cExpand'] +
'</a>' +
'<div class="pp_hoverContainer">' +
'<a class="pp_next" href="#">' +
'<span class="pp-button-conainer pp-round-left">' +
'<i class="fa fa-chevron-right" aria-hidden="true"></i>' +
'<i class="pp-bc-nextstr">' +
ppTranslationVar['next'] +
'</i>' +
'</span>' +
'</a>' +
'<a class="pp_previous" href="#">' +
'<span class="pp-button-conainer pp-round-right">' +
'<i class="pp-bc-nextstr">' +
ppTranslationVar['prev'] +
'</i>' +
'<i class="fa fa-chevron-left" aria-hidden="true"></i>' +
'</span>' +
'</a>' +
'</div>';
if(pp_settings.isShowAttributes){
if(pp_settings.attributesPosition=='left'){
markupHtml +=attributesHtml + '<div id="pp_full_res" style="float:left;"></div>';
}else{
markupHtml +='<div id="pp_full_res" style="float:left;"></div>' + attributesHtml;
}}else{
markupHtml +='<div id="pp_full_res"></div>';
}
markupHtml +=
'<div class="pp_details">' +
'<div class="pp_nav">' +
'<a href="#" class="pp_arrow_previous">' +
ppTranslationVar['cPrevious'] +
'</a>' +
'<p class="currentTextHolder">0/0</p>' +
'<a href="#" class="pp_arrow_next">' +
ppTranslationVar['cNext'] +
'</a>' +
'</div>' +
'<p class="pp_description"></p>';
if(pp_settings.isShowHovThumbnail==1){
markupHtml +='<div class="sggTheme6OnHoverThumbWr" data-show-on-hover="1"><img src="" alt="" class="sggT6OnHoverThumbImg"/></div>';
}
markupHtml +='<div class="pp_social">{pp_social}</div>' + '<div class="sggTheme6PopupBtns">';
if(pp_settings.isShowLinkBtn==1){
markupHtml +=
'<a target="_blank" class="sggLinkBtn" data-popup-theme-id="6" data-gg-id="' +
pp_settings.galleryId +
'" href="#">' +
'<span class="pp-button-conainer pp-round-all">' +
'<i class="pp-bc-nextstr">' +
ppTranslationVar['cDetails'] +
'</i>' +
'<i class="fa fa-link" aria-hidden="true"></i>' +
'</span>' +
'</a>';
}
if(pp_settings.isShowRotateBtn==1){
markupHtml +=
'<a class="sggRotateBtn" data-popup-theme-id="6" data-gg-id="' +
pp_settings.galleryId +
'" href="#">' +
'<span class="pp-button-conainer pp-round-all">' +
'<i class="pp-bc-nextstr">' +
ppTranslationVar['cRotate'] +
'</i>' +
'<i class="fa fa-refresh" aria-hidden="true"></i>' +
'</span>' +
'</a>';
}
markupHtml +=
'<a class="pp_close" href="#">' +
'<span class="pp-button-conainer pp-round-all">' +
'<i class="pp-bc-nextstr">' +
ppTranslationVar['close'] +
'</i>' +
'<i class="fa fa-times" aria-hidden="true"></i>' +
'</span>' +
'</a>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="pp_bottom">' +
'<div class="pp_left"></div>' +
'<div class="pp_middle"></div>' +
'<div class="pp_right"></div>' +
'</div>' +
'</div>' +
'<div class="pp_overlay"></div>';
pp_settings=jQuery.extend({
hook: 'rel' ,
animation_speed: 'fast' ,
ajaxcallback: function (){},
slideshow: 5000 ,
autoplay_slideshow: false ,
opacity: 0.8 ,
show_title: true ,
allow_resize: true ,
allow_expand: true ,
default_width: 500,
default_height: 344,
default_movie_width: 500,
default_movie_height: 344,
counter_separator_label: '/' ,
theme: 'pp_default' ,
horizontal_padding: 20 ,
hideflash: false ,
wmode: 'opaque' ,
autoplay: false ,
modal: false ,
deeplinking: true ,
overlay_gallery: true ,
overlay_gallery_max: 9999 ,
keyboard_shortcuts: true ,
changepicturecallback: function (){} ,
setImageTitleForPrepare: function ($element){},
callback: function (){} ,
getTitle: function (){
return 'test';
},
getImageDimensions: function (){} ,
ie6_fallback: true,
is_lazy_load: 0,
markup: markupHtml,
gallery_markup:
'<div style="clear: both;"></div><div class="pp_gallery">' + '<a href="#" class="pp_arrow_previous">' + ppTranslationVar['cPrevious'] + '</a>' + '<div>' + '<ul>' + '{gallery}' + '</ul>' + '</div>' + '<a href="#" class="pp_arrow_next">' + ppTranslationVar['cNext'] + '</a>' + '</div>',
image_markup: '<img id="fullResImage" src="{path}" data-rotate-angl="0"/>',
flash_markup:
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
quicktime_markup:
'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
html5_markup: '<video controls="" style="margin-bottom: 0px;"><source src="{path}" height="{height}" width="{width}"></video>',
iframe_markup: '<iframe src="{path}" width="{width}" height="{height}" allowfullscreen="true" frameborder="no" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',
inline_markup: '<div class="pp_inline">{content}</div>',
custom_markup: '',
social_tools:
'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>' ,
},
pp_settings
);
var matchedObjects=this,
percentBased=false,
pp_dimensions,
pp_open,
pp_contentHeight,
pp_contentWidth,
pp_attributesWidth=pp_settings.isShowAttributes ? parseFloat(pp_settings.attributesWidth):0,
pp_containerHeight,
pp_containerWidth,
windowHeight=$(window).height(),
windowWidth=$(window).width(),
pp_slideshow,
doresize=true,
scroll_pos=_get_scroll(),
$selfPp=this;
$selfPp.pp_settings=pp_settings;
$(window)
.unbind('resize.prettyphoto')
.bind('resize.prettyphoto', function (){
_center_overlay();
_resize_overlay();
});
if(pp_settings.keyboard_shortcuts){
$(document)
.unbind('keydown.prettyphoto')
.bind('keydown.prettyphoto', function (e){
if(typeof $pp_pic_holder!='undefined'){
if($pp_pic_holder.is(':visible')){
switch (e.keyCode){
case 37:
$selfPp.changePage('previous');
e.preventDefault();
break;
case 39:
$selfPp.changePage('next');
e.preventDefault();
break;
case 27:
if(!settings.modal) $selfPp.close();
e.preventDefault();
break;
}}
}});
}
$selfPp.refresh=function ($imgList){
matchedObjects=$imgList;
matchedObjects.off('click.prettyphoto').on('click.prettyphoto', this.initialize);
};
$selfPp.initialize=function (){
settings=pp_settings;
if(settings.theme=='pp_default') settings.horizontal_padding=16;
theRel=$(this).attr(settings.hook);
galleryRegExp=/\[(?:.*)\]/;
isSet=galleryRegExp.exec(theRel) ? true:false;
pp_images=isSet
? jQuery.map(matchedObjects, function (n, i){
if($(n).attr(settings.hook).indexOf(theRel)!=-1) return $(n).attr('href');
})
: $.makeArray($(this).attr('href'));
pp_titles=isSet
? jQuery.map(matchedObjects, function (n, i){
if($(n).attr(settings.hook).indexOf(theRel)!=-1) return $(n).find('img').attr('alt') ? $(n).find('img').attr('alt'):'';
})
: $.makeArray($(this).find('img').attr('alt'));
pp_descriptions=isSet
? jQuery.map(matchedObjects, function (n, i){
if($(n).attr(settings.hook).indexOf(theRel)!=-1) return $(n).attr('title') ? $(n).attr('title'):'';
})
: $.makeArray($(this).attr('title'));
if(pp_images.length > settings.overlay_gallery_max) settings.overlay_gallery=false;
set_position=jQuery.inArray($(this).attr('href'), pp_images);
rel_index=isSet ? set_position:$('a[' + settings.hook + "^='" + theRel + "']").index($(this));
_build_overlay(this);
if(settings.allow_resize)
$(window).bind('scroll.prettyphoto', function (){
_center_overlay();
});
$selfPp.open();
return false;
};
$selfPp.open=function (event){
if(typeof settings=='undefined'){
settings=pp_settings;
pp_images=$.makeArray(arguments[0]);
pp_titles=arguments[1] ? $.makeArray(arguments[1]):$.makeArray('');
pp_descriptions=arguments[2] ? $.makeArray(arguments[2]):$.makeArray('');
isSet=pp_images.length > 1 ? true:false;
set_position=arguments[3] ? arguments[3]:0;
_build_overlay(event.target);
}
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'hidden');
_checkPosition($(pp_images).length);
$('.pp_loaderIcon').show();
if(settings.deeplinking) setHashtag();
if(settings.social_tools){
facebook_like_link=settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
$pp_pic_holder.find('.pp_social').html(facebook_like_link);
}
if($ppt.is(':hidden')) $ppt.css('opacity', 0).show();
$pp_overlay.show().fadeTo(settings.animation_speed, settings.opacity);
$pp_pic_holder.find('.currentTextHolder').text(set_position + 1 + settings.counter_separator_label + $(pp_images).length);
if(typeof pp_descriptions[set_position]!='undefined'&&pp_descriptions[set_position]!=''){
settings.getTitle();
$pp_pic_holder.find('.pp_description').show().html($('<div/>').html(pp_descriptions[set_position]).text()
);
}else{
$pp_pic_holder.find('.pp_description').hide();
}
movie_width=parseFloat(getParam('width', pp_images[set_position])) ? getParam('width', pp_images[set_position]):settings.default_movie_width.toString();
movie_height=parseFloat(getParam('height', pp_images[set_position])) ? getParam('height', pp_images[set_position]):settings.default_movie_height.toString();
percentBased=false;
if(movie_height.indexOf('%')!=-1){
movie_height=parseFloat(($(window).height() * parseFloat(movie_height)) / 100 - 150);
percentBased=true;
}
if(movie_width.indexOf('%')!=-1){
movie_width=parseFloat(($(window).width() * parseFloat(movie_width)) / 100 - 150);
percentBased=true;
}
if(pp_settings.popup_border_enable&&pp_settings.popup_border_color&&pp_settings.popup_border_type&&pp_settings.popup_border_width){
$pp_pic_holder.css({
'border-color': pp_settings.popup_border_color,
'border-width': pp_settings.popup_border_width + 'px',
'border-style': pp_settings.popup_border_type,
});
}
$pp_pic_holder.fadeIn(function (){
settings.show_title&&pp_titles[set_position]!=''&&typeof pp_titles[set_position]!='undefined' ? $ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');
imgPreloader='';
skipInjection=false;
switch (_getFileType(pp_images[set_position])){
case 'image':
imgPreloader=new Image();
nextImage=new Image();
if(isSet&&set_position < $(pp_images).length - 1) nextImage.src=pp_images[set_position + 1];
prevImage=new Image();
if(isSet&&pp_images[set_position - 1]) prevImage.src=pp_images[set_position - 1];
$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g, pp_images[set_position]);
imgPreloader.onload=function (){
pp_dimensions=_fitToViewportImage(imgPreloader.width, imgPreloader.height);
_showContent();
};
imgPreloader.onerror=function (){
alert('Image cannot be loaded. Make sure the path is correct and image exist.');
$selfPp.close();
};
imgPreloader.src=pp_images[set_position];
break;
case 'youtube':
pp_dimensions=_fitToViewport(movie_width, movie_height);
if(pp_images[set_position].indexOf('embed')==-1){
movie_id=getParam('v', pp_images[set_position]);
if(movie_id==''){
movie_id=pp_images[set_position].split('youtu.be/');
movie_id=movie_id[1];
if(movie_id.indexOf('?') > 0) movie_id=movie_id.substr(0, movie_id.indexOf('?'));
if(movie_id.indexOf('&') > 0) movie_id=movie_id.substr(0, movie_id.indexOf('&'));
}
movie='//www.youtube.com/embed/' + movie_id;
}else{
movie=pp_images[set_position];
}
getParam('rel', pp_images[set_position]) ? (movie +='?rel=' + getParam('rel', pp_images[set_position])):(movie +='?rel=1');
toInject=settings.iframe_markup
.replace(/{width}/g, pp_dimensions['width'])
.replace(/{height}/g, pp_dimensions['height'])
.replace(/{wmode}/g, settings.wmode)
.replace(/{path}/g, movie);
break;
case 'vimeo':
pp_dimensions=_fitToViewport(movie_width, movie_height);
movie_id=pp_images[set_position];
var regExp=/(?:https?:)?\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/;
var match=movie_id.match(regExp);
movie='https://player.vimeo.com/video/' + match[3] + '?title=0&amp;byline=0&amp;portrait=0';
vimeo_width=pp_dimensions['width'] + '/embed/?moog_width=' + pp_dimensions['width'];
toInject=settings.iframe_markup
.replace(/{width}/g, vimeo_width)
.replace(/{height}/g, pp_dimensions['height'])
.replace(/{path}/g, movie);
break;
case 'quicktime':
pp_dimensions=_fitToViewport(movie_width, movie_height);
pp_dimensions['height'] +=15;
pp_dimensions['contentHeight'] +=15;
pp_dimensions['containerHeight'] +=15;
toInject=settings.quicktime_markup
.replace(/{width}/g, pp_dimensions['width'])
.replace(/{height}/g, pp_dimensions['height'])
.replace(/{wmode}/g, settings.wmode)
.replace(/{path}/g, pp_images[set_position])
.replace(/{autoplay}/g, settings.autoplay);
break;
case 'html5':
pp_dimensions=_fitToViewport(movie_width, movie_height);
pp_dimensions['height'] +=15;
pp_dimensions['contentHeight'] +=15;
pp_dimensions['containerHeight'] +=15;
if(settings.autoplay){
settings.autoplay='autoplay';
}else{
settings.autoplay='';
}
toInject=settings.html5_markup
.replace(/{width}/g, pp_dimensions['width'])
.replace(/{height}/g, pp_dimensions['height'])
.replace(/{wmode}/g, settings.wmode)
.replace(/{path}/g, pp_images[set_position])
.replace(/{autoplay}/g, settings.autoplay);
break;
case 'flash':
pp_dimensions=_fitToViewport(movie_width, movie_height);
flash_vars=pp_images[set_position];
flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10, pp_images[set_position].length);
filename=pp_images[set_position];
filename=filename.substring(0, filename.indexOf('?'));
toInject=settings.flash_markup
.replace(/{width}/g, pp_dimensions['width'])
.replace(/{height}/g, pp_dimensions['height'])
.replace(/{wmode}/g, settings.wmode)
.replace(/{path}/g, filename + '?' + flash_vars);
break;
case 'iframe':
pp_dimensions=_fitToViewport(movie_width, movie_height);
frame_url=pp_images[set_position];
frame_url=frame_url.substr(0, frame_url.indexOf('iframe') - 1);
toInject=pp_images[set_position].replace('watch?v=', 'embed/');
var container=$('<div>' + toInject + '</div>');
container.find('iframe').attr('width', pp_dimensions['width'] + 'px');
container.find('iframe').attr('height', pp_dimensions['height'] + 'px');
toInject=container.html();
break;
case 'ajax':
doresize=false;
pp_dimensions=_fitToViewport(movie_width, movie_height);
doresize=true;
skipInjection=true;
$.get(pp_images[set_position], function (responseHTML){
toInject=settings.inline_markup.replace(/{content}/g, responseHTML);
$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;
_showContent();
});
break;
case 'custom':
pp_dimensions=_fitToViewport(movie_width, movie_height);
toInject=settings.custom_markup;
break;
case 'inline':
myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({ width: settings.default_width }).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();
doresize=false;
pp_dimensions=_fitToViewport($(myClone).width(), $(myClone).height());
doresize=true;
$(myClone).remove();
toInject=settings.inline_markup.replace(/{content}/g, $(pp_images[set_position]).html());
break;
}
if(!imgPreloader&&!skipInjection){
$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;
_showContent();
}});
return false;
};
$selfPp.getImagesList=function (){
return pp_images;
};
$selfPp.changePage=function (direction){
currentGalleryPage=0;
if(direction=='previous'){
set_position--;
if(set_position < 0) set_position=$(pp_images).length - 1;
}else if(direction=='next'){
set_position++;
if(set_position > $(pp_images).length - 1) set_position=0;
}else{
set_position=direction;
}
rel_index=set_position;
if(!doresize) doresize=true;
if(settings.allow_expand){
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
}
_hideContent(function (){
$selfPp.open();
});
};
$selfPp.changeGalleryPage=function (direction){
if(direction=='next'){
currentGalleryPage++;
if(currentGalleryPage > totalPage) currentGalleryPage=0;
}else if(direction=='previous'){
currentGalleryPage--;
if(currentGalleryPage < 0) currentGalleryPage=totalPage;
}else{
currentGalleryPage=direction;
}
slide_speed=direction=='next'||direction=='previous' ? settings.animation_speed:0;
slide_to=currentGalleryPage * (itemsPerPage * itemWidth);
$pp_gallery.find('ul').animate({ left: -slide_to }, slide_speed);
};
$selfPp.startSlideshow=function (){
if(typeof pp_slideshow=='undefined'){
if(!$pp_pic_holder.find('.pp_play').hasClass('stop')&&!$pp_pic_holder.find('.pp_pause').hasClass('stop')){
$pp_pic_holder
.find('.pp_play')
.unbind('click')
.removeClass('pp_play')
.addClass('pp_pause')
.click(function (){
$selfPp.stopSlideshow();
return false;
});
pp_slideshow=setInterval($selfPp.startSlideshow, settings.slideshow);
}}else{
$selfPp.changePage('next');
}};
$selfPp.stopSlideshow=function (){
$pp_pic_holder
.find('.pp_pause')
.unbind('click')
.removeClass('pp_pause')
.addClass('pp_play')
.click(function (){
$selfPp.startSlideshow();
return false;
});
clearInterval(pp_slideshow);
pp_slideshow=undefined;
};
$selfPp.close=function (){
if($pp_overlay.is(':animated')) return;
$selfPp.stopSlideshow();
$pp_pic_holder.stop().find('object,embed').css('visibility', 'hidden');
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed, function (){
$(this).remove();
});
$pp_overlay.fadeOut(settings.animation_speed, function (){
if(settings.hideflash) $('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'visible');
$(this).remove();
$(window).unbind('scroll.prettyphoto');
clearHashtag();
settings.callback();
doresize=true;
pp_open=false;
settings=undefined;
});
}; 
$selfPp.resize=function (width, height){
_fitToViewport(width, height);
_resize_overlay();
_center_overlay();
};
function _showContent(changeWidthAndHeight, currImgRotateVal, notRunOnHoverInit){
$('.pp_loaderIcon').hide();
projectedTop=scroll_pos['scrollTop'] + (windowHeight / 2 - pp_dimensions['containerHeight'] / 2);
if(projectedTop < 0) projectedTop=0;
$ppt.fadeTo(settings.animation_speed, 1);
$pp_pic_holder.find('.pp_content').animate({
height: pp_dimensions['contentHeight'],
width: pp_dimensions['contentWidth'],
},
settings.animation_speed,
function (){
$pp_pic_holder.animate({
top: projectedTop,
left: windowWidth / 2 - pp_dimensions['containerWidth'] / 2 < 0 ? 0:windowWidth / 2 - pp_dimensions['containerWidth'] / 2,
width: pp_dimensions['containerWidth'],
},
settings.animation_speed,
function (){
var $ppHoverContainer=$pp_pic_holder.find('.pp_hoverContainer'),
$ppImageWrapper=$pp_pic_holder.find('#pp_full_res'),
$ppPopupImage=$pp_pic_holder.find('#fullResImage');
$ppHoverContainer.height(pp_dimensions['height']).width(pp_dimensions['width']);
$ppPopupImage.height(pp_dimensions['height']).width(pp_dimensions['width']);
if(settings.isShowRotateBtn&&window.prettyPhotoShowContent){
window.prettyPhotoShowContent(changeWidthAndHeight, currImgRotateVal, $ppPopupImage, $ppImageWrapper, pp_dimensions);
}
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);
if(isSet&&_getFileType(pp_images[set_position])=='image'){
$pp_pic_holder.find('.pp_hoverContainer').show();
}else{
$pp_pic_holder.find('.pp_hoverContainer').hide();
}
if(settings.isShowAttributes){
if(settings.attributesPosition=='left'){
$ppHoverContainer.css('left', pp_attributesWidth);
}else{
$('a.pp_expand').css('right', pp_attributesWidth + 10 + 'px');
}
$pp_pic_holder.find('#ppCustomAttributes').height(pp_dimensions['height'] - (settings.isShowButtonLink ? $pp_pic_holder.find('#ppAttributeButton').height() + 5:0));
}
if(settings.allow_expand){
if(pp_dimensions['resized']){
$('a.pp_expand,a.pp_contract').show();
}else{
$('a.pp_expand').hide();
}}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open) $selfPp.startSlideshow();
settings.changepicturecallback($('[href="' + pp_images[set_position] + '"]'));
if(!notRunOnHoverInit){
if(window.prettyPhotoInitOnHoverThumb){
window.prettyPhotoInitOnHoverThumb($('[href="' + pp_images[set_position] + '"]'), pp_settings.galleryId, $selfPp.setDimensionsAndShowCont);
}}
pp_open=true;
}
);
}
);
_insert_gallery();
pp_settings.ajaxcallback();
setTimeout(function (){
$pp_pic_holder.animate({
left: windowWidth / 2 - pp_dimensions['containerWidth'] / 2 < 0 ? 0:windowWidth / 2 - $pp_pic_holder.outerWidth() / 2,
width: pp_dimensions['containerWidth'],
});
}, 600);
}
$selfPp.initRotate=function (){
if(pp_settings.isShowRotateBtn&&window.prettyPhotoInitRotate){
window.prettyPhotoInitRotate(function (toFitWidth, toFitHeigth, currImgRotateVal){
pp_dimensions=_fitToViewportImage(toFitWidth, toFitHeigth);
_showContent(true, currImgRotateVal);
});
}};
$selfPp.setDimensionsAndShowCont=function (toFitWidth, toFitHeigth, currImgRotateVal){
pp_dimensions=_fitToViewportImage(toFitWidth, toFitHeigth);
_showContent(true, currImgRotateVal, 1);
};
$selfPp.initOnHoverPreview=function ($aLink, galleryId){
if(pp_settings.isShowHovThumbnail&&window.prettyPhotoInitOnHoverThumb){
window.prettyPhotoInitOnHoverThumb($aLink, galleryId, $selfPp.setDimensionsAndShowCont);
}};
function _hideContent(callback){
$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility', 'hidden');
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed, function (){
$('.pp_loaderIcon').show();
callback();
});
}
function _checkPosition(setCount){
setCount > 1 ? $('.pp_nav').show():$('.pp_nav').hide();
}
function _fitToViewportImage(width, height){
var dimensions=settings.getImageDimensions();
if(dimensions==undefined){
return _fitToViewport(width, height);
}else{
windowWidth=dimensions.width;
windowHeight=dimensions.height;
var response=_fitToViewport(width, height);
winWidth=$(window).width();
winHeight=$(window).height();
if(response.containerWidth > winWidth||response.containerHeight > winHeight){
if(response.containerWidth > winWidth){
windowWidth -=response.containerWidth - winWidth;
}else if(response.containerHeight > winHeight){
windowHeight -=response.containerHeight - winHeight;
}
response=_fitToViewport(response.width, response.height);
}
windowWidth=winWidth;
windowHeight=winHeight;
return response;
}}
function _fitToViewport(width, height){
resized=false;
_getDimensions(width, height);
((imageWidth=width), (imageHeight=height));
if((pp_containerWidth > windowWidth||pp_containerHeight > windowHeight)&&doresize&&settings.allow_resize&&!percentBased){
((resized=true), (fitting=false));
while (!fitting){
if(pp_containerWidth > windowWidth){
imageWidth=windowWidth - 60 - pp_attributesWidth;
imageHeight=(height / width) * imageWidth;
}else if(pp_containerHeight > windowHeight){
imageHeight=windowHeight - 80;
imageWidth=(width / height) * imageHeight;
}
if(!(pp_containerWidth > windowWidth)&&!(pp_containerHeight > windowHeight)){
fitting=true;
}
((pp_containerHeight=imageHeight), (pp_containerWidth=imageWidth));
}
if(pp_containerWidth > windowWidth||pp_containerHeight > windowHeight){
_fitToViewport(pp_containerWidth, pp_containerHeight);
}
_getDimensions(imageWidth, imageHeight);
}
return {
width: Math.floor(imageWidth),
height: Math.floor(imageHeight),
containerHeight: Math.floor(pp_containerHeight),
containerWidth: Math.floor(pp_containerWidth) + settings.horizontal_padding * 2,
contentHeight: Math.floor(pp_contentHeight),
contentWidth: Math.floor(pp_contentWidth),
resized: resized,
};}
function _getDimensions(width, height){
width=parseFloat(width) + pp_attributesWidth;
height=parseFloat(height);
$pp_details=$pp_pic_holder.find('.pp_details');
$pp_details.width(width);
detailsHeight=parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({
position: 'absolute',
top: -10000,
});
$pp_details.find('.pp_description').html(settings.setImageTitleForPrepare($('[href="' + pp_images[set_position] + '"]')));
detailsHeight +=$pp_details.height();
detailsHeight=detailsHeight <=34 ? 36:detailsHeight;
$pp_details.remove();
$pp_title=$pp_pic_holder.find('.ppt');
$pp_title.width(width);
titleHeight=parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom'));
$pp_title=$pp_title.clone().appendTo($('body')).css({
position: 'absolute',
top: -10000,
});
titleHeight +=$pp_title.height();
$pp_title.remove();
pp_contentHeight=height + detailsHeight;
pp_contentWidth=width;
pp_containerHeight=pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
pp_containerWidth=width;
}
function _getFileType(itemSrc){
if(itemSrc.match(/<iframe(.+)<\/iframe>/i)){
return 'iframe';
}else if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)||itemSrc.match(/youtube\.com\/embed/i)){
return 'youtube';
}else if(itemSrc.match(/vimeo\.com/i)){
return 'vimeo';
}else if(itemSrc.match(/\b.mov\b/i)){
return 'quicktime';
}else if(itemSrc.match(/\b.avi\b/i)){
return 'html5';
}else if(itemSrc.match(/\b.mp4\b/i)){
return 'html5';
}else if(itemSrc.match(/\b.swf\b/i)){
return 'flash';
}else if(itemSrc.match(/\bajax=true\b/i)){
return 'ajax';
}else if(itemSrc.match(/\bcustom=true\b/i)){
return 'custom';
}else if(itemSrc.substr(0, 1)=='#'){
return 'inline';
}else{
return 'image';
}}
function _center_overlay(){
if(doresize&&typeof $pp_pic_holder!='undefined'){
scroll_pos=_get_scroll();
((contentHeight=$pp_pic_holder.height()), (contentwidth=$pp_pic_holder.width()));
projectedTop=windowHeight / 2 + scroll_pos['scrollTop'] - contentHeight / 2;
if(projectedTop < 0) projectedTop=0;
if(contentHeight > windowHeight) return;
$pp_pic_holder.css({
top: projectedTop,
left: windowWidth / 2 + scroll_pos['scrollLeft'] - contentwidth / 2,
});
}}
function _get_scroll(){
if(self.pageYOffset){
return { scrollTop: self.pageYOffset, scrollLeft: self.pageXOffset };}else if(document.documentElement&&document.documentElement.scrollTop){
return { scrollTop: document.documentElement.scrollTop, scrollLeft: document.documentElement.scrollLeft };}else if(document.body){
return { scrollTop: document.body.scrollTop, scrollLeft: document.body.scrollLeft };}}
function _resize_overlay(){
((windowHeight=$(window).height()), (windowWidth=$(window).width()));
if(typeof $pp_overlay!='undefined') $pp_overlay.height($(document).height()).width(windowWidth);
}
function _insert_gallery(){
if(isSet&&settings.overlay_gallery&&(_getFileType(pp_images[set_position])=='image'||_getFileType(pp_images[set_position])=='iframe')){
itemWidth=52 + 5;
navWidth=settings.theme=='facebook'||settings.theme=='pp_default' ? 50:30;
itemsPerPage=Math.floor((pp_dimensions['containerWidth'] - 100 - pp_attributesWidth - navWidth) / itemWidth);
itemsPerPage=itemsPerPage < pp_images.length ? itemsPerPage:pp_images.length;
totalPage=Math.ceil(pp_images.length / itemsPerPage) - 1;
if(totalPage==0){
navWidth=0;
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();
}else{
$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();
}
galleryWidth=itemsPerPage * itemWidth;
fullGalleryWidth=pp_images.length * itemWidth;
$pp_gallery
.css('margin-left', -(galleryWidth / 2 + navWidth / 2 + (settings.isShowAttributes ? (pp_attributesWidth / 2) * (settings.attributesPosition=='left' ? -1:1):0)))
.find('div:first')
.width(galleryWidth + 5)
.find('ul')
.width(fullGalleryWidth)
.find('li.selected')
.removeClass('selected');
goToPage=Math.floor(set_position / itemsPerPage) < totalPage ? Math.floor(set_position / itemsPerPage):totalPage;
$selfPp.changeGalleryPage(goToPage);
$pp_gallery_li.filter(':eq(' + set_position + ')').addClass('selected');
}else{
$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
}}
function _build_overlay(caller){
if(settings.social_tools) facebook_like_link=settings.social_tools.replace('{location_href}', encodeURIComponent(location.href));
settings.markup=settings.markup.replace('{pp_social}', '');
$('body').append(settings.markup);
$selfPp.initRotate();
$selfPp.initOnHoverPreview($(caller), pp_settings.galleryId);
(($pp_pic_holder=$('.pp_pic_holder')), ($ppt=$('.ppt')), ($pp_overlay=$('div.pp_overlay')));
if(settings.isDisableRightClick){
$pp_pic_holder.off('contextmenu').on('contextmenu', function (e){
return false;
});
}
if(isSet&&settings.overlay_gallery){
currentGalleryPage=0;
toInject='';
for (var i=0; i < pp_images.length; i++){
img_src=pp_images[i];
thumbnail=$('[href="' + img_src + '"]').find('.crop > img');
if(!(thumbnail.length&&thumbnail.attr('data-gg-remote-image')=='1')&&!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){
classname='default';
img_src='';
}else{
classname='';
if(thumbnail.length){
if(pp_settings.is_lazy_load){
img_src=thumbnail.attr('data-gg-real-image-href');
}else{
img_src=thumbnail.attr('src');
}}
}
toInject +="<li class='" + classname + "'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>";
}
toInject=settings.gallery_markup.replace(/{gallery}/g, toInject);
$pp_pic_holder.find(settings.isShowAttributes&&settings.attributesPosition=='right' ? '.pp_attributes_container':'#pp_full_res').after(toInject);
(($pp_gallery=$('.pp_pic_holder .pp_gallery')), ($pp_gallery_li=$pp_gallery.find('li')));
$pp_gallery.find('.pp_arrow_next').click(function (){
$selfPp.changeGalleryPage('next');
$selfPp.stopSlideshow();
return false;
});
$pp_gallery.find('.pp_arrow_previous').click(function (){
$selfPp.changeGalleryPage('previous');
$selfPp.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_content').hover(function (){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
},
function (){
$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
}
);
itemWidth=52 + 5;
$pp_gallery_li.each(function (i){
$(this)
.find('a')
.click(function (){
$selfPp.changePage(i);
$selfPp.stopSlideshow();
return false;
});
});
}
if(settings.slideshow){
$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>');
$pp_pic_holder.find('.pp_nav .pp_play').click(function (){
$selfPp.startSlideshow();
return false;
});
}
$pp_pic_holder.attr('class', 'pp_pic_holder ' + settings.theme);
$pp_overlay
.css({
opacity: 0,
height: $(document).height(),
width: $(window).width(),
})
.bind('click', function (){
if(!settings.modal) $selfPp.close();
});
$('a.pp_close').bind('click', function (){
$selfPp.close();
return false;
});
if(settings.allow_expand){
$('a.pp_expand').bind('click', function (e){
if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract');
doresize=false;
}else{
$(this).removeClass('pp_contract').addClass('pp_expand');
doresize=true;
}
_hideContent(function (){
$selfPp.open();
});
return false;
});
}
$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click', function (){
$('.pp_nav a.pp_pause').removeClass('stop');
$('.pp_nav a.pp_play').removeClass('stop');
$selfPp.changePage('previous');
$selfPp.stopSlideshow();
return false;
});
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click', function (){
$('.pp_nav a.pp_pause').removeClass('stop');
$('.pp_nav a.pp_play').removeClass('stop');
$selfPp.changePage('next');
$selfPp.stopSlideshow();
return false;
});
_center_overlay();
}
if(!ggpp_alreadyInitialized&&getHashtag()){
ggpp_alreadyInitialized=true;
hashIndex=getHashtag();
hashRel=hashIndex;
hashIndex=hashIndex.substring(hashIndex.indexOf('/') + 1, hashIndex.length - 1);
hashRel=hashRel.substring(0, hashRel.indexOf('/'));
setTimeout(function (){
$('a[' + pp_settings.hook + "^='" + hashRel + "']:eq(" + hashIndex + ')').trigger('click');
}, 50);
}
return $selfPp.off('click.prettyphoto').on('click.prettyphoto', $selfPp.initialize);
};
function getHashtag(){
var url=location.href,
hashtag=url.indexOf('#prettyPhoto')!==-1 ? decodeURI(url.substring(url.indexOf('#prettyPhoto') + 1, url.length)):false;
if(hashtag){
hashtag=hashtag.replace(/<|>/g, '');
}
return hashtag;
}
function setHashtag(){
if(typeof theRel=='undefined') return;
location.hash=theRel + '/' + rel_index + '/';
}
function clearHashtag(){
if(location.href.indexOf('#prettyPhoto')!==-1) location.hash='prettyPhoto';
}
function getParam(name, url){
name=name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
var regexS='[\\?&]' + name + '=([^&#]*)';
var regex=new RegExp(regexS);
var results=regex.exec(url);
return results==null ? '':results[1];
}})(jQuery);
var ggpp_alreadyInitialized=false;
(function (e){
var t=function (e){
var t=e.clone();
var n=e.find('canvas');
if(n.length){
var r=t.find('canvas');
r.each(function (e){
var t=this.getContext('2d');
t.drawImage(n.get(e), 0, 0);
});
}
return t;
};
e.fn.quicksand=function (n, r){
var i={ duration: 750, easing: 'swing', attribute: 'data-id', adjustHeight: 'auto', adjustWidth: 'auto', useScaling: false, enhancement: function (e){}, selector: '> *', atomic: false, dx: 0, dy: 0, maxWidth: 0, retainExisting: true },
s=(function (){
var e='transform WebkitTransform MozTransform OTransform msTransform'.split(' '),
t=document.createElement('div');
for (var n=0; n < e.length; n++){
if(typeof t.style[e[n]]!='undefined'){
return true;
}}
return false;
})();
e.extend(i, r);
if(!s||typeof e.fn.scale=='undefined'){
i.useScaling=false;
}
var o;
if(typeof arguments[1]=='function'){
o=arguments[1];
}else if(typeof (arguments[2]=='function')){
o=arguments[2];
}
return this.each(function (r){
var s;
var u=[];
var a;
if(typeof i.attribute=='function'){
a=e(n);
}else{
a=t(e(n).filter('[' + i.attribute + ']'));
}
var f=e(this);
var l=e(this).css('height');
var c=e(this).css('width');
var h, p;
var d=false;
var v=false;
var m=e(f).offset();
var g=[];
var y=e(this).find(i.selector);
var b=e(y).innerWidth();
if(navigator.userAgent.match(/msie [6]/i)){
f.html('').append(a);
return;
}
var w=0;
var E=function (){
e(this).css('margin', '').css('position', '').css('top', '').css('left', '').css('opacity', '');
if(!w){
w=1;
if(!i.atomic){
var t=f.find(i.selector);
if(!i.retainExisting){
f.prepend(C.find(i.selector));
t.remove();
}else{
var n=e([]);
C.find(i.selector).each(function (r){
var s=e([]);
if(typeof i.attribute=='function'){
var o=i.attribute(e(this));
t.each(function (){
if(i.attribute(this)==o){
s=e(this);
return false;
}});
}else{
s=t.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
}
if(s.length > 0){
n=n.add(s);
if(r===0){
f.prepend(s);
}else{
s.insertAfter(f.find(i.selector).get(r - 1));
}}
});
t.not(n).remove();
}
if(d){
f.css('height', h);
}
if(v){
f.css('width', c);
}}
i.enhancement(f);
if(typeof o=='function'){
o.call(this);
}}
if(false===i.adjustHeight){
f.css('height', 'auto');
}
if(false===i.adjustWidth){
f.css('width', 'auto');
}};
var S=f.offsetParent();
var x=S.offset();
if(S.css('position')=='relative'){
if(S.get(0).nodeName.toLowerCase()!='body'){
x.top +=parseFloat(S.css('border-top-width'))||0;
x.left +=parseFloat(S.css('border-left-width'))||0;
}}else{
x.top -=parseFloat(S.css('border-top-width'))||0;
x.left -=parseFloat(S.css('border-left-width'))||0;
x.top -=parseFloat(S.css('margin-top'))||0;
x.left -=parseFloat(S.css('margin-left'))||0;
}
if(isNaN(x.left)){
x.left=0;
}
if(isNaN(x.top)){
x.top=0;
}
x.left -=i.dx;
x.top -=i.dy;
f.css('height', e(this).height());
f.css('width', e(this).width());
y.each(function (t){
g[t]=e(this).offset();
});
e(this).stop();
var T=0;
var N=0;
y.each(function (t){
e(this).stop();
var n=e(this).get(0);
if(n.style.position=='absolute'){
T=-i.dx;
N=-i.dy;
}else{
T=i.dx;
N=i.dy;
}
n.style.position='absolute';
n.style.margin='0';
if(!i.adjustWidth){
n.style.width=b + 'px';
}
n.style.top=g[t].top - parseFloat(n.style.marginTop) - x.top + N + 'px';
n.style.left=g[t].left - parseFloat(n.style.marginLeft) - x.left + T + 'px';
if(i.maxWidth > 0&&g[t].left > i.maxWidth){
n.style.display='none';
}});
var C=t(e(f));
var k=C.get(0);
k.innerHTML='';
k.setAttribute('id', '');
k.style.height='auto';
k.style.width=f.width() + 'px';
C.append(a);
C.insertBefore(f);
C.css('opacity', 0);
k.style.zIndex=-1;
k.style.margin='0';
k.style.position='absolute';
k.style.top=m.top - x.top + 'px';
k.style.left=m.left - x.left + 'px';
if(i.adjustHeight==='dynamic'){
f.animate({ height: C.height() }, i.duration, i.easing);
}else if(i.adjustHeight==='auto'){
h=C.height();
if(parseFloat(l) < parseFloat(h)){
f.css('height', h);
}else{
d=true;
}}
if(i.adjustWidth==='dynamic'){
f.animate({ width: C.width() }, i.duration, i.easing);
}else if(i.adjustWidth==='auto'){
p=C.width();
if(parseFloat(c) < parseFloat(p)){
f.css('width', p);
}else{
v=true;
}}
y.each(function (t){
var n=[];
if(typeof i.attribute=='function'){
s=i.attribute(e(this));
a.each(function (){
if(i.attribute(this)==s){
n=e(this);
return false;
}});
}else{
n=a.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
}
if(n.length){
if(!i.useScaling){
u.push({ element: e(this), dest: n, style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { top: n.offset().top - x.top, left: n.offset().left - x.left, opacity: 1 }});
}else{
u.push({ element: e(this), dest: n, style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { top: n.offset().top - x.top, left: n.offset().left - x.left, opacity: 1, scale: '1.0' }});
}}else{
if(!i.useScaling){
u.push({ element: e(this), style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { opacity: '0.0' }});
}else{
u.push({ element: e(this), animation: { opacity: '0.0', style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, scale: '0.0' }});
}}
});
a.each(function (n){
var r=[];
var o=[];
if(typeof i.attribute=='function'){
s=i.attribute(e(this));
y.each(function (){
if(i.attribute(this)==s){
r=e(this);
return false;
}});
a.each(function (){
if(i.attribute(this)==s){
o=e(this);
return false;
}});
}else{
r=y.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
o=a.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
}
var l;
if(r.length===0&&o.length > 0){
if(!i.useScaling){
l={ opacity: '1.0' };}else{
l={ opacity: '1.0', scale: '1.0' };}
var c=t(o);
var h=c.get(0);
h.style.position='absolute';
h.style.margin='0';
if(!i.adjustWidth){
h.style.width=b + 'px';
}
h.style.top=o.offset().top - x.top + 'px';
h.style.left=o.offset().left - x.left + 'px';
c.css('opacity', 0);
if(i.useScaling){
c.scale(0);
}
c.appendTo(f);
if(i.maxWidth===0||o.offset().left < i.maxWidth){
u.push({ element: e(c), dest: o, animation: l });
}}
});
C.remove();
if(!i.atomic){
i.enhancement(f);
for (r=0; r < u.length; r++){
u[r].element.animate(u[r].animation, i.duration, i.easing, E);
}}else{
$toDelete=f.find(i.selector);
f.prepend(C.find(i.selector));
for (r=0; r < u.length; r++){
if(u[r].dest&&u[r].style){
var L=u[r].dest;
var A=L.offset();
L.css({ position: 'relative', top: u[r].style.top - A.top, left: u[r].style.left - A.left });
L.animate({ top: '0', left: '0' }, i.duration, i.easing, E);
}else{
u[r].element.animate(u[r].animation, i.duration, i.easing, E);
}}
$toDelete.remove();
}});
};})(jQuery);
!(function (t){
'function'==typeof define&&define.amd ? define(['jquery'], t):t(jQuery);
})(function (t){
function i(t){
n(function (){
var i, e;
for (i=0; t.length > i; i++) ((e=t[i]), e.obj.css(e.css));
});
}
function e(i){
return t.trim(i).toLowerCase();
}
var s, h, o;
((o=function (t, i){
return function (){
return t.apply(i, arguments);
};}),
(h={ align: 'center', autoResize: !1, comparator: null, container: t('body'), direction: void 0, ignoreInactiveItems: !0, itemWidth: 0, fillEmptySpace: !1, flexibleWidth: 0, offset: 2, outerOffset: 0, onLayoutChanged: void 0, possibleFilters: [], resizeDelay: 50, verticalOffset: void 0 }));
var n =
window.requestAnimationFrame ||
function (t){
t();
},
r=t(window);
((s=(function (){
function s(i, e){
((this.handler=i),
(this.columns=this.containerWidth=this.resizeTimer=null),
(this.activeItemCount=0),
(this.itemHeightsDirty = !0),
(this.placeholders=[]),
t.extend(!0, this, h, e),
(this.verticalOffset=this.verticalOffset||this.offset),
(this.update=o(this.update, this)),
(this.onResize=o(this.onResize, this)),
(this.onRefresh=o(this.onRefresh, this)),
(this.getItemWidth=o(this.getItemWidth, this)),
(this.layout=o(this.layout, this)),
(this.layoutFull=o(this.layoutFull, this)),
(this.layoutColumns=o(this.layoutColumns, this)),
(this.filter=o(this.filter, this)),
(this.clear=o(this.clear, this)),
(this.getActiveItems=o(this.getActiveItems, this)),
(this.refreshPlaceholders=o(this.refreshPlaceholders, this)),
(this.sortElements=o(this.sortElements, this)),
(this.updateFilterClasses=o(this.updateFilterClasses, this)),
this.updateFilterClasses(),
this.autoResize&&r.bind('resize.wookmark', this.onResize),
this.container.bind('refreshWookmark', this.onRefresh));
}
return (
(s.prototype.updateFilterClasses=function (){
for (var t, i, s, h, o=0, n=0, r=0, a={}, l=this.possibleFilters; this.handler.length > o; o++)
if(((i=this.handler.eq(o)), (t=i.data('filterClass')), 'object'==typeof t&&t.length > 0)) for (n=0; t.length > n; n++) ((s=e(t[n])), void 0===a[s]&&(a[s]=[]), a[s].push(i[0]));
for (; l.length > r; r++) ((h=e(l[r])), h in a||(a[h]=[]));
this.filterClasses=a;
}),
(s.prototype.update=function (i){
((this.itemHeightsDirty = !0), t.extend(!0, this, i));
}),
(s.prototype.onResize=function (){
(clearTimeout(this.resizeTimer), (this.itemHeightsDirty=0!==this.flexibleWidth), (this.resizeTimer=setTimeout(this.layout, this.resizeDelay)));
}),
(s.prototype.onRefresh=function (){
((this.itemHeightsDirty = !0), this.layout());
}),
(s.prototype.filter=function (i, s, h){
var o,
n,
r,
a,
l,
f=[],
c=t();
if(((i=i||[]), (s=s||'or'), (h=h||!1), i.length)){
for (n=0; i.length > n; n++) ((l=e(i[n])), l in this.filterClasses&&f.push(this.filterClasses[l]));
if(((o=f.length), 'or'==s||1==o)) for (n=0; o > n; n++) c=c.add(f[n]);
else if('and'==s){
var u,
d,
m,
p=f[0],
g = !0;
for (n=1; o > n; n++) f[n].length < p.length&&(p=f[n]);
for (p=p||[], n=0; p.length > n; n++){
for (d=p[n], g = !0, r=0; f.length > r&&g; r++)
if(((m=f[r]), p!=m)){
for (a=0, u = !1; m.length > a&&!u; a++) u=m[a]==d;
g &=u;
}
g&&c.push(p[n]);
}}
h||this.handler.not(c).addClass('inactive');
} else c=this.handler;
return (h||(c.removeClass('inactive'), (this.columns=null), this.layout()), c);
}),
(s.prototype.refreshPlaceholders=function (i, e){
for (var s, h, o, n, r, a, l=this.placeholders.length, f=this.columns.length, c=this.container.innerHeight(); f > l; l++) ((s=t('<div class="wookmark-placeholder"/>').appendTo(this.container)), this.placeholders.push(s));
for (a=this.offset + 2 * parseInt(this.placeholders[0].css('borderLeftWidth'), 10), l=0; this.placeholders.length > l; l++)
if(((s=this.placeholders[l]), (o=this.columns[l]), l >=f||!o[o.length - 1])) s.css('display', 'none');
else {
if(!(h=o[o.length - 1])) continue;
((n=c - (r=h.data('wookmark-top') + h.data('wookmark-height') + this.verticalOffset) - a), s.css({ position: 'absolute', display: n > 0 ? 'block':'none', left: l * i + e, top: r, width: i - a, height: n }));
}}),
(s.prototype.getActiveItems=function (){
return this.ignoreInactiveItems ? this.handler.not('.inactive'):this.handler;
}),
(s.prototype.getItemWidth=function (){
var t=this.itemWidth,
i=this.container.width() - 2 * this.outerOffset,
e=this.handler.eq(0),
s=this.flexibleWidth;
if((void 0===this.itemWidth||(0===this.itemWidth&&!this.flexibleWidth) ? (t=e.outerWidth()):'string'==typeof this.itemWidth&&this.itemWidth.indexOf('%') >=0&&(t=(parseFloat(this.itemWidth) / 100) * i), s)){
'string'==typeof s&&s.indexOf('%') >=0&&(s=(parseFloat(s) / 100) * i);
var h=i + this.offset,
o=~~(0.5 + h / (s + this.offset)),
n=~~(h / (t + this.offset)),
r=Math.max(o, n),
a=Math.min(s, ~~((i - (r - 1) * this.offset) / r));
((t=Math.max(t, a)), this.handler.css('width', t));
}
return t;
}),
(s.prototype.layout=function (t){
if(this.container.is(':visible')){
var i,
e,
s=this.getItemWidth() + this.offset,
h=this.container.width() - 2 * this.outerOffset,
o=~~((h + this.offset) / s),
n=0,
r=0,
a=this.getActiveItems(),
l=a.length;
if(this.itemHeightsDirty||!this.container.data('itemHeightsInitialized')){
for (; l > r; r++) ((i=a.eq(r)), i.data('wookmark-height', i.outerHeight()));
((this.itemHeightsDirty = !1), this.container.data('itemHeightsInitialized', !0));
}
((o=Math.max(1, Math.min(o, l))),
(n=this.outerOffset),
'center'==this.align&&(n +=~~((h - (o * s - this.offset) + 0.5) >> 1)),
(this.direction=this.direction||('right'==this.align ? 'right':'left')),
(e=t||null===this.columns||this.columns.length!=o||this.activeItemCount!=l ? this.layoutFull(s, o, n):this.layoutColumns(s, n)),
(this.activeItemCount=l),
this.container.attr({ 'data-min-height': this.container.attr('data-flexible-height')=='1'||this.container.attr('data-min-height') > parseInt(e) ? this.container.attr('data-min-height'):e }),
this.container.css('height', this.container.attr('data-min-height') > parseInt(e) ? this.container.attr('data-min-height') + 'px':e),
this.fillEmptySpace&&this.refreshPlaceholders(s, n),
void 0!==this.onLayoutChanged&&'function'==typeof this.onLayoutChanged&&this.onLayoutChanged());
}}),
(s.prototype.sortElements=function (t){
return 'function'==typeof this.comparator ? t.sort(this.comparator):t;
}),
(s.prototype.layoutFull=function (e, s, h){
var o,
n,
r=0,
a=0,
l=t.makeArray(this.getActiveItems()),
f=l.length,
c=null,
u=null,
d=[],
m=[],
p='left'==this.align;
for (this.columns=[], l=this.sortElements(l); s > d.length;) (d.push(this.outerOffset), this.columns.push([]));
for (; f > r; r++){
for (o=t(l[r]), c=d[0], u=0, a=0; s > a; a++) c > d[a]&&((c=d[a]), (u=a));
(o.data('wookmark-top', c), (n=h), (u > 0||!p)&&(n +=u * e), ((m[r]={ obj: o, css: { position: 'absolute', top: c }}).css[this.direction]=n), (d[u] +=o.data('wookmark-height') + this.verticalOffset), this.columns[u].push(o));
}
return (i(m), Math.max.apply(Math, d));
}),
(s.prototype.layoutColumns=function (t, e){
for (var s, h, o, n, r=[], a=[], l=0, f=0, c=0; this.columns.length > l; l++){
for (r.push(this.outerOffset), h=this.columns[l], n=l * t + e, s=r[l], f=0; h.length > f; f++, c++) ((o=h[f].data('wookmark-top', s)), ((a[c]={ obj: o, css: { top: s }}).css[this.direction]=n), (s +=o.data('wookmark-height') + this.verticalOffset));
r[l]=s;
}
return (i(a), Math.max.apply(Math, r));
}),
(s.prototype.clear=function (){
(clearTimeout(this.resizeTimer), r.unbind('resize.wookmark', this.onResize), this.container.unbind('refreshWookmark', this.onRefresh), (this.handler.wookmarkInstance=null));
}),
s
);
})()),
(t.fn.wookmark=function (t){
return (this.wookmarkInstance ? this.wookmarkInstance.update(t||{}):(this.wookmarkInstance=new s(this, t||{})), this.wookmarkInstance.layout(!0), this.show());
}));
});
!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(j(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(b,c,d){var e="DEPRECATED METHOD: "+c+"\n"+d+" AT \n";return function(){var c=new Error("get-stack-trace"),d=c&&c.stack?c.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=a.console&&(a.console.warn||a.console.log);return f&&f.call(a.console,e,d),b.apply(this,arguments)}}function i(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&la(d,c)}function j(a,b){return function(){return a.apply(b,arguments)}}function k(a,b){return typeof a==oa?a.apply(b?b[0]||d:d,b):a}function l(a,b){return a===d?b:a}function m(a,b,c){g(q(b),function(b){a.addEventListener(b,c,!1)})}function n(a,b,c){g(q(b),function(b){a.removeEventListener(b,c,!1)})}function o(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function p(a,b){return a.indexOf(b)>-1}function q(a){return a.trim().split(/\s+/g)}function r(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function s(a){return Array.prototype.slice.call(a,0)}function t(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];r(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function u(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<ma.length;){if(c=ma[g],e=c?c+f:b,e in a)return e;g++}return d}function v(){return ua++}function w(b){var c=b.ownerDocument||b;return c.defaultView||c.parentWindow||a}function x(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){k(a.options.enable,[a])&&c.handler(b)},this.init()}function y(a){var b,c=a.options.inputClass;return new(b=c?c:xa?M:ya?P:wa?R:L)(a,z)}function z(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&Ea&&d-e===0,g=b&(Ga|Ha)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,A(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function A(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=D(b)),e>1&&!c.firstMultiple?c.firstMultiple=D(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=E(d);b.timeStamp=ra(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=I(h,i),b.distance=H(h,i),B(c,b),b.offsetDirection=G(b.deltaX,b.deltaY);var j=F(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=qa(j.x)>qa(j.y)?j.x:j.y,b.scale=g?K(g.pointers,d):1,b.rotation=g?J(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,C(c,b);var k=a.element;o(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function B(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};b.eventType!==Ea&&f.eventType!==Ga||(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function C(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Ha&&(i>Da||h.velocity===d)){var j=b.deltaX-h.deltaX,k=b.deltaY-h.deltaY,l=F(i,j,k);e=l.x,f=l.y,c=qa(l.x)>qa(l.y)?l.x:l.y,g=G(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function D(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:pa(a.pointers[c].clientX),clientY:pa(a.pointers[c].clientY)},c++;return{timeStamp:ra(),pointers:b,center:E(b),deltaX:a.deltaX,deltaY:a.deltaY}}function E(a){var b=a.length;if(1===b)return{x:pa(a[0].clientX),y:pa(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:pa(c/b),y:pa(d/b)}}function F(a,b,c){return{x:b/a||0,y:c/a||0}}function G(a,b){return a===b?Ia:qa(a)>=qa(b)?0>a?Ja:Ka:0>b?La:Ma}function H(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function I(a,b,c){c||(c=Qa);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function J(a,b){return I(b[1],b[0],Ra)+I(a[1],a[0],Ra)}function K(a,b){return H(b[0],b[1],Ra)/H(a[0],a[1],Ra)}function L(){this.evEl=Ta,this.evWin=Ua,this.pressed=!1,x.apply(this,arguments)}function M(){this.evEl=Xa,this.evWin=Ya,x.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=$a,this.evWin=_a,this.started=!1,x.apply(this,arguments)}function O(a,b){var c=s(a.touches),d=s(a.changedTouches);return b&(Ga|Ha)&&(c=t(c.concat(d),"identifier",!0)),[c,d]}function P(){this.evTarget=bb,this.targetIds={},x.apply(this,arguments)}function Q(a,b){var c=s(a.touches),d=this.targetIds;if(b&(Ea|Fa)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=s(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return o(a.target,i)}),b===Ea)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(Ga|Ha)&&delete d[g[e].identifier],e++;return h.length?[t(f.concat(h),"identifier",!0),h]:void 0}function R(){x.apply(this,arguments);var a=j(this.handler,this);this.touch=new P(this.manager,a),this.mouse=new L(this.manager,a),this.primaryTouch=null,this.lastTouches=[]}function S(a,b){a&Ea?(this.primaryTouch=b.changedPointers[0].identifier,T.call(this,b)):a&(Ga|Ha)&&T.call(this,b)}function T(a){var b=a.changedPointers[0];if(b.identifier===this.primaryTouch){var c={x:b.clientX,y:b.clientY};this.lastTouches.push(c);var d=this.lastTouches,e=function(){var a=d.indexOf(c);a>-1&&d.splice(a,1)};setTimeout(e,cb)}}function U(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d<this.lastTouches.length;d++){var e=this.lastTouches[d],f=Math.abs(b-e.x),g=Math.abs(c-e.y);if(db>=f&&db>=g)return!0}return!1}function V(a,b){this.manager=a,this.set(b)}function W(a){if(p(a,jb))return jb;var b=p(a,kb),c=p(a,lb);return b&&c?jb:b||c?b?kb:lb:p(a,ib)?ib:hb}function X(){if(!fb)return!1;var b={},c=a.CSS&&a.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(d){b[d]=c?a.CSS.supports("touch-action",d):!0}),b}function Y(a){this.options=la({},this.defaults,a||{}),this.id=v(),this.manager=null,this.options.enable=l(this.options.enable,!0),this.state=nb,this.simultaneous={},this.requireFail=[]}function Z(a){return a&sb?"cancel":a&qb?"end":a&pb?"move":a&ob?"start":""}function $(a){return a==Ma?"down":a==La?"up":a==Ja?"left":a==Ka?"right":""}function _(a,b){var c=b.manager;return c?c.get(a):a}function aa(){Y.apply(this,arguments)}function ba(){aa.apply(this,arguments),this.pX=null,this.pY=null}function ca(){aa.apply(this,arguments)}function da(){Y.apply(this,arguments),this._timer=null,this._input=null}function ea(){aa.apply(this,arguments)}function fa(){aa.apply(this,arguments)}function ga(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ha(a,b){return b=b||{},b.recognizers=l(b.recognizers,ha.defaults.preset),new ia(a,b)}function ia(a,b){this.options=la({},ha.defaults,b||{}),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=a,this.input=y(this),this.touchAction=new V(this,this.options.touchAction),ja(this,!0),g(this.options.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function ja(a,b){var c=a.element;if(c.style){var d;g(a.options.cssProps,function(e,f){d=u(c.style,f),b?(a.oldCssProps[d]=c.style[d],c.style[d]=e):c.style[d]=a.oldCssProps[d]||""}),b||(a.oldCssProps={})}}function ka(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var la,ma=["","webkit","Moz","MS","ms","o"],na=b.createElement("div"),oa="function",pa=Math.round,qa=Math.abs,ra=Date.now;la="function"!=typeof Object.assign?function(a){if(a===d||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var e=arguments[c];if(e!==d&&null!==e)for(var f in e)e.hasOwnProperty(f)&&(b[f]=e[f])}return b}:Object.assign;var sa=h(function(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a},"extend","Use `assign`."),ta=h(function(a,b){return sa(a,b,!0)},"merge","Use `assign`."),ua=1,va=/mobile|tablet|ip(ad|hone|od)|android/i,wa="ontouchstart"in a,xa=u(a,"PointerEvent")!==d,ya=wa&&va.test(navigator.userAgent),za="touch",Aa="pen",Ba="mouse",Ca="kinect",Da=25,Ea=1,Fa=2,Ga=4,Ha=8,Ia=1,Ja=2,Ka=4,La=8,Ma=16,Na=Ja|Ka,Oa=La|Ma,Pa=Na|Oa,Qa=["x","y"],Ra=["clientX","clientY"];x.prototype={handler:function(){},init:function(){this.evEl&&m(this.element,this.evEl,this.domHandler),this.evTarget&&m(this.target,this.evTarget,this.domHandler),this.evWin&&m(w(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(w(this.element),this.evWin,this.domHandler)}};var Sa={mousedown:Ea,mousemove:Fa,mouseup:Ga},Ta="mousedown",Ua="mousemove mouseup";i(L,x,{handler:function(a){var b=Sa[a.type];b&Ea&&0===a.button&&(this.pressed=!0),b&Fa&&1!==a.which&&(b=Ga),this.pressed&&(b&Ga&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:Ba,srcEvent:a}))}});var Va={pointerdown:Ea,pointermove:Fa,pointerup:Ga,pointercancel:Ha,pointerout:Ha},Wa={2:za,3:Aa,4:Ba,5:Ca},Xa="pointerdown",Ya="pointermove pointerup pointercancel";a.MSPointerEvent&&!a.PointerEvent&&(Xa="MSPointerDown",Ya="MSPointerMove MSPointerUp MSPointerCancel"),i(M,x,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Va[d],f=Wa[a.pointerType]||a.pointerType,g=f==za,h=r(b,a.pointerId,"pointerId");e&Ea&&(0===a.button||g)?0>h&&(b.push(a),h=b.length-1):e&(Ga|Ha)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Za={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},$a="touchstart",_a="touchstart touchmove touchend touchcancel";i(N,x,{handler:function(a){var b=Za[a.type];if(b===Ea&&(this.started=!0),this.started){var c=O.call(this,a,b);b&(Ga|Ha)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}}});var ab={touchstart:Ea,touchmove:Fa,touchend:Ga,touchcancel:Ha},bb="touchstart touchmove touchend touchcancel";i(P,x,{handler:function(a){var b=ab[a.type],c=Q.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:za,srcEvent:a})}});var cb=2500,db=25;i(R,x,{handler:function(a,b,c){var d=c.pointerType==za,e=c.pointerType==Ba;if(!(e&&c.sourceCapabilities&&c.sourceCapabilities.firesTouchEvents)){if(d)S.call(this,b,c);else if(e&&U.call(this,c))return;this.callback(a,b,c)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var eb=u(na.style,"touchAction"),fb=eb!==d,gb="compute",hb="auto",ib="manipulation",jb="none",kb="pan-x",lb="pan-y",mb=X();V.prototype={set:function(a){a==gb&&(a=this.compute()),fb&&this.manager.element.style&&mb[a]&&(this.manager.element.style[eb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){k(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),W(a.join(" "))},preventDefaults:function(a){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=p(d,jb)&&!mb[jb],f=p(d,lb)&&!mb[lb],g=p(d,kb)&&!mb[kb];if(e){var h=1===a.pointers.length,i=a.distance<2,j=a.deltaTime<250;if(h&&i&&j)return}return g&&f?void 0:e||f&&c&Na||g&&c&Oa?this.preventSrc(b):void 0},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var nb=1,ob=2,pb=4,qb=8,rb=qb,sb=16,tb=32;Y.prototype={defaults:{},set:function(a){return la(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=_(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=_(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=_(a,this),-1===r(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=_(a,this);var b=r(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(b,a)}var c=this,d=this.state;qb>d&&b(c.options.event+Z(d)),b(c.options.event),a.additionalEvent&&b(a.additionalEvent),d>=qb&&b(c.options.event+Z(d))},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=tb)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(tb|nb)))return!1;a++}return!0},recognize:function(a){var b=la({},a);return k(this.options.enable,[this,b])?(this.state&(rb|sb|tb)&&(this.state=nb),this.state=this.process(b),void(this.state&(ob|pb|qb|sb)&&this.tryEmit(b))):(this.reset(),void(this.state=tb))},process:function(a){},getTouchAction:function(){},reset:function(){}},i(aa,Y,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ob|pb),e=this.attrTest(a);return d&&(c&Ha||!e)?b|sb:d||e?c&Ga?b|qb:b&ob?b|pb:ob:tb}}),i(ba,aa,{defaults:{event:"pan",threshold:10,pointers:1,direction:Pa},getTouchAction:function(){var a=this.options.direction,b=[];return a&Na&&b.push(lb),a&Oa&&b.push(kb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Na?(e=0===f?Ia:0>f?Ja:Ka,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ia:0>g?La:Ma,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return aa.prototype.attrTest.call(this,a)&&(this.state&ob||!(this.state&ob)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=$(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),i(ca,aa,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ob)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),i(da,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[hb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(Ga|Ha)&&!f)this.reset();else if(a.eventType&Ea)this.reset(),this._timer=e(function(){this.state=rb,this.tryEmit()},b.time,this);else if(a.eventType&Ga)return rb;return tb},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===rb&&(a&&a.eventType&Ga?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=ra(),this.manager.emit(this.options.event,this._input)))}}),i(ea,aa,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ob)}}),i(fa,aa,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Na|Oa,pointers:1},getTouchAction:function(){return ba.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Na|Oa)?b=a.overallVelocity:c&Na?b=a.overallVelocityX:c&Oa&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&qa(b)>this.options.velocity&&a.eventType&Ga},emit:function(a){var b=$(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),i(ga,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ib]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&Ea&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=Ga)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||H(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=rb,this.tryEmit()},b.interval,this),ob):rb}return tb},failTimeout:function(){return this._timer=e(function(){this.state=tb},this.options.interval,this),tb},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==rb&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ha.VERSION="2.0.8",ha.defaults={domEvents:!1,touchAction:gb,enable:!0,inputTarget:null,inputClass:null,preset:[[ea,{enable:!1}],[ca,{enable:!1},["rotate"]],[fa,{direction:Na}],[ba,{direction:Na},["swipe"]],[ga],[ga,{event:"doubletap",taps:2},["tap"]],[da]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var ub=1,vb=2;ia.prototype={set:function(a){return la(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?vb:ub},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&rb)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===vb||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ob|pb|qb)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof Y)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;if(a=this.get(a)){var b=this.recognizers,c=r(b,a);-1!==c&&(b.splice(c,1),this.touchAction.update())}return this},on:function(a,b){if(a!==d&&b!==d){var c=this.handlers;return g(q(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this}},off:function(a,b){if(a!==d){var c=this.handlers;return g(q(a),function(a){b?c[a]&&c[a].splice(r(c[a],b),1):delete c[a]}),this}},emit:function(a,b){this.options.domEvents&&ka(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&ja(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},la(ha,{INPUT_START:Ea,INPUT_MOVE:Fa,INPUT_END:Ga,INPUT_CANCEL:Ha,STATE_POSSIBLE:nb,STATE_BEGAN:ob,STATE_CHANGED:pb,STATE_ENDED:qb,STATE_RECOGNIZED:rb,STATE_CANCELLED:sb,STATE_FAILED:tb,DIRECTION_NONE:Ia,DIRECTION_LEFT:Ja,DIRECTION_RIGHT:Ka,DIRECTION_UP:La,DIRECTION_DOWN:Ma,DIRECTION_HORIZONTAL:Na,DIRECTION_VERTICAL:Oa,DIRECTION_ALL:Pa,Manager:ia,Input:x,TouchAction:V,TouchInput:P,MouseInput:L,PointerEventInput:M,TouchMouseInput:R,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:aa,Tap:ga,Pan:ba,Swipe:fa,Pinch:ca,Rotate:ea,Press:da,on:m,off:n,each:g,merge:ta,extend:sa,assign:la,inherit:i,bindFn:j,prefixed:u});var wb="undefined"!=typeof a?a:"undefined"!=typeof self?self:{};wb.Hammer_gg=ha,"function"==typeof define&&define.amd?define(function(){return ha}):"undefined"!=typeof module&&module.exports?module.exports=ha:a[c]=ha}(window,document,"Hammer_gg");
if(!window.History.Adapter){
(typeof JSON!='object'&&(JSON={}),
(function (){
'use strict';
function f(e){
return e < 10 ? '0' + e:e;
}
function quote(e){
return (
(escapable.lastIndex=0),
escapable.test(e)
? '"' +
e.replace(escapable, function (e){
var t=meta[e];
return typeof t=='string' ? t:'\\u' + ('0000' + e.charCodeAt(0).toString(16)).slice(-4);
}) +
'"'
: '"' + e + '"'
);
}
function str(e, t){
var n,
r,
i,
s,
o=gap,
u,
a=t[e];
(a&&typeof a=='object'&&typeof a.toJSON=='function'&&(a=a.toJSON(e)), typeof rep=='function'&&(a=rep.call(t, e, a)));
switch (typeof a){
case 'string':
return quote(a);
case 'number':
return isFinite(a) ? String(a):'null';
case 'boolean':
case 'null':
return String(a);
case 'object':
if(!a) return 'null';
((gap +=indent), (u=[]));
if(Object.prototype.toString.apply(a)==='[object Array]'){
s=a.length;
for (n=0; n < s; n +=1) u[n]=str(n, a)||'null';
return ((i=u.length===0 ? '[]':gap ? '[\n' + gap + u.join(',\n' + gap) + '\n' + o + ']':'[' + u.join(',') + ']'), (gap=o), i);
}
if(rep&&typeof rep=='object'){
s=rep.length;
for (n=0; n < s; n +=1) typeof rep[n]=='string'&&((r=rep[n]), (i=str(r, a)), i&&u.push(quote(r) + (gap ? ': ':':') + i));
} else for (r in a) Object.prototype.hasOwnProperty.call(a, r)&&((i=str(r, a)), i&&u.push(quote(r) + (gap ? ': ':':') + i));
return ((i=u.length===0 ? '{}':gap ? '{\n' + gap + u.join(',\n' + gap) + '\n' + o + '}':'{' + u.join(',') + '}'), (gap=o), i);
}}
typeof Date.prototype.toJSON!='function' &&
((Date.prototype.toJSON=function (e){
return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z':null;
}),
(String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON =
function (e){
return this.valueOf();
}));
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta={ '\b': '\\b', '	': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' },
rep;
(typeof JSON.stringify!='function' &&
(JSON.stringify=function (e, t, n){
var r;
((gap=''), (indent=''));
if(typeof n=='number') for (r=0; r < n; r +=1) indent +=' ';
else typeof n=='string'&&(indent=n);
rep=t;
if(!t||typeof t=='function'||(typeof t=='object'&&typeof t.length=='number')) return str('', { '': e });
throw new Error('JSON.stringify');
}),
typeof JSON.parse!='function' &&
(JSON.parse=function (text, reviver){
function walk(e, t){
var n,
r,
i=e[t];
if(i&&typeof i=='object') for (n in i) Object.prototype.hasOwnProperty.call(i, n)&&((r=walk(i, n)), r!==undefined ? (i[n]=r):delete i[n]);
return reviver.call(e, t, i);
}
var j;
((text=String(text)),
(cx.lastIndex=0),
cx.test(text) &&
(text=text.replace(cx, function (e){
return '\\u' + ('0000' + e.charCodeAt(0).toString(16)).slice(-4);
})));
if(/^[\],:{}\s]*$/.test(text
.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, '')
)
)
return ((j=eval('(' + text + ')')), typeof reviver=='function' ? walk({ '': j }, ''):j);
throw new SyntaxError('JSON.parse');
}));
})(),
(function (e, t){
'use strict';
var n=(e.History=e.History||{}),
r=e.jQuery;
if(typeof n.Adapter!='undefined') throw new Error('History.js Adapter has already been loaded...');
((n.Adapter={
bind: function (e, t, n){
r(e).bind(t, n);
},
trigger: function (e, t, n){
r(e).trigger(t, n);
},
extractEventData: function (e, n, r){
var i=(n&&n.originalEvent&&n.originalEvent[e])||(r&&r[e])||t;
return i;
},
onDomLoad: function (e){
r(e);
},
}),
typeof n.init!='undefined'&&n.init());
})(window),
(function (e, t){
'use strict';
var n=e.document,
r=e.setTimeout||r,
i=e.clearTimeout||i,
s=e.setInterval||s,
o=(e.History=e.History||{});
if(typeof o.initHtml4!='undefined') throw new Error('History.js HTML4 Support has already been loaded...');
((o.initHtml4=function (){
if(typeof o.initHtml4.initialized!='undefined') return !1;
((o.initHtml4.initialized = !0),
(o.enabled = !0),
(o.savedHashes=[]),
(o.isLastHash=function (e){
var t=o.getHashByIndex(),
n;
return ((n=e===t), n);
}),
(o.isHashEqual=function (e, t){
return ((e=encodeURIComponent(e).replace(/%25/g, '%')), (t=encodeURIComponent(t).replace(/%25/g, '%')), e===t);
}),
(o.saveHash=function (e){
return o.isLastHash(e) ? !1:(o.savedHashes.push(e), !0);
}),
(o.getHashByIndex=function (e){
var t=null;
return (typeof e=='undefined' ? (t=o.savedHashes[o.savedHashes.length - 1]):e < 0 ? (t=o.savedHashes[o.savedHashes.length + e]):(t=o.savedHashes[e]), t);
}),
(o.discardedHashes={}),
(o.discardedStates={}),
(o.discardState=function (e, t, n){
var r=o.getHashByState(e),
i;
return ((i={ discardedState: e, backState: n, forwardState: t }), (o.discardedStates[r]=i), !0);
}),
(o.discardHash=function (e, t, n){
var r={ discardedHash: e, backState: n, forwardState: t };
return ((o.discardedHashes[e]=r), !0);
}),
(o.discardedState=function (e){
var t=o.getHashByState(e),
n;
return ((n=o.discardedStates[t]||!1), n);
}),
(o.discardedHash=function (e){
var t=o.discardedHashes[e]||!1;
return t;
}),
(o.recycleState=function (e){
var t=o.getHashByState(e);
return (o.discardedState(e)&&delete o.discardedStates[t], !0);
}),
o.emulated.hashChange &&
((o.hashChangeInit=function (){
o.checkerFunction=null;
var t='',
r,
i,
u,
a,
f=Boolean(o.getHash());
return (
o.isInternetExplorer()
? ((r='historyjs-iframe'),
(i=n.createElement('iframe')),
i.setAttribute('id', r),
i.setAttribute('src', '#'),
(i.style.display='none'),
n.body.appendChild(i),
i.contentWindow.document.open(),
i.contentWindow.document.close(),
(u=''),
(a = !1),
(o.checkerFunction=function (){
if(a) return !1;
a = !0;
var n=o.getHash(),
r=o.getHash(i.contentWindow.document);
return (
n!==t
? ((t=n), r!==n&&((u=r = n), i.contentWindow.document.open(), i.contentWindow.document.close(), (i.contentWindow.document.location.hash=o.escapeHash(n))), o.Adapter.trigger(e, 'hashchange'))
: r!==u&&((u=r), f&&r==='' ? o.back():o.setHash(r, !1)),
(a = !1),
!0
);
}))
: (o.checkerFunction=function (){
var n=o.getHash()||'';
return (n!==t&&((t=n), o.Adapter.trigger(e, 'hashchange')), !0);
}),
o.intervalList.push(s(o.checkerFunction, o.options.hashChangeInterval)),
!0
);
}),
o.Adapter.onDomLoad(o.hashChangeInit)),
o.emulated.pushState &&
((o.onHashChange=function (t){
var n=(t&&t.newURL)||o.getLocationHref(),
r=o.getHashByUrl(n),
i=null,
s=null,
u=null,
a;
return o.isLastHash(r)
? (o.busy(!1), !1)
: (o.doubleCheckComplete(),
o.saveHash(r),
r&&o.isTraditionalAnchor(r)
? (o.Adapter.trigger(e, 'anchorchange'), o.busy(!1), !1)
: ((i=o.extractState(o.getFullUrl(r||o.getLocationHref()), !0)),
o.isLastSavedState(i) ? (o.busy(!1), !1):((s=o.getHashByState(i)), (a=o.discardedState(i)), a ? (o.getHashByIndex(-2)===o.getHashByState(a.forwardState) ? o.back(!1):o.forward(!1), !1):(o.pushState(i.data, i.title, encodeURI(i.url), !1), !0))));
}),
o.Adapter.bind(e, 'hashchange', o.onHashChange),
(o.pushState=function (t, n, r, i){
r=encodeURI(r).replace(/%25/g, '%');
if(o.getHashByUrl(r)) throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');
if(i!==!1&&o.busy()) return (o.pushQueue({ scope: o, callback: o.pushState, args: arguments, queue: i }), !1);
o.busy(!0);
var s=o.createStateObject(t, n, r),
u=o.getHashByState(s),
a=o.getState(!1),
f=o.getHashByState(a),
l=o.getHash(),
c=o.expectedStateId==s.id;
return (
o.storeState(s),
(o.expectedStateId=s.id),
o.recycleState(s),
o.setTitle(s),
u===f ? (o.busy(!1), !1):(o.saveState(s), c||o.Adapter.trigger(e, 'statechange'), !o.isHashEqual(u, l)&&!o.isHashEqual(u, o.getShortUrl(o.getLocationHref()))&&o.setHash(u, !1), o.busy(!1), !0)
);
}),
(o.replaceState=function (t, n, r, i){
r=encodeURI(r).replace(/%25/g, '%');
if(o.getHashByUrl(r)) throw new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');
if(i!==!1&&o.busy()) return (o.pushQueue({ scope: o, callback: o.replaceState, args: arguments, queue: i }), !1);
o.busy(!0);
var s=o.createStateObject(t, n, r),
u=o.getHashByState(s),
a=o.getState(!1),
f=o.getHashByState(a),
l=o.getStateByIndex(-2);
return (o.discardState(a, s, l), u===f ? (o.storeState(s), (o.expectedStateId=s.id), o.recycleState(s), o.setTitle(s), o.saveState(s), o.Adapter.trigger(e, 'statechange'), o.busy(!1)):o.pushState(s.data, s.title, s.url, !1), !0);
})),
o.emulated.pushState &&
o.getHash() &&
!o.emulated.hashChange &&
o.Adapter.onDomLoad(function (){
o.Adapter.trigger(e, 'hashchange');
}));
}),
typeof o.init!='undefined'&&o.init());
})(window),
(function (e, t){
'use strict';
var n=e.console||t,
r=e.document,
i=e.navigator,
s = !1,
o=e.setTimeout,
u=e.clearTimeout,
a=e.setInterval,
f=e.clearInterval,
l=e.JSON,
c=e.alert,
h=(e.History=e.History||{}),
p=e.history;
try {
((s=e.sessionStorage), s.setItem('TEST', '1'), s.removeItem('TEST'));
} catch (d){
s = !1;
}
((l.stringify=l.stringify||l.encode), (l.parse=l.parse||l.decode));
if(typeof h.init!='undefined') throw new Error('History.js Core has already been loaded...');
((h.init=function (e){
return typeof h.Adapter=='undefined' ? !1:(typeof h.initCore!='undefined'&&h.initCore(), typeof h.initHtml4!='undefined'&&h.initHtml4(), !0);
}),
(h.initCore=function (d){
if(typeof h.initCore.initialized!='undefined') return !1;
((h.initCore.initialized = !0),
(h.options=h.options||{}),
(h.options.hashChangeInterval=h.options.hashChangeInterval||100),
(h.options.safariPollInterval=h.options.safariPollInterval||500),
(h.options.doubleCheckInterval=h.options.doubleCheckInterval||500),
(h.options.disableSuid=h.options.disableSuid||!1),
(h.options.storeInterval=h.options.storeInterval||1e3),
(h.options.busyDelay=h.options.busyDelay||250),
(h.options.debug=h.options.debug||!1),
(h.options.initialTitle=h.options.initialTitle||r.title),
(h.options.html4Mode=h.options.html4Mode||!1),
(h.options.delayInit=h.options.delayInit||!1),
(h.intervalList=[]),
(h.clearAllIntervals=function (){
var e,
t=h.intervalList;
if(typeof t!='undefined'&&t!==null){
for (e=0; e < t.length; e++) f(t[e]);
h.intervalList=null;
}}),
(h.debug=function (){
(h.options.debug||!1)&&h.log.apply(h, arguments);
}),
(h.log=function (){
var e=typeof n!='undefined'&&typeof n.log!='undefined'&&typeof n.log.apply!='undefined',
t=r.getElementById('log'),
i,
s,
o,
u,
a;
e ? ((u=Array.prototype.slice.call(arguments)), (i=u.shift()), typeof n.debug!='undefined' ? n.debug.apply(n, [i, u]):n.log.apply(n, [i, u])):(i='\n' + arguments[0] + '\n');
for (s=1, o=arguments.length; s < o; ++s){
a=arguments[s];
if(typeof a=='object'&&typeof l!='undefined')
try {
a=l.stringify(a);
} catch (f){}
i +='\n' + a + '\n';
}
return (t ? ((t.value +=i + '\n-----\n'), (t.scrollTop=t.scrollHeight - t.clientHeight)):e||c(i), !0);
}),
(h.getInternetExplorerMajorVersion=function (){
var e=(h.getInternetExplorerMajorVersion.cached =
typeof h.getInternetExplorerMajorVersion.cached!='undefined'
? h.getInternetExplorerMajorVersion.cached
: (function (){
var e=3,
t=r.createElement('div'),
n=t.getElementsByTagName('i');
while ((t.innerHTML='<!--[if gt IE ' + ++e + ']><i></i><![endif]-->')&&n[0]);
return e > 4 ? e:!1;
})());
return e;
}),
(h.isInternetExplorer=function (){
var e=(h.isInternetExplorer.cached=typeof h.isInternetExplorer.cached!='undefined' ? h.isInternetExplorer.cached:Boolean(h.getInternetExplorerMajorVersion()));
return e;
}),
h.options.html4Mode
? (h.emulated={ pushState: !0, hashChange: !0 })
: (h.emulated={
pushState: !Boolean(e.history&&e.history.pushState&&e.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(i.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(i.userAgent)),
hashChange: Boolean(!('onhashchange' in e||'onhashchange' in r)||(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion() < 8)),
}),
(h.enabled = !h.emulated.pushState),
(h.bugs={
setHash: Boolean(!h.emulated.pushState&&i.vendor==='Apple Computer, Inc.'&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),
safariPoll: Boolean(!h.emulated.pushState&&i.vendor==='Apple Computer, Inc.'&&/AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)),
ieDoubleCheck: Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion() < 8),
hashEscape: Boolean(h.isInternetExplorer()&&h.getInternetExplorerMajorVersion() < 7),
}),
(h.isEmptyObject=function (e){
for (var t in e) if(e.hasOwnProperty(t)) return !1;
return !0;
}),
(h.cloneObject=function (e){
var t, n;
return (e ? ((t=l.stringify(e)), (n=l.parse(t))):(n={}), n);
}),
(h.getRootUrl=function (){
var e=r.location.protocol + '//' + (r.location.hostname||r.location.host);
if(r.location.port||!1) e +=':' + r.location.port;
return ((e +='/'), e);
}),
(h.getBaseHref=function (){
var e=r.getElementsByTagName('base'),
t=null,
n='';
return (e.length===1&&((t=e[0]), (n=t.href.replace(/[^\/]+$/, ''))), (n=n.replace(/\/+$/, '')), n&&(n +='/'), n);
}),
(h.getBaseUrl=function (){
var e=h.getBaseHref()||h.getBasePageUrl()||h.getRootUrl();
return e;
}),
(h.getPageUrl=function (){
var e=h.getState(!1, !1),
t=(e||{}).url||h.getLocationHref(),
n;
return (
(n=t.replace(/\/+$/, '').replace(/[^\/]+$/, function (e, t, n){
return /\./.test(e) ? e:e + '/';
})),
n
);
}),
(h.getBasePageUrl=function (){
var e =
h
.getLocationHref()
.replace(/[#\?].*/, '')
.replace(/[^\/]+$/, function (e, t, n){
return /[^\/]$/.test(e) ? '':e;
})
.replace(/\/+$/, '') + '/';
return e;
}),
(h.getFullUrl=function (e, t){
var n=e,
r=e.substring(0, 1);
return (
(t=typeof t=='undefined' ? !0:t),
/[a-z]+\:\/\//.test(e) ||
(r==='/'
? (n=h.getRootUrl() + e.replace(/^\/+/, ''))
: r==='#'
? (n=h.getPageUrl().replace(/#.*/, '') + e)
: r==='?'
? (n=h.getPageUrl().replace(/[\?#].*/, '') + e)
: t
? (n=h.getBaseUrl() + e.replace(/^(\.\/)+/, ''))
: (n=h.getBasePageUrl() + e.replace(/^(\.\/)+/, ''))),
n.replace(/\#$/, '')
);
}),
(h.getShortUrl=function (e){
var t=e,
n=h.getBaseUrl(),
r=h.getRootUrl();
return (h.emulated.pushState&&(t=t.replace(n, '')), (t=t.replace(r, '/')), h.isTraditionalAnchor(t)&&(t='./' + t), (t=t.replace(/^(\.\/)+/g, './').replace(/\#$/, '')), t);
}),
(h.getLocationHref=function (e){
return (
(e=e||r),
e.URL===e.location.href
? e.location.href
: e.location.href===decodeURIComponent(e.URL)
? e.URL
: e.location.hash&&decodeURIComponent(e.location.href.replace(/^[^#]+/, ''))===e.location.hash
? e.location.href
: e.URL.indexOf('#')==-1&&e.location.href.indexOf('#')!=-1
? e.location.href
: e.URL||e.location.href
);
}),
(h.store={}),
(h.idToState=h.idToState||{}),
(h.stateToId=h.stateToId||{}),
(h.urlToId=h.urlToId||{}),
(h.storedStates=h.storedStates||[]),
(h.savedStates=h.savedStates||[]),
(h.normalizeStore=function (){
((h.store.idToState=h.store.idToState||{}), (h.store.urlToId=h.store.urlToId||{}), (h.store.stateToId=h.store.stateToId||{}));
}),
(h.getState=function (e, t){
(typeof e=='undefined'&&(e = !0), typeof t=='undefined'&&(t = !0));
var n=h.getLastSavedState();
return (!n&&t && (n=h.createStateObject()), e&&((n=h.cloneObject(n)), (n.url=n.cleanUrl||n.url)), n);
}),
(h.getIdByState=function (e){
var t=h.extractId(e.url),
n;
if(!t){
n=h.getStateString(e);
if(typeof h.stateToId[n]!='undefined') t=h.stateToId[n];
else if(typeof h.store.stateToId[n]!='undefined') t=h.store.stateToId[n];
else {
for (;;){
t=new Date().getTime() + String(Math.random()).replace(/\D/g, '');
if(typeof h.idToState[t]=='undefined'&&typeof h.store.idToState[t]=='undefined') break;
}
((h.stateToId[n]=t), (h.idToState[t]=e));
}}
return t;
}),
(h.normalizeState=function (e){
var t, n;
if(!e||typeof e!='object') e={};
if(typeof e.normalized!='undefined') return e;
if(!e.data||typeof e.data!='object') e.data={};
return (
(t={}),
(t.normalized = !0),
(t.title=e.title||''),
(t.url=h.getFullUrl(e.url ? e.url:h.getLocationHref())),
(t.hash=h.getShortUrl(t.url)),
(t.data=h.cloneObject(e.data)),
(t.id=h.getIdByState(t)),
(t.cleanUrl=t.url.replace(/\??\&_suid.*/, '')),
(t.url=t.cleanUrl),
(n = !h.isEmptyObject(t.data)),
(t.title||n)&&h.options.disableSuid!==!0&&((t.hash=h.getShortUrl(t.url).replace(/\??\&_suid.*/, '')), /\?/.test(t.hash)||(t.hash +='?'), (t.hash +='&_suid=' + t.id)),
(t.hashedUrl=h.getFullUrl(t.hash)),
(h.emulated.pushState||h.bugs.safariPoll)&&h.hasUrlDuplicate(t)&&(t.url=t.hashedUrl),
t
);
}),
(h.createStateObject=function (e, t, n){
var r={ data: e, title: t, url: n };
return ((r=h.normalizeState(r)), r);
}),
(h.getStateById=function (e){
e=String(e);
var n=h.idToState[e]||h.store.idToState[e]||t;
return n;
}),
(h.getStateString=function (e){
var t, n, r;
return ((t=h.normalizeState(e)), (n={ data: t.data, title: e.title, url: e.url }), (r=l.stringify(n)), r);
}),
(h.getStateId=function (e){
var t, n;
return ((t=h.normalizeState(e)), (n=t.id), n);
}),
(h.getHashByState=function (e){
var t, n;
return ((t=h.normalizeState(e)), (n=t.hash), n);
}),
(h.extractId=function (e){
var t, n, r, i;
return (e.indexOf('#')!=-1 ? (i=e.split('#')[0]):(i=e), (n=/(.*)\&_suid=([0-9]+)$/.exec(i)), (r=n ? n[1]||e:e), (t=n ? String(n[2]||''):''), t||!1);
}),
(h.isTraditionalAnchor=function (e){
var t = !/[\/\?\.]/.test(e);
return t;
}),
(h.extractState=function (e, t){
var n=null,
r,
i;
return ((t=t||!1), (r=h.extractId(e)), r&&(n=h.getStateById(r)), n||((i=h.getFullUrl(e)), (r=h.getIdByUrl(i)||!1), r&&(n=h.getStateById(r)), !n&&t && !h.isTraditionalAnchor(e)&&(n=h.createStateObject(null, null, i))), n);
}),
(h.getIdByUrl=function (e){
var n=h.urlToId[e]||h.store.urlToId[e]||t;
return n;
}),
(h.getLastSavedState=function (){
return h.savedStates[h.savedStates.length - 1]||t;
}),
(h.getLastStoredState=function (){
return h.storedStates[h.storedStates.length - 1]||t;
}),
(h.hasUrlDuplicate=function (e){
var t = !1,
n;
return ((n=h.extractState(e.url)), (t=n&&n.id!==e.id), t);
}),
(h.storeState=function (e){
return ((h.urlToId[e.url]=e.id), h.storedStates.push(h.cloneObject(e)), e);
}),
(h.isLastSavedState=function (e){
var t = !1,
n,
r,
i;
return (h.savedStates.length&&((n=e.id), (r=h.getLastSavedState()), (i=r.id), (t=n===i)), t);
}),
(h.saveState=function (e){
return h.isLastSavedState(e) ? !1:(h.savedStates.push(h.cloneObject(e)), !0);
}),
(h.getStateByIndex=function (e){
var t=null;
return (typeof e=='undefined' ? (t=h.savedStates[h.savedStates.length - 1]):e < 0 ? (t=h.savedStates[h.savedStates.length + e]):(t=h.savedStates[e]), t);
}),
(h.getCurrentIndex=function (){
var e=null;
return (h.savedStates.length < 1 ? (e=0):(e=h.savedStates.length - 1), e);
}),
(h.getHash=function (e){
var t=h.getLocationHref(e),
n;
return ((n=h.getHashByUrl(t)), n);
}),
(h.unescapeHash=function (e){
var t=h.normalizeHash(e);
return ((t=decodeURIComponent(t)), t);
}),
(h.normalizeHash=function (e){
var t=e.replace(/[^#]*#/, '').replace(/#.*/, '');
return t;
}),
(h.setHash=function (e, t){
var n, i;
return t!==!1&&h.busy()
? (h.pushQueue({ scope: h, callback: h.setHash, args: arguments, queue: t }), !1)
: (h.busy(!0), (n=h.extractState(e, !0)), n&&!h.emulated.pushState ? h.pushState(n.data, n.title, n.url, !1):h.getHash()!==e&&(h.bugs.setHash ? ((i=h.getPageUrl()), h.pushState(null, null, i + '#' + e, !1)):(r.location.hash=e)), h);
}),
(h.escapeHash=function (t){
var n=h.normalizeHash(t);
return ((n=e.encodeURIComponent(n)), h.bugs.hashEscape||(n=n.replace(/\%21/g, '!').replace(/\%26/g, '&').replace(/\%3D/g, '=').replace(/\%3F/g, '?')), n);
}),
(h.getHashByUrl=function (e){
var t=String(e).replace(/([^#]*)#?([^#]*)#?(.*)/, '$2');
return ((t=h.unescapeHash(t)), t);
}),
(h.setTitle=function (e){
var t=e.title,
n;
t||((n=h.getStateByIndex(0)), n&&n.url===e.url&&(t=n.title||h.options.initialTitle));
try {
r.getElementsByTagName('title')[0].innerHTML=t.replace('<', '&lt;').replace('>', '&gt;').replace(' & ', ' &amp; ');
} catch (i){}
return ((r.title=t), h);
}),
(h.queues=[]),
(h.busy=function (e){
typeof e!='undefined' ? (h.busy.flag=e):typeof h.busy.flag=='undefined'&&(h.busy.flag = !1);
if(!h.busy.flag){
u(h.busy.timeout);
var t=function (){
var e, n, r;
if(h.busy.flag) return;
for (e=h.queues.length - 1; e >=0; --e){
n=h.queues[e];
if(n.length===0) continue;
((r=n.shift()), h.fireQueueItem(r), (h.busy.timeout=o(t, h.options.busyDelay)));
}};
h.busy.timeout=o(t, h.options.busyDelay);
}
return h.busy.flag;
}),
(h.busy.flag = !1),
(h.fireQueueItem=function (e){
return e.callback.apply(e.scope||h, e.args||[]);
}),
(h.pushQueue=function (e){
return ((h.queues[e.queue||0]=h.queues[e.queue||0]||[]), h.queues[e.queue||0].push(e), h);
}),
(h.queue=function (e, t){
return (typeof e=='function'&&(e={ callback: e }), typeof t!='undefined'&&(e.queue=t), h.busy() ? h.pushQueue(e):h.fireQueueItem(e), h);
}),
(h.clearQueue=function (){
return ((h.busy.flag = !1), (h.queues=[]), h);
}),
(h.stateChanged = !1),
(h.doubleChecker = !1),
(h.doubleCheckComplete=function (){
return ((h.stateChanged = !0), h.doubleCheckClear(), h);
}),
(h.doubleCheckClear=function (){
return (h.doubleChecker&&(u(h.doubleChecker), (h.doubleChecker = !1)), h);
}),
(h.doubleCheck=function (e){
return (
(h.stateChanged = !1),
h.doubleCheckClear(),
h.bugs.ieDoubleCheck &&
(h.doubleChecker=o(function (){
return (h.doubleCheckClear(), h.stateChanged||e(), !0);
}, h.options.doubleCheckInterval)),
h
);
}),
(h.safariStatePoll=function (){
var t=h.extractState(h.getLocationHref()),
n;
if(!h.isLastSavedState(t)) return ((n=t), n||(n=h.createStateObject()), h.Adapter.trigger(e, 'popstate'), h);
return;
}),
(h.back=function (e){
return e!==!1&&h.busy()
? (h.pushQueue({ scope: h, callback: h.back, args: arguments, queue: e }), !1)
: (h.busy(!0),
h.doubleCheck(function (){
h.back(!1);
}),
p.go(-1),
!0);
}),
(h.forward=function (e){
return e!==!1&&h.busy()
? (h.pushQueue({ scope: h, callback: h.forward, args: arguments, queue: e }), !1)
: (h.busy(!0),
h.doubleCheck(function (){
h.forward(!1);
}),
p.go(1),
!0);
}),
(h.go=function (e, t){
var n;
if(e > 0) for (n=1; n <=e; ++n) h.forward(t);
else {
if(!(e < 0)) throw new Error('History.go: History.go requires a positive or negative integer passed.');
for (n=-1; n >=e; --n) h.back(t);
}
return h;
}));
if(h.emulated.pushState){
var v=function (){};
((h.pushState=h.pushState||v), (h.replaceState=h.replaceState||v));
} else
((h.onPopState=function (t, n){
var r = !1,
i = !1,
s,
o;
return (
h.doubleCheckComplete(),
(s=h.getHash()),
s
? ((o=h.extractState(s||h.getLocationHref(), !0)), o ? h.replaceState(o.data, o.title, o.url, !1):(h.Adapter.trigger(e, 'anchorchange'), h.busy(!1)), (h.expectedStateId = !1), !1)
: ((r=h.Adapter.extractEventData('state', t, n)||!1),
r ? (i=h.getStateById(r)):h.expectedStateId ? (i=h.getStateById(h.expectedStateId)):(i=h.extractState(h.getLocationHref())),
i||(i=h.createStateObject(null, null, h.getLocationHref())),
(h.expectedStateId = !1),
h.isLastSavedState(i) ? (h.busy(!1), !1):(h.storeState(i), h.saveState(i), h.setTitle(i), h.Adapter.trigger(e, 'statechange'), h.busy(!1), !0))
);
}),
h.Adapter.bind(e, 'popstate', h.onPopState),
(h.pushState=function (t, n, r, i){
if(h.getHashByUrl(r)&&h.emulated.pushState) throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
if(i!==!1&&h.busy()) return (h.pushQueue({ scope: h, callback: h.pushState, args: arguments, queue: i }), !1);
h.busy(!0);
var s=h.createStateObject(t, n, r);
return (h.isLastSavedState(s) ? h.busy(!1):(h.storeState(s), (h.expectedStateId=s.id), p.pushState(s.id, s.title, s.url), h.Adapter.trigger(e, 'popstate')), !0);
}),
(h.replaceState=function (t, n, r, i){
if(h.getHashByUrl(r)&&h.emulated.pushState) throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
if(i!==!1&&h.busy()) return (h.pushQueue({ scope: h, callback: h.replaceState, args: arguments, queue: i }), !1);
h.busy(!0);
var s=h.createStateObject(t, n, r);
return (h.isLastSavedState(s) ? h.busy(!1):(h.storeState(s), (h.expectedStateId=s.id), p.replaceState(s.id, s.title, s.url), h.Adapter.trigger(e, 'popstate')), !0);
}));
if(s){
try {
h.store=l.parse(s.getItem('History.store'))||{};} catch (m){
h.store={};}
h.normalizeStore();
} else ((h.store={}), h.normalizeStore());
(h.Adapter.bind(e, 'unload', h.clearAllIntervals),
h.saveState(h.storeState(h.extractState(h.getLocationHref(), !0))),
s &&
((h.onUnload=function (){
var e, t, n;
try {
e=l.parse(s.getItem('History.store'))||{};} catch (r){
e={};}
((e.idToState=e.idToState||{}), (e.urlToId=e.urlToId||{}), (e.stateToId=e.stateToId||{}));
for (t in h.idToState){
if(!h.idToState.hasOwnProperty(t)) continue;
e.idToState[t]=h.idToState[t];
}
for (t in h.urlToId){
if(!h.urlToId.hasOwnProperty(t)) continue;
e.urlToId[t]=h.urlToId[t];
}
for (t in h.stateToId){
if(!h.stateToId.hasOwnProperty(t)) continue;
e.stateToId[t]=h.stateToId[t];
}
((h.store=e), h.normalizeStore(), (n=l.stringify(e)));
try {
s.setItem('History.store', n);
} catch (i){
if(i.code!==DOMException.QUOTA_EXCEEDED_ERR) throw i;
s.length&&(s.removeItem('History.store'), s.setItem('History.store', n));
}}),
h.intervalList.push(a(h.onUnload, h.options.storeInterval)),
h.Adapter.bind(e, 'beforeunload', h.onUnload),
h.Adapter.bind(e, 'unload', h.onUnload)));
if(!h.emulated.pushState){
h.bugs.safariPoll&&h.intervalList.push(a(h.safariStatePoll, h.options.safariPollInterval));
if(i.vendor==='Apple Computer, Inc.'||(i.appCodeName||'')==='Mozilla')
(h.Adapter.bind(e, 'hashchange', function (){
h.Adapter.trigger(e, 'popstate');
}),
h.getHash() &&
h.Adapter.onDomLoad(function (){
h.Adapter.trigger(e, 'hashchange');
}));
}}),
(!h.options||!h.options.delayInit)&&h.init());
})(window));
};
!function(e,t,i,o){var n=e(t);e.fn.ggLazyLoad=function(r){var f,l=this,a={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:t,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};function h(){var t=0;l.each(function(){var i=e(this);if(!a.skip_invisible||i.is(":visible"))if(e.abovethetop(this,a)||e.leftofbegin(this,a));else if(e.belowthefold(this,a)||e.rightoffold(this,a)){if(++t>a.failure_limit)return!1}else i.trigger("appear"),t=0})}return r&&(o!==r.failurelimit&&(r.failure_limit=r.failurelimit,delete r.failurelimit),o!==r.effectspeed&&(r.effect_speed=r.effectspeed,delete r.effectspeed),e.extend(a,r)),f=a.container===o||a.container===t?n:e(a.container),0===a.event.indexOf("scroll")&&f.bind(a.event,function(){return h()}),this.each(function(){var t=this,i=e(t);t.loaded=!1,i.attr("src")!==o&&!1!==i.attr("src")||i.is("img")&&i.attr("src",a.placeholder),i.one("appear",function(){if(!this.loaded){if(a.appear){var o=l.length;a.appear.call(t,o,a)}e("<img />").bind("load",function(){var o=i.attr("data-"+a.data_attribute);i.hide(),i.is("img")?i.attr("src",o):i.css("background-image","url('"+o+"')"),i.removeClass("ggLazyImg"),i[a.effect](a.effect_speed),t.loaded=!0;var n=e.grep(l,function(e){return!e.loaded});if(l=e(n),a.load){var r=l.length;a.load.call(t,r,a)}}).attr("src",i.attr("data-"+a.data_attribute))}}),0!==a.event.indexOf("scroll")&&i.bind(a.event,function(){t.loaded||i.trigger("appear")})}),n.bind("resize",function(){h()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&n.bind("pageshow",function(t){t.originalEvent&&t.originalEvent.persisted&&l.each(function(){e(this).trigger("appear")})}),e(i).ready(function(){h()}),this},e.belowthefold=function(i,r){return(r.container===o||r.container===t?(t.innerHeight?t.innerHeight:n.height())+n.scrollTop():e(r.container).offset().top+e(r.container).height())<=e(i).offset().top-r.threshold},e.rightoffold=function(i,r){return(r.container===o||r.container===t?n.width()+n.scrollLeft():e(r.container).offset().left+e(r.container).width())<=e(i).offset().left-r.threshold},e.abovethetop=function(i,r){return(r.container===o||r.container===t?n.scrollTop():e(r.container).offset().top)>=e(i).offset().top+r.threshold+e(i).height()},e.leftofbegin=function(i,r){return(r.container===o||r.container===t?n.scrollLeft():e(r.container).offset().left)>=e(i).offset().left+r.threshold+e(i).width()},e.inviewport=function(t,i){return!(e.rightoffold(t,i)||e.leftofbegin(t,i)||e.belowthefold(t,i)||e.abovethetop(t,i))},e.extend(e.expr[":"],{"below-the-fold":function(t){return e.belowthefold(t,{threshold:0})},"above-the-top":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-screen":function(t){return e.rightoffold(t,{threshold:0})},"left-of-screen":function(t){return!e.rightoffold(t,{threshold:0})},"in-viewport":function(t){return e.inviewport(t,{threshold:0})},"above-the-fold":function(t){return!e.belowthefold(t,{threshold:0})},"right-of-fold":function(t){return e.rightoffold(t,{threshold:0})},"left-of-fold":function(t){return!e.rightoffold(t,{threshold:0})}})}(jQuery,window,document);
(function ($){
$.fn.extend({
slimScroll: function (options){
var defaults={
axis: 'y',
width: 'auto',
height: '250px',
size: '7px',
color: '#000',
positionX: 'bottom',
positionY: 'right',
distance: '1px',
startX: 'left',
startY: 'top',
opacity: 0.4,
alwaysVisible: false,
disableFadeOut: false,
railVisible: false,
railColor: '#333',
railOpacity: 0.2,
railDraggable: true,
railClassX: 'slimScrollRailX',
barClassX: 'slimScrollBarX',
railClassY: 'slimScrollRailY',
barClassY: 'slimScrollBarY',
wrapperClass: 'slimScrollDiv',
animate: false,
allowPageScroll: false,
wheelStep: 20,
touchScrollStep: 200,
borderRadius: '7px',
railBorderRadius: '7px',
ggSlimscrollHandler: false,
};
var o=$.extend(defaults, options);
o.axis=o.axis.toLowerCase();
this.each(function (){
var hasHorizontalScrollbar;
var hasVerticalScrollbar;
var t, pageX, pageY;
var isOverPanel,
isOverBarX,
isOverBarY,
isDragg,
queueHideX,
queueHideY,
touchDifX,
touchDifY,
barHeight,
barWidth,
percentScrollX,
lastScrollX,
percentScrollY,
lastScrollY,
divS='<div></div>',
minBarHeight=30,
minBarWidth=30,
releaseScroll=false;
var me=$(this);
var $doc=$(document);
if(me.parent().hasClass(o.wrapperClass)){
$.extend(o, me.data('slimScrollConfig')||{});
var offset_horizontal=me.scrollLeft();
var offset_vertical=me.scrollTop();
barX=me.siblings('.' + o.barClassX);
railX=me.siblings('.' + o.railClassX);
barY=me.siblings('.' + o.barClassY);
railY=me.siblings('.' + o.railClassY);
hasHorizontalScrollbar=o.axis=='both'||o.axis=='x';
hasVerticalScrollbar=o.axis=='both'||o.axis=='y';
getBarXWidth();
getBarYHeight();
if($.isPlainObject(options)){
if('width' in options&&hasHorizontalScrollbar){
if(options.width=='auto'){
me.parent().css('width', 'auto');
me.css('width', 'auto');
o.width=me.parent().parent().width();
}else{
o.width=options.width;
me.css({ 'white-space': 'nowrap' });
}}
if('height' in options&&hasVerticalScrollbar){
if(options.height=='auto'){
me.parent().css('height', 'auto');
me.css('height', 'auto');
o.height=me.parent().parent().height();
}else{
o.height=options.height;
}}
me.parent().css({
position: 'relative',
overflow: 'hidden',
width: o.width,
height: o.height,
});
me.css({
overflow: 'hidden',
width: o.width,
height: o.height,
});
if('scrollToX' in options){
offset_horizontal=parseInt(o.scrollToX);
}else if('scrollByX' in options){
offset_horizontal +=parseInt(o.scrollByX);
}
if('scrollToY' in options){
offset_vertical=parseInt(o.scrollToY);
}else if('scrollByY' in options){
offset_vertical +=parseInt(o.scrollByY);
}
if('destroy' in options){
barX.remove();
railX.remove();
barY.remove();
railY.remove();
me.unwrap();
return;
}}
scrollContent(offset_horizontal, offset_vertical, false, true);
return;
}else if($.isPlainObject(options)){
if('destroy' in options){
return;
}}
hasHorizontalScrollbar=o.axis=='both'||o.axis=='x';
hasVerticalScrollbar=o.axis=='both'||o.axis=='y';
o.height=o.height=='auto' ? me.parent().height():o.height;
o.width=o.width=='auto' ? me.parent().width():o.width;
me.data('slimScrollConfig', o);
var wrapper=$(divS).addClass(o.wrapperClass).css({
position: 'relative',
overflow: 'hidden',
width: o.width,
height: o.height,
});
me.css({
overflow: 'hidden',
width: o.width,
height: o.height,
});
me.wrap(wrapper);
if(hasHorizontalScrollbar){
if(o.width!='auto'&&hasHorizontalScrollbar){
me.css({ 'white-space': 'nowrap' });
}
var railX=$(divS)
.addClass(o.railClassX)
.css({
width: '100%',
height: o.size,
position: 'absolute',
left: 0,
display: o.alwaysVisible&&o.railVisible ? 'block':'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90,
});
var barX=$(divS)
.addClass(o.barClassX)
.css({
background: o.color,
height: o.size,
position: 'absolute',
left: 0,
opacity: o.opacity,
display: o.alwaysVisible ? 'block':'none',
'border-radius': o.borderRadius,
BorderRadius: o.borderRadius,
MozBorderRadius: o.borderRadius,
WebkitBorderRadius: o.borderRadius,
zIndex: 99,
});
var xPosCss=o.positionX=='top' ? { top: o.distance }:{ bottom: o.distance };
railX.css(xPosCss);
barX.css(xPosCss);
me.parent().append(barX);
me.parent().append(railX);
if(o.railDraggable){
barX
.on('mousedown', function (e){
isDragg=true;
t=parseFloat(barX.css('left'));
pageX=e.pageX;
$doc.on('mousemove.slimscrollX', function (e){
currLeft=t + e.pageX - pageX;
barX.css('left', currLeft);
scrollContent(0, 0, barX.position().left);
});
$doc.on('mouseup.slimscrollX', function (e){
isDragg=false;
hideBarX();
$doc.unbind('.slimscrollX');
});
return false;
})
.on('selectstart.slimscrollX', function (e){
e.stopPropagation();
e.preventDefault();
return false;
});
railX.on('mousedown', function (e){
var deltaX=((e.offsetX - barWidth / 2) * me[0].scrollWidth) / me.outerWidth();
scrollContent(deltaX, 0, false, true);
t=parseFloat(barX.css('left'));
pageX=e.pageX;
$doc.on('mousemove.slimscrollX', function (e){
currLeft=t + e.pageX - pageX;
barX.css('left', currLeft);
scrollContent(0, 0, barX.position().left);
});
$doc.on('mouseup.slimscrollX', function (e){
isDragg=false;
hideBarX();
$doc.unbind('.slimscrollX');
});
return false;
});
}
railX.hover(function (){
showBarX();
},
function (){
hideBarX();
}
);
barX.hover(function (){
isOverBarX=true;
},
function (){
isOverBarX=false;
}
);
getBarXWidth();
if(o.startX==='right'){
barX.css({ left: me.outerWidth() - barX.outerWidth() });
scrollContent(0, 0, true);
}else if(o.startX!=='left'){
scrollContent($(o.startX).position().left, null, null, true);
if(!o.alwaysVisible){
barX.hide();
}}
}
if(hasVerticalScrollbar){
var railY=$(divS)
.addClass(o.railClassY)
.css({
width: o.size,
height: '100%',
position: 'absolute',
top: 0,
display: o.alwaysVisible&&o.railVisible ? 'block':'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90,
});
var barY=$(divS)
.addClass(o.barClassY)
.css({
background: o.color,
width: o.size,
position: 'absolute',
top: 0,
opacity: o.opacity,
display: o.alwaysVisible ? 'block':'none',
'border-radius': o.borderRadius,
BorderRadius: o.borderRadius,
MozBorderRadius: o.borderRadius,
WebkitBorderRadius: o.borderRadius,
zIndex: 99,
});
var yPosCss=o.positionY=='right' ? { right: o.distance }:{ left: o.distance };
railY.css(yPosCss);
barY.css(yPosCss);
me.parent().append(barY);
me.parent().append(railY);
if(o.railDraggable){
barY
.on('mousedown', function (e){
isDragg=true;
t=parseFloat(barY.css('top'));
pageY=e.pageY;
$doc.on('mousemove.slimscrollY', function (e){
currTop=t + e.pageY - pageY;
barY.css('top', currTop);
scrollContent(0, 0, barY.position().top);
});
$doc.on('mouseup.slimscrollY', function (e){
isDragg=false;
hideBarY();
$doc.unbind('.slimscrollY');
});
return false;
})
.on('selectstart.slimscrollY', function (e){
e.stopPropagation();
e.preventDefault();
return false;
});
railY.on('mousedown', function (e){
var deltaY=((e.offsetY - barHeight / 2) * me[0].scrollHeight) / me.outerHeight();
scrollContent(0, deltaY, false, true);
t=parseFloat(barY.css('top'));
pageY=e.pageY;
$doc.on('mousemove.slimscrollY', function (e){
currTop=t + e.pageY - pageY;
barY.css('top', currTop);
scrollContent(0, 0, barY.position().top);
});
$doc.on('mouseup.slimscrollY', function (e){
isDragg=false;
hideBarY();
$doc.unbind('.slimscrollY');
});
return false;
});
}
railY.hover(function (){
showBarY();
},
function (){
hideBarY();
}
);
barY.hover(function (){
isOverBarY=true;
},
function (){
isOverBarY=false;
}
);
getBarYHeight();
if(o.startY==='bottom'){
barY.css({ top: me.outerHeight() - barY.outerHeight() });
scrollContent(0, 0, true);
}else if(o.startY!=='top'){
scrollContent(null, $(o.startY).position().top, null, true);
if(!o.alwaysVisible){
barY.hide();
}}
}
me.hover(function (){
isOverPanel=true;
showBarX();
showBarY();
hideBarX();
hideBarY();
},
function (){
isOverPanel=false;
hideBarX();
hideBarY();
}
);
var _triggerInit=function (){
if(typeof Hammer_gg=='undefined'){
setTimeout(_triggerInit, 100);
return;
}
if(o.isMobile){
var hammer=new Hammer_gg(this),
scrollWidth=50;
hammer.get('pan').set({
threshold: scrollWidth,
});
hammer.on('panleft', function (e){
scrollContent(0, scrollWidth, false, false, true);
panDistance=e.distance;
});
hammer.on('panend', function (e){
var offset=scrollWidth * (e.velocityX * -1) * 30;
scrollContent(0, offset, false, false, true);
});
hammer.on('panright', function (e){
scrollContent(0, -scrollWidth, false, false, true);
panDistance=e.distance;
});
}};
_triggerInit();
attachWheel(this);
function _getDeltaFromEvent(e){
var deltaX=0;
var deltaY=0;
deltaX=(e.deltaX||-e.wheelDelta||e.detail) >> 10||1;
deltaY=(e.deltaY||-e.wheelDelta||e.detail) >> 10||1;
if('axis' in e&&e.axis===e.HORIZONTAL_AXIS){
deltaX=deltaY * -1;
deltaY=0;
}
if(deltaX!==deltaX&&deltaY!==deltaY ){
deltaX=0;
}
return [deltaX, deltaY];
}
function _onWheel(e){
if(!isOverPanel){
return;
}
e=e||window.event;
var delta=_getDeltaFromEvent(e);
var deltaX=delta[0];
var deltaY=delta[1];
var target=e.target||e.srcTarget||e.srcElement;
if($(target)
.closest('.' + o.wrapperClass)
.is(me.parent())
){
scrollContent(deltaX, deltaY, true);
}
if(e.preventDefault&&!releaseScroll){
e.preventDefault();
e.stopPropagation();
}
if(!releaseScroll){
e.returnValue=false;
}}
function scrollContent(x, y, isWheel, isJump, isPan){
releaseScroll=false;
var needToRunWindowScroll=false,
prevBarXOffset=0;
if(hasHorizontalScrollbar){
var deltaX=x;
var maxLeft=me.outerWidth() - barX.outerWidth(),
totalWidth=me[0].scrollWidth,
scrollOffset=me.scrollLeft(),
barXOffset=parseFloat(barX.css('left'));
if(isWheel){
if(!hasVerticalScrollbar){
x=y;
}
deltaX=parseInt(barX.css('left')) + x * parseInt(o.wheelStep);
deltaX=Math.min(Math.max(deltaX, 0), maxLeft);
deltaX=x > 0 ? Math.ceil(deltaX):Math.floor(deltaX);
barX.css({ left: deltaX + 'px' });
prevBarXOffset=barXOffset;
barXOffset=parseFloat(barX.css('left'));
needToRunWindowScroll=prevBarXOffset==barXOffset;
}
percentScrollX=barXOffset / maxLeft;
deltaX=percentScrollX * (totalWidth - me.outerWidth());
if(isPan){
deltaX=totalWidth - (totalWidth - scrollOffset - y);
var panOffsetPercent=deltaX / (totalWidth - me.outerWidth());
var scrollBarOffset=maxLeft * panOffsetPercent;
scrollBarOffset=Math.min(Math.max(scrollBarOffset, 0), maxLeft);
scrollBarOffset=x > 0 ? Math.ceil(scrollBarOffset):Math.floor(scrollBarOffset);
barX.stop(true, true).animate({ left: scrollBarOffset + 'px' }, 300, 'linear');
}
if(isJump){
if(!hasVerticalScrollbar){
x=y;
}
deltaX=x;
var offsetLeft=(deltaX / me[0].scrollWidth) * me.outerWidth();
offsetLeft=Math.min(Math.max(offsetLeft, 0), maxLeft);
barX.css({ left: offsetLeft + 'px' });
}
if(o.animate){
me.scrollTop(deltaX);
me.stop(true, true).animate({ scrollLeft: deltaX }, 500, 'linear');
}else{
me.scrollLeft(deltaX);
}
me.trigger('slimscrollingX', ~~deltaX);
showBarX(needToRunWindowScroll);
hideBarX();
}
if(hasVerticalScrollbar){
var deltaY=y;
var maxTop=me.outerHeight() - barY.outerHeight();
if(isWheel){
deltaY=parseInt(barY.css('top')) + (y * parseInt(o.wheelStep)) / 100;
deltaY=Math.min(Math.max(deltaY, 0), maxTop);
deltaY=y > 0 ? Math.ceil(deltaY):Math.floor(deltaY);
barY.css({ top: deltaY + 'px' });
}
percentScrollY=parseInt(barY.css('top')) / (me.outerHeight() - barY.outerHeight());
deltaY=percentScrollY * (me[0].scrollHeight - me.outerHeight());
if(isJump){
deltaY=y;
var offsetTop=(deltaY / me[0].scrollHeight) * me.outerHeight();
offsetTop=Math.min(Math.max(offsetTop, 0), maxTop);
barY.css({ top: offsetTop + 'px' });
}
me.scrollTop(deltaY);
me.trigger('slimscrollingY', ~~deltaY);
showBarY();
hideBarY();
}
if(o.ggSlimscrollHandler){
o.ggSlimscrollHandler();
}}
function attachWheel(target){
if(window.addEventListener){
if(typeof window.onwheel!=='undefined'){
target.addEventListener('wheel', _onWheel, false);
}else if(typeof window.onmousewheel!=='undefined'){
target.addEventListener('mousewheel', _onWheel, false);
}
target.addEventListener('DOMMouseScroll', _onWheel, false);
}else{
document.attachEvent('onmousewheel', _onWheel);
}}
function getBarXWidth(){
if(!barX){
return;
}
barWidth=Math.max((me.outerWidth() / me[0].scrollWidth) * me.outerWidth(), minBarWidth);
barX.css({ width: barWidth + 'px' });
var display=hasHorizontalScrollbar&&me[0].scrollWidth > me[0].clientWidth ? 'block':'none';
barX.css({ display: display });
}
function getBarYHeight(){
if(!barY){
return;
}
barHeight=Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
barY.css({ height: barHeight + 'px' });
var display=hasVerticalScrollbar&&me[0].scrollHeight > me[0].clientHeight ? 'block':'none';
barY.css({ display: display });
}
function showBarX(needToRunWindowScroll){
if(!barX){
return;
}
getBarXWidth();
clearTimeout(queueHideX);
if(percentScrollX==~~percentScrollX&&needToRunWindowScroll){
releaseScroll=o.allowPageScroll;
if(lastScrollX!=percentScrollX){
var msg=~~percentScrollX===0 ? 'left':'right';
me.trigger('slimscrollX', msg);
}}else{
releaseScroll=false;
}
lastScrollX=percentScrollX;
if(barWidth >=me.outerWidth()){
releaseScroll=true;
return;
}
barX.fadeIn('fast');
if(o.railVisible){
railX.stop(true, true).fadeIn('fast');
}}
function hideBarX(){
if(!barX){
return;
}
if(!o.alwaysVisible){
queueHideX=setTimeout(function (){
if(!(o.disableFadeOut&&isOverPanel)&&!isOverBarX&&!isDragg){
barX.fadeOut('slow');
railX.fadeOut('slow');
}}, 1000);
}}
function showBarY(){
if(!barY){
return;
}
getBarYHeight();
clearTimeout(queueHideY);
if(percentScrollY==~~percentScrollY){
releaseScroll=o.allowPageScroll;
if(lastScrollY!=percentScrollY){
var msg=~~percentScrollY===0 ? 'top':'bottom';
me.trigger('slimscrollY', msg);
}}else{
releaseScroll=false;
}
lastScrollY=percentScrollY;
if(barHeight >=me.outerHeight()){
releaseScroll=true;
return;
}
barY.stop(true, true).fadeIn('fast');
if(o.railVisible){
railY.stop(true, true).fadeIn('fast');
}}
function hideBarY(){
if(!barY){
return;
}
if(!o.alwaysVisible){
queueHideY=setTimeout(function (){
if(!(o.disableFadeOut&&isOverPanel)&&!isOverBarY&&!isDragg){
barY.fadeOut('slow');
railY.fadeOut('slow');
}}, 1000);
}}
});
return this;
},
});
$.fn.extend({
slimscroll: $.fn.slimScroll,
});
})(jQuery);
(function ($, doc, win){
'use strict';
var Photobox,
photobox,
options,
images=[],
imageLinks,
activeImage=-1,
activeURL,
lastActive,
activeType,
prevImage,
nextImage,
thumbsStripe,
docElm,
APControl,
changeImage,
transitionend='transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd',
isOldIE = !('placeholder' in doc.createElement('input')),
noPointerEvents=(function (){
var el=$('<p>')[0];
el.style.cssText='pointer-events:auto';
return !el.style.pointerEvents;
})(),
isTouchDevice=false,
thumbsContainerWidth,
thumbsTotalWidth,
activeThumb=$(),
blankImg='data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',
transformOrigin=getPrefixed('transformOrigin'),
transition=getPrefixed('transition'),
raf =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (cb){
return window.setTimeout(cb, 1000 / 60);
},
preload={},
preloadPrev=new Image(),
preloadNext=new Image(),
closeBtn,
image,
video,
prevBtn,
nextBtn,
thumbsToggler,
caption,
captionText,
pbLoader,
autoplayBtn,
thumbs,
wrapper,
defaults={
single: false,
beforeShow: null,
afterClose: null,
getTitle: null,
loop: true,
thumb: null,
thumbs: true,
thumbAttr: 'data-src',
counter: '(A/B)',
title: true,
autoplay: false,
time: 3000,
history: false,
hideFlash: true,
zoomable: true,
wheelNextPrev: true,
keys: {
close: [27, 88, 67],
prev: [37, 80],
next: [39, 78],
},
},
overlay=$('<div id="pbOverlay">').append((thumbsToggler=$('<input type="checkbox" id="pbThumbsToggler" checked hidden>')),
(pbLoader=$('<div class="pbLoader"><b></b><b></b><b></b></div>')),
(prevBtn=$('<div id="pbPrevBtn" class="prevNext"><b></b></div>').on('click', next_prev)),
(nextBtn=$('<div id="pbNextBtn" class="prevNext"><b></b></div>').on('click', next_prev)),
(wrapper=$('<div class="pbWrapper">').append((image=$('<img>')),
(video=$('<div>'))
)),
(closeBtn=$('<div id="pbCloseBtn">').on('click', close)[0]),
(autoplayBtn=$('<div id="pbAutoplayBtn">').append($('<div class="pbProgress">'))),
(caption=$('<div id="pbCaption">').append('<label for="pbThumbsToggler" title="thumbnails on/off"></label>', (captionText=$('<div class="pbCaptionText">').append('<div class="title"></div><div class="counter">')), (thumbs=$('<div>').addClass('pbThumbs'))))
);
function throttle(callback, duration){
var wait=false;
return function (){
if(!wait){
callback.call();
wait=true;
setTimeout(function (){
wait=false;
}, duration);
}};}
function prepareDOM(){
noPointerEvents&&overlay.hide();
$(doc).on('touchstart.testMouse', function (){
$(doc).off('touchstart.testMouse');
isTouchDevice=true;
overlay.addClass('mobile');
});
autoplayBtn.off().on('click', APControl.toggle);
thumbs.off().on('click', 'a', thumbsStripe.click);
isOldIE&&overlay.addClass('msie');
overlay.off().on('click', 'img', function (e){
e.stopPropagation();
});
$(doc.body).append(overlay);
docElm=doc.documentElement;
}
$.fn.photobox=function (target, settings, callback){
return this.each(function (){
var o,
PB_data=$(this).data('_photobox');
if(PB_data){
if(target==='destroy') PB_data.destroy();
return this;
}
if(typeof target!='string') target='a';
if(target==='prepareDOM'){
prepareDOM();
return this;
}
if(settings.isDisableRightClick){
overlay.off('contextmenu').on('contextmenu', function (e){
return false;
});
}
o=$.extend({}, defaults, settings||{});
photobox=new Photobox(o, this, target);
$(this).data('_photobox', photobox);
photobox.callback=callback;
});
};
Photobox=function (_options, object, target){
this.options=$.extend({}, _options);
this.target=target;
this.selector=$(object||doc);
this.thumbsList=null;
var filtered=this.imageLinksFilter(this.selector.find(target));
this.imageLinks=filtered[0];
this.images=filtered[1];
this.init();
};
Photobox.prototype={
init: function (){
var that=this;
if(!that.thumbsList){
that.thumbsList=thumbsStripe.generate.apply(that);
}
this.selector.on('click.photobox', this.target, function (e){
e.preventDefault();
that.open(this);
});
this.observerTimeout=null;
if(this.selector[0].nodeType==1)
this.observeDOM(this.selector[0], this.onDOMchanges.bind(this));
},
onDOMchanges: function (){
var that=this;
clearTimeout(this.observerTimeout);
that.observerTimeout=setTimeout(function (){
var filtered=that.imageLinksFilter(that.selector.find(that.target)),
activeIndex=0,
isActiveUrl=false,
i;
if(that.imageLinks.length==filtered[0].length) return;
that.imageLinks=filtered[0];
that.images=filtered[1];
if(photobox){
if(that.selector==photobox.selector){
images=that.images;
imageLinks=that.imageLinks;
for (i=images.length; i--;){
if(images[i][0]==activeURL) isActiveUrl=true;
}}
}
that.thumbsList=thumbsStripe.generate.apply(that);
thumbs.html(that.thumbsList);
if(that.images.length&&activeURL&&that.options.thumbs){
activeIndex=that.thumbsList
.find('a[href="' + activeURL + '"]')
.eq(0)
.parent()
.index();
if(activeIndex==-1) activeIndex=0;
thumbsStripe.changeActive(activeIndex, 0);
}}, 50);
},
open: function (link){
var startImage=$.inArray(link, this.imageLinks);
if(startImage==-1) return false;
options=this.options;
images=this.images;
imageLinks=this.imageLinks;
photobox=this;
this.setup(1);
overlay
.on(transitionend, function (){
overlay.off(transitionend).addClass('on');
changeImage(startImage, true);
})
.addClass('show');
if(isOldIE) overlay.trigger('MSTransitionEnd');
return false;
},
imageLinksFilter: function (obj){
var that=this,
images=[],
caption={},
captionlink;
return [
obj.filter(function (i){
var link=$(this),
thumbImg,
thumbSrc='';
caption.content=link[0].getAttribute('title')||'';
if(that.options.thumb&&typeof that.options.thumb==='string') thumbImg=link.find(that.options.thumb)[0];
if(typeof that.options.thumb==='function'&&link&&link.length&&link.closest){
var funcRetThumbs=that.options.thumb(link);
if(funcRetThumbs){
thumbImg=funcRetThumbs;
}}
if(!that.options.thumb||!thumbImg) thumbImg=link.find('img')[0];
if(thumbImg){
captionlink=thumbImg.getAttribute('data-pb-captionlink');
thumbSrc=thumbImg.getAttribute(that.options.thumbAttr)||thumbImg.getAttribute('src');
caption.content=thumbImg.getAttribute('title')||thumbImg.getAttribute('alt')||'';
}
if(captionlink){
captionlink=captionlink.split('[');
if(captionlink.length==2){
caption.linkText=captionlink[0];
caption.linkHref=captionlink[1].slice(0, -1);
}else{
caption.linkText=captionlink;
caption.linkHref=captionlink;
}
caption.content +=' <a href="' + caption.linkHref + '">' + caption.linkText + '</a>';
}
images.push([link[0].href, caption.content, thumbSrc]);
return true;
}),
images,
];
},
observeDOM: (function (){
var MutationObserver=win.MutationObserver||win.WebKitMutationObserver,
eventListenerSupported=win.addEventListener;
return function (obj, callback){
if(MutationObserver){
var that=this;
var obs=new MutationObserver(function (mutations, observer){
if(mutations[0].addedNodes.length||mutations[0].removedNodes.length) callback(that);
});
obs.observe(obj, { childList: true, subtree: true });
}else if(eventListenerSupported){
obj.addEventListener('DOMNodeInserted', callback.bind(that), false);
obj.addEventListener('DOMNodeRemoved', callback.bind(that), false);
}};})(),
setup: function (open){
var fn=open ? 'on':'off';
image[0].src=blankImg;
if(options.thumbs){
if(!isTouchDevice){
thumbs[fn]('mouseenter.photobox', thumbsStripe.calc)[fn]('mousemove.photobox', thumbsStripe.move);
}}
if(open){
image.css({ transition: '0s' }).removeAttr('style');
overlay.show();
thumbs.html(this.thumbsList).trigger('mouseenter.photobox');
if(options.thumbs){
overlay.addClass('thumbs');
}else{
thumbsToggler.prop('checked', false);
overlay.removeClass('thumbs');
}
if(this.images.length < 2||options.single) overlay.removeClass('thumbs hasArrows hasCounter hasAutoplay');
else {
overlay.addClass('hasArrows hasCounter');
if(options.time > 1000){
overlay.addClass('hasAutoplay');
if(options.autoplay) APControl.progress.start();
else APControl.pause();
} else overlay.removeClass('hasAutoplay');
}
options.hideFlash&&$('iframe, object, embed').css('visibility', 'hidden');
}else{
$(win).off('resize.photobox');
}
$(doc).off('keydown.photobox')[fn]({ 'keydown.photobox': keyDown });
if(isTouchDevice){
wrapper[fn]('swipe', onSwipe);
}
if(options.zoomable){
overlay[fn]({ 'mousewheel.photobox': scrollZoom });
if(!isOldIE) thumbs[fn]({ 'mousewheel.photobox': thumbsResize });
}
if(!options.single&&options.wheelNextPrev){
overlay[fn]({ 'mousewheel.photobox': throttle(wheelNextPrev, 1000) });
}},
destroy: function (){
options=this.options;
this.selector.off('click.photobox', this.target).removeData('_photobox');
close();
},
};
function onSwipe(e, Dx, Dy){
if(Dx==1){
image.css({ transform: 'translateX(25%)', transition: '.2s', opacity: 0 });
setTimeout(function (){
changeImage(prevImage);
}, 200);
}else if(Dx==-1){
image.css({ transform: 'translateX(-25%)', transition: '.2s', opacity: 0 });
setTimeout(function (){
changeImage(nextImage);
}, 200);
}
if(Dy==1) thumbsToggler.prop('checked', true);
else if(Dy==-1) thumbsToggler.prop('checked', false);
}
thumbsStripe=(function (){
var containerWidth=0,
scrollWidth=0,
posFromLeft=0,
stripePos=0,
animated=null,
padding,
el,
$el,
ratio,
scrollPos,
pos;
return {
generate: function (){
var thumbsList=$('<ul>'),
elements=[],
len=this.imageLinks.length,
title,
thumbSrc,
link,
type,
i;
for (i=0; i < len; i++){
link=this.imageLinks[i];
thumbSrc=this.images[i][2];
if(!thumbSrc) continue;
title=this.images[i][1];
type=link.rel ? " class='" + link.rel + "'":'';
elements.push('<li' + type + '><a href="' + link.href + '"><img src="' + thumbSrc + '" alt="" title="' + $('<div />').html(title).text() + '" /></a></li>');
}
thumbsList.html(elements.join(''));
return thumbsList;
},
click: function (e){
e.preventDefault();
activeThumb.removeClass('active');
$(document).trigger('pboxPreviewClicked');
activeThumb=$(this).parent().addClass('active');
var imageIndex=$(this.parentNode).index();
return changeImage(imageIndex, 0, 1);
},
changeActiveTimeout: null,
changeActive: function (index, delay, thumbClick){
if(!options.thumbs) return;
var lastIndex=activeThumb.index();
activeThumb.removeClass('active');
activeThumb=thumbs.find('li').eq(index).addClass('active');
if(thumbClick||!activeThumb[0]) return;
clearTimeout(this.changeActiveTimeout);
this.changeActiveTimeout=setTimeout(function (){
var pos=activeThumb[0].offsetLeft + activeThumb[0].clientWidth / 2 - docElm.clientWidth / 2;
delay ? thumbs.delay(800):thumbs.stop();
thumbs.animate({ scrollLeft: pos }, 500, 'swing');
}, 200);
},
calc: function (e){
el=thumbs[0];
containerWidth=el.clientWidth;
scrollWidth=el.scrollWidth;
padding=0.15 * containerWidth;
posFromLeft=thumbs.offset().left;
stripePos=e.pageX - padding - posFromLeft;
pos=stripePos / (containerWidth - padding * 2);
scrollPos=(scrollWidth - containerWidth) * pos;
thumbs.animate({ scrollLeft: scrollPos }, 200);
clearTimeout(animated);
animated=setTimeout(function (){
animated=null;
}, 200);
return this;
},
move: function (e){
if(animated) return;
var ratio=scrollWidth / containerWidth,
stripePos=e.pageX - padding - posFromLeft,
pos,
scrollPos;
if(stripePos < 0) stripePos=0;
pos=stripePos / (containerWidth - padding * 2);
scrollPos=(scrollWidth - containerWidth) * pos;
raf(function (){
el.scrollLeft=scrollPos;
});
},
};})();
APControl={
autoPlayTimer: false,
play: function (){
APControl.autoPlayTimer=setTimeout(function (){
changeImage(nextImage);
}, options.time);
APControl.progress.start();
autoplayBtn.removeClass('play');
APControl.setTitle('Click to stop autoplay');
options.autoplay=true;
},
pause: function (){
clearTimeout(APControl.autoPlayTimer);
APControl.progress.reset();
autoplayBtn.addClass('play');
APControl.setTitle('Click to resume autoplay');
options.autoplay=false;
},
progress: {
reset: function (){
autoplayBtn.find('div').removeAttr('style');
setTimeout(function (){
autoplayBtn.removeClass('playing');
}, 200);
},
start: function (){
if(!isOldIE) autoplayBtn.find('div').css(transition, options.time + 'ms');
autoplayBtn.addClass('playing');
},
},
setTitle: function (text){
if(text) autoplayBtn.prop('title', text + ' (every ' + options.time / 1000 + ' seconds)');
},
toggle: function (e){
e.stopPropagation();
APControl[options.autoplay ? 'pause':'play']();
},
};
function getPrefixed(prop){
var i,
s=doc.createElement('p').style,
v=['ms', 'O', 'Moz', 'Webkit'];
if(s[prop]=='') return prop;
prop=prop.charAt(0).toUpperCase() + prop.slice(1);
for (i=v.length; i--;) if(s[v[i] + prop]=='') return v[i] + prop;
}
function keyDown(event){
var code=event.keyCode,
ok=options.keys,
result;
return ($.inArray(code, ok.close) >=0&&close())||($.inArray(code, ok.next) >=0&&!options.single&&loophole(nextImage))||($.inArray(code, ok.prev) >=0&&!options.single&&loophole(prevImage))||true;
}
function wheelNextPrev(e, dY, dX){
if(dX==1) loophole(nextImage);
else if(dX==-1) loophole(prevImage);
}
function next_prev(){
var idx=this.id=='pbPrevBtn' ? prevImage:nextImage;
loophole(idx);
return false;
}
function updateIndexes(idx){
lastActive=activeImage;
activeImage=idx;
activeURL=images[idx][0];
prevImage=(activeImage||(options.loop ? images.length:0)) - 1;
nextImage=(activeImage + 1) % images.length||(options.loop ? 0:-1);
}
function loophole(idx){
if(!options.loop){
var afterLast=activeImage==images.length - 1&&idx==nextImage,
beforeFirst=activeImage==0&&idx==prevImage;
if(afterLast||beforeFirst) return;
}
changeImage(idx);
}
changeImage=(function (){
var timer;
return function (imageIndex, firstTime, thumbClick){
if(timer) return;
timer=setTimeout(function (){
timer=null;
}, 150);
if(!imageIndex||imageIndex < 0) imageIndex=0;
if(!options.loop){
nextBtn[imageIndex==images.length - 1 ? 'addClass':'removeClass']('hide');
prevBtn[imageIndex==0 ? 'addClass':'removeClass']('hide');
}
if(typeof options.beforeShow=='function') options.beforeShow(imageLinks[imageIndex]);
overlay.removeClass('error').addClass(imageIndex > activeImage ? 'next':'prev');
updateIndexes(imageIndex);
stop();
video.empty();
preload.onerror=null;
image.add(video).data('zoom', 1);
activeType=imageLinks[imageIndex].rel=='video' ? 'video':'image';
if(activeType=='video'){
if($(imageLinks[activeImage])
.attr('href')
.match(/<iframe(.+)<\/iframe>/i)
){
video.html(newVideo(true)).addClass('hide').attr('data-iframe', 'original_frame');
}else{
video.html(newVideo()).addClass('hide');
}
showContent(firstTime);
}else{
var loaderTimeout=setTimeout(function (){
overlay.addClass('pbLoading');
}, 50);
if(isOldIE) overlay.addClass('hide');
options.autoplay&&APControl.progress.reset();
preload=new Image();
preload.onload=function (){
preload.onload=null;
if(prevImage >=0) preloadPrev.src=images[prevImage][0];
if(nextImage >=0) preloadNext.src=images[nextImage][0];
clearTimeout(loaderTimeout);
showContent(firstTime);
};
preload.onerror=imageError;
preload.src=activeURL;
}
captionText.on(transitionend, captionTextChange).addClass('change');
if(firstTime||isOldIE) captionTextChange();
thumbsStripe.changeActive(imageIndex, firstTime, thumbClick);
history.save();
};})();
function newVideo(iframe){
if(!iframe){
iframe=false;
}
if(iframe){
var url=$(imageLinks[activeImage]).attr('href');
return url;
}
var url=images[activeImage][0],
sign=$('<a>').prop('href', images[activeImage][0])[0].search ? '&':'?';
url +=sign + 'vq=hd720&wmode=opaque';
return $('<iframe>').prop({ scrolling: 'no', frameborder: 0, allowTransparency: true, src: url }).attr({ webkitAllowFullScreen: true, mozallowfullscreen: true, allowFullScreen: true });
}
function captionTextChange(){
captionText.off(transitionend).removeClass('change');
if(options.counter){
try {
var value=options.counter.replace('A', activeImage + 1).replace('B', images.length);
} catch (err){
options.counter='(A/B)';
captionTextChange();
}
caption.find('.counter').text(value);
}
var title=images[activeImage][1];
if(typeof options.getTitle=='function') title=options.getTitle(imageLinks[activeImage]);
if(options.title) caption.find('.title').html('<span>' + title + '</span>');
}
var history={
save: function (){
if('pushState' in window.history&&decodeURIComponent(window.location.hash.slice(1))!=activeURL&&options.history){
window.history.pushState('photobox', doc.title + '-' + images[activeImage][1], window.location.pathname + window.location.search + '#' + encodeURIComponent(activeURL));
}},
load: function (){
if(options&&!options.history) return false;
var hash=decodeURIComponent(window.location.hash.slice(1)),
i,
j;
if(!hash&&overlay.hasClass('show')) close();
$('a[href="' + hash + '"]').trigger('click.photobox');
},
clear: function (){
if(options.history&&'pushState' in window.history) window.history.pushState('photobox', doc.title, window.location.pathname + window.location.search);
},
};
window.onpopstate=(function (){
var cached=window.onpopstate;
return function (event){
cached&&cached.apply(this, arguments);
if(event.state=='photobox') history.load();
};})();
function imageError(){
overlay.addClass('error');
image[0].src=blankImg;
preload.onerror=null;
}
function getImages(){
return images;
}
function showContent(firstTime){
var out, showSaftyTimer;
showSaftyTimer=setTimeout(show, 2000);
pbLoader.fadeOut(300, function (){
overlay.removeClass('pbLoading');
pbLoader.removeAttr('style');
});
overlay.addClass('hide');
image.add(video).removeAttr('style').removeClass('zoomable');
if(!firstTime&&imageLinks[lastActive].rel=='video'){
out=video;
image.addClass('prepare');
} else out=image;
if(firstTime||isOldIE) show();
else out.on(transitionend, show);
function show(){
clearTimeout(showSaftyTimer);
out.off(transitionend).css({ transition: 'none' });
overlay.removeClass('video');
if(activeType=='video'){
image[0].src=blankImg;
video.addClass('prepare');
overlay.addClass('video');
} else image.prop({ src: activeURL, class: 'prepare' });
setTimeout(function (){
image.add(video).removeAttr('style').removeClass('prepare');
overlay.removeClass('hide next prev');
setTimeout(function (){
image.add(video).on(transitionend, showDone);
if(isOldIE) showDone();
}, 0);
}, 50);
}}
function showDone(){
image.add(video).off(transitionend).addClass('zoomable');
if(activeType=='video') video.removeClass('hide');
else {
autoplayBtn&&options.autoplay&&APControl.play();
}
if(photobox&&typeof photobox.callback=='function') photobox.callback.apply(imageLinks[activeImage]);
}
function scrollZoom(e, deltaY, deltaX){
if(deltaX) return false;
if(activeType=='video'){
var zoomLevel=video.data('zoom')||1;
zoomLevel +=deltaY / 10;
if(zoomLevel < 0.5) return false;
video.data('zoom', zoomLevel).css({ width: 624 * zoomLevel, height: 351 * zoomLevel });
}else{
var zoomLevel=image.data('zoom')||1,
getSize=image[0].getBoundingClientRect();
zoomLevel +=deltaY / 10;
if(zoomLevel < 0.1) zoomLevel=0.1;
raf(function (){
image.data('zoom', zoomLevel).css({ transform: 'scale(' + zoomLevel + ')' });
});
if(getSize.height > docElm.clientHeight||getSize.width > docElm.clientWidth){
$(doc).on('mousemove.photobox', imageReposition);
}else{
$(doc).off('mousemove.photobox');
image[0].style[transformOrigin]='50% 50%';
}}
return false;
}
function thumbsResize(e, delta){
e.preventDefault();
e.stopPropagation();
var thumbList=photobox.thumbsList,
h;
thumbList.css('height', thumbList[0].clientHeight + delta * 10);
h=caption[0].clientHeight / 2;
wrapper[0].style.cssText='margin-top: -' + h + 'px; padding: ' + h + 'px 0;';
thumbs.hide().show(0);
}
function imageReposition(e){
var y=(e.clientY / docElm.clientHeight) * (docElm.clientHeight + 200) - 100,
yDelta=(y / docElm.clientHeight) * 100,
xDelta=(e.clientX / docElm.clientWidth) * 100,
origin=xDelta.toFixed(2) + '% ' + yDelta.toFixed(2) + '%';
raf(function (){
image[0].style[transformOrigin]=origin;
});
}
function stop(){
clearTimeout(APControl.autoPlayTimer);
$(doc).off('mousemove.photobox');
preload.onload=function (){};
preload.src=preloadPrev.src=preloadNext.src=activeURL;
}
function close(){
if(!overlay.hasClass('show')) return false;
stop();
video.find('iframe').prop('src', '').empty();
Photobox.prototype.setup();
history.clear();
overlay.removeClass('on video').addClass('hide');
image.on(transitionend, hide);
isOldIE&&hide();
setTimeout(function (){
photobox=null;
}, 1000);
function hide(){
if(overlay[0].className=='') return;
overlay.removeClass('show hide error pbLoading');
image.removeAttr('class').removeAttr('style').off().data('zoom', 1);
caption.find('.title').empty();
if(noPointerEvents)
setTimeout(function (){
overlay.hide();
}, 200);
options.hideFlash&&$('iframe, object, embed').css('visibility', 'visible');
}
setTimeout(hide, 500);
if(typeof options.afterClose==='function') options.afterClose(overlay);
}
!(function (a){
'function'==typeof define&&define.amd ? define(['jquery'], a):'object'==typeof exports&&typeof module!='undefined'&&module.exports ? (module.exports=a):a(jQuery);
})(function (a){
function b(b){
var g=b||window.event,
h=i.call(arguments, 1),
j=0,
l=0,
m=0,
n=0,
o=0,
p=0;
if(((b=a.event.fix(g)),
(b.type='mousewheel'),
'detail' in g&&(m=-1 * g.detail),
'wheelDelta' in g&&(m=g.wheelDelta),
'wheelDeltaY' in g&&(m=g.wheelDeltaY),
'wheelDeltaX' in g&&(l=-1 * g.wheelDeltaX),
'axis' in g&&g.axis===g.HORIZONTAL_AXIS&&((l=-1 * m), (m=0)),
(j=0===m ? l:m),
'deltaY' in g&&((m=-1 * g.deltaY), (j=m)),
'deltaX' in g&&((l=g.deltaX), 0===m&&(j=-1 * l)),
0!==m||0!==l)
){
if(1===g.deltaMode){
var q=a.data(this, 'mousewheel-line-height');
((j *=q), (m *=q), (l *=q));
}else if(2===g.deltaMode){
var r=a.data(this, 'mousewheel-page-height');
((j *=r), (m *=r), (l *=r));
}
if(((n=Math.max(Math.abs(m), Math.abs(l))),
(!f||f > n)&&((f=n), d(g, n)&&(f /=40)),
d(g, n)&&((j /=40), (l /=40), (m /=40)),
(j=Math[j >=1 ? 'floor':'ceil'](j / f)),
(l=Math[l >=1 ? 'floor':'ceil'](l / f)),
(m=Math[m >=1 ? 'floor':'ceil'](m / f)),
k.settings.normalizeOffset&&this.getBoundingClientRect)
){
var s=this.getBoundingClientRect();
((o=b.clientX - s.left), (p=b.clientY - s.top));
}
return ((b.deltaX=l), (b.deltaY=m), (b.deltaFactor=f), (b.offsetX=o), (b.offsetY=p), (b.deltaMode=0), h.unshift(b, j, l, m), e&&clearTimeout(e), (e=setTimeout(c, 200)), (a.event.dispatch||a.event.handle).apply(this, h));
}}
function c(){
f=null;
}
function d(a, b){
return k.settings.adjustOldDeltas&&'mousewheel'===a.type&&b % 120===0;
}
var e,
f,
g=['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
h='onwheel' in document||document.documentMode >=9 ? ['wheel']:['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
i=Array.prototype.slice;
if(a.event.fixHooks) for (var j=g.length; j;) a.event.fixHooks[g[--j]]=a.event.mouseHooks;
var k=(a.event.special.mousewheel={
version: '3.1.11',
setup: function (){
if(this.addEventListener) for (var c=h.length; c;) this.addEventListener(h[--c], b, !1);
else this.onmousewheel=b;
(a.data(this, 'mousewheel-line-height', k.getLineHeight(this)), a.data(this, 'mousewheel-page-height', k.getPageHeight(this)));
},
teardown: function (){
if(this.removeEventListener) for (var c=h.length; c;) this.removeEventListener(h[--c], b, !1);
else this.onmousewheel=null;
(a.removeData(this, 'mousewheel-line-height'), a.removeData(this, 'mousewheel-page-height'));
},
getLineHeight: function (b){
var c=a(b)['offsetParent' in a.fn ? 'offsetParent':'parent']();
return (c.length||(c=a('body')), parseInt(c.css('fontSize'), 10));
},
getPageHeight: function (b){
return a(b).height();
},
settings: { adjustOldDeltas: !0, normalizeOffset: !0 },
});
a.fn.extend({
mousewheel: function (a){
return a ? this.bind('mousewheel', a):this.trigger('mousewheel');
},
unmousewheel: function (a){
return this.unbind('mousewheel', a);
},
});
});
$(doc).ready(prepareDOM);
window._photobox={
DOM: {
overlay: overlay,
},
close: close,
getImages: getImages,
changeImage: changeImage,
history: history,
defaults: defaults,
};})(jQuery, document, window);
(function ($, window, document, undefined){
var pluginName='sliphover',
defaults={
target: 'img',
caption: 'title',
duration: 'fast',
fontColor: '#fff',
textAlign: 'center',
verticalMiddle: true,
backgroundColor: 'rgba(0,0,0,.7)',
reverse: false,
height: '100%',
withLink: true,
};
function SlipHover(element, options){
this.element=element;
this.settings=$.extend({}, defaults, options);
this._defaults=defaults;
this._name=pluginName;
this.version='v2.0.3';
this.init();
}
SlipHover.prototype={
init: function (){
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
return;
}
var that=this,
target=this.settings.target;
$(this.element)
.off('mouseenter.sliphover', target)
.on('mouseenter.sliphover', target, function (event){
var $element=$(this),
$overlayContainer=that.createContainer($element);
$overlayContainer.off('mouseenter.sliphover mouseleave.sliphover').on('mouseenter.sliphover mouseleave.sliphover', function (event){
var direction=that.getDirection($(this), event);
direction=that.settings.reverse ? (direction=(direction + 2) % 4):direction;
if(event.type==='mouseenter'){
var $overlay=$overlayContainer.find('.sliphover-overlay');
if(!$overlay.length){
$overlay=that.createOverlay(that, direction, $element);
$(this).html($overlay);
}
that.slideIn(that, $overlay);
}else{
that.removeOverlay(that, $(this), direction);
}});
});
},
createContainer: function ($element){
var top=$element.offset().top,
left=$element.offset().left,
width=$element.outerWidth(),
height=$element.outerHeight();
zIndex=$element.css('z-index');
var $overlayContainer=$('<div>', {
class: 'sliphover-container',
}).css({
width: width,
height: height,
position: 'absolute',
overflow: 'hidden',
top: top,
left: left,
borderRadius: $element.css('border-radius'),
zIndex: zIndex==+zIndex ? zIndex + 1:999,
});
$overlayContainer.data('relatedElement', $element);
$('body').append($overlayContainer);
return $overlayContainer;
},
createOverlay: function (instance, direction, $element){
var bottom, left, $overlay, content, $targetAParent;
switch (direction){
case 0:
left=0;
bottom='100%';
break;
case 1:
left='100%';
bottom=0;
break;
case 2:
left=0;
bottom='-100%';
break;
case 3:
left='-100%';
bottom=0;
break;
default:
window.console.error('error when get direction of the mouse');
}
if(instance.settings.verticalMiddle){
content=$('<div>')
.css({
display: 'table-cell',
verticalAlign: 'middle',
})
.html($element.attr(instance.settings.caption));
}else{
content=$element.attr(instance.settings.caption);
}
$targetAParent=$element.closest('a');
if($targetAParent.length&&instance.settings.withLink){
var url=$targetAParent.attr('href');
classes=$targetAParent.attr('class');
$overlay=$('<a>', {
class: 'sliphover-overlay ' + classes,
href: url||'#',
}).css({
textDecoration: 'none',
});
}else{
$overlay=$('<div>', {
class: 'sliphover-overlay',
});
}
$overlay
.css({
width: '100%',
height: instance.settings.height,
position: 'absolute',
left: left,
bottom: bottom,
display: instance.settings.verticalMiddle ? 'table':'inline',
textAlign: instance.settings.textAlign,
color: instance.settings.fontColor,
backgroundColor: instance.settings.backgroundColor,
})
.html(content);
return $overlay;
},
slideIn: function (instance, $overlay){
$overlay.stop().animate({
left: 0,
bottom: 0,
},
instance.settings.duration
);
},
removeOverlay: function (instance, $overlayContainer, direction){
var finalState,
$overlay=$overlayContainer.find('.sliphover-overlay');
switch (direction){
case 0:
finalState={
bottom: '100%',
left: 0,
};
break;
case 1:
finalState={
bottom: 0,
left: '100%',
};
break;
case 2:
finalState={
bottom: '-100%',
left: 0,
};
break;
case 3:
finalState={
bottom: 0,
left: '-100%',
};
break;
default:
window.console.error('error when get direction of the mouse');
}
$overlay.stop().animate(finalState, instance.settings.duration, function (){
$overlayContainer.remove();
});
},
getDirection: function ($target, event){
var w=$target.width(),
h=$target.height(),
x=(event.pageX - $target.offset().left - w / 2) * (w > h ? h / w:1),
y=(event.pageY - $target.offset().top - h / 2) * (h > w ? w / h:1),
direction=Math.round((Math.atan2(y, x) * (180 / Math.PI) + 180) / 90 + 3) % 4;
return direction;
},
};
$.fn[pluginName]=function (options){
this.each(function (){
if(!$.data(this, 'plugin_' + pluginName)){
$.data(this, 'plugin_' + pluginName, new SlipHover(this, options));
}});
return this;
};})(jQuery, window, document);
(function ($, undefined){
window.supSocialSharePrintImage=function (img){
var printFrame=document.createElement('iframe');
printFrame.style.display='none';
document.body.appendChild(printFrame);
var printDocument=printFrame.contentWindow.document;
printDocument.write('<img style="max-width:100%;" src="' + img + '">');
printDocument.close();
printFrame.contentWindow.print();
};
jQuery('[data-video-source]').attr('rel', 'video');
var init=false;
function Gallery(selector, autoInit){
autoInit=autoInit||false;
var $deferred=jQuery.Deferred(),
self=this;
this.loadedFonts=[];
this.$container=$(selector);
if(window.sggIsMobile){
this.$container.attr('data-is-mobile', window.sggIsMobile[0]);
}
this.$container.addClass('fitvidsignore');
this.$elements=this.$container.find('figure.grid-gallery-caption').fadeIn();
this.initialMargin=this.$elements.first().css('margin-bottom');
this.$navigation=this.$container.find('nav.grid-gallery-nav');
this.selectedCategory='';
this.galleryContainerId=this.$container.attr('id').replace(/[^a-z0-9]/g, '');
this.$qsData=null;
this.$qsDuration='750';
this.$qsEnable=false;
this.areaPosition=this.$container.data('area-position');
this.pagination={
currentPage: 1,
limit: 0,
total: this.$elements.length,
pages: 1,
$wrapper: this.$container.find('.grid-gallery-pagination-wrap'),
};
this.loadingText=this.$container.data('show-more-loading-text');
this.popupTranslates=this.$container.data('popup-i18n-words');
if(this.$container.data('exif-as-popup')==1){
this.popupTitleAttribute='data-exif-text';
}else{
this.popupTitleAttribute=this.$container.data('popup-image-text');
}
this.popupMaxHeight='90%';
this.popupMaxWidth='90%';
this.popup_opened_image=false;
this.popupImageDimension=function (){};
this.resizeColorbox=function (){};
this.socialSharing=this.$container.data('social-sharing');
this.socialSharingWrapperClass='supsystic-grid-gallery-image-sharing';
this.socialSharingImageOperators={
pinterest: 'media',
};
this.socialButtonsUrl=window.location.href.replace(window.location.hash, '');
this.socialButtonsUrl=this.removePopUpHashFromUrl(this.socialButtonsUrl);
if(this.socialButtonsUrl.indexOf('#') + 1==this.socialButtonsUrl.length){
this.socialButtonsUrl=this.socialButtonsUrl.substr(0, this.socialButtonsUrl.length - 1);
}
this.disablePopupHistory = !!this.$container.data('popup-disable-history');
if(this.isFluidHeight()){
this.$elements.addClass('wookmarked');
}
$(document).trigger('GalleryExtend', this);
if(autoInit){
self.$container.data('isVisible',
setInterval(function (){
if(self.$container.is(':visible')||self.$container.hasClass('hidden-item')){
clearInterval(self.$container.data('isVisible'));
self.init();
}}, 500)
);
}
this.$container.addClass('initialized');
return $deferred.resolve();
}
Gallery.prototype.isFluidHeight=function (){
return this.$container.is('.grid-gallery-fluid-height');
};
Gallery.prototype.isImageOverlay=function (){
return this.$container.find('.crop').is('.image-overlay');
};
Gallery.prototype.isMouseShadowShow=function (){
return this.$container.find('.grid-gallery-caption').is('.shadow-show');
};
Gallery.prototype.initQuicksand=function (){
if(this.$container.data('quicksand')=='enabled'&&this.$container.data('caption-builder-icons')!==1){
this.$qsEnable=true;
this.$qsDuration=this.$container.data('quicksand-duration');
this.$qsHolder=this.$container.find('.grid-gallery-photos:first');
this.$qsData=this.$container.find('.grid-gallery-photos > a');
}};
Gallery.prototype.showCaption=function (){
var isExifCaption=this.$container.data('exif-as-caption');
this.$container.find('.grid-gallery-figcaption-wrap').each(function (){
if($.trim($(this).html())===''&&!$(this).find('img').length&&$(this).has('.hi-icon').length===0){
$(this).closest('figcaption').remove();
}});
this.$container.find('.gg-image-caption').each(function (){
var $this=$(this),
captionHtmlEntry='';
if(isExifCaption==1){
var $objExist=$this.find('object');
if($objExist.length){
captionHtmlEntry=$this
.find('object')
.html()
.replace(/<a(.*?)>(.*?)<\/a>/gi, "<object type='none'>$&</object>");
}else{
captionHtmlEntry=$this.html();
}}else{
captionHtmlEntry=$this.text().replace(/<a(.*?)>(.*?)<\/a>/gi, "<object type='none'>$&</object>");
}
$this.html(captionHtmlEntry);
$this.find('a').on('click', function (event){
event.stopPropagation();
});
});
$(document).on('click', '.sliphover-container object a', function (event){
event.stopPropagation();
});
};
Gallery.prototype.initWookmark=function (){
var self=this,
horizontalScroll=this.$container.data('horizontal-scroll'),
isMobile=parseInt($anyGallery.attr('data-is-mobile')),
width=this.$container.data('width'),
offset=0,
outerOffset=0,
spacing,
windowWidth=$(window).width(),
isFixedColumn=this.$container.data('gridType')==3;
if(horizontalScroll&&horizontalScroll.enabled){
if(horizontalScroll.responsiveMode==1&&isMobile){
}else{
return;
}}
if(this.$container.data('gridType')==4){
return;
}
if(this.$container.data('offset')){
offset=this.$container.data('offset');
}
if(this.$container.data('padding')){
outerOffset=parseInt(this.$container.data('padding'));
}
if(String(width).indexOf('%') > -1){
var imagesPerRow=Math.floor(100 / parseInt(width));
spacing=offset * (imagesPerRow - 1) + outerOffset * 2;
width=((this.$container.width() - spacing) / 100) * parseInt(width);
$.each(this.$container.find('img'), function (){
aspectRatio=$(this).width() / $(this).height();
$(this).width(width);
$(this).height(width / aspectRatio);
});
}
if(isFixedColumn){
var defaultWidth=parseInt(width),
defaultHeight=parseInt(this.$container.data('height')),
koefWidthHeigth=defaultWidth > 0&&defaultHeight > 0 ? defaultHeight / defaultWidth:1;
}
function resizeColumns(){
var columnsNumber=self.getResponsiveColumnsNumber();
spacing=offset * (columnsNumber - 1) + outerOffset * 2;
width=Math.floor(((self.$container.width() - spacing) / 100) * (100 / columnsNumber));
$.each(self.$elements, function (index, el){
var $el=$(el),
$img=$el.find('img');
if($img.length&&!$el.hasClass('initialized')){
var imageOriginalSize=self.getOriginalImageSizes($img.get(0)),
elWidth=imageOriginalSize.width,
elHeight=imageOriginalSize.height,
aspectRatio=elWidth / elHeight,
height=width / aspectRatio;
if(isFixedColumn&&$img.attr('data-gg-remote-image')==1){
height=width * koefWidthHeigth;
}
$el.css({
width: width,
height: height,
});
if(!$img.hasClass('ggLazyImg')){
$img.removeClass('ggNotInitImg');
self.polaroidCaptionCalculate($el);
if($el.hasClass('initialized')){
setTimeout(function (){
$el.trigger('refreshWookmark');
}, 350);
}}
}});
self.$container.find('.grid-gallery-photos').removeAttr('data-min-height');
return width;
}
if(this.$container.data('columns-number')){
self.$container.find('figure:not(.initialized) img').css({
maxWidth: '100%',
width: '100%',
height: 'auto',
});
resizeColumns();
}
if(this.$container.data('width')!=='auto'&&!this.$qsEnable){
this.wookmark=this.$elements
.filter(':visible')
.wookmark({
autoResize: true,
container: this.$container.find('.grid-gallery-photos'),
direction: this.areaPosition=='right' ? 'right':'left',
fillEmptySpace: false,
flexibleWidth: !this.$container.data('columns-number'),
itemWidth: width,
offset: offset,
align: this.areaPosition,
outerOffset: outerOffset,
onLayoutChanged: function (){
setTimeout(function (){
self.$container.trigger('wookmark.changed');
}, 50);
},
onResize: function (){
if($(window).width()!=windowWidth){
windowWidth=$(window).width();
clearTimeout(self.$container.data('resize.timer'));
self.$container.data('resize.timer',
setTimeout(function (){
var overflow=self.$container.css('overflow');
self.$container.removeData('resize.timer');
self.$container.css('overflow', 'hidden');
if(self.$container.data('columns-number')){
self.$elements.wookmark({
container: self.$container.find('.grid-gallery-photos'),
itemWidth: resizeColumns(),
offset: offset,
});
}
self.$elements.last().one('transitionend webkitTransitionEnd oTransitionEnd', function (){
self.$elements.filter(':visible').trigger('refreshWookmark');
});
self.$elements.filter(':visible').trigger('refreshWookmark');
self.$container.css('overflow', overflow);
}, 250)
);
}},
})
.css({
margin: '0',
transition: 'all 0.4s linear',
});
}
this.$container.find('.grid-gallery-photos').css('text-align', this.$container.data('area-position'));
var minheight=this.$container.find('.grid-gallery-photos').data('min-height');
this.$container.find('.grid-gallery-photos').css({
'min-height': minheight,
});
this.$container.filter(':visible').find('.grid-gallery-photos > *').filter(':visible').css({
float: 'none',
display: 'inline-block',
'vertical-align': 'top',
});
};
Gallery.prototype.initControll=function (){
$(document).on('click', '#cboxRight', function (){
$.colorbox.prev();
});
$(document).on('click', '#cboxLeft', function (){
$.colorbox.next();
});
};
Gallery.prototype.getPopupDimensions=function (width, height){
var width=$(window).width() < width ? '90%':width;
var height=$(window).height() < height ? '90%':height;
if(width=='90%'){
width=parseFloat(($(window).width() * parseFloat(width)) / 100);
}
if(height=='90%'){
height=parseFloat(($(window).height() * parseFloat(height)) / 100);
}
return {
width: width,
height: height,
};};
Gallery.prototype.getPopupTitle=function ($element){
var title, $img;
if($element.hasClass('hi-icon')){
$img=$element.closest('.grid-gallery-caption').find('img');
}else{
$img=$element.find('img');
}
title=$img.attr(this.popupTitleAttribute);
if(!title){
title=$img.attr('title');
}
return title;
};
Gallery.prototype.initPopup=function (){
var popupType=(this.popupType=this.$container.data('popup-type')),
popupMaxWidth=this.popupMaxWidth,
popupMaxHeight=this.popupMaxHeight,
sW=this.$container.data('popup-widthsize'),
sH=this.$container.data('popup-heightsize'),
popupOverlayTransper=this.$container.data('popup-transparency'),
popupBackground=this.$container.data('popup-background'),
slidePlay=this.$container.data('popup-slideshow')===true,
slidePlayAuto=slidePlay&&this.$container.data('popup-slideshow-auto')===true,
popupHoverStop=slidePlay&&this.$container.data('popup-hoverstop')===true,
slideshowSpeed=this.$container.data('popup-slideshow-speed'),
popupPlacementType=this.$container.data('popup-placement-type'),
isLazyLoad=this.$container.data('lazyload-enable')=='1',
self=this;
function generateOverlayColor(selector, background, opacity, optype){
var style=selector + '{',
rgb=self.hex2rgb(background);
opacity=(100 - opacity) / 100;
if(background){
color='rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', ' + opacity + ')';
style +='background-image:none!important; background-color:' + color + '!important;';
}else{
if(optype){
style +='opacity:' + opacity + '!important;';
}else{
rgb=self.hex2rgb(self.rgb2hex($(selector).css('backgroundColor')));
color='rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ', ' + opacity + ')';
style +='background-image:none!important; background-color:' + color + '!important;';
}}
style +='}';
$('<style type="text/css"> ' + style + '</style>').appendTo('head');
}
if(!!sW&&sW!=='auto'){
popupMaxWidth=sW;
}else{
sW='90%';
}
if(!!sH&&sH!=='auto'){
popupMaxHeight=sH;
}else{
sH='90%';
}
var getImageDimension=function (){
return self.getPopupDimensions(sW, sH);
};
var getColorboxImageDimension=function (){
var response=self.getPopupDimensions(sW, sH);
if($(self.popup_opened_image).children('figure').attr('data-linked-images')||$(self.popup_opened_image).hasClass('linked-element')){
response.width -=120;
}
return response;
};
var delayResize=(function (){
var timer=0;
return function (callback, ms){
clearTimeout(timer);
timer=setTimeout(callback, ms);
};})();
this.resizeColorbox=function (){
if(self.popup_opened_image===false) return;
var dimensions=getColorboxImageDimension();
if(self.popup_opened_image.attr&&self.popup_opened_image.attr('rel')=='video'&&dimensions.width >=0.9 * window.innerWidth){
return;
}
$(self.popup_opened_image).data('colorbox').maxWidth=dimensions.width;
$(self.popup_opened_image).data('colorbox').maxHeight=dimensions.height;
$(document).trigger('beforeResizeColorBoxResponsive', this);
delayResize(function (){
$.colorbox.resizeResponsive(self.popup_opened_image);
}, 500);
};
popupMaxWidth=$(window).width() < popupMaxWidth ? '90%':popupMaxWidth;
popupMaxHeight=$(window).height() < popupMaxHeight ? '90%':popupMaxHeight;
this.popupMaxWidth=popupMaxWidth;
this.popupMaxHeight=popupMaxHeight;
this.popupImageDimension=getImageDimension;
if(popupType&&popupType!=='disable'){
this.$container.parentsUntil('body').each(function (){
var events=$._data(this, 'events'),
el=this;
if(events&&events.click){
$.each(events.click, function (index, ev){
if(ev.selector&&self.$container.has($(ev.selector)).length){
$(el).off('click', ev.selector);
}});
}});
}
var hideLongTooltipTitles=this.$container.data('hide-long-tltp-title');
if(popupType=='colorbox'){
var $this=this.$container;
var colorBoxItemSelector =
'.grid-gallery-photos > .gg-colorbox:visible,' +
' .grid-gallery-photos .gg-mosaic-wrapper .gg-colorbox,' +
' .hi-icon.gg-colorbox:visible';
if($this.hasClass('one-photo')||$this.hasClass('hidden-item')){
colorBoxItemSelector='.grid-gallery-photos > .gg-colorbox, .hi-icon.gg-colorbox';
}
if(this.initColorbox){
this.$container.find(colorBoxItemSelector).colorbox.remove('#' + this.$container.attr('id'));
}else{
if(hideLongTooltipTitles==0){
var $colorboxtooltip=$('<div id="sggCboxTooltip">');
$(document).on({
mouseenter: function (){
$colorboxtooltip.addClass('active');
},
mouseleave: function (){
setTimeout(function (){
$colorboxtooltip.removeClass('active');
}, 400);
},
},
'#colorbox.' + $this.data('popup-theme') + ' #cboxTitle'
);
$(document).one('cbox_complete', function (event){
if(!$('#sggCboxTooltip').length){
$('#cboxWrapper').append($colorboxtooltip);
}});
$(document).on('cbox_complete', function (event){
$colorboxtooltip.html($('#cboxTitle').html());
if($('#colorbox').width() < 300){
$('#colorbox').filter('.theme_1').find('#cboxSlideshow').css('bottom', '30px');
}});
}}
this.initColorbox=true;
var colorBoxConfig={
fadeOut: this.$container.data('popup-fadeOut'),
fixed: true,
maxHeight: getImageDimension().height,
maxWidth: getImageDimension().width,
scalePhotos: true,
scrolling: false,
returnFocus: false,
slideshow: slidePlay&&this.$container.data('popup-slideshow-speed'),
slideshowAuto: slidePlayAuto,
slideshowSpeed: slideshowSpeed,
rel: this.$container.attr('id'),
slideshowStart: self.popupTranslates.start_slideshow,
slideshowStop: self.popupTranslates.stop_slideshow,
current: self.popupTranslates.image + ' {current} ' + self.popupTranslates.of + ' {total}',
previous: self.popupTranslates.previous,
next: self.popupTranslates.next,
close: self.popupTranslates.close,
isDisableRightClick: this.$container.attr('data-disable-right-click')=='true',
title: function (){
return self.getPopupTitle($(this));
},
speed: 350,
transition: 'elastic',
onComplete: function (e){
self.changePopUpHash($(e.el).attr('id')||$(e.el).attr('data-id'));
self.addSocialShareToPopUp($(e.el), $('#cboxContent'), 'popup');
self.$container.find('.grid-gallery-photos > .gg-colorbox, .hi-icon.gg-colorbox').colorbox.resize();
$('#cboxLoadedContent').append("<div id='cboxRight'></div><div id='cboxLeft'></div>");
},
onLoad: function (e){
if(self.popup_opened_image==e.el) return;
self.popup_opened_image=e.el;
var dimensions=getColorboxImageDimension();
$(self.popup_opened_image).data('colorbox').maxWidth=dimensions.width;
$(self.popup_opened_image).data('colorbox').maxHeight=dimensions.height;
},
onOpen: function (e){
if(popupHoverStop){
var timeoutId=0;
$('#cboxContent').hover(function (){
clearTimeout(timeoutId);
$('.cboxSlideshow_on #cboxSlideshow').click();
},
function (){
if(slidePlayAuto){
clearTimeout(timeoutId);
timeoutId=setTimeout(function (){
$('.cboxSlideshow_off #cboxSlideshow').click();
}, slideshowSpeed);
}}
);
}},
onClosed: function (){
self.popup_opened_image=false;
self.clearPopUpHash();
},
};
if(popupPlacementType==1||popupPlacementType==2){
colorBoxConfig['maxWidth']='100%';
colorBoxConfig['imgPlaceType']=popupPlacementType;
}
this.$container.find(colorBoxItemSelector).off('click').colorbox(colorBoxConfig);
$(window).resize(function (){
self.resizeColorbox();
});
$('#cboxOverlay')
.removeClass()
.addClass($this.data('popup-theme') + '-overlay');
$('#colorbox').removeClass().addClass($this.data('popup-theme'));
generateOverlayColor('#cboxOverlay', popupBackground, popupOverlayTransper, true);
}
if(popupType=='pretty-photo'){
var prettyPhotoItemSelector =
'.grid-gallery-photos > a[data-rel^="prettyPhoto"]:visible,' +
' .grid-gallery-photos .gg-mosaic-wrapper a[data-rel^="prettyPhoto"],' +
' .grid-gallery-photos .hi-icon-wrap > a[data-rel^="prettyPhoto"]:visible';
if(this.$container.hasClass('one-photo')||this.$container.hasClass('hidden-item')){
prettyPhotoItemSelector =
'.grid-gallery-photos > a[data-rel^="prettyPhoto"],' +
' .grid-gallery-photos .gg-mosaic-wrapper a[data-rel^="prettyPhoto"],' +
' .grid-gallery-photos .hi-icon-wrap > a[data-rel^="prettyPhoto"]';
}
if(!this.$prettyPhoto){
if(hideLongTooltipTitles==0){
var $prettyPhotoTooltip=$('<div id="sggPrettyPhototooltip">');
$(document).on({
mouseenter: function (){
$prettyPhotoTooltip.addClass('active');
},
mouseleave: function (){
setTimeout(function (){
$prettyPhotoTooltip.removeClass('active');
}, 400);
},
},
'.pp_content_container .pp_description'
);
}
if(this.$container.attr('data-show-buttonlink-in-popup')==1&&window.prettyPhotoDetailLink){
this.loadButtonsFontFamily(this.$container.attr('data-buttonlink-font'), null);
}
this.$prettyPhoto=this.$container
.find(prettyPhotoItemSelector)
.off('click')
.ggPrettyPhoto({
hook: 'data-rel',
theme: 'light_square',
allow_resize: true,
allow_expand: true,
deeplinking: false,
slideshow: slidePlay&&this.$container.data('popup-slideshow-speed'),
autoplay_slideshow: slidePlayAuto,
social_tools: '',
default_width: popupMaxWidth,
default_height: popupMaxHeight,
getImageDimensions: getImageDimension,
is_lazy_load: isLazyLoad,
ppTranslates: self.popupTranslates,
isDisableRightClick: this.$container.attr('data-disable-right-click')=='true',
isShowRotateBtn: this.$container.attr('data-show-rotate-btn-in-popup')==1,
isShowAttributes: this.$container.attr('data-show-attributes-in-popup')==1,
attributesPosition: this.$container.attr('data-attributes-position'),
attributesWidth: this.$container.attr('data-attributes-width'),
isShowButtonLink: this.$container.attr('data-show-buttonlink-in-popup')==1,
buttonLinkStyle: this.$container.attr('data-buttonlink-style'),
isShowLinkBtn: this.$container.attr('data-show-link-btn-in-popup')==1,
isShowHovThumbnail: this.$container.attr('data-show-thumb-hov-in-popup')==1,
galleryId: this.$container.attr('data-gg-id'),
getTitle: function (){},
setImageTitleForPrepare: function ($element){
var imgTile=self.getPopupTitle($element);
return imgTile;
},
popup_border_type: this.$container.attr('data-popup-border-type'),
popup_border_color: this.$container.attr('data-popup-border-color'),
popup_border_width: this.$container.attr('data-popup-border-width'),
popup_border_enable: this.$container.attr('data-popup-border-enable')=='on',
changepicturecallback: function (element){
self.changePopUpHash(element.attr('id')||element.attr('data-id'));
self.popup_opened_image=element;
$('.pp_description').html(self.getPopupTitle(element)).show();
self.addSocialShareToPopUp(element, $('.pp_hoverContainer'), 'popup');
if(!slidePlay){
$('.pp_play').hide();
}
if(self.$container.attr('data-show-link-btn-in-popup')==1&&window.prettyPhotoDetailLink){
window.prettyPhotoDetailLink(element);
}
if(self.$container.attr('data-show-attributes-in-popup')==1&&window.prettyPhotoAttributes){
window.prettyPhotoAttributes(element, self.$container);
}
if(popupHoverStop){
$('.pp_hoverContainer').hover(function (){
$('.pp_nav .pp_pause').click();
},
function (){
if(slidePlayAuto){
$('.pp_nav .pp_play').click();
}}
);
}
var $_desc=$('.pp_description'),
desc_height=parseInt($_desc.height()),
desc_line_height=parseInt($_desc.css('font-size'));
if(desc_line_height < desc_height){
$('.pp_content').height($('.pp_fade').outerHeight(true) + $('.pp_details').outerHeight(true));
}
if(hideLongTooltipTitles==0){
if(!$('#sggPrettyPhototooltip').length){
$('.pp_content_container .pp_content').append($prettyPhotoTooltip);
}
$prettyPhotoTooltip.html($('.pp_content_container .pp_description').html());
}},
callback: function (){
self.popup_opened_image=false;
self.clearPopUpHash();
},
});
$(window).resize(function (){
if(!self.popup_opened_image||!self.$prettyPhoto) return;
self.$prettyPhoto.open(self.popup_opened_image);
});
}else{
this.$prettyPhoto.refresh(this.$container.find(prettyPhotoItemSelector));
}
generateOverlayColor('.pp_overlay', popupBackground, popupOverlayTransper, true);
}
if(popupType=='photobox'){
var photoBoxItemSelector='a.pbox:visible',
photoBoxConfig=null;
if(this.$container.hasClass('one-photo')||this.$container.hasClass('hidden-item')||this.$container.data('gridType')=='4'){
photoBoxItemSelector='a.pbox';
}
if(this.initPhotobox){
this.$container.find('.grid-gallery-photos').photobox('destroy');
}
this.initPhotobox=true;
photoBoxConfig={
autoplay: slidePlayAuto,
isDisableRightClick: this.$container.attr('data-disable-right-click')=='true',
thumb: function (link){
if(self.$container.data('caption-buider')=='1'&&self.$container.data('caption-builder-icons')==1){
return link.closest('.grid-gallery-caption').find('img')[0];
}else if(self.$container.data('icons')){
return link.closest('.grid-gallery-caption').find('img')[0];
}
return null;
},
getTitle: function (el){
var nameTitle=self.getPopupTitle($(el));
return nameTitle;
},
beforeShow: function (element){
self.changePopUpHash($(element).attr('id')||$(element).attr('data-id'));
self.addSocialShareToPopUp($(element), $('#pbCaption'), 'photobox', true);
},
afterClose: function (){
self.clearPopUpHash();
},
};
if(isLazyLoad){
photoBoxConfig['thumbAttr']='data-gg-real-image-href';
}
this.$container.find('.grid-gallery-photos').off('click').photobox(photoBoxItemSelector, photoBoxConfig);
if(!this.$container.data('popup-slideshow')){
$('#pbAutoplayBtn').hide();
}
if(popupHoverStop){
$('.pbWrapper img').hover(function (){
$('#pbOverlay .playing').click();
},
function (){
if(slidePlayAuto){
$('#pbOverlay .play').click();
}}
);
}
generateOverlayColor('#pbOverlay', popupBackground, popupOverlayTransper);
}};
Gallery.prototype.preventImages=function (){
var popupType=this.$container.data('popup-type');
if(popupType=='disable'){
this.$container.find('a.gg-link').off('click');
this.$container.find('a.gg-link:not([data-type=link])').addClass('disabled');
this.$container.on('click', 'a.gg-link', function (event){
if($(this).data('type')!=='link'){
event.preventDefault();
event.stopPropagation();
}});
}};
Gallery.prototype.getResponsiveColumnsNumber=function (){
var columnsData=this.$container.data('responsive-colums'),
settings=[],
columnsNumber=parseInt(this.$container.data('columns-number'));
for (var key in columnsData){
settings.push(columnsData[key]);
}
settings.sort(function (a, b){
a.width=Number(a.width);
b.width=Number(b.width);
if(a.width > b.width){
return 1;
}else if(a.width < b.width){
return -1;
}else{
return 0;
}});
for (var i=0, len=settings.length, windowWidth=$(window).width(), minBreakpoint=0; i < len; i++){
if(windowWidth > minBreakpoint&&windowWidth <=settings[i].width){
columnsNumber=Number(settings[i].columns);
break;
}
minBreakpoint=settings[i].width;
}
return columnsNumber;
};
Gallery.prototype.initRowsMode=function (){
var columnsNumber=parseInt(this.$container.data('columns-number'));
if(this.$container.data('horizontal-scroll')){
return;
}
if(typeof this.$container.data('responsive-colums')=='object'){
columnsNumber=this.getResponsiveColumnsNumber();
}
if(columnsNumber){
var containerWidth=parseInt(this.$container.width()),
spacing=parseInt(this.$container.data('offset')),
scaleHeight=parseInt(this.$container.data('width')) / parseInt(this.$container.data('height')),
elementWidth=null,
elementHeight=null;
elementWidth=Math.floor((this.$container.width() - (columnsNumber - 1) * spacing) / columnsNumber);
elementHeight=Math.floor(elementWidth / scaleHeight);
this.$elements.each(function (){
var $this=$(this);
if(!$this.find('.post-feed-crop').length){
$this.css('width', elementWidth);
if(!isNaN(elementHeight)){
$this.css('height', elementHeight);
}else{
$this.css('height', 'auto');
}}else{
$this.find('figcaption').css('width', elementWidth);
}});
this.$elements.find('.crop').css({
width: 'auto',
height: 'auto',
});
}};
Gallery.prototype.setImagesHeight=function (){
var $images=this.$container.find('img');
if($images!=undefined&&$images.length > 0){
$images.each(function (){
var $image=$(this),
$wrapper=$image.parent();
if($image.height() < $wrapper.height()){
$wrapper.css('height', $image.height());
}});
}};
Gallery.prototype.setOverlayTransparency=function (){
this.$elements.find('figcaption, [class*="caption-with-icons"]').each(function (){
var $caption=$(this),
alpha=(10 - parseInt($caption.data('alpha'), 10)) / 10,
rgb=$caption.css('background-color'),
rgba=rgb.replace(')', ', ' + alpha + ')').replace('rgb', 'rgba');
$caption.css('background', rgba);
});
};
Gallery.prototype.setIconsPosition=function (){
var self=this;
this.$elements.each(function (){
var $element=$(this),
isCaptionBuilderUsed=self.$container.data('caption-buider'),
$wrapper=$element.find('div.hi-icon-wrap'),
$icons=$element.find('a.hi-icon');
$icons.each(function (){
var $icon=$(this),
marginData={},
marginY=$element.height() / 2 - $icon.height() / 2 - 10,
marginX=$wrapper.data('margin');
if(marginX&&!isCaptionBuilderUsed){
marginData['margin-left']=marginX;
marginData['margin-right']=marginX;
}
if(marginY&&!isCaptionBuilderUsed){
marginData['margin-top']=Math.abs(marginY);
}
$icon.css(marginData);
});
});
};
Gallery.prototype.initCategories=function (){
var $defaultElement=this.$navigation.find('a[data-tag="__all__"]'),
$elements=this.$navigation.find('a'),
$defaultBackground=$elements.first().css('background-color');
function shadeColor(color, percent){
var f=parseInt(color.slice(1), 16),
t=percent < 0 ? 0:255,
p=percent < 0 ? percent * -1:percent,
R=f >> 16,
G=(f >> 8) & 0x00ff,
B=f & 0x0000ff;
return '#' + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1);
}
bg=shadeColor('#' + this.rgb2hex($elements.first().css('borderTopColor')), 0.3);
this.$navigation.find('a').on('click',
$.proxy(function (event){
event.preventDefault();
var $category=$(event.currentTarget),
requested=String($category.data('tag')),
_defaultTag='__all__',
currentGallery=this.$navigation.parent().attr('id');
$elements.css('background-color', $defaultBackground);
$category.css('background-color', bg);
if(requested==_defaultTag){
this.$elements
.each(function (){
if($(this).parent().attr('rel')){
$(this)
.parent()
.attr('rel', 'prettyPhoto[' + currentGallery + ']');
}})
.fadeIn();
this.correctMargin();
this.initWookmark();
if(!this.isFluidHeight()&&this.$qsEnable){
this.callQuicksand (this.$qsHolder, this.$qsData, this.$qsDuration);
}
return false;
}
if(!this.isFluidHeight()&&this.$qsEnable){
var $filteredData=this.$qsData.filter(function (){
var tags=$(this).children().data('tags');
if(typeof tags!=='undefined'){
tags=tags.split('|');
}
return $.inArray(requested, tags) > -1;
});
this.callQuicksand (this.$qsHolder, $filteredData, this.$qsDuration);
}else{
$hidden=$();
$visible=$();
this.$elements.each(function (){
var $element=$(this),
tags=$element.data('tags');
if(typeof tags!='string'){
tags=String(tags);
}
if(tags!=undefined){
tags=tags.split('|');
}
if($.inArray(requested, tags) > -1){
if($element.parent().attr('rel')){
$element.parent().attr('rel', 'prettyPhoto[' + currentGallery + '-' + requested + ']');
}
$visible.push(this);
}else{
$hidden.push(this);
}});
$.when($hidden.fadeOut()).done($.proxy(function (){
$visible.fadeIn().css({ height: '' });
this.correctMargin();
this.initWookmark();
}, this)
);
}}, this)
);
var firstTag=$elements.first().data('tag');
this.$container.find('a[data-tag="' + firstTag + '"]').trigger('click');
};
Gallery.prototype.callQuicksand=function ($holder, $filteredData, duration){
self=this;
$filteredData.find('figure.grid-gallery-caption').css('margin', this.initialMargin).parent().css('clear', 'none');
$holder.quicksand (
$filteredData,
{
duration: Number(duration),
easing: 'swing',
attribute: 'href',
},
function (){
$holder
.css({
width: 'auto',
height: 'auto',
})
.append('<div class="grid-gallery-clearfix"></div>');
self.initPopup();
self.correctMargin();
if(self.$container.data('lazyload-enable')=='1'){
self.initLazyLoad();
}}
);
};
Gallery.prototype.hidePopupCaptions=function (){
$('<style type="text/css">.ppt{ display:none!important; }</style>').appendTo('head');
if(this.$container.data('popup-captions')=='hide'){
$('<style type="text/css">#cboxTitle, #cboxCurrent, .pbCaptionText, .ppt, .pp_description { display:none!important; }</style>').appendTo('head');
}};
Gallery.prototype.hidePaginationControls=function (){
return false;
};
Gallery.prototype.setImageOverlay=function (){
if(this.isImageOverlay()){
this.$container.find('.grid-gallery-caption').each(function (){
var image=$(this).find('img');
var crop=$(this).find('.image-overlay');
image.css('opacity', '0.2');
crop.css('background-color', '#424242');
$(this).on('mouseenter', function (){
image.css('opacity', '1.0');
crop.css('background-color', 'inherit');
});
$(this).on('mouseleave', function (){
image.css('opacity', '0.2');
crop.css('background-color', '#424242');
});
});
}};
Gallery.prototype.setMouseShadow=function (){
var shadow=null,
$selector=null,
$captions=this.$container.find('.grid-gallery-caption'),
self=this,
showOver=function (event){
if(event.type==='mouseenter'){
$(this).css('box-shadow', self.mouseOverBoxShadow);
}else{
$(this).css('box-shadow', 'none');
}},
hideOver=function (event){
if(event.type==='mouseenter'){
$(this).css('box-shadow', 'none');
}else{
$(this).css('box-shadow', self.mouseOverBoxShadow);
}};
if(!self.mouseOverBoxShadow){
self.mouseOverBoxShadow=$captions.filter(':first').css('box-shadow');
}
if($captions.is('.shadow-show')){
$captions.css('box-shadow', 'none');
$captions.off('hover').on('hover', showOver);
}else if($captions.is('.shadow-hide')){
$captions.off('hover').on('hover', hideOver);
}};
Gallery.prototype.initPagination=function (){
var perPage=parseInt(this.$container.find('.grid-gallery-photos').data('per-page'), 10),
buffer=[],
page=1,
offset=0;
self=this;
if(isNaN(perPage)){
this.$elements.fadeIn();
return false;
}
if(this.$container.data('gridType')==4&&this.$container.data('show-mosaic-all-img')!=1){
this.$elements.fadeIn();
this.pagination.wrapper.hide();
return false;
}
var showCurrentPage=function (gallery){
gallery.$elements.removeClass('current-page').hide(350);
$.each(buffer[gallery.pagination.currentPage], function (){
$(this)
.addClass('current-page')
.css({ height: gallery.$container.data('height'), width: gallery.$container.data('width') })
.show(function (){
gallery.setIconsPosition();
self.correctMargin();
});
});
};
this.pagination.limit=perPage;
this.$elements
.each($.proxy(function (index, el){
var currentIndex=index + 1;
if(currentIndex - offset <=this.pagination.limit){
if(!$.isArray(buffer[page])){
buffer[page]=[];
}
buffer[page].push(el);
}else{
offset +=this.pagination.limit;
page +=1;
buffer[page]=[el];
}}, this)
)
.hide();
this.pagination.pages=Math.ceil(this.pagination.total / this.pagination.limit);
var element=this.pagination.$wrapper.find('a.grid-gallery-page[data-page="1"]');
element.css('font-size', '19pt');
this.pagination.$wrapper.find('a.grid-gallery-page').on('click',
$.proxy(function (e){
e.preventDefault();
var element=$(e.currentTarget);
var galery=Gallery.prototype;
this.pagination.$wrapper.find('a.grid-gallery-page').each(function (){
$(this).css('font-size', 'inherit');
});
galery.selectedCategory=element.data('page');
element.css('font-size', '19pt');
var $anchor=$(e.currentTarget),
requestedPage=$anchor.data('page');
this.pagination.currentPage=requestedPage;
showCurrentPage(this);
return false;
}, this)
);
showCurrentPage(this);
};
Gallery.prototype.hex=function (x){
return isNaN(x) ? '00':hexDigits[(x - (x % 16)) / 16] + hexDigits[x % 16];
};
Gallery.prototype.rgb2hex=function (rgb){
if(rgb){
rgb=rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(0\.\d+))?\)$/);
function hex(x){
return ('0' + parseInt(x).toString(16)).slice(-2);
}
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}};
Gallery.prototype.hex2rgb=function (hex){
var shorthandRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex=hex.replace(shorthandRegex, function (m, r, g, b){
return r + r + g + g + b + b;
});
var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16),
}
: null;
};
Gallery.prototype.importFontFamily=function (familyName){
var styleId='sggFontFamilyStyle',
$style=$('#' + styleId);
if(!$style.length){
$style=$('<style/>', { id: styleId });
$('head').append($style);
}
familyName=familyName.replace(/\s+/g, '+').replace(/"/g, '');
var obj=document.getElementById(styleId),
sheet=obj.sheet||obj.styleSheet;
if(this.loadedFonts.indexOf(familyName)===-1){
if(sheet.insertRule){
sheet.insertRule('@import url("//fonts.googleapis.com/css?family=' + familyName + '"); ', 0);
}else if(sheet.addImport){
sheet.addImport('//fonts.googleapis.com/css?family=' + familyName);
}
this.loadedFonts.push(familyName);
}};
Gallery.prototype.loadFontFamily=function (){
font=this.$container.data('caption-font-family');
if(typeof font!=='undefined'){
if(window&&window.sggStandartFontsList&&$.inArray(font.replace(/\"/g, ''), window.sggStandartFontsList)!=-1){
return false;
}
if(font&&font!=='Default'){
this.importFontFamily(font);
}}else{
return false;
}};
Gallery.prototype.initCaptionCalculations=function (){
var self=this;
this.$container.find('.grid-gallery-caption').each(function (){
wrap=$(this).find('div.grid-gallery-figcaption-wrap');
figcaption=$(this).find('figcaption');
wrap.css({
display: 'table-cell',
'text-align': figcaption.css('text-align'),
});
wrap.wrap($('<div>', {
css: {
display: 'table',
height: '100%',
width: '100%',
},
})
);
});
};
Gallery.prototype.checkDirection=function ($element, e){
var w=$element.width(),
h=$element.height(),
x=(e.pageX - $element.offset().left - w / 2) * (w > h ? h / w:1),
y=(e.pageY - $element.offset().top - h / 2) * (h > w ? w / h:1);
return Math.round((Math.atan2(y, x) * (180 / Math.PI) + 180) / 90 + 3) % 4;
};
Gallery.prototype.generateOverlayCaptionColor=function (overlayColor, alpha){
if(typeof overlayColor=='string'){
overlayColor=overlayColor.split(')');
if(overlayColor.length > 0){
overlayColor=overlayColor[0].split('(');
if(overlayColor.length > 1){
var chanels=overlayColor[1].split(',');
if(chanels.length==4){
overlayColor[0]=overlayColor[0].replace('a', '');
chanels.splice(-1, 1);
overlayColor[1]=chanels.join(',');
}
return overlayColor[0] + 'a(' + overlayColor[1] + ', ' + (1 - alpha / 10) + ')';
}}
}
return overlayColor;
};
Gallery.prototype.initCaptionEffects=function (){
var self=this,
allwaysShowCaptionOnMobile=this.$container.data('caption-mobile'),
disableCaptionOnMobile=this.$container.data('caption-disabled-on-mobile'),
isMobile = !!parseInt(this.$container.data('is-mobile'));
if(isMobile&&navigator&&navigator.userAgent&&navigator.userAgent.indexOf('Safari') > -1){
var $3dCubeCaptions=this.$container.find('.grid-gallery-caption[data-grid-gallery-type="3d-cube"]');
$3dCubeCaptions.attr('data-grid-gallery-type', 'revolving-door-bottom');
$3dCubeCaptions.data('grid-gallery-type', 'revolving-door-bottom');
}
$.each(this.$elements, function (index, el){
var $el=$(el),
overlayColor=$el.find('figcaption').css('backgroundColor'),
alpha=parseInt($el.find('figcaption').data('alpha'));
if(isMobile&&allwaysShowCaptionOnMobile){
$el.attr('data-grid-gallery-type', 'none');
}
if($el.data('grid-gallery-type')=='cube'){
$el.on('mouseenter mouseleave', function (e){
var $figcaption=$(this).find('figcaption'),
direction=self.checkDirection($(this), e),
classHelper=null;
switch (direction){
case 0:
classHelper='cube-' + (e.type=='mouseenter' ? 'in':'out') + '-top';
break;
case 1:
classHelper='cube-' + (e.type=='mouseenter' ? 'in':'out') + '-right';
break;
case 2:
classHelper='cube-' + (e.type=='mouseenter' ? 'in':'out') + '-bottom';
break;
case 3:
classHelper='cube-' + (e.type=='mouseenter' ? 'in':'out') + '-left';
break;
}
$figcaption.removeClass().addClass(classHelper);
});
}
if($el.data('grid-gallery-type')=='direction-aware'){
var color=$el.find('figcaption').css('color'),
isCaptionBuilderUsed=self.$container.data('caption-buider'),
classStr='',
addAttr='',
align=$el.find('figcaption').css('text-align');
if(isCaptionBuilderUsed==1){
$el.attr('data-caption', '<div style="padding:0px; height: ' + $el.height() + 'px; font-family:' + self.$container.data('caption-font-family') + '; font-size:' + self.$container.data('caption-text-size') + '">' + ($el.find('figcaption').html()||'') + '</div>');
}else{
var $ggImgCaption=$el.find('.gg-image-caption');
if($ggImgCaption.hasClass('ggRtlClass')){
classStr='ggRtlClass';
addAttr='dir="rtl"';
}
$el.attr('data-caption', '<div class="' + classStr + '" ' + addAttr + ' style="padding:20px;font-family:' + self.$container.data('caption-font-family') + '; font-size:' + self.$container.data('caption-text-size') + ';">' + ($ggImgCaption.html()||'') + '</div>');
}
$el.sliphover({
target: $el,
backgroundColor: self.generateOverlayCaptionColor(overlayColor, alpha),
fontColor: color,
textAlign: align,
caption: 'data-caption',
});
}
if($el.data('grid-gallery-type')=='3d-cube'){
if(!$el.find('.box-3d-cube-scene').length){
var cubeWidth=$el.width(),
cubeHeight=$el.height();
$el.children('div').addClass('front').addClass('face');
$el.children('figcaption').addClass('back').addClass('face');
$el.html('<div class="box-3d-cube-scene"><div class="box-3d-cube">' + $el.html() + '</div></div>');
self.changeImageHeightFor3dCubeEffect($el, cubeWidth, cubeHeight);
}}
if($el.data('grid-gallery-type')=='polaroid'){
self.polaroidCaptionCalculate($el);
}else{
var topRow=$el.find('.gg-caption-row.top'),
centerRow=$el.find('.gg-caption-row.center');
if(centerRow.length==1&&topRow.length==1){
centerRow.css({ top: topRow.height(), transform: 'initial' });
}}
});
$(document).on('click', '.sliphover-container', function (event){
event.preventDefault();
$(this).data('relatedElement').get(0).click();
});
if(isMobile&&!disableCaptionOnMobile){
this.$container.find('.grid-gallery-caption').each(function (){
var caption=this,
$caption=$(caption),
hammer=new Hammer_gg(this),
captionIsMobile=self.$container.attr('data-caption-mobile'),
preventClick=false;
$caption.on('click', function (event){
if(preventClick){
event.preventDefault();
event.stopPropagation();
}});
hammer.on('tap panstart', function (event){
if(event.type==='panstart'){
self.$container.find('.grid-gallery-caption').removeClass('hovered');
}
if(event.type==='tap'){
preventClick=false;
if(!$caption.hasClass('hovered')){
self.$container.find('.grid-gallery-caption').not(caption).removeClass('hovered');
$(caption).addClass('hovered');
if(captionIsMobile=='false'){
preventClick=true;
}}
}});
});
}
if(isMobile&&disableCaptionOnMobile){
this.$container.find('.grid-gallery-caption figcaption').hide();
}};
Gallery.prototype.polaroidCaptionCalculate=function ($el){
if($el.data('grid-gallery-type')!='polaroid'||$(this).find('.post-feed-crop').length||$el.hasClass('initialized')) return;
var $img=$el.find('img');
if($img.hasClass('ggLazyImg')||$img.hasClass('ggNotInitImg')) return;
if($el.closest('.gg-mw-row').hasClass('sggDisplNone')) return;
$el.addClass('initialized');
$img.finish();
var width=$el.width(),
gridType=this.$container.data('gridType'),
frameWidth=parseInt(this.$container.data('polaroid-frame-width'), 10)||20,
captionHeight=this.$container.data('polaroid-caption-height'),
clearHeight=captionHeight ? parseInt(captionHeight.toString().match(/\d.?\d*.?\d*/)[0]):0,
overlayColor=$el.find('figcaption').css('backgroundColor'),
alpha=parseInt($el.find('figcaption').data('alpha')),
$figcaption=$el.find('figcaption'),
scaleRatio=$img.width() / $img.height();
if(gridType==2){
var imageHeight=$img.height() - frameWidth * 2,
imageWidth=imageHeight * scaleRatio;
}else{
var imageWidth=$img.width() - frameWidth * 2,
imageHeight=imageWidth / scaleRatio;
}
var figcaptionHeight = !isNaN(clearHeight)&&clearHeight!=0 ? (captionHeight.toString().indexOf('%') > 0 ? (imageHeight * clearHeight) / 100:clearHeight):0,
figureFullHeight=imageHeight + frameWidth * 2 + figcaptionHeight;
$img.css({
width: imageWidth + 'px',
height: imageHeight + 'px',
margin: frameWidth + 'px auto 0',
});
$el.find('.gg-caption-table').css('height', '1px');
$el.find('.crop').css({
height: imageHeight + frameWidth + 'px',
});
if(gridType==0){
$el.find('.crop').css('overflow', 'visible');
}else if(gridType==2){
$el.css({
height: figureFullHeight + 'px',
width: imageWidth + frameWidth * 2 + 'px',
});
}else if(gridType==3){
$el.css({
height: figureFullHeight + 'px',
});
}
$el.css({
background: overlayColor,
});
$el.css({
width: $el.width(),
background: this.generateOverlayCaptionColor(overlayColor, alpha),
});
$figcaption.css({
background: 'none',
transition: 'none',
});
if(figcaptionHeight){
figcaptionHeight +='px';
$figcaption.css('height', figcaptionHeight);
$el.find('.gg-caption-row').css({ 'max-height': figcaptionHeight ? figcaptionHeight:'100%', height: 'auto' });
$el.find('.gg-caption-cell').css('height', '100%');
if(gridType==3){
$figcaption.css('margin-top', frameWidth + 'px');
}}else{
$figcaption.css('padding', frameWidth + 'px');
}
if($figcaption.find('.grid-gallery-figcaption-wrap').text().length===0){
$figcaption.find('.grid-gallery-figcaption-wrap').append('<span></span>');
}
if(this.$container.data('polaroid-animation')){
$el.addClass('polaroid-animation');
}
if(this.$container.data('polaroid-scattering')){
$el.css({
transform: 'rotate(' + (-3 + Math.random() * (10 - 3)) + 'deg)',
});
$el.addClass('polaroid-scattering');
}
var slimScroll=$el.closest('div.slimScrollDiv');
if(slimScroll.length){
var scrollHeight=figureFullHeight + 20 + 'px';
slimScroll.css('height', scrollHeight);
slimScroll.find('.grid-gallery-photos').css('height', scrollHeight);
}};
Gallery.prototype.changeImageHeightFor3dCubeEffect=function ($figure, cubeWidth, cubeHeight){
if(!$figure){
return;
}
if(!$figure.length){
if('figure' in $figure&&'width' in $figure&&'height' in $figure){
cubeWidth=$figure.width;
cubeHeight=$figure.height;
$figure=$figure.figure;
}else{
return;
}}
if(!cubeWidth){
cubeWidth=$figure.width();
}
if(!cubeHeight){
cubeHeight=$figure.height();
}
var perspective=Math.max(cubeHeight, cubeWidth) * 2 + 'px',
transformOrigin='50% 50% -' + Math.round(cubeHeight / 2) + 'px';
$figure.find('.box-3d-cube-scene').css({
perspective: perspective,
'-webkit-perspective': perspective,
});
$figure.find('.box-3d-cube').css({
'transform-origin': transformOrigin,
'-ms-transform-origin': transformOrigin,
'-webkit-transform-origin': transformOrigin,
});
$figure.find('.box-3d-cube, .box-3d-cube .face').css({
width: cubeWidth + 'px',
height: cubeHeight + 'px',
});
};
Gallery.prototype.correctMargin=function (){
if(this.$container.data('area-position')=='right'){
return;
}
if(this.$container.data('gridType')==4){
return;
}
var horizontalScroll=this.$container.data('horizontal-scroll'),
isMobile=parseInt($anyGallery.attr('data-is-mobile'));
if(horizontalScroll&&horizontalScroll.responsiveMode==1&&isMobile){
}else{
return;
}
if(!this.isFluidHeight()){
if(this.$qsEnable){
this.$elements=this.$container.find('figure.grid-gallery-caption');
}
var prevElement=null,
totalElements=this.$elements.filter(':visible').length,
rowWidth=0,
maxRowWidth=this.$container.width(),
initialMargin=this.initialMargin;
this.$elements.css('margin', this.initialMargin);
this.$elements.parent().css('clear', 'none');
this.$elements.filter(':visible').each(function (index){
if(rowWidth + $(this).outerWidth() > maxRowWidth){
$(prevElement).css('margin-right', 0);
$(this).css('margin-right', this.initialMargin);
$(this).parent().css('clear', 'left');
rowWidth=$(this).outerWidth() + parseInt(initialMargin);
}else if(rowWidth + $(this).outerWidth()==maxRowWidth){
$(this).css('margin-right', 0);
rowWidth=0;
}else{
rowWidth +=$(this).outerWidth() + parseInt(initialMargin);
}
if(index==totalElements - 1){
$(this).css('margin-right', 0);
}
prevElement=this;
});
}};
Gallery.prototype.hideTitleTooltip=function (){
if(this.$container.data('hide-tooltip')==true){
title='';
this.$container
.find('a, img, div:not(.grid-gallery-photos)')
.on('mouseenter', function (){
title=$(this).attr('title');
$(this).attr({ title: ' ' });
})
.mouseout(function (){
$(this).attr({ title: title });
});
}};
Gallery.prototype.correctFullscreen=function (){
var windowWidth=$(window).width();
this.$elements.each(function (){
var coef=parseInt(windowWidth / $(this).width()),
resultWidth=Math.round(windowWidth / coef);
$(this).width(resultWidth);
});
};
Gallery.prototype.correctFullScreenWidthGallery=function (){
var windowWidth=$(window).width(),
$parentContainer=this.$container.parent(),
containerOffset=$parentContainer.offset(),
containerOffsetLeft=containerOffset.left + parseFloat($parentContainer.css('padding-left'));
this.$container.find('.grid-gallery-photos').css({
width: windowWidth,
});
var cssDirection=this.$container.css('direction');
if('ltr'==cssDirection){
this.$container.css({
width: windowWidth,
left: '-' + containerOffsetLeft + 'px',
});
this.$container.find('.grid-gallery-nav').css('width', windowWidth + 'px');
}else{
this.$container
.css({
width: windowWidth, //, 'max-width': '100%'
})
.offset(function (i, coords){
return { top: coords.top, left: 0 };});
}};
Gallery.prototype.getOriginalImageSizes=function (img){
var tempImage=new Image(),
width,
height;
if('naturalWidth' in tempImage&&'naturalHeight' in tempImage){
width=img.naturalWidth;
height=img.naturalHeight;
}else{
tempImage.src=img.src;
width=tempImage.width;
height=tempImage.height;
}
return {
width: width,
height: height,
};};
Gallery.prototype.initHorizontalMode=function (){
var horizontalScroll=this.$container.data('horizontal-scroll'),
height=this.$container.data('height'),
width=this.$container.data('width'),
offset=this.$container.data('offset'),
isMobile=parseInt($anyGallery.attr('data-is-mobile')),
mouseWheelStep=100,
touchStep=100,
responsiveMode=0,
tmpValue=0,
self=this;
if(this.$container.data('gridType')==4){
return;
}
if(!horizontalScroll){
return;
}
if(horizontalScroll){
if(horizontalScroll.responsiveMode==1&&isMobile){
return;
}
if(horizontalScroll.mouseWheelStep){
tmpValue=parseInt(horizontalScroll.mouseWheelStep);
if(!isNaN(tmpValue)){
mouseWheelStep=tmpValue;
}}
if(horizontalScroll.touchStep){
tmpValue=parseInt(horizontalScroll.touchStep);
if(!isNaN(tmpValue)){
touchStep=tmpValue;
}}
}
if(!height){
var elementsHeight=this.$container
.find('.grid-gallery-caption>a')
.map(function (){
return $(this).height();
})
.get(),
height=Math.max.apply(null, elementsHeight);
}else{
if(offset&&offset > 0){
height=height + offset * 2;
}}
if(width==='auto'){
this.$elements.each(function (index, el){
var $figure=$(el),
$image=$figure.find('img');
sizes=self.getOriginalImageSizes($image.get(0));
$image.css('max-width', 'none');
if(!$image.hasClass('ggLazyImg')) $figure.width(Math.floor((height / sizes.height) * sizes.width));
});
}
var isIE9OrBelow=function (){
return /MSIE\s/.test(navigator.userAgent)&&parseFloat(navigator.appVersion.split('MSIE')[1]) < 10;
};
if(isIE9OrBelow()){
this.$container.find('.grid-gallery-photos > *').css('display', 'table-cell');
}else{
this.$container.find('.grid-gallery-photos > *').css('display', 'inline-block');
}
this.$container.find('.grid-gallery-photos > *').css({
margin: 0,
padding: 0,
float: 'none',
animate: true,
'vertical-align': 'middle',
clear: 'right',
border: 'none',
'max-width': 'none',
});
this.$container.find('.grid-gallery-photos').css({
'font-size': 0,
});
this.$container.find('.grid-gallery-photos .grid-gallery-caption').css({
float: 'none',
'margin-left': 0,
});
height=height + 7;
var slimScroll=this.$container.find('.grid-gallery-photos').slimScroll({
height: height,
width: 'auto',
railVisible: true,
alwaysVisible: true,
allowPageScroll: true,
axis: 'x',
animate: true,
color: horizontalScroll.color||'#000',
opacity: (100 - horizontalScroll.transparency) * 0.01,
wheelStep: mouseWheelStep,
touchScrollStep: touchStep,
isMobile: isMobile,
ggSlimscrollHandler: function (){
self.lazyLoadTriggerHandler();
},
});
if(slimScroll.height() < height){
slimScroll.height(height);
slimScroll.parent().height(height);
}};
Gallery.prototype.initHorizontalGalleryType=function (){
if(this.$container.data('height')&&String(this.$container.data('height')).indexOf('%') > -1){
var height=this.$elements.first().height();
this.$elements.find('img').css({
'max-height': height,
'min-height': height,
});
}
var self=this;
setTimeout(function (){
self.resizeHorizontalElements();
}, 50);
};
Gallery.prototype.hidePreloader=function (){
var preloadEnab=this.$container.attr('data-preloader'),
preloader=this.$container.find('.gallery-loading'),
galleryPhotos=this.$container.find('.grid-gallery-photos');
preloader.hide();
if(preloadEnab!==''&&preloadEnab==='true'){
setTimeout(function (){
galleryPhotos.show().fadeTo('slow', 1, function (){
galleryPhotos.css('opacity', '1');
});
}, 0);
}else{
galleryPhotos.show().fadeTo('fast', 1, function (){
galleryPhotos.css('opacity', '1');
});
}};
Gallery.prototype.showGalleryParts=function (){
this.$container.children('.hidden-item').removeClass('hidden-item');
};
Gallery.prototype.$getImagesFigureContainer=function (){
return this.$container.find('figure.grid-gallery-caption');
};
Gallery.prototype.initSocialSharing=function (){
if(!this.socialSharing||!this.socialSharing.enabled){
return;
}
var newUrl=encodeURIComponent(window.location.href);
var newTitle=encodeURIComponent(document.title);
jQuery('.supSocialIcon').each(function (){
var $this=$(this);
var origUrl=$this.attr('originalurl');
var newUrl2=origUrl.replace('{url}', newUrl);
newUrl2=newUrl2.replace('{title}', newTitle);
newUrl2=newUrl2.replace('{description}', newTitle);
$this.attr('href', newUrl2);
});
this.initGallerySocialSharing();
this.initImageSocialSharing();
};
Gallery.prototype.initGallerySocialSharing=function (){
var gallerySharing=this.socialSharing.gallerySharing;
if(!parseInt(gallerySharing.enabled)){
return;
}
if(gallerySharing.position=='top'||gallerySharing.position=='all'){
this.$container.find('.gallery-sharing-top').fadeIn();
}
if(gallerySharing.position=='bottom'||gallerySharing.position=='all'){
this.$container.find('.gallery-sharing-bottom').fadeIn();
}};
Gallery.prototype.initImageSocialSharing=function (){
var imageSharing=this.socialSharing.imageSharing;
if(!parseInt(imageSharing.enabled)){
return;
}
var btns=this.$container.find('.gallery-sharing-image').clone();
var $images=this.$getImagesFigureContainer(),
iconsEnabled=this.$container.data('icons');
$images.each(function (){
var $this=$(this),
$el;
var imgLink=jQuery($this).parent().attr('href');
btns.find('.supSocialIcon').each(function (){
var $thisBtn=$(this);
if($thisBtn.hasClass('supSocialIconprint')){
$thisBtn.attr('onClick', 'supSocialSharePrintImage("' + imgLink + '")');
}});
if(!iconsEnabled){
$el=$this.parent();
}else{
$el=$this.find('a.hi-icon');
}
$this.append(btns.html());
});
};
Gallery.prototype.addSocialShareToPopUp=function ($element, $wrapper, addClass, fixed){
if(!this.socialSharing.enabled||!parseInt(this.socialSharing.popupSharing.enabled)){
return;
}
var btns=this.$container.find('.gallery-sharing-popup').clone();
var newUrl=encodeURIComponent($element.get(0).baseURI);
var imgLink=$element.get(0).href;
var newTitle=jQuery($element.get(0)).attr('title');
btns.find('.supSocialIcon').each(function (){
var $this=$(this);
if($this.hasClass('supSocialIconprint')){
$this.attr('onClick', 'supSocialSharePrintImage("' + imgLink + '")');
}
$this.attr('title', newTitle);
var origUrl=$this.attr('originalurl');
var newUrl2=origUrl.replace('{url}', newUrl);
newUrl2=newUrl2.replace('{title}', newTitle);
newUrl2=newUrl2.replace('{description}', newTitle);
$this.attr('href', newUrl2);
});
$wrapper.find('.supSocialIconsWrapper').remove();
$wrapper.append(btns.html());
};
Gallery.prototype.urlToObject=function (strUrl){
if(!strUrl){
return null;
}
var posQ=strUrl.indexOf('?');
if(posQ==-1){
return null;
}
var strQueryParams=strUrl.substr(posQ + 1),
result={
url: strUrl.substr(0, posQ),
params: {},
};
strQueryParams.split('&').forEach(function (part){
var item=part.split('=');
if(item.length >=2){
result.params[item[0]]=decodeURIComponent(item[1]);
}});
return result;
};
Gallery.prototype.objectToUrl=function (specObj){
if(!specObj){
return null;
}
var resUrl='';
if(specObj.url){
resUrl=specObj.url;
}
if(specObj.params){
var paramParts=[],
paramKeys=Object.keys(specObj.params),
indX=0;
for (indX=0; indX < paramKeys.length; indX++){
paramParts.push(encodeURIComponent(paramKeys[indX]) + '=' + encodeURIComponent(specObj.params[paramKeys[indX]]));
}
resUrl=resUrl + '?' + paramParts.join('&');
}
return resUrl;
};
Gallery.prototype.removePopUpHashFromUrl=function (url){
var match=url.match(/gg-\d+-\d+/);
return url.replace(url[url.indexOf(match) - 1] + match, '');
};
Gallery.prototype.addPopUpHashToUrl=function (url, hash){
if(!hash||!hash.length){
return url;
}
var prefix='?';
if(url.indexOf(prefix)!=-1) prefix='&';
return url + prefix + hash;
};
Gallery.prototype.openHashPopUp=function (){
var getElementId=function (){
var search=window.location.search;
if(search.match(/gg-\d+-\d+/)){
return search.match(/gg-\d+-\d+/);
}
var hash=window.location.hash;
if(hash.match(/gg-\d+-\d+/)){
return hash.match(/gg-\d+-\d+/);
}};
var elementId=getElementId(),
$element=this.$container.find('#' + elementId + ', [data-id="' + elementId + '"]').first();
if($element.length){
$element.click();
var $figure;
if($element.hasClass('hi-icon')){
$figure=$element.closest('figure.grid-gallery-caption');
}else{
$figure=$element.children('figure');
}
if($figure.length){
$('html, body').animate({
scrollTop: $figure.offset().top,
},
100
);
}}
};
Gallery.prototype.updateQueryParams=function (url, params){
for (var param in params){
var re=new RegExp('[\\?&]' + param + '=([^&#]*)'),
match=re.exec(url),
delimiter,
value=params[param];
if(match===null){
var hasQuestionMark=/\?/.test(url);
delimiter=hasQuestionMark ? '&':'?';
if(value){
url=url + delimiter + param + '=' + value;
}}else{
delimiter=match[0].charAt(0);
if(value){
url=url.replace(re, delimiter + param + '=' + value);
}else{
url=url.replace(re, '');
if(delimiter==='?'&&url.length){
url='?' + url.substr(1);
}}
}}
return url;
};
Gallery.prototype.changePopUpHash=function (hash){
var galleryId=this.$container.attr('data-gg-id'),
galleryOpenPopupHashRegex=new RegExp('gg-' + galleryId + '(?:-(\\d+))*'),
regexFoundGalleryImageId=galleryOpenPopupHashRegex.exec(hash),
changedUrlDisabled=this.$container.attr('data-popup-disable-changed-url');
if(changedUrlDisabled!=='true'){
if(!regexFoundGalleryImageId||regexFoundGalleryImageId.length < 2||!regexFoundGalleryImageId[1]){
return;
}
this.popupIsOpened=true;
if(this.ignoreStateChange){
this.ignoreStateChange=false;
return;
}
var queryParams=this.updateQueryParams(window.location.search, { _gallery: hash }),
stateUrl=window.location.pathname + queryParams;
this.historyStateChange=true;
if(!this.popupIsInit){
if(queryParams===document.location.search){
History.replaceState({
type: 'sc-gallery',
hash: hash,
state: 'close',
},
document.title,
window.location.pathname + this.updateQueryParams(window.location.search, { _gallery: null })
);
History.pushState({
type: 'sc-gallery',
hash: hash,
state: 'init',
},
document.title,
stateUrl
);
}else{
History.replaceState({
type: 'sc-gallery',
hash: hash,
state: 'init',
},
document.title,
stateUrl
);
}
this.popupIsInit=true;
}else{
if(this.disablePopupHistory){
History.replaceState({
type: 'sc-gallery',
hash: hash,
state: 'change',
},
document.title,
stateUrl
);
}else{
History.pushState({
type: 'sc-gallery',
hash: hash,
state: 'change',
},
document.title,
stateUrl
);
}}
this.historyStateChange=false;
}};
Gallery.prototype.clearPopUpHash=function (){
this.historyStateChange=true;
if(this.disablePopupHistory){
History.replaceState({
type: 'sc-gallery',
hash: '',
state: 'close',
},
document.title,
window.location.pathname + this.updateQueryParams(window.location.search, { _gallery: null })
);
}else{
History.pushState({
type: 'sc-gallery',
hash: '',
state: 'close',
},
document.title,
window.location.pathname + this.updateQueryParams(window.location.search, { _gallery: null })
);
}
this.historyStateChange=false;
this.popupIsOpened=false;
};
Gallery.prototype.getRealImgSizeInBrowser=function (arguments){
if(!arguments&&!arguments.length){
return null;
}
if(arguments.length > 1){
returnType=arguments[1];
}
if(arguments.length){
$image=arguments[0];
}
var returnData=null,
boundRect=null;
if($image&&$image.length&&$image[0].getBoundingClientRect){
boundRect=$image[0].getBoundingClientRect();
}
if(returnType=='h'){
if(boundRect&&boundRect.height){
returnData=boundRect.height;
}else{
returnData=parseFloat($image.css('height'));
}}else if(returnType=='w'){
if(boundRect&&boundRect.width){
returnData=boundRect.width;
}else{
returnData=parseFloat($image.css('width'));
}}
return returnData;
};
Gallery.prototype.lazyLoadTriggerHandler=function (){
$(document).trigger('scroll');
};
Gallery.prototype.lazyLoadDistanceRefresh=function (waitTime){
var self=this,
galleryType=this.$container.data('gridType');
if(typeof waitTime=='undefined'){
waitTime=400;
}
if(self.ggLazyTimeOut){
clearTimeout(self.ggLazyTimeOut);
}
self.ggLazyTimeOut=setTimeout(function (){
setTimeout(function (){
$.each(self.$elements, function (index, el){
var $el=$(el);
if($el.data('grid-gallery-type')=='polaroid'){
self.polaroidCaptionCalculate($el);
}});
}, waitTime + 50);
switch (galleryType){
case 4:
$(document).trigger('ggMosaicResizedEvent');
break;
case 0:
if(typeof self.setCaptionOnHoverImage=='function'){
self.setCaptionOnHoverImage();
}
setTimeout(function (){
self.lazyLoadTriggerHandler();
setTimeout(function (){
if(self.wookmark){
self.wookmark.trigger('refreshWookmark');
}}, 50);
}, waitTime + 60); //450); // animation transition time
break;
case 1:
if(typeof self.setCaptionOnHoverImage=='function'){
self.setCaptionOnHoverImage();
}
$.each(self.$elements, function (index, el){
var $el=$(el);
if($el.data('grid-gallery-type')=='3d-cube'){
self.changeImageHeightFor3dCubeEffect($el, $el.width(), $el.find('img').length ? $el.find('img').height():$el.height());
}});
case 2:
case 3:
default:
setTimeout(function (){
self.lazyLoadTriggerHandler();
self.initWookmark();
}, waitTime + 50); //450); // animation transition time
break;
}}, 100);
};
Gallery.prototype.initLazyLoad=function (){
var self=this,
hoverImgSrc=this.$container.data('image-on-hover');
var showMoreCategory=this.$container.find('.showMoreCategory'),
effect=this.$container.data('lazyload-effect'),
duration=this.$container.data('lazyload-effect-duration');
if(typeof effect=='undefined'){
effect='show';
duration=400;
}
var waitTime=effect=='fadeIn' ? 200:duration;
self.ggLazyTimeOut=null;
this.$container.find('.ggLazyImg').ggLazyLoad({
data_attribute: 'gg-real-image-href',
threshold: 50,
effect: effect,
effectspeed: duration,
skip_invisible: showMoreCategory.length > 0,
load: function (event){
var image=$(this);
self.lazyLoadDistanceRefresh(waitTime);
if(self.$container.data('gridType')!=0){
image.closest('div .crop').css('height', '');
}
image.closest('figure').css('height', 'auto');
if(self.$container.data('gridType')==2&&self.$elements){
setTimeout(function (){
self.resizeElementHeight(image, image.closest('figure'));
}, waitTime + 20); //460); // animation transition time + 20ms
}},
});
};
Gallery.prototype.init=function (){
var self=this;
this.setImagesHeight();
var galleryBeforeInitId='GalleryBeforeInit' + this.galleryContainerId;
setTimeout(()=> {
$(document).trigger(galleryBeforeInitId, [this]);
}, 10);
this.hidePreloader();
this.showCaption();
this.initRowsMode();
this.initHorizontalGalleryType();
this.initQuicksand ();
if(this.$container.attr('data-fullscreen')=='true'){
this.correctFullScreenWidthGallery();
$(window).resize(function (){
self.correctFullScreenWidthGallery();
});
}
this.initHorizontalMode();
this.setOverlayTransparency();
this.initCaptionCalculations();
this.initCaptionEffects();
this.hideTitleTooltip();
this.initPagination();
this.initPopup();
this.setMouseShadow();
this.setImageOverlay();
this.loadFontFamily();
this.hidePopupCaptions();
this.preventImages();
this.initWookmark();
this.initCategories();
this.setIconsPosition();
this.correctMargin();
this.initControll();
this.showGalleryParts();
this.initLazyLoad();
this.initSocialSharing();
setTimeout(function (){
if(self.wookmark){
self.wookmark.trigger('refreshWookmark');
}}, 500);
setTimeout(function (){
self.openHashPopUp();
}, 500);
$(document).ready(function (){
$(document).trigger('GalleryAfterInit', self);
});
var galleryId=this.$container.attr('data-gg-id'),
openByLinkRegexp=new RegExp('#gg-open-' + galleryId + '(\\-([\\d]+))*$');
History.Adapter.bind(window, 'statechange', function (event){
var state=History.getState();
if(!self.historyStateChange){
if((state.data.type!=='sc-gallery'&&self.popupIsOpened)||(state.data.type==='sc-gallery'&&(state.data.state==='close'||state.data.state==='hashchange')&&self.popupIsOpened)){
if(self.popupType=='pretty-photo'){
this.$prettyPhoto&&this.$prettyPhoto.close();
}
if(self.popupType=='colorbox'){
$.colorbox&&$.colorbox.close();
}
if(self.popupType=='photobox'){
window._photobox&&window._photobox.close();
}}
if(state.data.type==='sc-gallery'&&state.data.hash&&state.data.state!=='close'){
self.ignoreStateChange=true;
var $el=self.$container.find('#' + state.data.hash + ', [data-id="' + state.data.hash + '"]').first();
if(self.popupIsOpened){
if(self.popupType=='pretty-photo'&&this.$prettyPhoto){
var href=$el.attr('href'),
index=this.$prettyPhoto.getImagesList().indexOf(href);
this.$prettyPhoto.changePage(index);
}
if(self.popupType=='colorbox'){
$.colorbox.resizeResponsive($el);
}
if(self.popupType=='photobox'){
var images=window._photobox.getImages(),
href=$el.attr('href');
for (var i=0; i < images.length; i++){
if(images[i][0]==href||images[i][0]=='http:' + href||images[i][0]=='https:' + href){
window._photobox.changeImage(i);
}}
}}else{
$el.trigger('click');
}}
}});
function checkUrl(){
var hash=window.location.hash,
matches=openByLinkRegexp.exec(hash);
if(matches){
History.replaceState({
type: 'sc-gallery',
hash: '',
state: 'hashchange',
},
document.title,
window.location.pathname
);
var position=matches[2] ? 'eq(' + (matches[2] - 1) + ')':'first';
self.$container.find('.gg-link:' + position + ', .hi-icon:' + position).trigger('click');
}}
$(window).on('hashchange', function (event){
checkUrl();
});
$(document).ready(function (){
checkUrl();
});
$(window).on('resize',
$.proxy(function (){
this.correctMargin();
this.resizeHorizontalElements();
this.initHorizontalMode();
}, this)
);
};
Gallery.prototype.resizeHorizontalElements=function (){
var self=this;
if(this.$container.data('gridType')==2&&this.$elements){
this.$elements.each(function (){
var element=$(this),
image=element.find('img');
if(image){
self.resizeElementHeight(image, element);
}});
}};
Gallery.prototype.resizeElementHeight=function (image, element){
var imageHeight=parseInt(image.css('height'));
if(!isNaN(imageHeight)&&!element.hasClass('initialized')){
element.css('height', Math.floor(imageHeight - 1) + 'px');
}
if(!image.hasClass('ggLazyImg')){
image.removeClass('ggNotInitImg');
this.polaroidCaptionCalculate(element);
}};
window.initGridGallery=function (el, autoInit){
var makeSelector=function (el){
return '#' + el.id;
};
return new Gallery(makeSelector(el), autoInit);
};
window.contentLoaded=function (){
var $galleries=$(".grid-gallery:not('.initialized')"),
$promise=new $.Deferred().resolve();
if($galleries.length > 0){
$.each($galleries, function (i, el){
$promise=$promise.then(function (){
return new Gallery(el, true);
});
});
}
$('.crop').css('display', 'block');
};
if(!init){
var hammer=new Hammer_gg(document),
$anyGallery=$('.grid-gallery:first'),
isMobile=parseInt($anyGallery.attr('data-is-mobile'));
if(!isNaN(isMobile)&&isMobile){
hammer.on('swipeleft swiperight', function (event){
if(event.type=='swipeleft'){
$('#colorbox:visible #cboxNext, .pp_pic_holder a.pp_arrow_next, #cboxOverlay:visible #pbNextBtn').click();
}else{
$('#colorbox:visible #cboxPrevious, .pp_pic_holder a.pp_arrow_previous, #cboxOverlay:visible #pbPrevBtn').click();
}});
}
init=true;
}
$(document)
.ready(function (){
contentLoaded();
})
.ajaxComplete(function (){
contentLoaded();
});
if(jQuery('body').hasClass('oceanwp-theme')){
function oceanwpFixedFooter(){
$('#main').css('min-height', '0px');
}
jQuery(window).resize(function (){
oceanwpFixedFooter();
});
jQuery(document).ready(function (){
setTimeout(function (){
oceanwpFixedFooter();
}, 3000);
});
}
$(document).on('ggFirInitialize', function (){
contentLoaded();
});
$('a.gg-link').each(function (){
var gLink=$(this).attr('href');
var reg=/[0-9a-z_]+@[0-9a-z_]+\.[a-z]{2,5}/i;
if(gLink){
var isEmail=gLink.match(reg);
if(isEmail){
$(this).attr('href', 'mailto:' + isEmail[0]);
}}
});
jQuery(document).ready(function (){
jQuery('.supSocialIconBookmarkBtn').click(function (){
alert('Please press Ctrl+D (Cmd+D on Mac) to add this page to your bookmarks.');
});
setTimeout(function (){
jQuery('body')
.find('.supsystic-social-sharing')
.each(function (key, value){
var summary=0;
jQuery(this)
.find('.social-sharing-button')
.each(function (key2, value2){
if(jQuery(this).parent().hasClass('supsystic-social-sharing-popup')) return;
var networks=jQuery(this).attr('data-networks');
networks=jQuery.parseJSON(networks);
var attachId=jQuery('.supsystic-social-sharing').eq(key).closest('[data-attachment-id]').attr('data-attachment-id');
if(typeof attachId!='undefined'){
var nid=jQuery(this).attr('data-nid');
var counter=networks[attachId][nid];
if(parseInt(counter)&&!isNaN(counter)){
summary=summary + parseInt(counter);
}
var counterWrapper='';
if(jQuery(this).hasClass('counter-standard')){
jQuery(this).find('.counter-wrap.standard').remove('');
counterWrapper='<div class="counter-wrap standard"><span class="counter">' + counter + '</span></div>';
}
if(jQuery(this).hasClass('counter-arrowed')){
jQuery(this).find('.counter-wrap.arrowed').remove('');
counterWrapper='<div class="counter-wrap arrowed"><span class="counter">' + counter + '</span></div>';
}
if(jQuery(this).hasClass('counter-white-arrowed')){
jQuery(this).find('.counter-wrap.white-arrowed').remove('');
counterWrapper='<div class="counter-wrap white-arrowed"><span class="counter">' + counter + '</span></div>';
}
var attachId=jQuery(this).append(counterWrapper);
}});
summary='<span>Shares</span> <span>' + summary + '</span>';
jQuery(this).closest('a').find('.supsystic-social-sharing-total-counter.counter-wrap').html(summary);
});
}, 1000);
});
})(jQuery);