vendor: 5,019 bytes, lines 1-4
1/*! Magnific Popup - v1.1.0 - 2016-02-20 2* http://dimsemenov.com/plugins/magnific-popup/ 3* Copyright (c) 2016 Dmitry Semenov; */ 4!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b.st.autoFocusLast&&b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)}
4,updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||!(2===c.which||c.ctrlKey||c.metaKey||c.altKey||c.shiftKey)){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("<img>").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1
4));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;
4var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});
4var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()}); 5 6/* 7 * Title : gmPhantom 8 * Copyright : 2013-2016 CodEasily.com 9 * Website : http://www.codeasily.com 10 */ 11if ( typeof jQuery.fn.gmPhantom == 'undefined' ) { 12 (function( $, window, document ) { 13 $.fn.gmPhantom = function( method ) { 14 var Container = this, 15 elID = $( this ).attr( 'id' ),
16 ID = elID.replace( 'GmediaGallery_', '' ), 17 Content, 18 opt, 19 timeout, 20 21 opt_str = { 22 'thumbsNavigation': 'scroll', // Thumbnails Navigation (mouse, scroll). Default value: mouse. Set how you navigate through the thumbnails. 23 'thumbsAlign': 'center', // Thumbnails align. Default value: left. 24 'thumbsinfo': 'label', // Info Thumbnails Display (none, tooltip, label). Default value: tooltip. Display a small info text on the thumbnails, a tooltip or a label on bottom. 25 'mfp_css': '', 26 'module_dirurl': '' 27 }, 28 opt_hex = { 29 'bgColor': 'ffffff', // Background Color (color hex code). Default value: ffffff. Set gallery background color. 30 'thumbBG': 'ffffff', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border. 31 'thumbBorderColor': 'cccccc', // Thumbnail Border Color (color hex code). Default value: cccccc. Set the color of a thumbnail's border. 32 'tooltipTextColor': 'css', // Tooltip Text Color (color hex code). Default value: 000000. Set tooltip text color. 33 'tooltipBgColor': 'css', // Tooltip Background Color (color hex code). Default value: ffffff. Set tooltip background color. 34 'tooltipStrokeColor': 'css', // Tooltip Stroke Color (color hex code). Default value: 000000. Set tooltip stroke color. 35 'labelTextColor': 'ffffff', // Label-Over Text Color (color hex code). Default value: 000000. 36 'labelLinkColor': 'e7e179', 37 'label8TextColor': '0b0b0b', // Label Text Color (color hex code). Default value: 000000. 38 'label8LinkColor': '3695E7', 39 'sidebarBGColor': 'ffffff', 40 'lightboxControlsColor': 'ffffff', // Tooltip Text Color (color hex code). Default value: 000000. 41 'lightboxTitleColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000. 42 'lightboxTextColor': 'f3f3f3', // Tooltip Text Color (color hex code). Default value: 000000. 43 'lightboxBGColor': '0b0b0b' // Lightbox Window Color (color hex code). Default value: 000000. Set the color for the lightbox window. 44 }, 45 opt_int = { 46 'initRPdelay': 200, 47 'maxheight': 0, 48 'thumbCols': 0, // Number of Columns (auto, number). Default value: 0. Set the number of columns for the grid. 49 'thumbRows': 0, // Number of Lines (auto, number). Default value: 0. Set the number of lines for the grid. 50 'bgAlpha': 0, // Background Alpha (value from 0 to 100). Default value: 0. Set gallery background alpha. 51 'thumbWidth': 200, // Thumbnail Width (the size in pixels). Default value: 150. Set the width of a thumbnail. 52 'thumbHeight': 180, // Thumbnail Height (the size in pixels). Default value: 150. Set the height of a thumbnail. 53 'thumbWidthMobile': 150, 54 'thumbHeightMobile': 135, 55 'thumbsSpacing': 8, // Thumbnails Spacing (value in pixels). Default value: 10. Set the space between thumbnails. 56 'thumbsVerticalPadding': 4, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails. 57 'thumbsHorizontalPadding': 4, // Thumbnails Padding Top (value in pixels). Default value: 5. Set the top padding for the thumbnails. 58 'thumbAlpha': 90, // Thumbnail Alpha (value from 0 to 100). Default value: 85. Set the transparancy of a thumbnail. 59 'thumbAlphaHover': 100, // Thumbnail Alpha Hover (value from 0 to 100). Default value: 100. Set the transparancy of a thumbnail when hover. 60 'thumbBorderSize': 1, // Thumbnail Border Size (value in pixels). Default value: 1. Set the size of a thumbnail's border. 61 'thumbPadding': 2, // Thumbnail Padding (value in pixels). Default value: 3. Set padding value of a thumbnail. 62 'lightboxBGAlpha': 80 // Lightbox Window Alpha (value from 0 to 100). Default value: 80. Set the transparancy for the lightbox window. 63 }, 64 opt_bool = { 65 'deepLinks': true, 66 'socialShareEnabled': true, // Social Share Enabled (true, false). Default value: true. 67 'share_post_link': true, 68 'show_tags': true, 69 'show_categories': true, 70 'show_albums': true, 71 'viewsEnabled': true, 72 'likesEnabled': true, 73 'commentsEnabled': true, // Comments Enabled (true, false). Default value: true. 74 'lightbox800HideArrows': false, // Hide Arrows if window width less than 800px. 75 'thumbScale': true, // Scale effect for thumb on mouseover 76 'labelOnHover': true, // Show thumb label only on mouseover 77 'thumb2link': false // Open link instead of lightbox when item have "link" attr 78 }, 79 80 noItems = 0, 81 82 Storage = {views: [], likes: []}
82, 83 84 startGalleryID = 0, 85 startWith = 0, 86 87 scrollTop = 0, 88 scrollLeft = 0, 89 itemLoaded = 0, 90 thumbsNavigationArrowsSpeed = 200, 91 cc = 0, 92 93 methods = { 94 init: function( arguments ) {// Init Plugin. 95 opt = $.extend( true, {}, opt_str, opt_int, opt_bool, opt_hex, arguments[0] ); 96 $.each( opt, function( key, val ) { 97 if ( key in opt_bool ) { 98 opt[key] = (! (! val || val == '0' || val == 'false')); 99 } else if ( key in opt_int ) { 100 opt[key] = parseInt( val ); 101 } 102 } ); 103 opt.initialHeight = opt.maxheight; 104 opt.initialCols = opt.thumbCols; 105 opt.initialRows = opt.thumbRows; 106 opt.thumbWidthDesktop = opt.thumbWidth; 107 opt.thumbHeightDesktop = opt.thumbHeight; 108 opt.dratio = opt.thumbWidthDesktop / opt.thumbHeightDesktop; 109 opt.mratio = opt.thumbWidthMobile / opt.thumbHeightMobile; 110 111 methods.parseContent(); 112 113 var timeout; 114 $( window ).on( 'resize.gmPhantom', function() { 115 methods.initRP(); 116 clearTimeout( timeout ); 117 timeout = setTimeout( function() { 118 methods.initRP(); 119 }, 600 ); 120 } ); 121 122 setTimeout( methods.initRP, opt.initRPdelay ); 123 }, 124 parseContent: function() {// Parse Content. 125 126 $( '.gmPhantom_ThumbContainer', Container ).not( '.gmPhantom_parsed' ).each( function() { 127 var link = $( this ).attr( 'data-link' ); 128 if ( link ) { 129 if ( link.indexOf( 'youtube.com/' ) !== -1 || link.indexOf( 'vimeo.com/' ) !== -1 ) { 130 $( '.gmPhantom_Thumb', this ).attr( 'href', link ); 131 $( this ).addClass( 'mfp-iframe' ).removeAttr( 'data-link' ).removeAttr( 'data-target' ).attr( 'data-type', 'video' ); 132 } else if ( link.indexOf( '//maps.google.' ) !== -1 || (link.indexOf( 'google.' ) !== -1 && link.indexOf( '/maps/embed' ) !== -1) ) { 133 $( '.gmPhantom_Thumb', this ).attr( 'href', link ); 134 $( this ).addClass( 'mfp-iframe' ).removeAttr( 'data-link' ).removeAttr( 'data-target' ).attr( 'data-type', 'map' ); 135 } 136 } 137 $( this ).addClass( 'gmPhantom_parsed' ); 138 } ); 139 140 noItems = $( '.gmPhantom_thumbsWrapper', Container ).find( '> div' ).length; 141 methods.rpResponsive(); 142 143 if ( ! $( Container ).data( 'gmPhantom_initialized' ) ) { 144 methods.initGallery(); 145 $( Container ).data( 'gmPhantom_initialized', true ); 146 } 147 148 }, 149 initGallery: function() {// Init the Gallery 150 151 var currentScrollPosition = 0; 152 $( document ).scroll( function() { 153 currentScrollPosition = $( this ).scrollTop(); 154 } ); 155 window.onhashchange = function() { 156 methods.loadGalleryDeepLink(); 157 }; 158 159 $( 'input, textarea' ).focus( function() { 160 $( document ).scrollTop( currentScrollPosition ); 161 } ); 162 163 var browser_class = ''; 164 if ( prototypes.isIEBrowser() ) { 165 if ( prototypes.isIEBrowser() < 10 ) { 166 browser_class += ' msie msie9'; 167 } else { 168 browser_class += ' msie'; 169 } 170 } 171 if ( prototypes.isTouchDevice() ) { 172 browser_class += ' istouch'; 173 } 174 175 $( '.gmPhantom_thumbsWrapper', Container ).addClass( browser_class ); 176 if ( opt.thumbsinfo == 'tooltip' && ! prototypes.isTouchDevice() ) { 177 $( '.gmPhantom_Container', Container ).append( '<div class="gmPhantom_Tooltip"></div>' ); 178 } 179 180 methods.initSettings(); 181 182 var thumbs_wrapper = $( '.gmPhantom_thumbsWrapper', Container ); 183 thumbs_wrapper.magnificPopup( { 184 type: 'image', 185 delegate: '.gmPhantom_ThumbContainer', 186 preloader: true, 187 closeBtnInside: false, 188 fixedContentPos: 'auto', 189 fixedBgPos: true, 190 overflowY: '', 191 closeMarkup: '<div title="%title%" class="mfp-button mfp-close">×</div>', 192 tLoading: '', // remove text from preloader 193 callbacks: { 194 elementParse: function( item ) { 195 // Function will fire for each target element 196 // "item.el" is a target DOM element (if present) 197 // "item.src" is a source that you may modify 198 var data = item.el.data(); 199 item.gm = data; 200 item.image = $( '.gmPhantom_Thumb img', item.el ).attr( 'data-src' ); 201 item.src = $( '.gmPhantom_Thumb', item.el ).attr( 'href' ); 202 item.title = $( '.gmPhantom_title', item.el ).html(); 203 204 item.gm.viewed = prototypes.arrVal( Storage.views, parseInt( item.gm.id ) ); 205 item.gm.liked = prototypes.arrVal( Storage.likes, parseInt( item.gm.id ) ); 206 207 }, 208 markupParse: function( template, values, item ) { 209 values.title = item.title; 210 values.description = $( '.gmPhantom_Details', item.el ).html(); 211 }, 212 213 imageLoadComplete: function() { 214 var self = this; 215 setTimeout( function() { 216 self.wrap.addClass( 'mfp-image-loaded' ); 217 }, 16 ); 218 }, 219 open: function() { 220 $.magnificPopup.instance.next = function() { 221 if ( $.magnificPopup.instance.index < $.magnificPopup.instance.items.length - 1 ) { 222 $.magnificPopup.proto.next.call( this, arguments ); 223 } 224 }; 225 $.magnificPopup.instance.prev = function() { 226 if ( $.magnificPopup.instance.index > 0 ) { 227 $.magnificPopup.proto.prev.call( this, arguments ); 228 } 229 }; 230 $.magnificPopup.instance.toggleArrows = function() { 231 if ( $.magnificPopup.instance.index < $.magnificPopup.instance.items.length - 1 ) { 232 $( '.mfp-arrow-right' ).show(); 233 } 234 if ( $.magnificPopup.instance.index == $.magnificPopup.instance.items.length - 1 ) { 235 $( '.mfp-arrow-right' ).hide(); 236 } 237 238 if ( $.magnificPopup.instance.index > 0 ) { 239 $( '.mfp-arrow-left' ).show(); 240 } 241 if ( $.magnificPopup.instance.index == 0 ) { 242 $( '.mfp-arrow-left' ).hide(); 243 } 244 }; 245 $.magnificPopup.instance.updateItemHTML = function() { 246 $.magnificPopup.instance.toggleArrows(); 247 $.magnificPopup.proto.updateItemHTML.call( this, arguments ); 248 }; 249 var orig_checkIfClose = $.magnificPopup.instance._checkIfClose; 250 $.magnificPopup.instance._checkIfClose = function( target ) { 251 if ( $( target ).closest( '.mfp-prevent-close' ).length ) { 252 return; 253 } 254 return orig_checkIfClose( target ); 255 }; 256 257 $( document.body ).addClass( 'mfp-gmedia-open gmedia-phantom' );
258 itemLoaded = this.currItem.gm.id; 259 if ( opt.commentsEnabled ) { 260 this.wrap.on( 'click.gmCloseComments', '.mfp-img--comments-div', function() { 261 $( '#mfp_comments_' + ID, this.wrap ).trigger( 'click' ); 262 return false; 263 } ); 264 this.wrap.on( 'click', '.mfp-close-comments', function() { 265 $( '#mfp_comments_' + ID, this.wrap ).trigger( 'click' ); 266 return false; 267 } ); 268 } 269 if ( opt.socialShareEnabled ) { 270 var mfp = this; 271 $( mfp.wrap ).on( 'click', '.mfp-share_sharelizer', function() { 272 var sharelink, 273 title = mfp.currItem.title, 274 imgsrc = mfp.currItem.image, 275 _url = ('' + window.location.href).split( '#' ), 276 url = _url[0]; 277 if ( opt.share_post_link ) { 278 url = mfp.currItem.gm['post_link']; 279 } else { 280 var separator = (url.indexOf( '?' ) === -1) ? '?' : '&', 281 newParam = separator + 'gmedia_share=' + mfp.currItem.gm['id']; 282 url = url.replace( newParam, '' ); 283 url += newParam; 284 var hash = '#!gallery-' + ID + '-' + mfp.currItem.gm['id']; 285 url += hash; 286 } 287 if ( $( this ).hasClass( 'mfp-share_twitter' ) ) { 288 sharelink = 'https://twitter.com/home?status=' + encodeURIComponent( title + ' ' + url ); 289 window.open( sharelink, '_blank' ); 290 } 291 if ( $( this ).hasClass( 'mfp-share_facebook' ) ) { 292 sharelink = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent( url ); 293 window.open( sharelink, '_blank' ); 294 } 295 if ( $( this ).hasClass( 'mfp-share_pinterest' ) ) { 296 sharelink = 'https://pinterest.com/pin/create/button/?url=' + encodeURIComponent( url ) + '&media=' + encodeURIComponent( imgsrc ) + '&description=' + encodeURIComponent( title ); 297 window.open( sharelink, '_blank' ); 298 } 299 if ( $( this ).hasClass( 'mfp-share_stumbleupon' ) ) { 300 sharelink = 'http://www.stumbleupon.com/submit?url=' + encodeURIComponent( url ) + '&title=' + encodeURIComponent( title ); 301 window.open( sharelink, '_blank' ); 302 } 303 } ); 304 } 305 $.magnificPopup.instance.toggleArrows(); 306 }, 307 close: function() { 308 $( document.body ).removeClass( 'mfp-gmedia-open gmedia-phantom' ); 309 if ( 'image' != this.currItem.gm.type ) { 310 $( document.body ).removeClass( 'mfp-zoom-out-cur' ); 311 this.wrap.removeClass( 'mfp-iframe-loaded' ); 312 } 313 this.wrap.removeClass( 'mfp-image-loaded' ); 314 315 if ( opt.commentsEnabled ) { 316 this.wrap.off( 'click.gmCloseComments' ); 317 } 318 if ( opt.deepLinks ) { 319 var hash = '#!', 320 url = ('' + window.location).split( '#' )[0] + hash; 321 if ( !! (window.history && window.history.replaceState) ) { 322 window.history.replaceState( {}, document.title, url ); 323 } else { 324 location.replace( url ); 325 } 326 } 327 //this.contentContainer.attr('data-gmtype', this.currItem.gm.type).attr('data-ext', this.currItem.gm.ext); 328 $( '#wpadminbar' ).css( {'z-index': ''} ); 329 $( window ).scrollTop( scrollTop ); 330 itemLoaded = this.currItem.gm.id; 331 }, 332 beforeOpen: function() { 333 $( '#wpadminbar' ).css( {'z-index': 1000} ); 334 $( this.wrap ).attr( 'id', 'mfp_gm_' + ID ); 335 $( this.bgOverlay ).attr( 'id', 'mfp_gm_' + ID + '_bg' ); 336 if ( opt.lightbox800HideArrows ) { 337 this.wrap.addClass( 'mfp800-hide-arrows' ); 338 } 339 if ( opt.mfp_css && ! $( '#mfp_css_' + ID, this.wrap ).length ) { 340 this.wrap.append( '<style id="mfp_css_' + ID + '">' + opt.mfp_css + '</style>' ); 341 } 342 scrollTop = $( window ).scrollTop(); 343 }, 344 change: function() { 345 if ( opt.deepLinks ) { 346 var hash = '#!gallery-' + ID + '-' + this.currItem.gm.id, 347 url = ('' + window.location).split( '#' )[0] + hash; 348 if ( !! (window.history && window.history.replaceState) ) { 349 window.history.replaceState( {}, document.title, url ); 350 } else { 351 location.replace( url ); 352 } 353 } 354 this.contentContainer.attr( 'data-gmtype', this.currItem.gm.type ).attr( 'data-ext', this.currItem.gm.ext ); 355 if ( opt.commentsEnabled ) { 356 this.wrap.removeClass( 'mfp-comments-open mfp-comments-loaded' ); 357 $( '.mfp-comments-wrapper', this.contentContainer ).css( {height: ''} ).empty(); 358 } 359 if ( opt.likesEnabled ) { 360 this.wrap.removeClass( 'phantom-gmedia-liked' ); 361 } 362 clearTimeout( timeout ); 363 if ( 'image' != this.currItem.gm.type ) { 364 $( document.body ).addClass( 'mfp-zoom-out-cur' ); 365 var self = this; 366 setTimeout( function() { 367 self.wrap.addClass( 'mfp-iframe-loaded' ); 368 }, 16 ); 369 } 370 }, 371 afterChange: function() { 372 if ( opt.socialShareEnabled ) { 373 methods.initSocialShare( this.currItem, this ); 374 } 375 376 if ( opt.commentsEnabled ) { 377 methods.initComments( this.currItem, this ); 378 } 379 380 if ( opt.viewsEnabled || opt.likesEnabled ) { 381 var self = this; 382 timeout = setTimeout( function() { 383 methods.viewLike( self.currItem ); 384 }, 1000 ); 385 386 if ( opt.viewsEnabled ) { 387 methods.initViews( this.currItem, this ); 388 } 389 if ( opt.likesEnabled ) { 390 methods.initLikes( this.currItem, this ); 391 if ( this.currItem.gm.liked ) { 392 this.wrap.addClass( 'phantom-gmedia-liked' ); 393 } else { 394 this.wrap.removeClass( 'phantom-gmedia-liked' ); 395 } 396 } 397 }
398 itemLoaded = this.currItem.gm.id; 399 }, 400 updateStatus: function( data ) { 401 //console.log(data); 402 if ( data.status == 'loading' ) { 403 this.wrap.removeClass( 'mfp-image-loaded mfp-iframe-loaded' ); 404 } 405 } 406 }, 407 image: { 408 markup: '' + 409 '<div class="mfp-figure">' + 410 ' <div class="mfp-close"></div>' + 411 ' <figure>' + 412 ' <div class="mfp-img"></div>' + 413 ' <figcaption>' + 414 ' <div class="mfp-bottom-bar">' + 415 ' <div class="mfp-description gmPhantom_Details"></div>' + 416 ' <div class="mfp-counter"></div>' + 417 ' </div>' + 418 ' </figcaption>' + 419 ' </figure>' + 420 '</div>' + 421 '<div class="mfp-comments-container">' + 422 ' <div class="mfp-comments-content mfp-prevent-close"><div class="mfp-close-comments">×</div><div class="mfp-comments-wrapper"></div></div>' + 423 '</div>' + 424 '<div class="mfp-prevent-close mfp-buttons-bar mfp-gmedia-stuff10"></div>' 425 }, 426 iframe: { 427 markup: '' + 428 '<div class="mfp-iframe-wrapper">' + 429 ' <div class="mfp-close"></div>' + 430 ' <div class="mfp-iframe-scaler">' + 431 ' <iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowtransparency="true" allowfullscreen></iframe>' + 432 ' </div>' + 433 ' <div class="mfp-bottom-bar gm-iframe-bottom-bar">' + 434 ' <div class="mfp-description gmPhantom_Details"></div>' + 435 ' <div class="mfp-counter"></div>' + 436 ' </div>' + 437 '</div>' + 438 '<div class="mfp-comments-container">' + 439 ' <div class="mfp-comments-content"><div class="mfp-close-comments">×</div><div class="mfp-comments-wrapper"></div></div>' + 440 '</div>' + 441 '<div class="mfp-prevent-close mfp-buttons-bar mfp-gmedia-stuff10"></div>' 442 }, 443 gallery: { 444 enabled: true, 445 arrowMarkup: '<div title="%title%" class="mfp-button mfp-arrow mfp-arrow-%dir%"></div>', 446 tCounter: '%curr% / %total%' 447 }, 448 449 mainClass: 'mfp-zoom-in', 450 removalDelay: 500 //delay removal by X to allow out-animation 451 452 } ); 453 454 methods.loadGalleryDeepLink(); 455 456 $( Container ).on( 'click', '.gmPhantom_pager', function( e ) { 457 e.preventDefault(); 458 $( this ).parent().addClass( 'gmPhantom_ThumbLoader' ); 459 $.get( $( this ).attr( 'href' ), function( data ) { 460 var temp = $( '<div style="visibility:hidden;position:absolute;pointer-events:none;"></div>' ).appendTo( Container ); 461 temp.append( $( '#' + elID, data ).html() ); 462 $( '.gmPhantom_LoadMore', Container ).replaceWith( temp.find( '.gmPhantom_thumbsWrapper' ).html() ); 463 methods.initThumbs(); 464 temp.remove(); 465 } ); 466 return false; 467 } ); 468 469 }, 470 loadGalleryDeepLink: function() { 471 var prefix = '#!gallery-'; 472 var h = location.hash; 473 if ( h.indexOf( prefix ) === 0 ) { 474 h = h.substr( prefix.length ).split( '-' ); 475 if ( h[0] && h[0] == ID ) { 476 $( document ).scrollTop( $( Container ).offset().top ); 477 if ( h[1] ) { 478 startWith = $( '.gmPhantom_ThumbContainer[data-id="' + h[1] + '"]', Container ).index(); 479 } else { 480 startWith = 0; 481 } 482 if ( -1 !== startWith ) { 483 $( '.gmPhantom_thumbsWrapper', Container ).magnificPopup( 'open', startWith ); 484 } 485 } 486 } 487 }, 488 initSocialShare: function( item, mfp ) { 489 var share_buttons = '' + 490 '<div class="mfp-prevent-close mfp-button mfp-share mfp-gmedia-stuff08" id="mfp_share_' + ID + '">' + 491 ' <a title="Share">' + 492 ' <span class="mfp-prevent-click">' + 493 ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-share2" viewBox="0 0 32 32"><path class="path1" d="M27 22c-1.411 0-2.685 0.586-3.594 1.526l-13.469-6.734c0.041-0.258 0.063-0.522 0.063-0.791s-0.022-0.534-0.063-0.791l13.469-6.734c0.909 0.94 2.183 1.526 3.594 1.526 2.761 0 5-2.239 5-5s-2.239-5-5-5-5 2.239-5 5c0 0.269 0.022 0.534 0.063 0.791l-13.469 6.734c-0.909-0.94-2.183-1.526-3.594-1.526-2.761 0-5 2.239-5 5s2.239 5 5 5c1.411 0 2.685-0.586 3.594-1.526l13.469 6.734c-0.041 0.258-0.063 0.522-0.063 0.791 0 2.761 2.239 5 5 5s5-2.239 5-5c0-2.761-2.239-5-5-5z"></path></symbol></svg>
493' + 494 ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-share2"/></svg>' + 495 ' </span>' + 496 ' </a>' + 497 ' <ul class="mfp-prevent-close mfp-share_sharelizers">' + 498 ' <li><a class="mfp-share_facebook mfp-share_sharelizer">Facebook</a></li>' + 499 ' <li><a class="mfp-share_twitter mfp-share_sharelizer">Twitter</a></li>' + 500 ' <li><a class="mfp-share_pinterest mfp-share_sharelizer">Pinterest</a></li>' + 501 ' <li><a class="mfp-share_stumbleupon mfp-share_sharelizer">StumbleUpon</a></li>' + 502 ' </ul>' + 503 '</div>'; 504 505 var mfp_share = $( share_buttons ); 506 mfp_share.on( 'click', function() { 507 $( this ).toggleClass( 'mfp-share_open' ); 508 } ); 509 510 var share_div = mfp.wrap.find( '#mfp_share_' + ID ); 511 if ( ! share_div.length ) { 512 $( '.mfp-buttons-bar', mfp.wrap ).append( mfp_share ); 513 } else { 514 $( share_div ).replaceWith( mfp_share ); 515 } 516 }, 517 initComments: function( item, mfp ) { 518 var comments_button = '' + 519 '<div class="mfp-prevent-close mfp-button mfp-comments" id="mfp_comments_' + ID + '">' + 520 ' <a title="Comments"><span class="mfp-prevent-close mfp-comments-count">' + item.gm['cc'] + '</span>' + 521 ' <span class="mfp-prevent-click mfp_comments_icon">' + 522 ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-bubbles2" viewBox="0 0 36 32"><path class="path1" d="M15 0v0c8.284 0 15 5.435 15 12.139s-6.716 12.139-15 12.139c-0.796 0-1.576-0.051-2.339-0.147-3.222 3.209-6.943 3.785-10.661 3.869v-0.785c2.008-0.98 3.625-2.765 3.625-4.804 0-0.285-0.022-0.564-0.063-0.837-3.392-2.225-5.562-5.625-5.562-9.434 0-6.704 6.716-12.139 15-12.139zM31.125 27.209c0 1.748 1.135 3.278 2.875 4.118v0.673c-3.223-0.072-6.181-0.566-8.973-3.316-0.661 0.083-1.337 0.126-2.027 0.126-2.983 0-5.732-0.805-7.925-2.157 4.521-0.016 8.789-1.464 12.026-4.084 1.631-1.32 2.919-2.87 3.825-4.605 0.961-1.84 1.449-3.799 1.449-5.825 0-0.326-0.014-0.651-0.039-0.974 2.268 1.873 3.664 4.426 3.664 7.24 0 3.265-1.88 6.179-4.82 8.086-0.036 0.234-0.055 0.474-0.055 0.718z"></path></symbol></svg>' + 523 ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-bubbles2"/></svg>' + 524 ' </span>' + 525 ' </a>' + 526 '</div>'; 527 var mfp_comments = $( comments_button ); 528 mfp_comments.on( 'click', function() { 529 var comments_wrapper = $( '.mfp-comments-wrapper', mfp.contentContainer ); 530 if ( mfp.wrap.hasClass( 'mfp-comments-open' ) ) { 531 $( this ).removeClass( 'mfp-button-active' ); 532 comments_wrapper.css( {height: ''} ); 533 $( 'figure > img', mfp.wrap ).removeClass( 'mfp-img--comments-div' ).addClass( 'mfp-img' ); 534 mfp.wrap.removeClass( 'mfp-comments-open' ); 535 if ( $( window ).width() <= 800 ) { 536 $( '.mfp-wrap' ).animate( {scrollTop: 0}, 200 ); 537 $( 'body' ).delay( 200 ).animate( {scrollTop: $( '#mfp_gm_' + ID ).offset().top}, 400 ); 538 } else { 539 $( window ).scrollTop( $( '#mfp_gm_' + ID ).offset().top ); 540 } 541 } else { 542 $( this ).addClass( 'mfp-button-active' ); 543 var scrlbar = methods.scrollbarWidth(); 544 comments_wrapper.css( {height: $( 'iframe', comments_wrapper ).height()} ).parent().css( {'width': 'calc(100% + ' + scrlbar + 'px)', 'min-width': 320 + scrlbar + 'px'} ); 545 $( 'figure > img', mfp.wrap ).removeClass( 'mfp-img' ).addClass( 'mfp-img--comments-div' ); 546 mfp.wrap.addClass( 'mfp-comments-open' ); 547 if ( ! mfp.wrap.hasClass( 'mfp-comments-loaded' ) ) { 548 methods.loadComments( item, mfp ); 549 } 550 if ( $( window ).width() <= 800 ) { 551 $( '.mfp-wrap' ).animate( {scrollTop: ($( '.mfp-comments-container', '#mfp_gm_' + ID ).offset().top + $( '.mfp-wrap' ).scrollTop() - 150)}, 200 ); 552 $( 'body' ).delay( 200 ).animate( {scrollTop: ($( '.mfp-comments-container', '#mfp_gm_' + ID ).offset().top - 150)}, 400 ); 553 } 554 } 555 } ); 556 557 var comments_div = $( mfp.wrap ).find( '#mfp_comments_' + ID ); 558 if ( ! comments_div.length ) { 559 $( '.mfp-buttons-bar', mfp.wrap ).append( mfp_comments ); 560 } else { 561 $( comments_div ).replaceWith( mfp_comments ); 562 } 563 564 }, 565 loadComments: function( item, mfp ) { 566 var comments_content = $( '.mfp-comments-content', mfp.contentContainer ), 567 comments_wrapper = $( '.mfp-comments-wrapper', comments_content ); 568 comments_wrapper.empty(); 569 mfp.wrap.removeClass( 'mfp-comments-loaded' ).addClass( 'mfp-comments-loading' ); 570 if ( GmediaGallery ) { 571 opt.ajax_actions['comments']['data']['post_id'] = item.gm['post_id']; 572 $.ajax( { 573 type: 'post', 574 dataType: 'json', 575 url: GmediaGallery.ajaxurl, 576 data: {action: opt.ajax_actions['comments']['action'], _ajax_nonce: GmediaGallery.nonce, data: opt.ajax_actions['comments']['data']} 577 } ).done( function( data ) { 578 if ( data.comments_count ) { 579 mfp.wrap.find( '.mfp-comments-count' ).html( data.comments_count ); 580 item.gm['cc'] = data.comments_count; 581 } 582 if ( data.content ) { 583 $( '.mfp-comments-wrapper', comments_content ).html( data.content ).find( 'iframe' ).on( 'load', function() { 584 mfp.wrap.removeClass( 'mfp-comments-loading' ).addClass( 'mfp-comments-loaded' ); 585 var body = this.contentWindow.document.body, html = this.contentWindow.document.documentElement; 586 var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 587 $( this ).css( {height: 20 + height, overflowY: 'hidden'} ).parent().css( {height: 20 + height} ); 588 this.contentWindow.onbeforeunload = function() { 589 mfp.wrap.removeClass( 'mfp-comments-loaded' ).addClass( 'mfp-comments-loading' ); 590 }; 591 } ); 592 } 593 } ).fail( function() { 594 mfp.wrap.removeClass( 'mfp-comments-loading' ); 595 } ); 596 } 597 }, 598 initLikes: function( item, mfp ) { 599 if ( mfp.currItem.liked ) { 600 mfp.wrap.addClass( 'phantom-gmedia-liked' ); 601 } 602 603 var likes = '' + 604 '<div class="mfp-prevent-close mfp-button mfp-likes" id="mfp_likes_' + ID + '">' + 605 ' <a><span class="mfp-likes-count">' + item.gm['likes'] + '</span>' +
606 ' <span class="mfp-prevent-click mfp_likes_icon">' + 607 ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-heart" viewBox="0 0 32 32"><path class="path1" d="M23.6 2c-3.363 0-6.258 2.736-7.599 5.594-1.342-2.858-4.237-5.594-7.601-5.594-4.637 0-8.4 3.764-8.4 8.401 0 9.433 9.516 11.906 16.001 21.232 6.13-9.268 15.999-12.1 15.999-21.232 0-4.637-3.763-8.401-8.4-8.401z"></path></symbol></svg>' + 608 ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-heart"/></svg>' + 609 ' </span>' + 610 ' </a>' + 611 '</div>'; 612 var likes_obj = $( likes ); 613 likes_obj.on( 'click', function() { 614 methods.viewLike( mfp.currItem, true ); 615 mfp.wrap.addClass( 'phantom-gmedia-liked' ); 616 $( '.mfp-likes-count', mfp.wrap ).text( item.gm['likes'] ); 617 } ); 618 619 var likes_div = $( mfp.wrap ).find( '#mfp_likes_' + ID ); 620 if ( ! likes_div.length ) { 621 $( '.mfp-buttons-bar', mfp.wrap ).append( likes_obj ); 622 } else { 623 $( likes_div ).replaceWith( likes_obj ); 624 } 625 626 }, 627 initViews: function( item, mfp ) { 628 var views = '' + 629 '<div class="mfp-prevent-close mfp-button mfp-views" id="mfp_views_' + ID + '">' + 630 ' <span class="mfp-prevent-close mfp-prevent-click"><span class="mfp-prevent-close mfp-views-count">' + item.gm['views'] + '</span>' + 631 ' <span class="mfp-prevent-close mfp-prevent-click mfp_views_icon">' + 632 ' <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="icon-eye" viewBox="0 0 1024 1024"><path class="path1" d="M512 192c-223.318 0-416.882 130.042-512 320 95.118 189.958 288.682 320 512 320 223.312 0 416.876-130.042 512-320-95.116-189.958-288.688-320-512-320zM764.45 361.704c60.162 38.374 111.142 89.774 149.434 150.296-38.292 60.522-89.274 111.922-149.436 150.296-75.594 48.218-162.89 73.704-252.448 73.704-89.56 0-176.858-25.486-252.452-73.704-60.158-38.372-111.138-89.772-149.432-150.296 38.292-60.524 89.274-111.924 149.434-150.296 3.918-2.5 7.876-4.922 11.86-7.3-9.96 27.328-15.41 56.822-15.41 87.596 0 141.382 114.616 256 256 256 141.382 0 256-114.618 256-256 0-30.774-5.452-60.268-15.408-87.598 3.978 2.378 7.938 4.802 11.858 7.302v0zM512 416c0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96 96 42.982 96 96z"></path></symbol></svg>' + 633 ' <svg class="gmPhantom_svgicon"><use xlink:href="#icon-eye"/></svg>' + 634 ' </span></span>' + 635 '</div>'; 636 637 var views_div = $( mfp.wrap ).find( '#mfp_views_' + ID ); 638 if ( ! views_div.length ) { 639 $( '.mfp-buttons-bar', mfp.wrap ).append( views ); 640 } else { 641 $( views_div ).replaceWith( views ); 642 } 643 644 }, 645 viewLike: function( item, like ) { 646 var id = parseInt( item.gm.id ); 647 if ( ! item.gm.viewed ) { 648 item.gm.viewed = true; 649 item.gm['views'] += 1; 650 Storage.views.push( id ); 651 sessionStorage.setItem( 'GmediaGallery', JSON.stringify( Storage ) ); 652 if ( GmediaGallery.ajaxurl ) { 653 $.ajax( { 654 type: 'post', 655 dataType: 'json', 656 url: GmediaGallery.ajaxurl, 657 data: {action: 'gmedia_module_interaction', hit: id} 658 } ).done( function( r ) { 659 if ( r.views ) { 660 item.gm.views = r.views; 661 $( '.mfp-views-count', item.el ).text( item.gm['views'] ); 662 } 663 } ); 664 } 665 } 666 if ( like && ! item.gm.liked ) { 667 item.gm.liked = true; 668 item.gm.likes += 1; 669 Storage.likes.push( id ); 670 sessionStorage.setItem( 'GmediaGallery', JSON.stringify( Storage ) ); 671 $( '.mfp-likes-count', item.el ).text( item.gm['likes'] ); 672 if ( GmediaGallery.ajaxurl ) { 673 $.ajax( { 674 type: 'post', 675 dataType: 'json', 676 url: GmediaGallery.ajaxurl, 677 data: {action: 'gmedia_module_interaction', hit: id, vote: 1} 678 } ).done( function( r ) { 679 if ( r.likes ) { 680 item.gm.likes = r.likes; 681 $( '.mfp-likes-count', item.el ).text( item.gm['likes'] ); 682 } 683 } ); 684 } 685 } 686 }, 687 initSettings: function() {// Init Settings 688 if ( window.sessionStorage ) { 689 var sesion_storage = sessionStorage.getItem( 'GmediaGallery' ); 690 if ( sesion_storage ) { 691 $.extend( true, Storage, JSON.parse( sesion_storage ) ); 692 } 693 } 694 methods.initContainer(); 695 methods.initThumbs(); 696 if ( opt.thumbsinfo == 'tooltip' && ! prototypes.isTouchDevice() ) { 697 methods.initTooltip(); 698 } 699 700 }, 701 initRP: function() {// Init Resize & Positioning 702 if ( ! $( Container ).is( ':visible' ) ) { 703 setTimeout( function() { 704 methods.initRP(); 705 }, 1200 ); 706 } else { 707 methods.rpResponsive(); 708 var rrr = opt.width; 709 if ( ! rrr && 50 > cc ) { 710 cc++; 711 clearTimeout( timeout ); 712 timeout = setTimeout( function() { 713 methods.initRP(); 714 }, 100 ); 715 } else { 716 cc = 0; 717 methods.rpThumbs(); 718 719 $( '.gmPhantom_Container', Container ).css( {'opacity': ''} ); 720 } 721 } 722 }, 723 rpResponsive: function() { 724 var hiddenBustedItems; 725 setTimeout( function() { 726 hiddenBustedItems = prototypes.doHideBuster( $( Container ) ); 727 }, 0 ); 728 729 if ( $( window ).width() <= 640 ) { 730 $( '.gmPhantom_Container', Container ).addClass( 'gmPhantom_MobileView' ); 731 opt.thumbWidth = opt.thumbWidthMobile; 732 opt.thumbHeight = opt.thumbHeightMobile; 733 opt.ratio = opt.mratio; 734 } else { 735 $( '.gmPhantom_Container', Container ).removeClass( 'gmPhantom_MobileView' ); 736 opt.thumbWidth = opt.thumbWidthDesktop; 737 opt.thumbHeight = opt.thumbHeightDesktop; 738 opt.ratio = opt.dratio; 739 } 740 741 setTimeout( function() { 742 opt.width = $( Container ).width(); 743 }, 0 ); 744 setTimeout( function() { 745 prototypes.undoHideBuster( hiddenBustedItems ); 746 }, 0 ); 747 748 }, 749
750 initContainer: function() {// Init Container 751 $( Container ).css( {'text-align': opt.thumbsAlign} ); 752 753 $( '.gmPhantom_Container', Container ).css( { 754 'padding-top': opt.thumbsVerticalPadding, 755 'padding-bottom': opt.thumbsVerticalPadding, 756 'padding-left': opt.thumbsHorizontalPadding, 757 'padding-right': opt.thumbsHorizontalPadding 758 } ); 759 methods.rpContainer(); 760 }, 761 rpContainer: function() {// Resize & Position Container 762 if ( opt.maxheight !== 0 ) { 763 $( Container ).css( {maxHeight: opt.maxheight} ); 764 $( '.gmPhantom_Container', Container ).css( {maxWidth: 'none'} ); 765 } 766 if ( opt.thumbsSpacing ) { 767 $( '.gmPhantom_thumbsWrapper', Container ).css( {marginTop: -opt.thumbsSpacing, marginLeft: -opt.thumbsSpacing} ); 768 } 769 }, 770 771 initThumbs: function() {//Init Thumbnails 772 var thumb_container = $( '.gmPhantom_ThumbContainer', Container ); 773 if ( opt.thumbsinfo == 'tooltip' ) { 774 if ( ! prototypes.isTouchDevice() ) { 775 thumb_container.hover( function() { 776 methods.showTooltip( $( this ) ); 777 }, 778 function() { 779 $( '.gmPhantom_Tooltip', Container ).css( 'display', 'none' ); 780 } ); 781 } else { 782 $( '.gmPhantom_thumbsWrapper', Container ).removeClass( 'gmPhantom_LabelTolltip' ).addClass( 'gmPhantom_LabelInside' ); 783 } 784 } 785 786 thumb_container.click( function( e ) { 787 var link = $( this ).data( 'link' ), 788 target = $( this ).data( 'target' ); 789 if ( link && opt.thumb2link ) { 790 e.stopPropagation(); 791 prototypes.openLink( link, target ); 792 return false; 793 } 794 } ); 795 setTimeout( function() { 796 $( '.gmPhantom_Thumb', thumb_container ).off( 'click' ).on( 'click', function( e ) { 797 e.stopPropagation(); 798 e.preventDefault(); 799 $( this ).parent().trigger( 'click' ); 800 return false; 801 } ); 802 }, 1 ); 803 $( '.gmPhantom_ThumbLabel a', thumb_container ).on( 'click', function( e ) { 804 e.stopPropagation(); 805 } ); 806 807 $( '.gmPhantom_ThumbLoader .gmPhantom_Thumb img', Container ).css( {opacity: 0} ); 808 setTimeout( function() { 809 $( '.gmPhantom_ThumbLoader .gmPhantom_Thumb img', Container ).on( 'load', function() { 810 var image = $( this ); 811 image.closest( '.gmPhantom_ThumbContainer' ).removeClass( 'gmPhantom_ThumbLoader' ); 812 if ( prototypes.isIEBrowser() ) { 813 image.parent().css( 'background-image', 'url("' + image.attr( 'src' ) + '")' ); 814 } else { 815 image.animate( {opacity: opt.thumbAlpha / 100}, 600, function() { 816 $( this ).css( {opacity: ''} ); 817 } ); 818 } 819 } ).on( 'error', function() {} ).each( function() { 820 if ( this.complete ) { 821 $( this ).load(); 822 } else if ( this.error ) { 823 $( this ).error(); 824 } 825 } ); 826 }, 0 ); 827 828 if ( opt.maxheight !== 0 ) { 829 if ( prototypes.isTouchDevice() ) { 830 prototypes.touchNavigation( $( Container ), $( '.gmPhantom_thumbsWrapper', Container ) ); 831 } else if ( opt.thumbsNavigation == 'mouse' ) { 832 methods.moveThumbs(); 833 } else if ( opt.thumbsNavigation == 'scroll' ) { 834 methods.initThumbsScroll(); 835 } 836 } 837 838 methods.rpThumbs(); 839 }, 840 rpThumbs: function() {// Resize & Position Thumbnails 841 var thumbW = opt.thumbWidth + opt.thumbBorderSize * 2 + opt.thumbPadding * 2, 842 no = 0, 843 col = 0, 844 row = 1, 845 hiddenBustedItems = prototypes.doHideBuster( $( Container ) ); 846 opt.thumbCols = opt.initialCols; 847 opt.thumbRows = opt.initialRows; 848 if ( opt.initialHeight === 0 || (opt.thumbCols === 0 && opt.thumbRows === 0) ) { 849 opt.thumbCols = parseInt( (opt.width + opt.thumbsSpacing - opt.thumbsHorizontalPadding * 2) / (thumbW + opt.thumbsSpacing) ); 850 opt.thumbRows = parseInt( noItems / opt.thumbCols ); 851 852 if ( opt.thumbCols === 0 ) { 853 opt.thumbCols = 1; 854 } 855 856 if ( opt.thumbRows * opt.thumbCols < noItems ) { 857 opt.thumbRows++; 858 } 859 } else { 860 if ( (opt.thumbRows * opt.thumbCols < noItems) && opt.thumbCols !== 0 ) { 861 if ( noItems % opt.thumbCols === 0 ) { 862 opt.thumbRows = noItems / opt.thumbCols; 863 } else { 864 opt.thumbRows = parseInt( noItems / opt.thumbCols ) + 1; 865 } 866 } else { 867 if ( noItems % opt.thumbRows === 0 ) { 868 opt.thumbCols = noItems / opt.thumbRows; 869 } else { 870 opt.thumbCols = parseInt( noItems / opt.thumbRows ) + 1; 871 } 872 } 873 } 874 875 $( '.gmPhantom_thumbsWrapper > div', Container ).each( function() { 876 no++; 877 col++; 878 879 $( this ).attr( 'data-col', col ).attr( 'data-row', row ).css( {'margin': ''} ); 880 if ( no % opt.thumbCols === 0 ) { 881 col = 0; 882 row++; 883 } 884 885 var img = $( '.gmPhantom_Thumb > img', this ); 886 var thumb_ratio = $( this ).data( 'ratio' ); 887 if ( opt.ratio <= thumb_ratio ) { 888 img.removeClass( 'portrait' ).addClass( 'landscape' ); 889 } else { 890 img.removeClass( 'landscape' ).addClass( 'portrait' ); 891 if ( 1 != thumb_ratio ) { 892 img.css( 'margin', Math.floor( (opt.thumbWidth / thumb_ratio - opt.thumbHeight) / opt.thumbHeight * 10 ) + '% 0 0 0' ); 893 } 894 } 895 896 } ); 897 var thumbs_el = $( '.gmPhantom_thumbsWrapper', Container ),
898 thumbs_el_width = thumbW * opt.thumbCols + (opt.thumbCols - 1) * opt.thumbsSpacing, 899 scrollbar_width = 0; 900 thumbs_el.width( thumbs_el_width + opt.thumbsSpacing ); 901 $( '.gmPhantom_Container', Container ).width( thumbs_el_width ); 902 if ( thumbs_el_width >= $( Container ).width() ) { 903 scrollbar_width = methods.scrollbarWidth(); 904 } 905 906 if ( opt.initialHeight !== 0 ) { 907 //var thumbH = opt.thumbHeight + opt.thumbBorderSize * 2 + opt.thumbPadding * 2, 908 // thumbs_el_height = thumbH * opt.thumbRows + opt.thumbRows * opt.thumbsSpacing; 909 //$('.gmPhantom_thumbsWrapper', Container).height(thumbs_el_height + scrollbar_width); 910 $( '.gmPhantom_Container', Container ).height( thumbs_el.height() - opt.thumbsSpacing ); 911 912 if ( ! prototypes.isTouchDevice() ) { 913 if ( opt.thumbsNavigation == 'scroll' && typeof (jQuery.fn.jScrollPane) != 'undefined' ) { 914 $( '.jspContainer', Container ).width( $( '.gmPhantom_Container', Container ).width() ); 915 } 916 } 917 } 918 919 prototypes.undoHideBuster( hiddenBustedItems ); 920 }, 921 moveThumbs: function() {// Init thumbnails move 922 var thumbs_el = $( '.gmPhantom_thumbsWrapper', Container ); 923 $( '.gmPhantom_Container', Container ).mousemove( function( e ) { 924 if ( itemLoaded ) { 925 return; 926 } 927 928 var w1 = $( this ).width(), 929 w2 = thumbs_el.outerWidth() - opt.thumbsSpacing, 930 h1 = $( this ).height(), 931 h2 = thumbs_el.outerHeight() - opt.thumbsSpacing, 932 wdiff = w2 - w1, 933 hdiff = h2 - h1, 934 mpw, mph, 935 tx, ty; 936 if ( wdiff < 0 ) { 937 tx = 0; 938 } else { 939 mpw = e.clientX - 0.1 * w1 - $( this ).offset().left + parseInt( $( this ).css( 'margin-left' ) ) + $( document ).scrollLeft(); 940 mpw = mpw / (w1 - w1 * 0.2); 941 if ( mpw < 0 ) { 942 mpw = 0; 943 } else if ( mpw > 1 ) { 944 mpw = 1; 945 } 946 tx = wdiff * mpw; 947 } 948 if ( hdiff < 0 ) { 949 ty = 0; 950 } else { 951 mph = e.clientY - 0.1 * h1 - $( this ).offset().top + parseInt( $( this ).css( 'margin-top' ) ) + $( document ).scrollTop(); 952 mph = mph / (h1 - h1 * 0.2); 953 if ( mph < 0 ) { 954 mph = 0; 955 } else if ( mph > 1 ) { 956 mph = 1; 957 } 958 ty = hdiff * mph; 959 } 960 961 thumbs_el.css( 'transform', 'translate(-' + tx + 'px, -' + ty + 'px)' ); 962 963 } ); 964 }, 965 initThumbsScroll: function() {//Init Thumbnails Scroll 966 if ( typeof (jQuery.fn.jScrollPane) == 'undefined' ) { 967 $( Container ).css( 'overflow', 'auto' ); 968 } else { 969 setTimeout( function() { 970 $( Container ).jScrollPane( {autoReinitialise: true} ); 971 }, 10 ); 972 } 973 }, 974 scrollbarWidth: function() { 975 var div = $( '<div style="position:absolute;left:-200px;top:-200px;width:50px;height:50px;overflow:scroll"><div> </div></div>' ).appendTo( 'body' ), 976 width = 50 - div.children().innerWidth(); 977 div.remove(); 978 return width; 979 }, 980 initTooltip: function() {// Init Tooltip 981 $( Container ).on( 'mouseover mousemove', '.gmPhantom_ThumbContainer', function( e ) { 982 var thumbs_container = $( '.gmPhantom_Container', Container ), 983 mousePositionX = e.clientX - $( thumbs_container ).offset().left + $( document ).scrollLeft(), 984 mousePositionY = e.clientY - $( thumbs_container ).offset().top + $( document ).scrollTop(); 985 986 $( '.gmPhantom_Tooltip', Container ).css( 'left', mousePositionX - 10 ); 987 $( '.gmPhantom_Tooltip', Container ).css( 'top', mousePositionY - $( '.gmPhantom_Tooltip', Container ).height() - 15 ); 988 } ); 989 }, 990 showTooltip: function( thumb ) {// Resize, Position & Display the Tooltip 991 var title = $.trim( $( '.gmPhantom_title', thumb ).text() ), 992 HTML = []; 993 HTML.push( title ); 994 HTML.push( '<div class="gmPhantom_Tooltip_ArrowBorder"></div>' ); 995 HTML.push( '<div class="gmPhantom_Tooltip_Arrow"></div>' ); 996 $( '.gmPhantom_Tooltip', Container ).html( HTML.join( '' ) ); 997 if ( opt.tooltipBgColor != 'css' ) { 998 $( '.gmPhantom_Tooltip', Container ).css( 'background-color', '#' + opt.tooltipBgColor ); 999 $( '.gmPhantom_Tooltip_Arrow', Container ).css( 'border-top-color', '#' + opt.tooltipBgColor ); 1000 } 1001 if ( opt.tooltipStrokeColor != 'css' ) { 1002 $( '.gmPhantom_Tooltip', Container ).css( 'border-color', '#' + opt.tooltipStrokeColor ); 1003 $( '.gmPhantom_Tooltip_ArrowBorder', Container ).css( 'border-top-color', '#' + opt.tooltipStrokeColor ); 1004 } 1005 if ( opt.tooltipTextColor != 'css' ) { 1006 $( '.gmPhantom_Tooltip', Container ).css( 'color', '#' + opt.tooltipTextColor ); 1007 } 1008 if ( title !== '' ) { 1009 $( '.gmPhantom_Tooltip', Container ).css( 'display', 'block' ); 1010 } 1011 } 1012 }, 1013 1014 prototypes = { 1015 isIEBrowser: function() {// Detect the browser IE 1016 var myNav = navigator.userAgent.toLowerCase(), 1017 msie = (myNav.indexOf( 'msie' ) == -1) ? false : parseInt( myNav.split( 'msie' )[1] ); 1018 msie = ! msie ? ((myNav.indexOf( 'rv:11' ) != -1) ? 11 : false) : false;
1019 return msie; 1020 }, 1021 isTouchDevice: function() {// Detect Touchscreen devices 1022 return 'ontouchend' in document; 1023 }, 1024 touchNavigation: function( parent, child ) {// One finger Navigation for touchscreen devices 1025 var prevX, prevY, currX, currY, touch, moveTo, thumbsPositionX, thumbsPositionY, 1026 thumbW = opt.thumbWidth + 2 * opt.thumbPadding + 2 * opt.thumbBorderSize, 1027 thumbH = opt.thumbHeight + 2 * opt.thumbPadding + 2 * opt.thumbBorderSize; 1028 1029 parent.bind( 'touchstart', function( e ) { 1030 touch = e.originalEvent.touches[0]; 1031 prevX = touch.clientX; 1032 prevY = touch.clientY; 1033 } ); 1034 1035 parent.bind( 'touchmove', function( e ) { 1036 touch = e.originalEvent.touches[0]; 1037 currX = touch.clientX; 1038 currY = touch.clientY; 1039 thumbsPositionX = currX > prevX ? parseInt( child.css( 'margin-left' ) ) + (currX - prevX) : parseInt( child.css( 'margin-left' ) ) - (prevX - currX); 1040 thumbsPositionY = currY > prevY ? parseInt( child.css( 'margin-top' ) ) + (currY - prevY) : parseInt( child.css( 'margin-top' ) ) - (prevY - currY); 1041 1042 if ( thumbsPositionX < (-1) * (child.outerWidth() - parent.width()) ) { 1043 thumbsPositionX = (-1) * (child.outerWidth() - parent.width()); 1044 } else if ( thumbsPositionX > 0 ) { 1045 thumbsPositionX = 0; 1046 } else { 1047 e.preventDefault(); 1048 } 1049 1050 if ( thumbsPositionY < (-1) * (child.outerHeight() - parent.height()) ) { 1051 thumbsPositionY = (-1) * (child.outerHeight() - parent.height()); 1052 } else if ( thumbsPositionY > 0 ) { 1053 thumbsPositionY = 0; 1054 } else { 1055 e.preventDefault(); 1056 } 1057 1058 prevX = currX; 1059 prevY = currY; 1060 1061 if ( parent.width() < child.outerWidth() ) { 1062 child.css( 'margin-left', thumbsPositionX ); 1063 } 1064 if ( parent.height() < child.outerHeight() ) { 1065 child.css( 'margin-top', thumbsPositionY ); 1066 } 1067 } ); 1068 1069 }, 1070 1071 openLink: function( url, target ) {// Open a link. 1072 switch ( target.toLowerCase() ) { 1073 case '_blank': 1074 window.open( url ); 1075 break; 1076 case '_top': 1077 top.location.href = url; 1078 break; 1079 case '_parent': 1080 parent.location.href = url; 1081 break; 1082 default: 1083 window.location = url; 1084 } 1085 }, 1086 arrVal: function( arr, val ) { 1087 return $.inArray( val, arr ) !== -1 ? val : false; 1088 }, 1089 $_GET: function( variable ) { 1090 var url = window.location.href.split( '?' )[1]; 1091 if ( url ) { 1092 url = url.split( '#' )[0]; 1093 var variables = (typeof (url) === 'undefined') ? [] : url.split( '&' ), 1094 i; 1095 1096 for ( i = 0; i < variables.length; i++ ) { 1097 if ( variables[i].indexOf( variable ) != -1 ) { 1098 return variables[i].split( '=' )[1]; 1099 } 1100 } 1101 } 1102 1103 return false; 1104 }, 1105 doHideBuster: function( item ) {// Make all parents & current item visible 1106 var parent = item.parent(), 1107 items = []; 1108 1109 if ( typeof (item.prop( 'tagName' )) !== 'undefined' && item.prop( 'tagName' ).toLowerCase() != 'body' ) { 1110 items = this.doHideBuster( parent ); 1111 1112 item.addClass( 'gmShowBuster' ); 1113 items.push( item ); 1114 } 1115 1116 return items; 1117 }, 1118 undoHideBuster: function( items ) {// Hide items in the array 1119 var i; 1120 1121 for ( i = 0; i < items.length; i++ ) { 1122 items[i].removeClass( 'gmShowBuster' ); 1123 } 1124 } 1125 }; 1126 1127 return methods.init.apply( this, arguments ); 1128 }; 1129 })( jQuery, window, document ); 1130}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.