1// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/booster/assets/js/global.js?ver=1.0.0 2jQuery(function () { 3 /* Change the CTA for pages with PG in it.*/ 4 if (jQuery(".bwg-container").length) { 5 var html = '<div class="twb_admin_bar_menu_header">'; 6 html += '<img class="twb_menu_logo" src="' + twb.plugin_url + '/assets/images/logo_white.svg" />'; 7 html += '<div class="twb_menu_logo">Optimize Images</div>'; 8 html += '</div>'; 9 jQuery(".twb_admin_bar_menu").html(html).on("click", function () { 10 window.open(twb.href, '_blank'); 11 }); 12 jQuery(".twb_admin_bar_menu_main").remove(); 13 } 14 15 /* Is score check in progress.*/ 16 twb_inprogress = false; 17 18 /* Check if any score check is in progress.*/ 19 jQuery(".twb-notoptimized").each(function () { 20 if (jQuery(this).data("status") == 'inprogress') { 21 /* Disable score check button.*/ 22 twb_disable_check(); 23 } 24 }); 25 26 /* Add check score action to the button in page/posts list, 27 if there is no inprogress action.*/ 28 jQuery(".twb-notoptimized .twb_check_score_button").on("click", function () { 29 if (!twb_inprogress) { 30 twb_check_score(this); 31 } 32 }); 33 34 /* Add a hover action to show dismiss tooltip.*/ 35 jQuery("th[id^='twb-speed-']").hover(function () { 36 jQuery(this).find(".twb-dismiss-container").removeClass("twb-hidden"); 37 }, 38 function () { 39 jQuery(this).find(".twb-dismiss-container").addClass("twb-hidden"); 40 }); 41 42 /* Add a hover action to show page score.*/ 43 jQuery(".twb-see-score").hover(function () { 44 jQuery(this).parent().parent().find(".twb-score-container").removeClass("twb-hidden"); 45 }, 46 function () { 47 jQuery(this).parent().parent().find(".twb-score-container").addClass("twb-hidden"); 48 }); 49 jQuery(".twb-score-container:not(.twb_admin_bar_menu_content .twb-score-container), .twb-score-disabled-container").hover(function () { 50 jQuery(this).removeClass("twb-hidden"); 51 }, 52 function () { 53 jQuery(this).addClass("twb-hidden"); 54 }); 55 56 /* Draw circle on given scores.*/ 57 jQuery(".twb-score-circle").each(function () { 58 twb_draw_score_circle(this); 59 }); 60 61 /* Show/hide Image optimizer menu content container */ 62 jQuery("#wp-admin-bar-twb_adminbar_info").mouseenter(function(){ 63 jQuery(".twb_admin_bar_menu_main .twb-score-container").removeClass("twb-hidden"); 64 jQuery(".twb_admin_bar_menu_main").removeClass("twb-hidden"); 65 }).mouseleave(function() { 66 jQuery(".twb_admin_bar_menu_main").addClass("twb-hidden"); 67 }); 68 69 70 /* Draw circle on given scores.*/ 71 jQuery('.twb-score-circle').each(function () { 72 twb_draw_score_circle(this); 73 }); 74 75 if( jQuery(".twb_admin_bar_menu.twb_backend span").hasClass("twb_backend_optimizing_logo") ) { 76 /* Run ajax every 30 seconds to check if score counted */ 77 twb_run_notif_check = setInterval( twb_run_notif_check, 30000 ); 78 } 79}); 80 81/* Run ajax to check score counting status and show notification */ 82function twb_run_notif_check() { 83 jQuery.ajax({ 84 type: "POST", 85 url: twb.ajax_url, 86 data: { 87 action: "twb_notif_check", 88 twb_nonce: twb.nonce, 89 } 90 }).success(function (results) { 91 var result = jQuery.parseJSON(results); 92 if (result.html != "") { 93 /* Show notification popup and change menu icon and text from loading to Not optimised */ 94 if ( result.changeLogo == 1 ) { 95 jQuery(".twb_admin_bar_menu_header span").addClass("twb_counted"); 96 } 97 jQuery("#wp-admin-bar-twb_adminbar_info").append(result.html); 98 jQuery(".twb_admin_bar_menu_content .twb-score-container").removeClass("twb-hidden"); 99 jQuery(".twb_admin_bar_menu_content .twb-score-container .twb-score-circle").each(function () { 100 twb_draw_score_circle(this); 101 }); 102 clearInterval(twb_run_notif_check); 103 } 104 }).error(function () { 105 clearInterval(twb_run_notif_check); 106 }); 107 108} 109 110function twb_disable_check() { 111 twb_inprogress = true; 112 /* Add a hover action to show disabled notification.*/ 113 jQuery(".twb-notoptimized").hover(function () { 114 jQuery(this).parent().find(".twb-score-disabled-container").removeClass("twb-hidden"); 115 }, 116 function () { 117 jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden"); 118 }); 119} 120/** 121 * Optimize the page. 122 * @param that 123 */ 124function twb_check_score(that) { 125 var post_id = jQuery(that).data("post_id"); 126 var parent = jQuery(that).parent().parent().parent(); 127 //var parent = jQuery(that).closest(".twb-score-container").parent(); 128 /* Class add loading near admin bar menu */ 129 jQuery(".twb_admin_bar_menu.twb_frontend").addClass("twb_score_inprogress"); 130 131 /* If the action is not called with reload button.*/ 132 if (parent.find(".twb-optimized").hasClass("twb-hidden")) { 133 /* Do not show loading in list.*/ 134 parent.find(".twb-optimizing").removeClass("twb-hidden"); 135 } 136 else { 137 /* Show loading on reload buttons.*/ 138 parent.find(".twb-score-overlay").removeClass("twb-hidden"); 139 parent.find(".twb-score-overlay div").removeClass("twb-reload").addClass("twb-loader"); 140 } 141 142 parent.find(".twb-notoptimized").addClass("twb-hidden"); 143 144 /* In case of Elementor */ 145 if( parent.hasClass("twb_elementor_settings_content") ) { 146 jQuery(".twb_elementor_control_title").text(twb.checking).removeClass("twb_not_optimized").prepend("<span class='twb_inprogress'></span>"); 147 } 148 149 /* Disable score check button.*/ 150 twb_disable_check(); 151 152 jQuery.ajax({ 153 url: twb.ajax_url, 154 type: "POST", 155 dataType: 'json', 156 data: { 157 action: "twb_check_score", 158 post_id: post_id, 159 twb_nonce: twb.nonce 160 }, 161 success: function (data) { 162 if (data.error) { 163 /* Show reload buttons on failure.*/ 164 parent.find(".twb-score-overlay").removeClass("twb-hidden"); 165 parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload"); 166 } 167 else { 168 parent.find(".twb-score-overlay").addClass("twb-hidden"); 169 var desktop = parent.find(".twb-score-desktop").find(".twb-score-circle"); 170 desktop.data( 171 { 172 "score": data.desktop_score, 173 "tti": data.desktop_tti, 174 }); 175 twb_draw_score_circle(desktop); 176 var mobile = parent.find(".twb-score-mobile").find(".twb-score-circle"); 177 mobile.data( 178 { 179 "score": data.mobile_score, 180 "tti": data.mobile_tti, 181 }); 182 twb_draw_score_circle(mobile); 183 } 184 }, 185 error: function (xhr, textStatus, errorThrown) { 186 /* Show reload buttons on failure.*/ 187 parent.find(".twb-score-overlay").removeClass("twb-hidden"); 188 parent.find(".twb-score-overlay div").removeClass("twb-loader").addClass("twb-reload"); 189 }, 190 complete: function (xhr, textStatus) { 191 /* Hide optimizing container, show See score container.*/ 192 parent.find(".twb-optimizing").addClass("twb-hidden"); 193 parent.find(".twb-optimized").removeClass("twb-hidden"); 194 195 jQuery("#wpadminbar .twb-optimized .twb-score-container").removeClass("twb-hidden"); 196 jQuery("#wpadminbar .twb_admin_bar_menu").removeClass("twb_score_inprogress"); 197 jQuery("#wpadminbar .twb_menu_logo").remove(); 198 jQuery("#wpadminbar .twb_not_optimized_logo").removeClass("twb-hidden"); 199 jQuery("#wpadminbar .twb_admin_bar_menu_header").addClass("twb_not_optimized"); 200 201 /* Remove disabled action.*/ 202 twb_inprogress = false;
203 jQuery(".twb-notoptimized").hover(function () { 204 jQuery(this).parent().find(".twb-score-disabled-container").addClass("twb-hidden"); 205 }); 206 207 /* In case of Elementor */ 208 if( parent.hasClass("twb_elementor_settings_content") ) { 209 jQuery(".twb_elementor_control_title").text(twb.notoptimized).remove("span.twb_inprogress").addClass("twb_not_optimized"); 210 } 211 } 212 }); 213} 214 215/** 216 * Draw circle on given score. 217 * @param that 218 */ 219function twb_draw_score_circle(that) { 220 var score = parseInt(jQuery(that).data('score')); 221 var size = parseInt(jQuery(that).data('size')); 222 var thickness = parseInt(jQuery(that).data('thickness')); 223 var color = score <= 49 ? "rgb(253, 60, 49)" : (score >= 90 ? "rgb(12, 206, 107)" : "rgb(255, 164, 0)"); 224 jQuery(that).parent().find('.twb-load-time').html(jQuery(that).data('tti')); 225 var _this = that; 226 jQuery(_this).circleProgress({ 227 value: score / 100, 228 size: size, 229 startAngle: -Math.PI / 4 * 2, 230 lineCap: 'round', 231 emptyFill: "rgba(255, 255, 255, 0)", 232 thickness: thickness, 233 fill: { 234 color: color 235 } 236 }).on('circle-animation-progress', function (event, progress) { 237 var content = '<span class="twb-score0"></span>'; 238 if (score != 0) { 239 content = Math.round(score * progress); 240 } 241 jQuery(that).find('.twb-score-circle-animated').html(content).css({"color": color}); 242 jQuery(that).find('canvas').html(Math.round(score * progress)); 243 }); 244} 245 246/* Adding button in Elementor edit panel navigation view */ 247function twb_add_elementor_button() { 248 window.elementor.modules.layouts.panel.pages.menu.Menu.addItem({ 249 name: twb.title, 250 icon: "twb-element-menu-icon", 251 title: twb.title, 252 type: "page", 253 callback: () => { 254 try { 255 window.$e.route("panel/page-settings/twb_optimize") 256 } catch (e) { 257 window.$e.route("panel/page-settings/settings"), window.$e.route("panel/page-settings/twb_optimize") 258 } 259 } 260 }, "more") 261} 262 263jQuery(window).on("elementor:init", () => { 264 window.elementor.on("panel:init", () => { 265 setTimeout(twb_add_elementor_button) 266 }) 267}); 268// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/jquery.lazy.min.js?ver=1.8.13 269/*! jQuery & Zepto Lazy v1.7.11 - http://jquery.eisbehr.de/lazy - MIT&GPL-2.0 license - Copyright 2012-2018 Daniel 'Eisbehr' Kern */ 270!function(t,e){"use strict";function r(r,a,i,u,l){function f(){L=t.devicePixelRatio>1,i=c(i),a.delay>=0&&setTimeout(function(){s(!0)},a.delay),(a.delay<0||a.combined)&&(u.e=v(a.throttle,function(t){"resize"===t.type&&(w=B=-1),s(t.all)}),u.a=function(t){t=c(t),i.push.apply(i,t)},u.g=function(){return i=n(i).filter(function(){return!n(this).data(a.loadedName)})},u.f=function(t){for(var e=0;e<t.length;e++){var r=i.filter(function(){return this===t[e]});r.length&&s(!1,r)}},s(),n(a.appendScroll).on("scroll."+l+" resize."+l,u.e))}function c(t){var i=a.defaultImage,o=a.placeholder,u=a.imageBase,l=a.srcsetAttribute,f=a.loaderAttribute,c=a._f||{};t=n(t).filter(function(){var t=n(this),r=m(this);return!t.data(a.handledName)&&(t.attr(a.attribute)||t.attr(l)||t.attr(f)||c[r]!==e)}).data("plugin_"+a.name,r);for(var s=0,d=t.length;s<d;s++){var A=n(t[s]),g=m(t[s]),h=A.attr(a.imageBaseAttribute)||u;g===N&&h&&A.attr(l)&&A.attr(l,b(A.attr(l),h)),c[g]===e||A.attr(f)||A.attr(f,c[g]),g===N&&i&&!A.attr(E)?A.attr(E,i):g===N||!o||A.css(O)&&"none"!==A.css(O)||A.css(O,"url('"+o+"')")}return t}function s(t,e){if(!i.length)return void(a.autoDestroy&&r.destroy());for(var o=e||i,u=!1,l=a.imageBase||"",f=a.srcsetAttribute,c=a.handledName,s=0;s<o.length;s++)if(t||e||A(o[s])){var g=n(o[s]),h=m(o[s]),b=g.attr(a.attribute),v=g.attr(a.imageBaseAttribute)||l,p=g.attr(a.loaderAttribute);g.data(c)||a.visibleOnly&&!g.is(":visible")||!((b||g.attr(f))&&(h===N&&(v+b!==g.attr(E)||g.attr(f)!==g.attr(F))||h!==N&&v+b!==g.css(O))||p)||(u=!0,g.data(c,!0),d(g,h,v,p))}u&&(i=n(i).filter(function(){return!n(this).data(c)}))}function d(t,e,r,i){++z;var o=function(){y("onError",t),p(),o=n.noop};y("beforeLoad",t);var u=a.attribute,l=a.srcsetAttribute,f=a.sizesAttribute,c=a.retinaAttribute,s=a.removeAttribute,d=a.loadedName,A=t.attr(c);if(i){var g=function(){s&&t.removeAttr(a.loaderAttribute),t.data(d,!0),y(T,t),setTimeout(p,1),g=n.noop};t.off(I).one(I,o).one(D,g),y(i,t,function(e){e?(t.off(D),g()):(t.off(I),o())})||t.trigger(I)}else{var h=n(new Image);h.one(I,o).one(D,function(){t.hide(),e===N?t.attr(C,h.attr(C)).attr(F,h.attr(F)).attr(E,h.attr(E)):t.css(O,"url('"+h.attr(E)+"')"),t[a.effect](a.effectTime),s&&(t.removeAttr(u+" "+l+" "+c+" "+a.imageBaseAttribute),f!==C&&t.removeAttr(f)),t.data(d,!0),y(T,t),h.remove(),p()});var m=(L&&A?A:t.attr(u))||"";h.attr(C,t.attr(f)).attr(F,t.attr(l)).attr(E,m?r+m:null),h.complete&&h.trigger(D)}}function A(t){var e=t.getBoundingClientRect(),r=a.scrollDirection,n=a.threshold,i=h()+n>e.top&&-n<e.bottom,o=g()+n>e.left&&-n<e.right;return"vertical"===r?i:"horizontal"===r?o:i&&o}function g(){return w>=0?w:w=n(t).width()}function h(){return B>=0?B:B=n(t).height()}function m(t){return t.tagName.toLowerCase()}function b(t,e){if(e){var r=t.split(",");t="";for(var a=0,n=r.length;a<n;a++)t+=e+r[a].trim()+(a!==n-1?",":"")}return t}function v(t,e){var n,i=0;return function(o,u){function l(){i=+new Date,e.call(r,o)}var f=+new Date-i;n&&clearTimeout(n),f>t||!a.enableThrottle||u?l():n=setTimeout(l,t-f)}}function p(){--z,i.length||z||y("onFinishedAll")}function y(t,e,n){return!!(t=a[t])&&(t.apply(r,[].slice.call(arguments,1
270)),!0)}var z=0,w=-1,B=-1,L=!1,T="afterLoad",D="load",I="error",N="img",E="src",F="srcset",C="sizes",O="background-image";"event"===a.bind||o?f():n(t).on(D+"."+l,f)}function a(a,o){var u=this,l=n.extend({},u.config,o),f={},c=l.name+"-"+ ++i;return u.config=function(t,r){return r===e?l[t]:(l[t]=r,u)},u.addItems=function(t){return f.a&&f.a("string"===n.type(t)?n(t):t),u},u.getItems=function(){return f.g?f.g():{}},u.update=function(t){return f.e&&f.e({},!t),u},u.force=function(t){return f.f&&f.f("string"===n.type(t)?n(t):t),u},u.loadAll=function(){return f.e&&f.e({all:!0},!0),u},u.destroy=function(){return n(l.appendScroll).off("."+c,f.e),n(t).off("."+c),f={},e},r(u,l,a,f,c),l.chainable?a:u}var n=t.jQuery||t.Zepto,i=0,o=!1;n.fn.Lazy=n.fn.lazy=function(t){return new a(this,t)},n.Lazy=n.lazy=function(t,r,i){if(n.isFunction(r)&&(i=r,r=[]),n.isFunction(i)){t=n.isArray(t)?t:[t],r=n.isArray(r)?r:[r];for(var o=a.prototype.config,u=o._f||(o._f={}),l=0,f=t.length;l<f;l++)(o[t[l]]===e||n.isFunction(o[t[l]]))&&(o[t[l]]=i);for(var c=0,s=r.length;c<s;c++)u[r[c]]=t[0]}},a.prototype.config={name:"lazy",chainable:!0,autoDestroy:!0,bind:"load",threshold:500,visibleOnly:!1,appendScroll:t,scrollDirection:"both",imageBase:null,defaultImage:"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",placeholder:null,delay:-1,combined:!1,attribute:"data-src",srcsetAttribute:"data-srcset",sizesAttribute:"data-sizes",retinaAttribute:"data-retina",loaderAttribute:"data-loader",imageBaseAttribute:"data-imagebase",removeAttribute:!0,handledName:"handled",loadedName:"loaded",effect:"show",effectTime:0,enableThrottle:!0,throttle:250,beforeLoad:e,afterLoad:e,onError:e,onFinishedAll:e},n(t).on("load",function(){o=!0})}(window); 271// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/jquery.sumoselect.min.js?ver=3.4.6 272"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _arrayWithHoles(a){if(Array.isArray(a))return a}/*global jQuery, define, module, require*/ /*! 273 * jquery.sumoselect v3.4.6 274 * http://hemantnegi.github.io/jquery.sumoselect 275 * 2016-12-12 276 * 277 * Copyright 2015 Hemant Negi 278 * Email : [email protected] 279 * Compressor http://refresh-sf.com/ 280 */(function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"==typeof exports?a(jQuery):module.exports=a(require("jquery"))})(function(a){"namespace sumo";a.fn.SumoSelect=function(b){// Extra check for IE compatibility 281var c=function(a,b){var c=null;"function"==typeof Event?c=new Event(b,{bubbles:!0}):(c=document.createEvent("Event"),c.initEvent(b,!0,!0)),a.dispatchEvent(c)};// missing forEach on NodeList for IE11 282window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach);// This is the easiest way to have default options. 283var d={placeholder:"Select Here",// Dont change it here. 284csvDispCount:3,// display no. of items in multiselect. 0 to display all. 285captionFormat:"{0} Selected",// format of caption text. you can set your locale. 286captionFormatAllSelected:"{0} all selected!",// format of caption text when all elements are selected. set null to use captionFormat. It will not work if there are disabled elements in select. 287floatWidth:400,// Screen width of device at which the list is rendered in floating popup fashion. 288forceCustomRendering:!1,// force the custom modal on all devices below floatWidth resolution. 289nativeOnDevice:["Android","BlackBerry","iPhone","iPad","iPod","Opera Mini","IEMobile","Silk"],// 290outputAsCSV:!1,// true to POST data as csv ( false for Html control array ie. default select ) 291csvSepChar:",",// separation char in csv mode 292okCancelInMulti:!1,// display ok cancel buttons in desktop mode multiselect also. 293isClickAwayOk:!1,// for okCancelInMulti=true. sets whether click outside will trigger Ok or Cancel (default is cancel). 294triggerChangeCombined:!0,// im multi select mode whether to trigger change event on individual selection or combined selection. 295selectAll:!1,// to display select all button in multiselect mode.|| also select all will not be available on mobile devices.
vendor: 15,372 bytes, lines 296-358
296selectAllPartialCheck:!0,// Display a disabled checkbox in multiselect mode when all the items are not selected. 297search:!1,// to display input for filtering content. selectAlltext will be input text placeholder 298searchText:"Search...",// placeholder for search input 299searchFn:function searchFn(a,b){// search function 300return 0>a.toLowerCase().indexOf(b.toLowerCase())},noMatch:"No matches for \"{0}\"",prefix:"",// some prefix usually the field name. eg. '<b>Hello</b>' 301locale:["OK","Cancel","Select All","Clear all"],// all text that is used. don't change the index. 302up:!1,// set true to open upside. 303showTitle:!0,// set to false to prevent title (tooltip) from appearing 304clearAll:!1,// im multi select - clear all checked options 305closeAfterClearAll:!1,// im multi select - close select after clear 306max:null,// Maximum number of options selected (when multiple) 307// eslint-disable-next-line no-unused-vars 308renderLi:function renderLi(a){return a}// Custom <li> item renderer 309},e=this.each(function(){var e=this;// the original select object. 310if(!this.sumo&&a(this).is("select")){//already initialized 311var f=a.extend({},d,b,a(this).data());this.sumo={E:a(e),//the jquery object of original select element. 312is_multi:a(e).attr("multiple"),//if its a multiple select 313select:"",caption:"",placeholder:"",optDiv:"",CaptionCont:"",ul:"",is_floating:!1,is_opened:!1,//backdrop: '', 314mob:!1,// if to open device default select 315Pstate:[],lastUnselected:null,selectedCount:0,createElems:function createElems(){var b=this,c=b.E.find("option:checked");//break for mobile rendring.. if forceCustomRendering is false 316return b.E.wrap("<div class=\"SumoSelect\" tabindex=\"0\" role=\"button\" aria-expanded=\"false\">"),c.each(function(a,b){b.selected=!0}),b.select=b.E.parent(),b.caption=a("<span>"),b.CaptionCont=a("<p class=\"CaptionCont SelectBox ".concat(b.E.attr("class"),"\" ><label><i></i></label></p>")).attr("style",b.E.attr("style")).prepend(b.caption),b.select.append(b.CaptionCont),b.is_multi||(f.okCancelInMulti=!1),b.E.attr("disabled")&&b.select.addClass("disabled").removeAttr("tabindex"),f.outputAsCSV&&b.is_multi&&b.E.attr("name")&&(b.select.append(a("<input class=\"HEMANT123\" type=\"hidden\" />").attr("name",b.E.attr("name")).val(b.getSelStr())),b.E.removeAttr("name")),b.isMobile()&&!f.forceCustomRendering?void b.setNativeMobile():void(//hide original select 317//## Creating the list... 318//branch for floating list in low res devices. 319//Creating the markup for the available options 320b.E.attr("name")&&b.select.addClass("sumo_".concat(b.E.attr("name").replace(/\[\]/,""))),b.E.addClass("SumoUnder").attr("tabindex","-1"),b.optDiv=a("<div class=\"optWrapper ".concat(f.up?"up":"","\">")),b.floatingList(),b.ul=a("<ul class=\"options\">"),b.optDiv.append(b.ul),f.clearAll&&b.is_multi&&b.ClearAll(),f.selectAll&&b.is_multi&&!f.max&&b.SelAll(),f.search&&b.Search(),b.ul.append(b.prepItems(b.E.children())),b.is_multi&&b.multiSelelect(),b.select.append(b.optDiv),b._handleMax(),b.basicEvents(),b.selAllState());// if there is a name attr in select add a class to container div 321},prepItems:function prepItems(b,c){var d=[],e=this;return a(b).each(function(b,f){// parsing options to li 322var g=a(f);d.push(g.is("optgroup")?a("<li class=\"group ".concat(f.disabled?"disabled":"","\"><label></label><ul></ul></li>")).find("label").text(g.attr("label")).end().find("ul").append(e.prepItems(g.children(),f.disabled)).end():e.createLi(g,c))}),d},//## Creates a LI element from a given option and binds events to it 323//## returns the jquery instance of li (not inserted in dom) 324createLi:function createLi(b,c){var d=this;b.attr("value")||b.attr("value",b.val());var e=a("<li class=\"opt\"><label>".concat(b.html(),"</label></li>"));return e.data("opt",b),b.data("li",e),d.is_multi&&e.prepend("<span><i></i></span>"),(b[0].disabled||c)&&e.addClass("disabled"),d.onOptClick(e),b[0].selected&&(e.addClass("selected"),d.selectedCount++),b.attr("class")&&e.addClass(b.attr("class")),b.attr("title")&&e.attr("title",b.attr("title")),f.renderLi(e,b)},//## Returns the selected items as string in a Multiselect. 325getSelStr:function getSelStr(){// get the pre selected items. 326var b=[];return this.E.find("option:checked").each(function(){b.push(a(this).val())}),b.join(f.csvSepChar)},//## THOSE OK/CANCEL BUTTONS ON MULTIPLE SELECT. 327multiSelelect:function multiSelelect(){var b=this;b.optDiv.addClass("multiple"),b.okbtn=a("<p tabindex=\"0\" class=\"btnOk\"></p>").click(function(){b._okbtn(),b.hideOpts()});var c=_slicedToArray(f.locale,1);b.okbtn[0].innerText=c[0],b.cancelBtn=a("<p tabindex=\"0\" class=\"btnCancel\"></p>").click(function(){b._cnbtn(),b.hideOpts()});var d=_slicedToArray(f.locale,2);b.cancelBtn[0].innerText=d[1];var e=b.okbtn.add(b.cancelBtn);b.optDiv.append(a("<div class=\"MultiControls\">").append(e)),e.on("keydown.sumo",function(c){var d=a(this);switch(c.which){case 32:// space 328case 13:d.trigger("click");break;case 9://tab 329if(d.hasClass("btnOk"))return;break;case 27:return b._cnbtn(),void b.hideOpts();default:}c.stopPropagation(),c.preventDefault()})},_okbtn:function _okbtn(){var a=this,b=0;f.triggerChangeCombined&&(a.E.find("option:checked").length===a.Pstate.length?a.E.find("option").each(function(c,d){d.selected&&0>a.Pstate.indexOf(c)&&(b=1)}):b=1,b&&(a.callChange(),a.setText()))},_cnbtn:function _cnbtn(){var a=this;//remove all selections 330a.E.find("option:checked").each(function(){this.selected=!1}),a.optDiv.find("li.selected").removeClass("selected");//restore selections from saved state. 331for(var b=0;b<a.Pstate.length;b++)a.E.find("option")[a.Pstate[b]].selected=!0,a.ul.find("li.opt").eq(a.Pstate[b]).addClass("selected");a.selAllState()},_handleMax:function _handleMax(){f.max&&(this.selectedCount>=+f.max?this.optDiv.find("li.opt").not(".hidden").each(function(b,c){a(c).hasClass("selected")||a(c).addClass("temporary-disabled disabled")}):this.optDiv.find("li.opt").not(".hidden").each(function(b,c){a(c).hasClass("temporary-disabled")&&a(c).removeClass("temporary-disabled disabled")}))},ClearAll:function ClearAll(){var b=this;if(b.is_multi){b.selAll=a("<p class=\"reset-all\"><span><i></i></span><label></label></p>");var c=_slicedToArray(f.locale,4);b.selAll.find("label")[0].innerText=c[3],b.optDiv.addClass("resetAll"),b.selAll.on("click",function(){b.selAll.removeClass("selected"),b.toggSelAll(!1,1),f.closeAfterClearAll&&b.hideOpts()}),b.optDiv.prepend(b.selAll)}},SelAll:function SelAll(){var b=this;if(b.is_multi){b.selAll=a("<p class=\"select-all\"><span><i></i></span><label></label></p>");var c=_slicedToArray(f.locale,3);b.selAll.find("label")[0].innerText=c[2],b.optDiv.addClass("selall"),b.selAll.on("click",function(){b.selAll.toggleClass("selected"),b.toggSelAll(b.selAll.hasClass("selected"),1),b.selAllState()}),b.optDiv.prepend(b.selAll)}},// search module (can be removed if not required.) 332Search:function Search(){var c=this,d=c.CaptionCont.addClass("search"),e=a("<p class=\"no-match\">"),g=b.searchFn&&"function"==typeof b.searchFn?b.searchFn:f.searchFn;c.ftxt=a("<input type=\"text\" class=\"search-txt\" value=\"\" autocomplete=\"off\">").on("click",function(a){a.stopPropagation()}),c.ftxt[0].placeholder=f.searchText,d.append(c.ftxt),c.optDiv.children("ul").after(e),c.ftxt.on("keyup.sumo",function(){var b=c.optDiv.find("ul.options li.opt").each(function(b,d){var e=a(d),f=e.data("opt"),h=f[0];h.hidden=g(e.text(),c.ftxt.val(),e),e.toggleClass("hidden",h.hidden)}).not(".hidden");// Hide opt-groups with no options matched 333c.optDiv[0].querySelectorAll("li.group").forEach(function(a){a.querySelector("li:not(.hidden)")?a.classList.remove("hidden"):a.classList.add("hidden")}),e.html(f.noMatch.replace(/\{0\}/g,"<em></em>")).toggle(!b.length),e.find("em").text(c.ftxt.val()),c.selAllState()})},selAllState:function selAllState(){var b=this;if(f.selectAll&&b.is_multi){var c=0,d=0;b.optDiv.find("li.opt:not(.disabled):not(.hidden)").each(function(b,f){a(f).hasClass("selected")&&c++,d++}),c==d?b.selAll.removeClass("partial").addClass("selected"):0===c?b.selAll.removeClass("selected partial"):(f.selectAllPartialCheck&&b.selAll.addClass("partial"),b.selAll.removeClass("selected"))}},showOpts:function showOpts(){var b=this;if(!b.E.attr("disabled")){if(b.E.trigger("sumo:opening",b),b.is_opened=!0,b.select.addClass("open").attr("aria-expanded","true"),b.E.trigger("sumo:opened",b),b.ftxt?b.ftxt.focus():b.select.focus(),a(document).on("click.sumo",function(a){if(!b.select.is(a.target)// if the target of the click isn't the container... 334&&0===b.select.has(a.target).length){// ... nor a descendant of the container 335if(!b.is_opened)return;b.hideOpts(),f.okCancelInMulti&&(f.isClickAwayOk?b._okbtn():b._cnbtn())}}),b.is_floating){var c=b.optDiv.children("ul").outerHeight()+2;// +2 is clear fix 336b.is_multi&&(c+=+b.optDiv.css("padding-bottom")),b.optDiv.css("height",c),a("body").addClass("sumoStopScroll")}b.setPstate()}// if select is disabled then retrun 337},//maintain state when ok/cancel buttons are available storing the indexes. 338setPstate:function setPstate(){var a=this;a.is_multi&&(a.is_floating||f.okCancelInMulti)&&(a.Pstate=[],a.E.find("option").each(function(b,c){c.selected&&a.Pstate.push(b)}))},callChange:function callChange(){this.E.get().forEach(function(a){c(a,"change"),c(a,"click")})},hideOpts:function hideOpts(){var b=this;b.is_opened&&(b.E.trigger("sumo:closing",b),b.is_opened=!1,b.select.removeClass("open").attr("aria-expanded","false").find("ul li.sel").removeClass("sel"),b.E.trigger("sumo:closed",b),a(document).off("click.sumo"),a("body").removeClass("sumoStopScroll"),f.search&&(b.ftxt.val(""),b.ftxt.trigger("keyup.sumo")))},setOnOpen:function setOnOpen(){var a=this,b=a.optDiv.find("li.opt:not(.hidden)").eq(f.search?0:a.E[0].selectedIndex);b.hasClass("disabled")&&(b=b.next(":not(disabled)"),!b.length)||(a.optDiv.find("li.sel").removeClass("sel"),b.addClass("sel"),a.showOpts())},nav:function nav(a){var b=this,d=null,e=b.ul.find("li.opt.sel:not(.hidden)"),f=b.ul.find("li.opt:not(.disabled):not(.hidden)"),g=f.index(e);if(b.is_opened&&e.length){if(a&&0<g)d=f.eq(g-1);else if(!a&&g<f.length-1&&-1<g)d=f.eq(g+1);else return;// if no items before or after 339e.removeClass("sel"),e=d.addClass("sel");// setting sel item to visible view. 340var h=b.ul,i=h.scrollTop(),j=e.position().top+i;j>=i+h.height()-e.outerHeight()&&h.scrollTop(j-h.height()+e.outerHeight()),j<i&&h.scrollTop(j)}else b.setOnOpen()},basicEvents:function basicEvents(){var b=this;b.CaptionCont.click(function(a){b.E.trigger("click"),b.is_opened?b.hideOpts():b.showOpts(),a.stopPropagation()}),b.select.on("keydown.sumo",function(a){switch(a.which){case 38:b.nav(!0);break;case 40:b.nav(!1);break;case 65:// shortcut ctrl + a to select all and ctrl + shift + a to unselect all. 341if(b.is_multi&&!f.max&&a.ctrlKey){b.toggSelAll(!a.shiftKey,1);break}else return;case 32:// space 342if(f.search&&b.ftxt.is(a.target))return;break;case 13:b.is_opened?b.optDiv.find("ul li.sel").trigger("click"):b.setOnOpen();break;case 9:return void(f.okCancelInMulti||b.hideOpts());case 27:return f.okCancelInMulti&&b._cnbtn(),void b.hideOpts();default:return;// exit this handler for other keys 343}a.preventDefault()}),a(window).on("resize.sumo",function(){b.floatingList()})},onOptClick:function onOptClick(b){var c=this;b.click(function(){var b=a(this);b.hasClass("disabled")||(c.is_multi?(b.toggleClass("selected"),b.data("opt")[0].selected=b.hasClass("selected"),!1===b.data("opt")[0].selected?(c.lastUnselected=b.data("opt")[0].textContent,c.selectedCount--):c.selectedCount++,f.max&&c._handleMax(),c.selAllState()):(b.parent().find("li.selected").removeClass("selected"),b.toggleClass("selected"),b.data("opt")[0].selected=!0,c.selectedCount=1),!(c.is_multi&&f.triggerChangeCombined&&(c.is_floating||f.okCancelInMulti))&&(c.setText(),c.callChange()),!c.is_multi&&c.hideOpts())})},// fixed some variables that were not explicitly typed (michc) 344setText:function setText(){var a=this,b=0;if(a.placeholder="",a.is_multi){var e=a.E.find(":checked").not(":disabled");//selected options. 345b=e.length,a.placeholder=f.csvDispCount&&e.length>f.csvDispCount?e.length===a.E.find("option").length&&f.captionFormatAllSelected?f.captionFormatAllSelected.replace(/\{0\}/g,e.length):f.captionFormat.replace(/\{0\}/g,e.length):e.toArray().map(function(a){return a.innerText}).join(", ")}else{var g=a.E.find(":checked").not(":disabled");a.placeholder=g.text(),b=g.length}var c=!1;a.placeholder||(c=!0,a.placeholder=a.E.attr("placeholder"),!a.placeholder&&(//if placeholder is there then set it 346a.placeholder=a.E.find("option:disabled:checked").text())),a.select.attr("selected-count",b),a.select.attr("is-selected",b?"true":"false"),a.placeholder=a.placeholder?"".concat(f.prefix," ").concat(a.placeholder):f.placeholder,a.caption.text(a.placeholder),f.showTitle&&a.CaptionCont.attr("title",a.placeholder);//set the hidden field if post as csv is true. 347var d=a.select.find("input.HEMANT123");return d.length&&d.val(a.getSelStr()),c?a.caption.addClass("placeholder"):a.caption.removeClass("placeholder"),a.placeholder},isMobile:function isMobile(){// Adapted from http://www.detectmobilebrowsers.com 348// Checks for iOs, Android, Blackberry, Opera Mini, and Windows mobile devices 349for(var a=navigator.userAgent||navigator.vendor||window.opera,b=0;b<f.nativeOnDevice.length;b++)if(0<a.toString().toLowerCase().indexOf(f.nativeOnDevice[b].toLowerCase()))return f.nativeOnDevice[b];return!1},setNativeMobile:function setNativeMobile(){var a=this;a.E.addClass("SelectClass"),a.mob=!0,a.E.change(function(){a.setText()})},floatingList:function floatingList(){var b=this;//called on init and also on resize. 350//O.is_floating = true if window width is < specified float width 351b.is_floating=a(window).width()<=f.floatWidth,b.optDiv.toggleClass("isFloating",b.is_floating),b.is_floating||b.optDiv.css("height",""),b.optDiv.toggleClass("okCancelInMulti",f.okCancelInMulti&&!b.is_floating)},//HELPERS FOR OUTSIDERS 352// validates range of given item operations 353vRange:function vRange(a){var b=this,c=b.E.find("option");if(c.length<=a||0>a)throw new Error("index out of bounds");return b},//toggles selection on c as boolean. 354toggSel:function toggSel(b,c){var d=this,e=null;"number"==typeof c?(d.vRange(c),e=d.E.find("option")[c]):e=d.E.find("option[value=\"".concat(c,"\"]"))[0]||0,!e||e.disabled||e.selected!==b&&(f.max&&!e.selected&&d.selectedCount<f.max||e.selected||!f.max&&!e.selected)&&(e.selected=b,!d.mob&&a(e).data("li").toggleClass("selected",b),d.callChange(),d.setPstate(),d.setText(),d.selAllState())},//toggles disabled on c as boolean. 355toggDis:function toggDis(a,b){var c=this.vRange(b);c.E.find("option")[b].disabled=a,a&&(c.E.find("option")[b].selected=!1),c.mob||c.optDiv.find("ul.options li.opt").eq(b).toggleClass("disabled",a).removeClass("selected"),c.setText()},// toggle disable/enable on complete select control 356toggSumo:function toggSumo(a){var b=this;return b.enabled=a,b.select.toggleClass("disabled",a),a?(b.E.attr("disabled","disabled"),b.select.removeAttr("tabindex")):(b.E.removeAttr("disabled"),b.select.attr("tabindex","0")),b},// toggles all option on c as boolean. 357// set direct=false/0 bypasses okCancelInMulti behaviour. 358toggSelAll:function toggSelAll(b,c){var d=this,e=a.extend(!0,{},a._data(d.E.get(0),"events"));d.E.off(),d.is_multi?b?d.E.find("option").toArray().filter(function(a){return!a.selected&&!a.disabled&&"none"!==a.style.display}
358).forEach(function(b){a(b).data("li").hasClass("hidden")||(b.selected=!0,a(b).data("li").toggleClass("selected",!0))}):d.E.find("option").toArray().filter(function(a){return a.selected&&!a.disabled&&"none"!==a.style.display}).forEach(function(b){a(b).data("li").hasClass("hidden")||(b.selected=!1,a(b).data("li").toggleClass("selected",!1))}):b?console.warn("You called `SelectAll` on a non-multiple select"):d.E[0].selectedIndex=-1,a.each(e,function(b,c){a.each(c,function(a,b){d.E.on(b.type,b.handler)})}),(!d.is_multi||f.okCancelInMulti)&&d.is_multi||(d.callChange(),d.setText()),c||(!d.mob&&d.selAll&&d.selAll.removeClass("partial").toggleClass("selected",!!b),d.setText(),d.setPstate())},/* outside accessibility options 359 which can be accessed from the element instance. 360 */reload:function reload(){var b=this.unload();return a(b).SumoSelect(f)},unload:function unload(){var a=this;return a.select.before(a.E),a.E.show(),a.E[0].classList.remove("SumoUnder","SelectClass"),f.outputAsCSV&&a.is_multi&&a.select.find("input.HEMANT123").length&&a.E.attr("name",a.select.find("input.HEMANT123").attr("name")),a.select.remove(),delete e.sumo,a.E.trigger("sumo:unloaded",a),e},//## add a new option to select at a given index. 361add:function add(b,c,d,f){if("undefined"==typeof b)throw new Error("No value to add");var g=this,h=g.E.find("option"),i=c,j=d;"number"==typeof c?(j=c,i=b):"undefined"==typeof c&&(i=b);var k=a("<option></option>").val(b).html(i);if(f&&"object"===_typeof(f)&&a.each(f,function(a,b){k.attr(a,b)}),h.length<j)throw new Error("index out of bounds");return"undefined"==typeof j||h.length===j?(g.E.append(k),!g.mob&&g.ul.append(g.createLi(k))):(h.eq(j).before(k),!g.mob&&g.ul.find("li.opt").eq(j).before(g.createLi(k))),e},//## removes an item at a given index. 362remove:function remove(a){var b=this.vRange(a);b.E.find("option").eq(a).remove(),b.mob||b.optDiv.find("ul.options li.opt").eq(a).remove(),b.setText()},// removes all but the selected one 363removeAll:function removeAll(){for(var a=this,b=a.E.find("option"),c=b.length-1;0<=c;c--)!0!==b[c].selected&&a.remove(c)},find:function find(a){var b=this,c=b.E.find("option");for(var d in c)if(c[d].value===a)return+d;return-1},//## Select an item at a given index. 364selectItem:function selectItem(a){this.toggSel(!0,a)},//## UnSelect an iten at a given index. 365unSelectItem:function unSelectItem(a){this.toggSel(!1,a)},//## Select all items of the select. 366selectAll:function selectAll(){this.toggSelAll(!0)},//## UnSelect all items of the select. 367unSelectAll:function unSelectAll(){this.toggSelAll(!1)},//## Disable an iten at a given index. 368disableItem:function disableItem(a){this.toggDis(!0,a)},//## Removes disabled an iten at a given index. 369enableItem:function enableItem(a){this.toggDis(!1,a)},//## New simple methods as getter and setter are not working fine in ie8- 370//## variable to check state of control if enabled or disabled. 371enabled:!0,//## Enables the control 372enable:function enable(){return this.toggSumo(!1)},//## Disables the control 373disable:function disable(){return this.toggSumo(!0)},init:function init(){var a=this;return a.createElems(),a.setText(),a.E.trigger("sumo:initialized",a),a}},e.sumo.init()}});return 1===e.length?e[0]:e}}); 374// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/tocca.min.js?ver=2.0.9 375!function(doc,win){if("function"!=typeof doc.createEvent)return;function pointerEvent(type){var lo=type.toLowerCase(),ms="MS"+type;return navigator.msPointerEnabled?ms:!!window.PointerEvent&&lo}function touchEvent(name){return"on"+name in window&&name}function isTheSameFingerId(e){return!e.pointerId||void 0===pointerId||e.pointerId===pointerId}function setListener(elm,events,callback){for(var eventsArray=events.split(" "),i=eventsArray.length;i--;)elm.addEventListener(eventsArray[i],callback,!1)}function getPointerEvent(event){var hasTargetTouches=Boolean(event.targetTouches&&event.targetTouches.length);switch(!0){case Boolean(event.target.touches):return event.target.touches[0];case hasTargetTouches&&void 0!==event.targetTouches[0].pageX:return event.targetTouches[0];case hasTargetTouches&&Boolean(event.targetTouches[0].touches):return event.targetTouches[0].touches[0];default:return event}}function isMultipleTouches(event){return 1<(event.targetTouches||event.target.touches||[]).length}function getTimestamp(){return(new Date).getTime()}function sendEvent(elm,eventName,originalEvent,data){var customEvent=doc.createEvent("Event");
vendor: 3,160 bytes, lines 375-377
375if(customEvent.originalEvent=originalEvent,(data=data||{}).x=currX,data.y=currY,defaults.useJquery&&(customEvent=jQuery.Event(eventName,{originalEvent:originalEvent}),jQuery(elm).trigger(customEvent,data)),customEvent.initEvent){for(var key in data)customEvent[key]=data[key];customEvent.initEvent(eventName,!0,!0),elm.dispatchEvent(customEvent)}for(;elm;)elm["on"+eventName]&&elm["on"+eventName](customEvent),elm=elm.parentNode}var pointerId,currX,currY,cachedX,cachedY,timestamp,target,dblTapTimer,longtapTimer,defaults={useJquery:!win.IGNORE_JQUERY&&"undefined"!=typeof jQuery,swipeThreshold:win.SWIPE_THRESHOLD||100,tapThreshold:win.TAP_THRESHOLD||150,dbltapThreshold:win.DBL_TAP_THRESHOLD||200,longtapThreshold:win.LONG_TAP_THRESHOLD||1e3,tapPrecision:win.TAP_PRECISION/2||30,justTouchEvents:win.JUST_ON_TOUCH_DEVICES},wasTouch=!1,touchevents_touchstart=touchEvent("touchstart")||pointerEvent("PointerDown"),touchevents_touchend=touchEvent("touchend")||pointerEvent("PointerUp"),touchevents_touchmove=touchEvent("touchmove")||pointerEvent("PointerMove"),tapNum=0;setListener(doc,touchevents_touchstart+(defaults.justTouchEvents?"":" mousedown"),function(e){if(isTheSameFingerId(e)&&!isMultipleTouches(e)&&(pointerId=e.pointerId,"mousedown"!==e.type&&(wasTouch=!0),"mousedown"!==e.type||!wasTouch)){var pointer=getPointerEvent(e);cachedX=currX=pointer.pageX,cachedY=currY=pointer.pageY,longtapTimer=setTimeout(function(){sendEvent(e.target,"longtap",e),target=e.target},defaults.longtapThreshold),timestamp=getTimestamp(),tapNum++}}),setListener(doc,touchevents_touchend+(defaults.justTouchEvents?"":" mouseup"),function(e){if(isTheSameFingerId(e)&&!isMultipleTouches(e))if(pointerId=void 0,"mouseup"===e.type&&wasTouch)wasTouch=!1;else{var eventsArr=[],now=getTimestamp(),deltaY=cachedY-currY,deltaX=cachedX-currX;if(clearTimeout(dblTapTimer),clearTimeout(longtapTimer),deltaX<=-defaults.swipeThreshold&&eventsArr.push("swiperight"),deltaX>=defaults.swipeThreshold&&eventsArr.push("swipeleft"),deltaY<=-defaults.swipeThreshold&&eventsArr.push("swipedown"),deltaY>=defaults.swipeThreshold&&eventsArr.push("swipeup"),eventsArr.length){for(var i=0;i<eventsArr.length;i++){var eventName=eventsArr[i];sendEvent(e.target,eventName,e,{distance:{x:Math.abs(deltaX),y:Math.abs(deltaY)}})}tapNum=0}else cachedX>=currX-defaults.tapPrecision&&cachedX<=currX+defaults.tapPrecision&&cachedY>=currY-defaults.tapPrecision&&cachedY<=currY+defaults.tapPrecision&&0<=timestamp+defaults.tapThreshold-now&&(sendEvent(e.target,2<=tapNum&&target===e.target?"dbltap":"tap",e),target=e.target),dblTapTimer=setTimeout(function(){tapNum=0},defaults.dbltapThreshold)}}),setListener(doc,touchevents_touchmove+(defaults.justTouchEvents?"":" mousemove"),function(e){if(isTheSameFingerId(e)&&("mousemove"!==e.type||!wasTouch)){var pointer=getPointerEvent(e);currX=pointer.pageX,currY=pointer.pageY}}),win.tocca=function(options){for(var opt in options)defaults[opt]=options[opt];return defaults}}(document,window); 376// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/jquery.mCustomScrollbar.concat.min.js?ver=3.1.5 377/* == jquery mousewheel plugin == Version: 3.1.15
vendor: 45,430 bytes, lines 377-381
377, License: MIT License (MIT) */ 378!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof 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.12",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),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},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)}})});!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof 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.12",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),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},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)}})}); 379/* == malihu jquery custom scrollbar plugin == Version: 3.1.5, License: MIT License (MIT) */ 380!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var o="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",i="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";o||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+i+"%3E%3C/script%3E"))),t()}(function(){var t,o="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",i={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},r=0,l={},s=window.attachEvent&&!window.addEventListener?1:0,c=!1,d=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],u={init:function(t){var t=e.extend(!0,{},i,t),o=f.call(this);if(t.live){var s=t.liveSelector||this.selector||n,c=e(s);if("off"===t.live)return void m(s);l[s]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&m(s)},500)}else m(s);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":p(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),h(t),e(o).each(function(){var o=e(this);if(!o.data(a)){o.data(a,{idx:++r,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:o.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var n=o.data(a),i=n.opt,l=o.data("mcs-axis"),s=o.data("mcs-scrollbar-position"),c=o.data("mcs-theme");l&&(i.axis=l),s&&(i.scrollbarPosition=s),c&&(i.theme=c,h(i)),v.call(this),n&&i.callbacks.onCreate&&"function"==typeof i.callbacks.onCreate&&i.callbacks.onCreate.call(this),e("#mCSB_"+n.idx+"_container img:not(."+d[2]+")").addClass(d[2]),u.update.call(null,o)}})},update:function(t,o){var n=t||f.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container"),l=e("#mCSB_"+n.idx),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!r.length)return;n.tweenRunning&&Q(t),o&&n&&i.callbacks.onBeforeUpdate&&"function"==typeof i.callbacks.onBeforeUpdate&&i.callbacks.onBeforeUpdate.call(this),t.hasClass(d[3])&&t.removeClass(d[3]),t.hasClass(d[4])&&t.removeClass(d[4]),l.css("max-height","none"),l.height()!==t.height()&&l.css("max-height",t.height()),_.call(this),"y"===i.axis||i.advanced.autoExpandHorizontalScroll||r.css("width",x(r)),n.overflowed=y.call(this),M.call(this),i.autoDraggerLength&&S.call(this),b.call(this),T.call(this);var c=[Math.abs(r[0].offsetTop),Math.abs(r[0].offsetLeft)];"x"!==i.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?B.call(this):(G(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(B.call(this),"y"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[1]&&G(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==i.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?B.call(this):(G(t,c[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(B.call(this),"x"===i.axis?k.call(this):"yx"===i.axis&&n.overflowed[0]&&G(t,c[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),o&&n&&(2===o&&i.callbacks.onImageLoad&&"function"==typeof i.callbacks.onImageLoad?i.callbacks.onImageLoad.call(this):3===o&&i.callbacks.onSelectorChange&&"function"==typeof i.callbacks.onSelectorChange?i.callbacks.onSelectorChange.call(this):i.callbacks.onUpdate&&"function"==typeof i.callbacks.onUpdate&&i.callbacks.onUpdate.call(this)),N.call(this)}})},scrollTo:function(t,o){if("undefined"!=typeof t&&null!=t){var n=f.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l={trigger:"external",scrollInertia:r.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},s=e.extend(!0,{},l,o),c=Y.call(this,t),d=s.scrollInertia>0&&s.scrollInertia<17?17:s.scrollInertia;c[0]=X.call(this,c[0],"y"),c[1]=X.call(this,c[1],"x"),s.moveDragger&&(c[0]*=i.scrollRatio.y,c[1]*=i.scrollRatio.x),s.dur=ne()?0:d,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==r.axis&&i.overflowed[0]&&(s.dir="y",s.overwrite="all",G(n,c[0].toString(),s)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==r.axis&&i.overflowed[1]&&(s.dir="x",s.overwrite="none",G(n,c[1].toString(),s))},s.timeout)}})}},stop:function(){var t=f.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Q(t)})},disable:function(t){var o=f.call(this);return e(o).each(function(){var o=e(this);if(o.data(a)){o.data(a);N.call(this,"remove"),k.call(this),t&&B.call(this),M.call(this,!0),o.addClass(d[3])}})},destroy:function(){var t=f.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx),s=e("#mCSB_"+i.idx+"_container"),c=e(".mCSB_"+i.idx+"_scrollbar");r.live&&m(r.liveSelector||e(t).selector),N.call(this,"remove"),k.call(this),B.call(this),n.removeData(a),$(this,"mcs"),c.remove(),s.find("img."+d[2]).removeClass(d[2]),l.replaceWith(s.contents()),n.removeClass(o+" _"+a+"_"+i.idx+" "+d[6]+" "+d[7]+" "+d[5]+" "+d[3]).addClass(d[4])}})}},f=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},h=function(t){var o=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],i=["minimal","minimal-dark"],r=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,o)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,i)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,r)>-1?"outside":t.scrollbarPosition},m=function(e){l[e]&&(clearTimeout(l[e]),$(l,e))},p=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),i=n.opt,r=i.autoExpandScrollbar?" "+d[1]+"_expand":"",l=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_vertical"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+i.theme+" mCSB_scrollTools_horizontal"+r+"'><div class='"+d[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],s="yx"===i.axis?"mCSB_vertical_horizontal":"x"===i.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===i.axis?l[0]+l[1]:"x"===i.axis?l[1]:l[0],u="yx"===i.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",f=i.autoHideScrollbar?" "+d[6]:"",h="x"!==i.axis&&"rtl"===n.langDir?" "+d[7]:"";i.setWidth&&t.css("width",i.setWidth),i.setHeight&&t.css("height",i.setHeight),i.setLeft="y"!==i.axis&&"rtl"===n.langDir?"989999px":i.setLeft,t.addClass(o+" _"+a+"_"+n.idx+f+h).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+i.theme+" "+s+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+i.setTop+"; left:"+i.setLeft+";' dir='"+n.langDir+"' /></div>");var m=e("#mCSB_"+n.idx),p=e("#mCSB_"+n.idx+"_container");"y"===i.axis||i.advanced.autoExpandHorizontalScroll||p.css("width",x(p)),"outside"===i.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),m.addClass("mCSB_outside").after(c)):(m.addClass("mCSB_inside").append(c),p.wrap(u)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},x=function(t){var o=[t[0].scrollWidth,Math.max.apply(Math,t.children().map(function(){return e(this).outerWidth(!0)}).get())],a=t.parent().width();return o[0]>a?o[0]:o[1]>a?o[1]:"100%"},_=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx+"_container");if(n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis){i.css({width:"auto","min-width":0,"overflow-x":"scroll"});var r=Math.ceil(i[0].scrollWidth);3===n.advanced.autoExpandHorizontalScroll||2!==n.advanced.autoExpandHorizontalScroll&&r>i.parent().width()?i.css({width:r,"min-width":"100%","overflow-x":"inherit"}):i.css({"overflow-x":"inherit",position:"absolute"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(i[0].getBoundingClientRect().right+.4)-Math.floor(i[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},w=function(){var t=e(this),o=t.data(a),n=o.opt,i=e(".mCSB_"+o.idx+"_scrollbar:first"),r=oe(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",l=["<a href='#' class='"+d[13]+"' "+r+" />","<a href='#' class='"+d[14]+"' "+r+" />","<a href='#' class='"+d[15]+"' "+r+" />","<a href='#' class='"+d[16]+"' "+r+" />"],s=["x"===n.axis?l[2]:l[0],"x"===n.axis?l[3]:l[1],l[2],l[3]];n.scrollButtons.enable&&i.prepend(s[0]).append(s[1]).next(".mCSB_scrollTools").prepend(s[2]).append(s[3])},S=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[n.height()/i.outerHeight(!1),n.width()/i.outerWidth(!1)],c=[parseInt(r[0].css("min-height")),Math.round(l[0]*r[0].parent().height()),parseInt(r[1].css("min-width")),Math.round(l[1]*r[1].parent().width())],d=s&&c[1]<c[0]?c[0]:c[1],u=s&&c[3]<c[2]?c[2]:c[3];r[0].css({height:d,"max-height":r[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),r[1].css({width:u,"max-width":r[1].parent().width()-10})},b=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")],l=[i.outerHeight(!1)-n.height(),i.outerWidth(!1)-n.width()],s=[l[0]/(r[0].parent().height()-r[0].height()),l[1]/(r[1].parent().width()-r[1].width())];o.scrollRatio={y:s[0],x:s[1]}},C=function(e,t,o){var a=o?d[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(d[0]+" "+a),n.toggleClass(d[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(d[0]),n.removeClass(d[1])):(e.addClass(d[0]),n.addClass(d[1])))},y=function(){var t=e(this),o=t.data(a),n=e("#mCSB_"+o.idx),i=e("#mCSB_"+o.idx+"_container"),r=null==o.overflowed?i.height():i.outerHeight(!1),l=null==o.overflowed?i.width():i.outerWidth(!1),s=i[0].scrollHeight,c=i[0].scrollWidth;return s>r&&(r=s),c>l&&(l=c),[r>n.height(),l>n.width()]},B=function(){var t=e(this),o=t.data(a),n=o.opt,i=e("#mCSB_"+o.idx),r=e("#mCSB_"+o.idx+"_container"),l=[e("#mCSB_"+o.idx+"_dragger_vertical"),e("#mCSB_"+o.idx+"_dragger_horizontal")];if(Q(t),("x"!==n.axis&&!o.overflowed[0]||"y"===n.axis&&o.overflowed[0])&&(l[0].add(r).css("top",0),G(t,"_resetY")),"y"!==n.axis&&!o.overflowed[1]||"x"===n.axis&&o.overflowed[1]){var s=dx=0;"rtl"===o.langDir&&(s=i.width()-r.outerWidth(!1),dx=Math.abs(s/o.scrollRatio.x)),r.css("left",s),l[1].css("left",dx),G(t,"_resetX")}},T=function(){function t(){r=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(r),W.call(o[0])):t()},100)}var o=e(this),n=o.data(a),i=n.opt;if(!n.bindEvents){if(I.call(this),i.contentTouchScroll&&D.call(this),E.call(this),i.mouseWheel.enable){var r;t()}P.call(this),U.call(this),i.advanced.autoScrollOnFocus&&H.call(this),i.scrollButtons.enable&&F.call(this),i.keyboard.enable&&q.call(this),n.bindEvents=!0}},k=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=".mCSB_"+o.idx+"_scrollbar",l=e("#mCSB_"+o.idx+",#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,"+r+" ."+d[12]+",#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal,"+r+">a"),s=e("#mCSB_"+o.idx+"_container");n.advanced.releaseDraggableSelectors&&l.add(e(n.advanced.releaseDraggableSelectors)),n.advanced.extraDraggableSelectors&&l.add(e(n.advanced.extraDraggableSelectors)),o.bindEvents&&(e(document).add(e(!A()||top.document)).unbind("."+i),l.each(function(){e(this).unbind("."+i)}),clearTimeout(t[0]._focusTimeout),$(t[0],"_focusTimeout"),clearTimeout(o.sequential.step),$(o.sequential,"step"),clearTimeout(s[0].onCompleteTimeout),$(s[0],"onCompleteTimeout"),o.bindEvents=!1)},M=function(t){var o=e(this),n=o.data(a),i=n.opt,r=e("#mCSB_"+n.idx+"_container_wrapper"),l=r.length?r:e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[s[0].find(".mCSB_dragger"),s[1].find(".mCSB_dragger")];"x"!==i.axis&&(n.overflowed[0]&&!t?(s[0].add(c[0]).add(s[0].children("a")).css("display","block"),l.removeClass(d[8]+" "+d[10])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[0].css("display","none"),l.removeClass(d[10])):(s[0].css("display","none"),l.addClass(d[10])),l.addClass(d[8]))),"y"!==i.axis&&(n.overflowed[1]&&!t?(s[1].add(c[1]).add(s[1].children("a")).css("display","block"),l.removeClass(d[9]+" "+d[11])):(i.alwaysShowScrollbar?(2!==i.alwaysShowScrollbar&&c[1].css("display","none"),l.removeClass(d[11])):(s[1].css("display","none"),l.addClass(d[11])),l.addClass(d[9]))),n.overflowed[0]||n.overflowed[1]?o.removeClass(d[5]):o.addClass(d[5])},O=function(t){var o=t.type,a=t.target.ownerDocument!==document&&null!==frameElement?[e(frameElement).offset().top,e(frameElement).offset().left]:null,n=A()&&t.target.ownerDocument!==top.document&&null!==frameElement?[e(t.view.frameElement).offset().top,e(t.view.frameElement).offset().left]:[0,0];switch(o){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return a?[t.originalEvent.pageY-a[0]+n[0],t.originalEvent.pageX-a[1]+n[1],!1]:[t.originalEvent.pageY,t.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],r=t.originalEvent.touches.length||t.originalEvent.changedTouches.length;return t.target.ownerDocument!==document?[i.screenY,i.screenX,r>1]:[i.pageY,i.pageX,r>1];default:return a?[t.pageY-a[0]+n[0],t.pageX-a[1]+n[1],!1]:[t.pageY,t.pageX,!1]}},I=function(){function t(e,t,a,n){if(h[0].idleTimer=d.scrollInertia<233?250:0,o.attr("id")===f[1])var i="x",s=(o[0].offsetLeft-t+n)*l.scrollRatio.x;else var i="y",s=(o[0].offsetTop-e+a)*l.scrollRatio.y;G(r,s.toString(),{dir:i,drag:!0})}var o,n,i,r=e(this),l=r.data(a),d=l.opt,u=a+"_"+l.idx,f=["mCSB_"+l.idx+"_dragger_vertical","mCSB_"+l.idx+"_dragger_horizontal"],h=e("#mCSB_"+l.idx+"_container"),m=e("#"+f[0]+",#"+f[1]),p=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m,g=d.advanced.extraDraggableSelectors?e(!A()||top.document).add(e(d.advanced.extraDraggableSelectors)):e(!A()||top.document);m.bind("contextmenu."+u,function(e){e.preventDefault()}).bind("mousedown."+u+" touchstart."+u+" pointerdown."+u+" MSPointerDown."+u,function(t){if(t.stopImmediatePropagation(),t.preventDefault(),ee(t)){c=!0,s&&(document.onselectstart=function(){return!1}),L.call(h,!1),Q(r),o=e(this);var a=o.offset(),l=O(t)[0]-a.top,u=O(t)[1]-a.left,f=o.height()+a.top,m=o.width()+a.left;f>l&&l>0&&m>u&&u>0&&(n=l,i=u),C(o,"active",d.autoExpandScrollbar)}}).bind("touchmove."+u,function(e){e.stopImmediatePropagation(),e.preventDefault();var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;t(n,i,r,l)}),e(document).add(g).bind("mousemove."+u+" pointermove."+u+" MSPointerMove."+u,function(e){if(o){var a=o.offset(),r=O(e)[0]-a.top,l=O(e)[1]-a.left;if(n===r&&i===l)return;t(n,i,r,l)}}).add(p).bind("mouseup."+u+" touchend."+u+" pointerup."+u+" MSPointerUp."+u,function(){o&&(C(o,"active",d.autoExpandScrollbar),o=null),c=!1,s&&(document.onselectstart=null),L.call(h,!0)})},D=function(){function o(e){if(!te(e)||c||O(e)[2])return void(t=0);t=1,b=0,C=0,d=1,y.removeClass("mCS_touch_action");var o=I.offset();u=O(e)[0]-o.top,f=O(e)[1]-o.left,z=[O(e)[0],O(e)[1]]}function n(e){if(te(e)&&!c&&!O(e)[2]&&(T.documentTouchScroll||e.preventDefault(),e.stopImmediatePropagation(),(!C||b)&&d)){g=K();var t=M.offset(),o=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(o),W.push(a),z[2]=Math.abs(O(e)[0]-z[0]),z[3]=Math.abs(O(e)[1]-z[1]),B.overflowed[0])var i=D[0].parent().height()-D[0].height(),r=u-o>0&&o-u>-(i*B.scrollRatio.y)&&(2*z[3]<z[2]||"yx"===T.axis);if(B.overflowed[1])var l=D[1].parent().width()-D[1].width(),h=f-a>0&&a-f>-(l*B.scrollRatio.x)&&(2*z[2]<z[3]||"yx"===T.axis);r||h?(U||e.preventDefault(),b=1):(C=1,y.addClass("mCS_touch_action")),U&&e.preventDefault(),w="yx"===T.axis?[u-o,f-a]:"x"===T.axis?[null,f-a]:[u-o,null],I[0].idleTimer=250,B.overflowed[0]&&s(w[0],R,n,"y","all",!0),B.overflowed[1]&&s(w[1],R,n,"x",L,!0)}}function i(e){if(!te(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Q(y),p=K();var o=M.offset();h=O(e)[0]-o.top,m=O(e)[1]-o.left,E=[],W=[]}function r(e){if(te(e)&&!c&&!O(e)[2]){d=0,e.stopImmediatePropagation(),b=0,C=0,v=K();var t=M.offset(),o=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(v-g>30)){_=1e3/(v-p);var n="mcsEaseOut",i=2.5>_,r=i?[E[E.length-2],W[W.length-2]]:[0,0];x=i?[o-r[0],a-r[1]]:[o-h,a-m];var u=[Math.abs(x[0]),Math.abs(x[1])];_=i?[Math.abs(x[0]/4),Math.abs(x[1]/4)]:[_,_];var f=[Math.abs(I[0].offsetTop)-x[0]*l(u[0]/_[0],_[0]),Math.abs(I[0].offsetLeft)-x[1]*l(u[1]/_[1],_[1])];w="yx"===T.axis?[f[0],f[1]]:"x"===T.axis?[null,f[1]]:[f[0],null],S=[4*u[0]+T.scrollInertia,4*u[1]+T.scrollInertia];var y=parseInt(T.contentTouchScroll)||0;w[0]=u[0]>y?w[0]:0,w[1]=u[1]>y?w[1]:0,B.overflowed[0]&&s(w[0],S[0],n,"y",L,!1),B.overflowed[1]&&s(w[1],S[1],n,"x",L,!1)}}}function l(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?o[0]:o[3]:e>60?t>3?o[3]:o[2]:e>30?t>8?o[1]:t>6?o[0]:t>4?t:o[2]:t>8?t:o[3]}function s(e,t,o,a,n,i){e&&G(y,e.toString(),{dur:t,scrollEasing:o,dir:a,overwrite:n,drag:i})}var d,u,f,h,m,p,g,v,x,_,w,S,b,C,y=e(this),B=y.data(a),T=B.opt,k=a+"_"+B.idx,M=e("#mCSB_"+B.idx),I=e("#mCSB_"+B.idx+"_container"),D=[e("#mCSB_"+B.idx+"_dragger_vertical"),e("#mCSB_"+B.idx+"_dragger_horizontal")],E=[],W=[],R=0,L="yx"===T.axis?"none":"all",z=[],P=I.find("iframe"),H=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k],U=void 0!==document.body.style.touchAction&&""!==document.body.style.touchAction;I.bind(H[0],function(e){o(e)}).bind(H[1],function(e){n(e)}),M.bind(H[0],function(e){i(e)}).bind(H[2],function(e){r(e)}),P.length&&P.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(H[0],function(e){o(e),i(e)}).bind(H[1],function(e){n(e)}).bind(H[2],function(e){r(e)})})})},E=function(){function o(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,o){d.type=o&&i?"stepped":"stepless",d.scrollAmount=10,j(r,e,t,"mcsLinearOut",o?60:null)}var i,r=e(this),l=r.data(a),s=l.opt,d=l.sequential,u=a+"_"+l.idx,f=e("#mCSB_"+l.idx+"_container"),h=f.parent();f.bind("mousedown."+u,function(){t||i||(i=1,c=!0)}).add(document).bind("mousemove."+u,function(e){if(!t&&i&&o()){var a=f.offset(),r=O(e)[0]-a.top+f[0].offsetTop,c=O(e)[1]-a.left+f[0].offsetLeft;r>0&&r<h.height()&&c>0&&c<h.width()?d.step&&n("off",null,"stepped"):("x"!==s.axis&&l.overflowed[0]&&(0>r?n("on",38):r>h.height()&&n("on",40)),"y"!==s.axis&&l.overflowed[1]&&(0>c?n("on",37):c>h.width()&&n("on",39)))}}).bind("mouseup."+u+" dragend."+u,function(){t||(i&&(i=0,n("off",null)),c=!1)})},W=function(){function t(t,a){if(Q(o),!z(o,t.target)){var r="auto"!==i.mouseWheel.deltaFactor?parseInt(i.mouseWheel.deltaFactor):s&&t.deltaFactor<100?100:t.deltaFactor||100,d=i.scrollInertia;if("x"===i.axis||"x"===i.mouseWheel.axis)var u="x",f=[Math.round(r*n.scrollRatio.x),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.width()?.9*l.width():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),p=c[1][0].offsetLeft,g=c[1].parent().width()-c[1].width(),v="y"===i.mouseWheel.axis?t.deltaY||a:t.deltaX;else var u="y",f=[Math.round(r*n.scrollRatio.y),parseInt(i.mouseWheel.scrollAmount)],h="auto"!==i.mouseWheel.scrollAmount?f[1]:f[0]>=l.height()?.9*l.height():f[0],m=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),p=c[0][0].offsetTop,g=c[0].parent().height()-c[0].height(),v=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||((i.mouseWheel.invert||t.webkitDirectionInvertedFromDevice)&&(v=-v),i.mouseWheel.normalizeDelta&&(v=0>v?-1:1),(v>0&&0!==p||0>v&&p!==g||i.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),t.deltaFactor<5&&!i.mouseWheel.normalizeDelta&&(h=t.deltaFactor,d=17),G(o,(m-v*h).toString(),{dir:u,dur:d}))}}if(e(this).data(a)){var o=e(this),n=o.data(a),i=n.opt,r=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],d=e("#mCSB_"+n.idx+"_container").find("iframe");d.length&&d.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+r,function(e,o){t(e,o)})})}),l.bind("mousewheel."+r,function(e,o){t(e,o)})}},R=new Object,A=function(t){var o=!1,a=!1,n=null;if(void 0===t?a="#empty":void 0!==e(t).attr("id")&&(a=e(t).attr("id")),a!==!1&&void 0!==R[a])return R[a];if(t){try{var i=t.contentDocument||t.contentWindow.document;n=i.body.innerHTML}catch(r){}o=null!==n}else{try{var i=top.document;n=i.body.innerHTML}catch(r){}o=null!==n}return a!==!1&&(R[a]=o),o},L=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},z=function(t,o){var n=o.nodeName.toLowerCase(),i=t.data(a).opt.mouseWheel.disableOver,r=["select","textarea"];return e.inArray(n,i)>-1&&!(e.inArray(n,r)>-1&&!e(o).is(":focus"))},P=function(){var t,o=e(this),n=o.data(a),i=a+"_"+n.idx,r=e("#mCSB_"+n.idx+"_container"),l=r.parent(),s=e(".mCSB_"+n.idx+"_scrollbar ."+d[12]);s.bind("mousedown."+i+" touchstart."+i+" pointerdown."+i+" MSPointerDown."+i,function(o){c=!0,e(o.target).hasClass("mCSB_dragger")||(t=1)}).bind("touchend."+i+" pointerup."+i+" MSPointerUp."+i,function(){c=!1}).bind("click."+i,function(a){if(t&&(t=0,e(a.target).hasClass(d[12])||e(a.target).hasClass("mCSB_draggerRail"))){Q(o);var i=e(this),s=i.find(".mCSB_dragger");if(i.parent(".mCSB_scrollTools_horizontal").length>0){if(!n.overflowed[1])return;var c="x",u=a.pageX>s.offset().left?-1:1,f=Math.abs(r[0].offsetLeft)-u*(.9*l.width())}else{if(!n.overflowed[0])return;var c="y",u=a.pageY>s.offset().top?-1:1,f=Math.abs(r[0].offsetTop)-u*(.9*l.height())}G(o,f.toString(),{dir:c,scrollEasing:"mcsEaseInOut"})}})},H=function(){var t=e(this),o=t.data(a),n=o.opt,i=a+"_"+o.idx,r=e("#mCSB_"+o.idx+"_container"),l=r.parent();r.bind("focusin."+i,function(){var o=e(document.activeElement),a=r.find(".mCustomScrollBox").length,i=0;o.is(n.advanced.autoScrollOnFocus)&&(Q(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(i+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ae(o)[0],ae(o)[1]],a=[r[0].offsetTop,r[0].offsetLeft],s=[a[0]+e[0]>=0&&a[0]+e[0]<l.height()-o.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<l.width()-o.outerWidth(!1)],c="yx"!==n.axis||s[0]||s[1]?"all":"none";"x"===n.axis||s[0]||G(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:i}),"y"===n.axis||s[1]||G(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:i})},t[0]._focusTimer))})},U=function(){var t=e(this),o=t.data(a),n=a+"_"+o.idx,i=e("#mCSB_"+o.idx+"_container").parent();i.bind("scroll."+n,function(){0===i.scrollTop()&&0===i.scrollLeft()||e(".mCSB_"+o.idx+"_scrollbar").css("visibility","hidden")})},F=function(){var t=e(this),o=t.data(a),n=o.opt,i=o.sequential,r=a+"_"+o.idx,l=".mCSB_"+o.idx+"_scrollbar",s=e(l+">a");s.bind("contextmenu."+r,function(e){e.preventDefault()}).bind("mousedown."+r+" touchstart."+r+" pointerdown."+r+" MSPointerDown."+r+" mouseup."+r+" touchend."+r+" pointerup."+r+" MSPointerUp."+r+" mouseout."+r+" pointerout."+r+" MSPointerOut."+r+" click."+r,function(a){function r(e,o){i.scrollAmount=n.scrollButtons.scrollAmount,j(t,e,o)}if(a.preventDefault(),ee(a)){var l=e(this).attr("class");switch(i.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===i.type)return;c=!0,o.tweenRunning=!1,r("on",l);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===i.type)return;c=!1,i.dir&&r("off",l);break;case"click":if("stepped"!==i.type||o.tweenRunning)return;r("on",l)}}})},q=function(){function t(t){function a(e,t){r.type=i.keyboard.scrollType,r.scrollAmount=i.keyboard.scrollAmount,"stepped"===r.type&&n.tweenRunning||j(o,e,t)}switch(t.type){case"blur":n.tweenRunning&&r.dir&&a("off",null);break;case"keydown":case"keyup":var l=t.keyCode?t.keyCode:t.which,s="on";if("x"!==i.axis&&(38===l||40===l)||"y"!==i.axis&&(37===l||39===l)){if((38===l||40===l)&&!n.overflowed[0]||(37===l||39===l)&&!n.overflowed[1])return;"keyup"===t.type&&(s="off"),e(document.activeElement).is(u)||(t.preventDefault(),t.stopImmediatePropagation(),a(s,l))}else if(33===l||34===l){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Q(o);var f=34===l?-1:1;if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=Math.abs(c[0].offsetLeft)-f*(.9*d.width());else var h="y",m=Math.abs(c[0].offsetTop)-f*(.9*d.height());G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}else if((35===l||36===l)&&!e(document.activeElement).is(u)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===i.axis||"yx"===i.axis&&n.overflowed[1]&&!n.overflowed[0])var h="x",m=35===l?Math.abs(d.width()-c.outerWidth(!1)):0;else var h="y",m=35===l?Math.abs(d.height()-c.outerHeight(!1)):0;G(o,m.toString(),{dir:h,scrollEasing:"mcsEaseInOut"})}}}var o=e(this),n=o.data(a),i=n.opt,r=n.sequential,l=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),d=c.parent(),u="input,textarea,select,datalist,keygen,[contenteditable='true']",f=c.find("iframe"),h=["blur."+l+" keydown."+l+" keyup."+l];f.length&&f.each(function(){e(this).bind("load",function(){A(this)&&e(this.contentDocument||this.contentWindow.document).bind(h[0],function(e){t(e)})})}),s.attr("tabindex","0").bind(h[0],function(e){t(e)})},j=function(t,o,n,i,r){function l(e){u.snapAmount&&(f.scrollAmount=u.snapAmount instanceof Array?"x"===f.dir[0]?u.snapAmount[1]:u.snapAmount[0]:u.snapAmount);var o="stepped"!==f.type,a=r?r:e?o?p/1.5:g:1e3/60,n=e?o?7.5:40:2.5,s=[Math.abs(h[0].offsetTop),Math.abs(h[0].offsetLeft)],d=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],m="x"===f.dir[0]?s[1]+f.dir[1]*(d[1]*n):s[0]+f.dir[1]*(d[0]*n),v="x"===f.dir[0]?s[1]+f.dir[1]*parseInt(f.scrollAmount):s[0]+f.dir[1]*parseInt(f.scrollAmount),x="auto"!==f.scrollAmount?v:m,_=i?i:e?o?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",w=!!e;return e&&17>a&&(x="x"===f.dir[0]?s[1]:s[0]),G(t,x.toString(),{dir:f.dir[0],scrollEasing:_,dur:a,onComplete:w}),e?void(f.dir=!1):(clearTimeout(f.step),void(f.step=setTimeout(function(){l()},a)))}function s(){clearTimeout(f.step),$(f,"step"),Q(t)}var c=t.data(a),u=c.opt,f=c.sequential,h=e("#mCSB_"+c.idx+"_container"),m="stepped"===f.type,p=u.scrollInertia<26?26:u.scrollInertia,g=u.scrollInertia<1?17:u.scrollInertia;switch(o){case"on":if(f.dir=[n===d[16]||n===d[15]||39===n||37===n?"x":"y",n===d[13]||n===d[15]||38===n||37===n?-1:1],Q(t),oe(n)&&"stepped"===f.type)return;l(m);break;case"off":s(),(m||c.tweenRunning&&f.dir)&&l(!0)}},Y=function(t){var o=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===o.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===o.axis?null:t,n[1]=t.x?t.x:t.y||"y"===o.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},X=function(t,o){if(null!=t&&"undefined"!=typeof t){var n=e(this),i=n.data(a),r=i.opt,l=e("#mCSB_"+i.idx+"_container"),s=l.parent(),c=typeof t;o||(o="x"===r.axis?"x":"y");var d="x"===o?l.outerWidth(!1)-s.width():l.outerHeight(!1)-s.height(),f="x"===o?l[0].offsetLeft:l[0].offsetTop,h="x"===o?"left":"top";switch(c){case"function":return t();case"object":var m=t.jquery?t:e(t);if(!m.length)return;return"x"===o?ae(m)[1]:ae(m)[0];case"string":case"number":if(oe(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(d*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(f-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var p=f+parseInt(t.split("+=")[1]);return p>=0?0:Math.abs(p)}if(-1!==t.indexOf("px")&&oe(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(s.height()-l.outerHeight(!1));if("right"===t)return Math.abs(s.width()-l.outerWidth(!1));if("first"===t||"last"===t){var m=l.find(":"+t);return"x"===o?ae(m)[1]:ae(m)[0]}return e(t).length?"x"===o?ae(e(t))[1]:ae(e(t))[0]:(l.css(h,t),void u.update.call(null,n[0]))}}},N=function(t){function o(){return clearTimeout(f[0].autoUpdate),0===l.parents("html").length?void(l=null):void(f[0].autoUpdate=setTimeout(function(){return c.advanced.updateOnSelectorChange&&(s.poll.change.n=i(),s.poll.change.n!==s.poll.change.o)?(s.poll.change.o=s.poll.change.n,void r(3)):c.advanced.updateOnContentResize&&(s.poll.size.n=l[0].scrollHeight+l[0].scrollWidth+f[0].offsetHeight+l[0].offsetHeight+l[0].offsetWidth,s.poll.size.n!==s.poll.size.o)?(s.poll.size.o=s.poll.size.n,void r(1)):!c.advanced.updateOnImageLoad||"auto"===c.advanced.updateOnImageLoad&&"y"===c.axis||(s.poll.img.n=f.find("img").length,s.poll.img.n===s.poll.img.o)?void((c.advanced.updateOnSelectorChange||c.advanced.updateOnContentResize||c.advanced.updateOnImageLoad)&&o()):(s.poll.img.o=s.poll.img.n,void f.find("img").each(function(){n(this)}))},c.advanced.autoUpdateTimeout))}function n(t){function o(e,t){return function(){ 381return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(d[2]),r(2)}if(e(t).hasClass(d[2]))return void r();var n=new Image;n.onload=o(n,a),n.src=t.src}function i(){c.advanced.updateOnSelectorChange===!0&&(c.advanced.updateOnSelectorChange="*");var e=0,t=f.find(c.advanced.updateOnSelectorChange);return c.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){e+=this.offsetHeight+this.offsetWidth}),e}function r(e){clearTimeout(f[0].autoUpdate),u.update.call(null,l[0],e)}var l=e(this),s=l.data(a),c=s.opt,f=e("#mCSB_"+s.idx+"_container");return t?(clearTimeout(f[0].autoUpdate),void $(f[0],"autoUpdate")):void o()},V=function(e,t,o){return Math.round(e/t)*t-o},Q=function(t){var o=t.data(a),n=e("#mCSB_"+o.idx+"_container,#mCSB_"+o.idx+"_container_wrapper,#mCSB_"+o.idx+"_dragger_vertical,#mCSB_"+o.idx+"_dragger_horizontal");n.each(function(){Z.call(this)})},G=function(t,o,n){function i(e){return s&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function r(){return[c.callbacks.alwaysTriggerOffsets||w>=S[0]+y,c.callbacks.alwaysTriggerOffsets||-B>=w]}function l(){var e=[h[0].offsetTop,h[0].offsetLeft],o=[x[0].offsetTop,x[0].offsetLeft],a=[h.outerHeight(!1),h.outerWidth(!1)],i=[f.height(),f.width()];t[0].mcs={content:h,top:e[0],left:e[1],draggerTop:o[0],draggerLeft:o[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-i[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-i[1])),direction:n.dir}}var s=t.data(a),c=s.opt,d={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(d,n),u=[n.dur,n.drag?0:n.dur],f=e("#mCSB_"+s.idx),h=e("#mCSB_"+s.idx+"_container"),m=h.parent(),p=c.callbacks.onTotalScrollOffset?Y.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?Y.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(s.trigger=n.trigger,0===m.scrollTop()&&0===m.scrollLeft()||(e(".mCSB_"+s.idx+"_scrollbar").css("visibility","visible"),m.scrollTop(0).scrollLeft(0)),"_resetY"!==o||s.contentReset.y||(i("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),s.contentReset.y=1),"_resetX"!==o||s.contentReset.x||(i("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),s.contentReset.x=1),"_resetY"!==o&&"_resetX"!==o){if(!s.contentReset.y&&t[0].mcs||!s.overflowed[0]||(i("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),s.contentReset.x=null),!s.contentReset.x&&t[0].mcs||!s.overflowed[1]||(i("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),s.contentReset.x=null),c.snapAmount){var v=c.snapAmount instanceof Array?"x"===n.dir?c.snapAmount[1]:c.snapAmount[0]:c.snapAmount;o=V(o,v,c.snapOffset)}switch(n.dir){case"x":var x=e("#mCSB_"+s.idx+"_dragger_horizontal"),_="left",w=h[0].offsetLeft,S=[f.width()-h.outerWidth(!1),x.parent().width()-x.width()],b=[o,0===o?0:o/s.scrollRatio.x],y=p[1],B=g[1],T=y>0?y/s.scrollRatio.x:0,k=B>0?B/s.scrollRatio.x:0;break;case"y":var x=e("#mCSB_"+s.idx+"_dragger_vertical"),_="top",w=h[0].offsetTop,S=[f.height()-h.outerHeight(!1),x.parent().height()-x.height()],b=[o,0===o?0:o/s.scrollRatio.y],y=p[0],B=g[0],T=y>0?y/s.scrollRatio.y:0,k=B>0?B/s.scrollRatio.y:0}b[1]<0||0===b[0]&&0===b[1]?b=[0,0]:b[1]>=S[1]?b=[S[0],S[1]]:b[0]=-b[0],t[0].mcs||(l(),i("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(h[0].onCompleteTimeout),J(x[0],_,Math.round(b[1]),u[1],n.scrollEasing),!s.tweenRunning&&(0===w&&b[0]>=0||w===S[0]&&b[0]<=S[0])||J(h[0],_,Math.round(b[0]),u[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!s.tweenRunning&&(i("onScrollStart")&&(l(),c.callbacks.onScrollStart.call(t[0])),s.tweenRunning=!0,C(x),s.cbOffsets=r())},onUpdate:function(){n.callbacks&&n.onUpdate&&i("whileScrolling")&&(l(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(h[0].onCompleteTimeout);var e=h[0].idleTimer||0;h[0].onCompleteTimeout=setTimeout(function(){i("onScroll")&&(l(),c.callbacks.onScroll.call(t[0])),i("onTotalScroll")&&b[1]>=S[1]-T&&s.cbOffsets[0]&&(l(),c.callbacks.onTotalScroll.call(t[0])),i("onTotalScrollBack")&&b[1]<=k&&s.cbOffsets[1]&&(l(),c.callbacks.onTotalScrollBack.call(t[0])),s.tweenRunning=!1,h[0].idleTimer=0,C(x,"hide")},e)}}})}},J=function(e,t,o,a,n,i,r){function l(){S.stop||(x||m.call(),x=K()-v,s(),x>=S.time&&(S.time=x>S.time?x+f-(x-S.time):x+f-1,S.time<x+1&&(S.time=x+1)),S.time<a?S.id=h(l):g.call())}function s(){a>0?(S.currVal=u(S.time,_,b,a,n),w[t]=Math.round(S.currVal)+"px"):w[t]=o+"px",p.call()}function c(){f=1e3/60,S.time=x+f,h=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return s(),setTimeout(e,.01)},S.id=h(l)}function d(){null!=S.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(S.id):clearTimeout(S.id),S.id=null)}function u(e,t,o,a,n){switch(n){case"linear":case"mcsLinear":return o*e/a+t;case"mcsLinearOut":return e/=a,e--,o*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?o/2*e*e+t:(e--,-o/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?o/2*Math.pow(2,10*(e-1))+t:(e--,o/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?o/2*e*e*e+t:(e-=2,o/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-o*(e*e*e*e-1)+t;case"easeOutStrong":return o*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var f,h,r=r||{},m=r.onStart||function(){},p=r.onUpdate||function(){},g=r.onComplete||function(){},v=K(),x=0,_=e.offsetTop,w=e.style,S=e._mTween[t];"left"===t&&(_=e.offsetLeft);var b=o-_;S.stop=0,"none"!==i&&d(),c()},K=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},Z=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],o=0;o<t.length;o++){var a=t[o];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},$=function(e,t){try{delete e[t]}catch(o){e[t]=null}},ee=function(e){return!(e.which&&1!==e.which)},te=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},oe=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ae=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]},ne=function(){function e(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}var t=e();return t?document[t]:!1};e.fn[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o]=function(t){return u[t]?u[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):u.init.apply(this,arguments)},e[o].defaults=i,window[o]=!0,e(window).bind("load",function(){e(n)[o](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var o,a,n=e(t),i=n.parents(".mCSB_container");if(i.length)return o=i.parent(),a=[i[0].offsetTop,i[0].offsetLeft],a[0]+ae(n)[0]>=0&&a[0]+ae(n)[0]<o.height()-n.outerHeight(!1)&&a[1]+ae(n)[1]>=0&&a[1]+ae(n)[1]<o.width()-n.outerWidth(!1)},mcsInSight:e.expr[":"].mcsInSight||function(t,o,a){var n,i,r,l,s=e(t),c=s.parents(".mCSB_container"),d="exact"===a[3]?[[1,0],[1,0]]:[[.9,.1],[.6,.4]];if(c.length)return n=[s.outerHeight(!1),s.outerWidth(!1)],r=[c[0].offsetTop+ae(s)[0],c[0].offsetLeft+ae(s)[1]],i=[c.parent()[0].offsetHeight,c.parent()[0].offsetWidth],l=[n[0]<i[0]?d[0]:d[1],n[1]<i[1]?d[0]:d[1]],r[0]-i[0]*l[0][0]<0&&r[0]+n[0]-i[0]*l[0][1]>=0&&r[1]-i[1]*l[1][0]<0&&r[1]+n[1]-i[1]*l[1][1]>=0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var o=e(t).data(a);if(o)return o.overflowed[0]||o.overflowed[1]}})})})});
vendor: 4,598 bytes, lines 381-408
381 382// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/jquery.fullscreen.min.js?ver=0.6.0 383/* 384 * jquery.fullscreen v0.6.0 385 * https://github.com/private-face/jquery.fullscreen 386 * 387 * Copyright (c) 2012–2016 Vladimir Zhuravlev 388 * Released under the MIT license 389 * https://github.com/private-face/jquery.fullscreen/blob/master/LICENSE 390 * 391 * Date: 2016-08-25 392 **/ 393(function(global, factory) { 394 if (typeof define === 'function' && define.amd) { 395 // AMD 396 define(['jquery'], function (jQuery) { 397 return factory(jQuery); 398 }); 399 } else if (typeof exports === 'object') { 400 // CommonJS/Browserify 401 factory(require('jquery')); 402 } else { 403 // Global 404 factory(global.jQuery); 405 } 406}(this, function($) { 407 408function defined(a){return"undefined"!=typeof a}function extend(a,b,c){var d=function(){};d.prototype=b.prototype,a.prototype=new d,a.prototype.constructor=a,b.prototype.constructor=b,a._super=b.prototype,c&&$.extend(a.prototype,c)}function native(a,b){var c;"string"==typeof a&&(b=a,a=document);for(var d=0;d<SUBST.length;++d){b=b.replace(SUBST[d][0],SUBST[d][1]);for(var e=0;e<VENDOR_PREFIXES.length;++e)if(c=VENDOR_PREFIXES[e],c+=0===e?b:b.charAt(0).toUpperCase()+b.substr(1),defined(a[c]))return a[c]}}var SUBST=[["",""],["exit","cancel"],["screen","Screen"]],VENDOR_PREFIXES=["","o","ms","moz","webkit","webkitCurrent"],ua=navigator.userAgent,fsEnabled=native("fullscreenEnabled"),parsedChromeUA=ua.match(/Android.*Chrome\/(\d+)\./),IS_ANDROID_CHROME=!!parsedChromeUA,CHROME_VERSION,ANDROID_CHROME_VERSION;IS_ANDROID_CHROME&&(ANDROID_CHROME_VERSION=parseInt(parsedChromeUA[1]));var IS_NATIVELY_SUPPORTED=(!IS_ANDROID_CHROME||ANDROID_CHROME_VERSION>37)&&defined(native("fullscreenElement"))&&(!defined(fsEnabled)||fsEnabled===!0),version=$.fn.jquery.split("."),JQ_LT_17=parseInt(version[0])<2&&parseInt(version[1])<7,FullScreenAbstract=function(){this.__options=null,this._fullScreenElement=null,this.__savedStyles={}};FullScreenAbstract.prototype={native:native,_DEFAULT_OPTIONS:{styles:{boxSizing:"border-box",MozBoxSizing:"border-box",WebkitBoxSizing:"border-box"},toggleClass:null},__documentOverflow:"",__htmlOverflow:"",_preventDocumentScroll:function(){this.__documentOverflow=document.body.style.overflow,this.__htmlOverflow=document.documentElement.style.overflow,$(this._fullScreenElement).is("body, html")||$("body, html").css("overflow","hidden")},_allowDocumentScroll:function(){document.body.style.overflow=this.__documentOverflow,document.documentElement.style.overflow=this.__htmlOverflow},_fullScreenChange:function(){this.__options&&(this.isFullScreen()?(this._preventDocumentScroll(),this._triggerEvents()):(this._allowDocumentScroll(),this._revertStyles(),this._triggerEvents(),this._fullScreenElement=null))},_fullScreenError:function(a){this.__options&&(this._revertStyles(),this._fullScreenElement=null,a&&$(document).trigger("fscreenerror",[a]))},_triggerEvents:function(){$(this._fullScreenElement).trigger(this.isFullScreen()?"fscreenopen":"fscreenclose"),$(document).trigger("fscreenchange",[this.isFullScreen(),this._fullScreenElement])},_saveAndApplyStyles:function(){var a=$(this._fullScreenElement);this.__savedStyles={};for(var b in this.__options.styles)this.__savedStyles[b]=this._fullScreenElement.style[b],this._fullScreenElement.style[b]=this.__options.styles[b];a.is("body")&&(document.documentElement.style.overflow=this.__options.styles.overflow),this.__options.toggleClass&&a.addClass(this.__options.toggleClass)},_revertStyles:function(){var a=$(this._fullScreenElement);for(var b in this.__options.styles)this._fullScreenElement.style[b]=this.__savedStyles[b];a.is("body")&&(document.documentElement.style.overflow=this.__savedStyles.overflow),this.__options.toggleClass&&a.removeClass(this.__options.toggleClass)},open:function(a,b){a!==this._fullScreenElement&&(this.isFullScreen()&&this.exit(),this._fullScreenElement=a,this.__options=$.extend(!0,{},this._DEFAULT_OPTIONS,b),this._saveAndApplyStyles())},exit:null,isFullScreen:null,isNativelySupported:function(){return IS_NATIVELY_SUPPORTED}};var FullScreenNative=function(){FullScreenNative._super.constructor.apply(this,arguments),this.exit=$.proxy(native("exitFullscreen"),document),this._DEFAULT_OPTIONS=$.extend(!0,{},this._DEFAULT_OPTIONS,{styles:{width:"100%",height:"100%"}}),$(document).bind(this._prefixedString("fullscreenchange")+" MSFullscreenChange",$.proxy(this._fullScreenChange,this)).bind(this._prefixedString("fullscreenerror")+" MSFullscreenError",$.proxy(this._fullScreenError,this))};extend(FullScreenNative,FullScreenAbstract,{VENDOR_PREFIXES:["","o","moz","
408webkit"],_prefixedString:function(a){return $.map(this.VENDOR_PREFIXES,function(b){return b+a}).join(" ")},open:function(a,b){FullScreenNative._super.open.apply(this,arguments);var c=native(a,"requestFullscreen");c.call(a)},exit:$.noop,isFullScreen:function(){return null!==native("fullscreenElement")},element:function(){return native("fullscreenElement")}});var FullScreenFallback=function(){FullScreenFallback._super.constructor.apply(this,arguments),this._DEFAULT_OPTIONS=$.extend({},this._DEFAULT_OPTIONS,{styles:{position:"fixed",zIndex:"2147483647",left:0,top:0,bottom:0,right:0}}),this.__delegateKeydownHandler()};extend(FullScreenFallback,FullScreenAbstract,{__isFullScreen:!1,__delegateKeydownHandler:function(){var a=$(document);a.delegate("*","keydown.fullscreen",$.proxy(this.__keydownHandler,this));var b=JQ_LT_17?a.data("events"):$._data(document).events,c=b.keydown;JQ_LT_17?b.live.unshift(b.live.pop()):c.splice(0,0,c.splice(c.delegateCount-1,1)[0])},__keydownHandler:function(a){return!this.isFullScreen()||27!==a.which||(this.exit(),!1)},_revertStyles:function(){FullScreenFallback._super._revertStyles.apply(this,arguments),this._fullScreenElement.offsetHeight},open:function(a){FullScreenFallback._super.open.apply(this,arguments),this.__isFullScreen=!0,this._fullScreenChange()},exit:function(){this.__isFullScreen&&(this.__isFullScreen=!1,this._fullScreenChange())},isFullScreen:function(){return this.__isFullScreen},element:function(){return this.__isFullScreen?this._fullScreenElement:null}}),$.fullscreen=IS_NATIVELY_SUPPORTED?new FullScreenNative:new FullScreenFallback,$.fn.fullscreen=function(a){var b=this[0];return a=$.extend({toggleClass:null,overflow:"hidden"},a),a.styles={overflow:a.overflow},delete a.overflow,b&&$.fullscreen.open(b,a),this}; 409//# sourceMappingURL=jquery.fullscreen.min.js.mapreturn $.fullscreen; 410})); 411// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/bwg_gallery_box.js?ver=1.8.13 412var isPopUpOpened = false; 413var bwg_overflow_initial_value = false; 414var bwg_overflow_x_initial_value = false; 415var bwg_overflow_y_initial_value = false; 416var bwg_current_filmstrip_pos; 417var total_thumbnail_count; 418var key; 419var startPoint; 420var endPoint; 421var bwg_image_info_pos; 422var filmstrip_width; 423var preloadCount; 424var filmstrip_thumbnail_width; 425var filmstrip_thumbnail_height; 426var addthis_share; 427var lightbox_comment_pos; 428var bwg_transition_duration; 429var bwg_playInterval; 430 431function gallery_box_ready() { 432 filmstrip_width; 433 preloadCount; 434 filmstrip_thumbnail_width = jQuery(".bwg_filmstrip_thumbnail").width(); 435 filmstrip_thumbnail_height = jQuery(".bwg_filmstrip_thumbnail").height(); 436 if ( gallery_box_data['open_with_fullscreen'] == 1 ) { 437 filmstrip_width = jQuery( window ).width(); 438 filmstrip_height = jQuery( window ).height(); 439 } else { 440 filmstrip_width = jQuery(".bwg_filmstrip_container").width(); 441 filmstrip_height = jQuery(".bwg_filmstrip_container").height(); 442 } 443 if ( gallery_box_data['filmstrip_direction'] == 'horizontal' ) { 444 preloadCount = parseInt(filmstrip_width/filmstrip_thumbnail_width) + gallery_box_data['preload_images_count']; 445 } 446 else { 447 preloadCount = parseInt(filmstrip_height/filmstrip_thumbnail_height) + gallery_box_data['preload_images_count']; 448 } 449 total_thumbnail_count = jQuery(".bwg_filmstrip_thumbnail").length; 450 451 key = parseInt(jQuery("#bwg_current_image_key").val()); 452 startPoint = 0; 453 endPoint = key+preloadCount; 454 455 jQuery(function() { 456 bwg_load_visible_images( key, preloadCount, total_thumbnail_count ); 457 jQuery(".pge_tabs li a").on("click", function(){ 458 jQuery(".pge_tabs_container > div").hide(); 459 jQuery(".pge_tabs li").removeClass("pge_active"); 460 jQuery(jQuery(this).attr("href")).show(); 461 jQuery(this).closest("li").addClass("pge_active"); 462 jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)); 463 return false; 464 }); 465 466 var data_rated = jQuery("#bwg_rated").attr("data-params"); 467 if ( typeof data_rated != "undefined" ) { 468 data_rated = JSON.parse(data_rated); 469 bwg_rating(data_rated['current_rate'], data_rated['current_rate_count'], data_rated['current_avg_rating'], data_rated['current_image_key']); 470 } 471 }); 472 473 if ( gallery_box_data['enable_addthis'] == 1 && gallery_box_data['addthis_profile_id'] ) { 474 addthis_share = { 475 url: gallery_box_data['share_url'] 476 } 477 } 478 lightbox_comment_pos = gallery_box_data['lightbox_comment_pos'];
479 bwg_image_info_pos = (jQuery(".bwg_ctrl_btn_container").length) ? jQuery(".bwg_ctrl_btn_container").height() : 0; 480 bwg_transition_duration = ((gallery_box_data['slideshow_interval'] < 4 * gallery_box_data['slideshow_effect_duration']) && (gallery_box_data['slideshow_interval'] != 0)) ? (gallery_box_data['slideshow_interval'] * 1000) / 4 : (gallery_box_data['slideshow_effect_duration'] * 1000); 481 gallery_box_data['bwg_transition_duration'] = bwg_transition_duration; 482 gallery_box_data['bwg_trans_in_progress'] = false; 483 484 /* Change close button position to IN LIGHTBOX, 485 if lightbox width/height is smaller than window 486 and if the button by default is out of lightbox.*/ 487 if ( (jQuery("#spider_popup_wrap").width() >= jQuery(window).width() 488 || jQuery("#spider_popup_wrap").height() >= jQuery(window).height()) 489 && parseInt(jQuery(".spider_popup_close").css("right")) < 0 ) { 490 jQuery(".spider_popup_close").attr("class", "spider_popup_close_fullscreen"); 491 } 492 493 /* Stop autoplay.*/ 494 window.clearInterval(bwg_playInterval); 495 /* Set watermark container size.*/ 496 497 bwg_current_filmstrip_pos = gallery_box_data['current_pos']; 498 /* Set filmstrip initial position.*/ 499 jQuery(document).on('keydown', function (e) { 500 if (jQuery("#bwg_name").is(":focus") || jQuery("#bwg_email").is(":focus") || jQuery("#bwg_comment").is(":focus") || jQuery("#bwg_captcha_input").is(":focus")) { 501 return; 502 } 503 if (e.key == 'ArrowRight' ) { /* Right arrow.*/ 504 if (parseInt(jQuery('#bwg_current_image_key').val()) == gallery_box_data.data.length - 1) { /* are current image is last? */ 505 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), 0) 506 } 507 else { 508 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), parseInt(j
508Query('#bwg_current_image_key').val()) + 1) 509 } 510 } 511 else if (e.key == 'ArrowLeft' ) { /* Left arrow.*/ 512 if (parseInt(jQuery('#bwg_current_image_key').val()) == 0) { /* are current image is first? */ 513 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), gallery_box_data.data.length - 1) 514 } 515 else { 516 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), parseInt(jQuery('#bwg_current_image_key').val()) - 1) 517 } 518 } 519 else if (e.key == 'Escape') { /* Esc.*/ 520 spider_destroypopup(1000); 521 } 522 else if ( e.key == 'Space' ) { /* Space.*/ 523 jQuery(".bwg_play_pause").trigger('click'); 524 } 525 }); 526 jQuery(window).resize(function() { 527 if (typeof jQuery().fullscreen !== 'undefined') { 528 if (jQuery.isFunction(jQuery().fullscreen)) { 529 if (!jQuery.fullscreen.isFullScreen()) { 530 bwg_popup_resize(); 531 } 532 } 533 } 534 }); 535 /* Popup current width/height.*/ 536 var bwg_popup_current_width = gallery_box_data['image_width']; 537 var bwg_popup_current_height = gallery_box_data['image_height']; 538 539 /* jQuery(document).ready(function () { */ 540 if ( gallery_box_data['enable_addthis'] == 1 && gallery_box_data['addthis_profile_id'] ) { 541 jQuery(".at4-share-outer").show(); 542 } 543 /* Increase image hit counter.*/ 544 spider_set_input_value('rate_ajax_task', 'save_hit_count'); 545 spider_rate_ajax_save('bwg_rate_form'); 546 var tempdata = gallery_box_data['data']; 547 var current_image_key = gallery_box_data['current_image_key']; 548 549 jQuery(".bwg_image_hits span").html(++tempdata[current_image_key]["hit_count"]); 550 var bwg_hash = window.location.hash; 551 if ( !bwg_hash || bwg_hash.indexOf("bwg") == "-1" ) { 552 location.replace("#bwg"+gallery_box_data['gallery_id']+"/"+gallery_box_data['current_image_id']); 553 history.replaceState(undefined, undefined, "#bwg"+gallery_box_data['gallery_id']+"/"+gallery_box_data['current_image_id']); 554 } 555 if (gallery_box_data['image_right_click'] == 1) { 556 /* Disable right click.*/ 557 jQuery(".bwg_image_wrap").bind("contextmenu", function (e) { 558 return false; 559 }); 560 jQuery(".bwg_image_wrap").css('webkitTouchCallout','none'); 561 } 562 jQuery('#spider_popup_wrap').bind('touchmove', function (event) { 563 event.preventDefault(); 564 }); 565 jQuery('#spider_popup_wrap .bwg_image_wrap').on("swiperight", function () { 566 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + gallery_box_data['data'].length - 1) % gallery_box_data['data'].length); 567 return false; 568 }); 569 jQuery('#spider_popup_wrap .bwg_image_wrap').on("swipeleft", function () { 570 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + 1) % gallery_box_data['data'].length); 571 return false; 572 }); 573 bwg_reset_zoom(); 574 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 575 var bwg_click = isMobile ? 'touchend' : 'click'; 576 jQuery("#spider_popup_left").on(bwg_click, function () { 577 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + gallery_box_data['data'].length - 1) % gallery_box_data['data'].length); 578 return false; 579 }); 580 jQuery("#spider_popup_right").on(bwg_click, function () { 581 bwg_change_image(parseInt(jQuery('#bwg_current_image_key').val()), (parseInt(jQuery('#bwg_current_image_key').val()) + 1) % gallery_box_data['data'].length); 582 return false; 583 }); 584 if (navigator.appVersion.indexOf("MSIE 10") != -1 || navigator.appVersion.indexOf("MSIE 9") != -1) { 585 setTimeout(function () { 586 bwg_popup_resize(); 587 }, 1); 588 } 589 else { 590 bwg_popup_resize(); 591 } 592 jQuery(".bwg_watermark").css({ display: 'none' }); 593 setTimeout(function () { 594 bwg_change_watermark_container(); 595 }, 500); 596 /* If browser doesn't support Fullscreen API.*/ 597 if (typeof jQuery().fullscreen !== 'undefined') { 598 if (jQuery.isFunction(jQuery().fullscreen)) { 599 if (!jQuery.fullscreen.isNativelySupported()) { 600 jQuery(".bwg_fullscreen").hide(); 601 } 602 } 603 } 604 /* Set image container height.*/ 605 if ( gallery_box_data['filmstrip_direction'] == 'horizontal' ) { 606 jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height() - gallery_box_data['image_filmstrip_he
606ight']); 607 jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width()); 608 } 609 else { 610 jQuery(".bwg_image_container").height(jQuery(".bwg_image_wrap").height()); 611 jQuery(".bwg_image_container").width(jQuery(".bwg_image_wrap").width() - gallery_box_data['image_filmstrip_width']); 612 } 613 /* Change default scrollbar in comments, ecommerce.*/ 614 if (typeof jQuery().mCustomScrollbar !== 'undefined' && jQuery.isFunction(jQuery().mCustomScrollbar)) { 615 jQuery(".bwg_comments,.bwg_ecommerce_panel, .bwg_image_info").mCustomScrollbar({ 616 scrollInertia: 150, 617 theme: 'dark-thick', 618 advanced:{ 619 updateOnContentResize: true 620 } 621 }); 622 } 623 var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel"; /*FF doesn't recognize mousewheel as of FF3.x*/ 624 jQuery('.bwg_filmstrip').on(mousewheelevt, function(e) { 625 var evt = window.event || e; /* Equalize event object.*/ 626 evt = evt.originalEvent ? evt.originalEvent : evt; /* Convert to originalEvent if possible.*/ 627 var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta; /* Check for detail first, because it is used by Opera and FF.*/ 628 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 629 if (delta > 0) { 630 /* Scroll up.*/ 631 jQuery(".bwg_filmstrip_left").trigger(isMobile ? 'touchend' : 'click'); 632 } 633 else { 634 /* Scroll down.*/ 635 jQuery(".bwg_filmstrip_right").trigger(isMobile ? 'touchend' : 'click'); 636 } 637 }); 638 639 jQuery(".bwg_filmstrip_right").on(bwg_click, function () { 640 jQuery( ".bwg_filmstrip_thumbnails" ).stop(true, false); 641 if ( gallery_box_data['left_or_top'] == 'left' ) { 642 if ( gallery_box_data['width_or_height'] == 'width' ) { /* left -X- width */ 643 if ( jQuery(".bwg_filmstrip_thumbnails").position().left >= - (jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width()) ) { 644 jQuery(".bwg_filmstrip_left").css({ opacity: 1 }); 645 if ( jQuery(".bwg_filmstrip_thumbnails").position().left < -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width() - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'] + gallery_box_data['all_images_right_left_space'])) ) { 646 jQuery(".bwg_filmstrip_thumbnails").animate({ 647 left: -( jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width() - gallery_box_data['all_images_right_left_space']) 648 }, 500, 'linear', function() { 649 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 650 }); 651 } 652 else { 653 jQuery(".bwg_filmstrip_thumbnails").animate({ 654 left: ( jQuery(".bwg_filmstrip_thumbnails").position().left - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width']) ) 655 }, 500, 'linear', function() { 656 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 657 }); 658 } 659 } 660 } 661 else { /* left -X- height */ 662 if ( jQuery(".bwg_filmstrip_thumbnails").position().left >= - (jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height()) ) { 663 jQuery(".bwg_filmstrip_left").css({ opacity: 1 }); 664 if ( (jQuery(".bwg_filmstrip_thumbnails").position().left) < ( - (jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height() - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'] + gallery_box_data['all_images_right_left_space'])))) { 665 jQuery(".bwg_filmstrip_thumbnails").animate({ 666 left: -( jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height() - gallery_box_data['all_images_right_left_space']) 667 }, 500, 'linear', function() { 668 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 669 }); 670 } else { 671 jQuery(".bwg_filmstrip_thumbnails").animate({ 672 left: (jQuery(".bwg_filmstrip_thumbnails").position().left - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'])) 673 }, 500, 'linear', function() { 674 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 675 }); 676 } 677 } 678 } 679 } 680 else { 681 if ( gallery_box_data['width_or_height'] == 'width' ) { /* top -X- width */ 682 if ( jQuery(".bwg_filmstrip_thumbnails").position().top >= - (jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width()) ) { 683 jQuery(".bwg_filmstrip_left").css({ opacity: 1 }); 684 if ( (jQuery(".bwg_filmstrip_thumbnails").position().top) < ( - (jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width() - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'] + gallery_box_data['all_images_right_left_space'])))) { 685 jQuery(".bwg_filmstrip_thumbnails").animate({ 686 left: -( jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width() - gallery_box_data['all_images_right_left_space']) 687 }, 500, 'linear', function() { 688 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 689 }); 690 } else { 691 jQuery(".bwg_filmstrip_thumbnails").animate({ 692 left: (jQuery(".bwg_filmstrip_thumbnails").position().top - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'])) 693 }, 500, 'linear', function() { 694 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 695 }); 696 } 697 } 698 } 699 else { /* top -X- height */ 700 if ( jQuery(".bwg_filmstrip_thumbnails").position().top >= - (jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height()) ) { 701 jQuery(".bwg_filmstrip_left").css({ opacity: 1 }); 702 if ( (jQuery(".bwg_filmstrip_thumbnails").position().top) < ( - (jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height() - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'] + gallery_box_data['all_images_right_left_space']) ) ) ) { 703 jQuery(".bwg_filmstrip_thumbnails").animate({ 704 top: -( jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height() - gallery_box_data['all_images_right_left_space']) 705 }, 500, 'linear', function() { 706 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 707 }); 708 } else { 709 jQuery(".bwg_filmstrip_thumbnails").animate({ 710 top: (jQuery(".bwg_filmstrip_thumbnails").position().top - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'])) 711 }, 500, 'linear', function() { 712 bwg_disable_lightbox_filmstrip_right_arrow( gallery_box_data ); 713 }); 714 } 715 } 716 } 717 } 718 }); 719 720 if ( gallery_box_data['left_or_top'] == 'left' ) { 721 jQuery(".bwg_filmstrip_left").on(bwg_click, function () { 722 jQuery( ".bwg_filmstrip_thumbnails" ).stop(true, false); 723 if ( jQuery(".bwg_filmstrip_thumbnails").position().left < 0 ) { 724 jQuery(".bwg_filmstrip_right").css({ opacity: 1 }); 725 if (jQuery(".bwg_filmstrip_thumbnails").position().left > - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'])) { 726 jQuery(".bwg_filmstrip_thumbnails").animate({ 727 left: 0 728 }, 500, 'linear', function() { 729 bwg_disable_lightbox_filmstrip_left_arrow( gallery_box_data ); 730 }); 731 } 732 else { 733 jQuery(".bwg_filmstrip_thumbnails").animate({ 734 left: (jQuery(".bwg_filmstrip_thumbnails").position().left + gallery_box_data['image_filmstrip_width'] + gallery_box_data['filmstrip_thumb_right_left_space'] ) 735 }, 500, 'linear', function() { 736 bwg_disable_lightbox_filmstrip_left_arrow( gallery_box_data ); 737 }); 738 } 739 } 740 }); 741 } 742 else { 743 jQuery(".bwg_filmstrip_left").on(bwg_click, function () { 744 jQuery( ".bwg_filmstrip_thumbnails" ).stop(true, false); 745 if ((jQuery(".bwg_filmstrip_thumbnails").position().top) < 0) { 746 jQuery(".bwg_filmstrip_right").css({ opacity: 1 }); 747 if (jQuery(".bwg_filmstrip_thumbnails").position().top > - (gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['image_filmstrip_width'])) { 748 jQuery(".bwg_filmstrip_thumbnails").animate({ 749 top: 0 750 }, 500, 'linear', function() { 751 bwg_disable_lightbox_filmstrip_left_arrow( gallery_box_data ); 752 }); 753 } 754 else { 755 jQuery(".bwg_filmstrip_thumbnails").animate({ 756 top: (jQuery(".bwg_filmstrip_thumbnails").position().top + gallery_box_data['image_filmstrip_width'] + gallery_box_data['filmstrip_thumb_right_left_space']) 757 }, 500, 'linear', function() { 758 bwg_disable_lightbox_filmstrip_left_arrow( gallery_box_data ); 759 }); 760 } 761 } 762 }); 763 } 764 765 if ( gallery_box_data['width_or_height'] == 'width' ) { 766 /* Set filmstrip initial position.*/ 767 bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").width(), '', gallery_box_data); 768 } 769 else { 770 /* Set filmstrip initial position.*/ 771 bwg_set_filmstrip_pos(jQuery(".bwg_filmstrip").height(), '', gallery_box_data); 772 } 773 /* Show/hide image title/description.*/ 774 jQuery(".bwg_info").on(bwg_click, function() { 775 if (jQuery(".bwg_image_info_container1").css("display") == 'none') { 776 jQuery(".bwg_image_info_container1").css("display", "table-cell"); 777 jQuery(".bwg_info").attr("title", bwg_objectsL10n.bwg_hide_info);
778 var bwg_image_info_pos = (jQuery(".bwg_ctrl_btn_container").length) ? jQuery(".bwg_ctrl_btn_container").height() : 0; 779 jQuery(".bwg_image_info").css("height","auto"); 780 bwg_info_height_set(); 781 } 782 else { 783 jQuery(".bwg_image_info_container1").css("display", "none"); 784 jQuery(".bwg_info").attr("title", bwg_objectsL10n.bwg_show_info); 785 } 786 }); 787 /* Show/hide image rating.*/ 788 jQuery(".bwg_rate").on(bwg_click, function() { 789 if (jQuery(".bwg_image_rate_container1").css("display") == 'none') { 790 jQuery(".bwg_image_rate_container1").css("display", "table-cell"); 791 jQuery(".bwg_rate").attr("title", bwg_objectsL10n.bwg_hide_rating); 792 } 793 else { 794 jQuery(".bwg_image_rate_container1").css("display", "none"); 795 jQuery(".bwg_rate").attr("title", bwg_objectsL10n.bwg_show_rating); 796 } 797 }); 798 /*Zoom*/ 799 jQuery('.bwg_zoom').on(bwg_click, function() { 800 var array = ["mousemove", "touchmove"]; 801 jQuery('figure.bwg_popup_image').each(function() { 802 var figure = jQuery(this); 803 if (!figure.hasClass('zoom')) { 804 jQuery.each(array, function (_, userEvent) { 805 figure.addClass('zoom'); 806 figure.on(userEvent, function (e) { 807 window.clearInterval(bwg_playInterval); 808 jQuery(".bwg_play_pause").attr("title", bwg_objectsL10n.bwg_play); 809 jQuery(".bwg_play_pause").attr("class", "bwg-icon-play bwg_ctrl_btn bwg_play_pause"); 810 var offsetX, offsetY, touchOffsetX, touchOffsetY; 811 var zoomer = e.target; 812 var rect = zoomer.getBoundingClientRect(); 813 if ( e.targetTouches ) { 814 touchOffsetX = e.targetTouches[0].clientX - rect.left; 815 touchOffsetY = e.targetTouches[0].clientY - rect.top; 816 } 817 e.offsetX ? offsetX = e.offsetX : offsetX = e.targetTouches ? touchOffsetX : zoomer.offsetHeight; 818 e.offsetY ? offsetY = e.offsetY : offsetY = e.targetTouches ? touchOffsetY : zoomer.offsetWidth; 819 x = offsetX / zoomer.offsetWidth * 100; 820 y = offsetY / zoomer.offsetHeight * 100; 821 zoomer.parentNode.style.backgroundPosition = x + '% ' + y + '%'; 822 }); 823 }); 824 } else { 825 jQuery.each(array, function (_, userEvent) { 826 figure.removeClass('zoom'); 827 figure.off(userEvent); 828 }) 829 } 830 }); 831 }); 832 833 /* Open/close comments.*/ 834 jQuery(".bwg_comment, .bwg_comments_close_btn").on(bwg_click, function() { bwg_comment() }); 835 /* Open/close ecommerce.*/ 836 jQuery(".bwg_ecommerce, .bwg_ecommerce_close_btn").on(bwg_click, function() { bwg_ecommerce() }); 837 /* Open/close control buttons.*/ 838 jQuery(".bwg_toggle_container").on(bwg_click, function () { 839 var bwg_open_toggle_btn_class = (gallery_box_data['lightbox_ctrl_btn_pos'] == 'top') ? 'bwg-icon-caret-up' : 'bwg-icon-caret-down'; 840 var bwg_close_toggle_btn_class = (gallery_box_data['lightbox_ctrl_btn_pos'] == 'top') ? 'bwg-icon-caret-down' : 'bwg-icon-caret-up'; 841 842 if (jQuery(".bwg_toggle_container i").hasClass(bwg_open_toggle_btn_class)) { 843 if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'bottom') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' && gallery_box_data['lightbox_rate_pos'] == 'bottom') { 844 jQuery(".bwg_image_rate").animate({bottom: 0}, 500); 845 } 846 else if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'top') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'top' && gallery_box_data['lightbox_rate_pos'] == 'top') { 847 jQuery(".bwg_image_rate").animate({top: 0}, 500); 848 } 849 if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'bottom') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' && gallery_box_data['lightbox_hit_pos'] == 'bottom') { 850 jQuery(".bwg_image_hit").animate({bottom: 0}, 500); 851 } 852 else if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'top') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'top' && gallery_box_data['lightbox_hit_pos'] == 'top') { 853 jQuery(".bwg_image_hit").animate({top: 0}, 500); 854 } 855 if ( gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' ) {
856 jQuery(".bwg_ctrl_btn_container").animate({ bottom : '-' + jQuery(".bwg_ctrl_btn_container").height()}, 500).addClass('closed'); 857 jQuery(".bwg_toggle_container").animate({ 858 bottom : 0 859 }, { 860 duration: 500, 861 complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn " + bwg_close_toggle_btn_class) } 862 }); 863 } else { 864 jQuery(".bwg_ctrl_btn_container").animate({ top : '-' + jQuery(".bwg_ctrl_btn_container").height()}, 500).addClass('closed'); 865 jQuery(".bwg_toggle_container").animate({ 866 top : 0 867 }, { 868 duration: 500, 869 complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn " + bwg_close_toggle_btn_class) } 870 }); 871 } 872 } 873 else { 874 if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'bottom') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' && gallery_box_data['lightbox_rate_pos'] == 'bottom') { 875 jQuery(".bwg_image_rate").animate({bottom: jQuery(".bwg_ctrl_btn_container").height()}, 500); 876 } 877 else if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'top') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'top' && gallery_box_data['lightbox_rate_pos'] == 'top') { 878 jQuery(".bwg_image_rate").animate({top: jQuery(".bwg_ctrl_btn_container").height()}, 500); 879 } 880 if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'bottom') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' && gallery_box_data['lightbox_hit_pos'] == 'bottom') { 881 jQuery(".bwg_image_hit").animate({bottom: jQuery(".bwg_ctrl_btn_container").height()}, 500); 882 } 883 else if ((!gallery_box_data['enable_image_filmstrip'] || gallery_box_data['lightbox_filmstrip_pos'] != 'top') && gallery_box_data['lightbox_ctrl_btn_pos'] == 'top' && gallery_box_data['lightbox_hit_pos'] == 'top') { 884 jQuery(".bwg_image_hit").animate({top: jQuery(".bwg_ctrl_btn_container").height()}, 500); 885 } 886 887 if ( gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' ) { 888 jQuery(".bwg_ctrl_btn_container").animate({ bottom: 0 }, 500).removeClass('closed'); 889 jQuery(".bwg_toggle_container").animate({ 890 bottom : jQuery(".bwg_ctrl_btn_container").height() 891 }, { 892 duration: 500, 893 complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn " + bwg_open_toggle_btn_class) } 894 }); 895 } else { 896 jQuery(".bwg_ctrl_btn_container").animate({ top: 0 }, 500).removeClass('closed'); 897 jQuery(".bwg_toggle_container").animate({ 898 top : jQuery(".bwg_ctrl_btn_container").height() 899 }, { 900 duration: 500, 901 complete: function () { jQuery(".bwg_toggle_container i").attr("class", "bwg_toggle_btn " + bwg_open_toggle_btn_class) } 902 }); 903 } 904 } 905 bwg_info_position( true ); 906 }); 907 /* Set window height not full screen */ 908 var bwg_windowheight = window.innerHeight; 909 /* Maximize/minimize.*/ 910 jQuery(".bwg_resize-full").on(bwg_click, function () { 911 bwg_resize_full(); 912 }); 913 /* Fullscreen.*/ 914 /*Toggle with mouse click*/ 915 jQuery(".bwg_fullscreen").on(bwg_click, function () { 916 jQuery(".bwg_watermark").css({display: 'none'}); 917 var comment_container_width = 0; 918 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 919 comment_container_width = jQuery(".bwg_comment_container").width() || jQuery(".bwg_ecommerce_container").width(); 920 } 921 function bwg_exit_fullscreen(windowheight) { 922 if (jQuery(window).width() > gallery_box_data['image_width']) { 923 bwg_popup_current_width = gallery_box_data['image_width']; 924 } 925 if (window.innerHeight > gallery_box_data['image_height']) { 926 bwg_popup_current_height = gallery_box_data['image_height']; 927 } 928 /* "Full width lightbox" sets yes.*/ 929 if (gallery_box_data['open_with_fullscreen']) { 930 bwg_popup_current_width = jQuery(window).width(); 931 bwg_popup_current_height = windowheight; 932 } 933 jQuery("#spider_popup_wrap").on("fscreenclose", function() { 934 jQuery("#spider_popup_wrap").css({ 935 width: bwg_popup_current_width,
936 height: bwg_popup_current_height, 937 left: '50%', 938 top: '50%', 939 marginLeft: -bwg_popup_current_width / 2, 940 marginTop: -bwg_popup_current_height / 2, 941 zIndex: 100000 942 }); 943 jQuery(".bwg_image_wrap").css({width: (bwg_popup_current_width - comment_container_width)}); 944 jQuery(".bwg_image_container").css({ 945 'height': (bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)), 946 'width': (bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)) 947 }); 948 jQuery(".bwg_image_info").css("height","auto"); 949 bwg_info_height_set(); 950 jQuery(".bwg_popup_image").css({ 951 'maxWidth': (bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)), 952 'maxHeight': (bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)) 953 }); 954 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 955 'maxWidth': (bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)), 956 'maxHeight': (bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)) 957 }); 958 bwg_resize_instagram_post(); 959 /* Set watermark container size.*/ 960 bwg_change_watermark_container(); 961 if ( gallery_box_data['width_or_height'] == 'width' ) { 962 jQuery(".bwg_filmstrip_container").css({width: bwg_popup_current_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 963 jQuery(".bwg_filmstrip").css({width: bwg_popup_current_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)- 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}); 964 /* Set filmstrip initial position.*/ 965 bwg_set_filmstrip_pos( bwg_popup_current_width - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data ); 966 } else { 967 jQuery(".bwg_filmstrip_container").css({height: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 968 jQuery(".bwg_filmstrip").css({height: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)- 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}); 969 /* Set filmstrip initial position.*/ 970 bwg_set_filmstrip_pos( bwg_popup_current_height - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data ); 971 gallery_box_data['filmstrip_direction'] == 'horizontal' ? '' : jQuery(".bwg_filmstrip_right").css({ top: (bwg_popup_current_height - jQuery('.bwg_filmstrip_right').height() ) }); 972 } 973 jQuery(".bwg_resize-full").show(); 974 jQuery(".bwg_resize-full").attr("class", "bwg-icon-expand bwg_ctrl_btn bwg_resize-full"); 975 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_maximize); 976 jQuery(".bwg_fullscreen").attr("class", "bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"); 977 jQuery(".bwg_fullscreen").attr("title", bwg_objectsL10n.bwg_fullscreen); 978 if (jQuery("#spider_popup_wrap").width() < jQuery(window).width()) { 979 if (jQuery("#spider_popup_wrap").height() < window.innerHeight) { 980 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 981 } 982 } 983 }); 984 } 985 if (typeof jQuery().fullscreen !== 'undefined') { 986 if (jQuery.isFunction(jQuery().fullscreen)) { 987 if (jQuery.fullscreen.isFullScreen()) { 988 /* Exit Fullscreen.*/ 989 jQuery.fullscreen.exit(); 990 bwg_exit_fullscreen(bwg_windowheight); 991 } 992 else { 993 /* Fullscreen.*/ 994 jQuery("#spider_popup_wrap").fullscreen(); 995 /*jQuery("#spider_popup_wrap").on("fscreenopen", function() { 996 if (jQuery.fullscreen.isFullScreen()) {*/ 997 var screen_width = screen.width; 998 var screen_height = screen.height; 999 jQuery("#spider_popup_wrap").css({ 1000 width: screen_width, 1001 height: screen_height, 1002 left: 0, 1003 top: 0, 1004 margin: 0, 1005 zIndex: 100000 1006 }); 1007 jQuery(".bwg_image_wrap").css({width: screen_width - comment_container_width}); 1008 jQuery(".bwg_image_container").css({height: (screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_he
1008ight'] : 0)), width: screen_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)}); 1009 jQuery(".bwg_image_info").css("height","auto"); 1010 bwg_info_height_set(); 1011 jQuery(".bwg_popup_image").css({ 1012 maxWidth: (screen_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)), 1013 maxHeight: (screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)) 1014 }); 1015 1016 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1017 maxWidth: (screen_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)), 1018 maxHeight: (screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)) 1019 }); 1020 1021 bwg_resize_instagram_post(); 1022 1023 /* Set watermark container size.*/ 1024 bwg_change_watermark_container(); 1025 if ( gallery_box_data['width_or_height'] == 'width') { 1026 jQuery(".bwg_filmstrip_container").css({width: screen_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 1027 jQuery(".bwg_filmstrip").css({width: screen_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}, 500); 1028 /* Set filmstrip initial position.*/ 1029 bwg_set_filmstrip_pos(screen_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 1030 } else { 1031 jQuery(".bwg_filmstrip_container").css({height: (screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal') ? 'comment_container_width' : 0)}); 1032 jQuery(".bwg_filmstrip").css({height: (screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2 * (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height() ) ) }); 1033 /* Set filmstrip initial position.*/ 1034 bwg_set_filmstrip_pos(screen_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height() ), '', gallery_box_data); 1035 gallery_box_data['filmstrip_direction'] == 'horizontal' ? '' : jQuery(".bwg_filmstrip_right").css({ top: (screen_height - jQuery('.bwg_filmstrip_right').height() ) }); 1036 } 1037 jQuery(".bwg_resize-full").hide(); 1038 jQuery(".bwg_fullscreen").attr("class", "bwg-icon-compress bwg_ctrl_btn bwg_fullscreen"); 1039 jQuery(".bwg_fullscreen").attr("title", bwg_objectsL10n.bwg_exit_fullscreen); 1040 jQuery(".spider_popup_close").attr("class", "spider_popup_close_fullscreen"); 1041 } 1042 } 1043 } 1044 1045 return false; 1046 }); 1047 /* Play/pause.*/ 1048 jQuery(".bwg_play_pause").on(bwg_click, function () { 1049 if (jQuery(".bwg_play_pause").length && jQuery(".bwg_play_pause").hasClass("bwg-icon-play") && !jQuery(".bwg_comment_container").hasClass("bwg_open")) { 1050 /* PLay.*/ 1051 bwg_play( gallery_box_data['data'] ); 1052 jQuery(".bwg_play_pause").attr("title", bwg_objectsL10n.bwg_pause); 1053 jQuery(".bwg_play_pause").attr("class", "bwg-icon-pause bwg_ctrl_btn bwg_play_pause"); 1054 } 1055 else { 1056 /* Pause.*/ 1057 window.clearInterval(bwg_playInterval); 1058 jQuery(".bwg_play_pause").attr("title", bwg_objectsL10n.bwg_play); 1059 jQuery(".bwg_play_pause").attr("class", "bwg-icon-play bwg_ctrl_bt
1059n bwg_play_pause"); 1060 } 1061 }); 1062 /* Open with autoplay.*/ 1063 if (gallery_box_data['open_with_autoplay']) { 1064 bwg_play( gallery_box_data['data'] ); 1065 jQuery(".bwg_play_pause").attr("title", bwg_objectsL10n.bwg_pause); 1066 jQuery(".bwg_play_pause").attr("class", "bwg-icon-pause bwg_ctrl_btn bwg_play_pause"); 1067 } 1068 /* Open with fullscreen.*/ 1069 if (gallery_box_data['open_with_fullscreen']) { 1070 bwg_open_with_fullscreen(); 1071 } 1072 1073 jQuery(".bwg_popup_image").removeAttr("width"); 1074 jQuery(".bwg_popup_image").removeAttr("height"); 1075 1076 jQuery(window).focus(function() { 1077 /* event_stack = [];*/ 1078 if (jQuery(".bwg_play_pause").length && !jQuery(".bwg_play_pause").hasClass("bwg-icon-play")) { 1079 bwg_play( gallery_box_data['data'] ); 1080 } 1081 /*var i = 0; 1082 jQuery(".bwg_slider").children("span").each(function () { 1083 if (jQuery(this).css('opacity') == 1) { 1084 jQuery("#bwg_current_image_key").val(i); 1085 } 1086 i++; 1087 });*/ 1088 }); 1089 jQuery(window).blur(function() { 1090 event_stack = []; 1091 window.clearInterval(bwg_playInterval); 1092 }); 1093 var lightbox_ctrl_btn_pos = gallery_box_data['lightbox_ctrl_btn_pos']; 1094 if ( gallery_box_data['open_ecommerce'] == 1) { 1095 setTimeout(function(){ bwg_ecommerce(); }, 400); 1096 } 1097 if ( gallery_box_data['open_comment'] == 1 ) { 1098 bwg_comment(); 1099 } 1100} 1101 1102function spider_createpopup(url, current_view, width, height, duration, description, lifetime, lightbox_ctrl_btn_pos) { 1103 url = url.replace(/&/g, '&'); 1104 if (isPopUpOpened) { return }; 1105 isPopUpOpened = true; 1106 if (spider_isunsupporteduseragent()) { 1107 return; 1108 } 1109 bwg_overflow_initial_value = jQuery("html").css("overflow"); 1110 bwg_overflow_x_initial_value = jQuery("html").css("overflow-x"); 1111 bwg_overflow_y_initial_value = jQuery("html").css("overflow-y"); 1112 jQuery("html").attr("style", "overflow:hidden !important;"); 1113 jQuery("#bwg_spider_popup_loading_" + current_view).show(); 1114 jQuery("#spider_popup_overlay_" + current_view).css({display: "block"}); 1115 jQuery.ajax({ 1116 type: "GET", 1117 url: url, 1118 success: function (data) { 1119 var popup = jQuery( 1120 '<div id="spider_popup_wrap" class="spider_popup_wrap" style="' + 1121 ' width:' + width + 'px;' + 1122 ' height:' + height + 'px;' + 1123 ' margin-top:-' + height / 2 + 'px;' + 1124 ' margin-left: -' + width / 2 + 'px; ">' + 1125 data + 1126 '</div>') 1127 .hide() 1128 .appendTo("body"); 1129 gallery_box_ready(); 1130 spider_showpopup(description, lifetime, popup, duration, lightbox_ctrl_btn_pos); 1131 1132 if ( typeof addthis !== 'undefined' ) { 1133 jQuery(".addthis-smartlayers").show(); 1134 var addThisTimer = setInterval(function () { 1135 if (typeof addthis.layers.refresh !== 'undefined') { 1136 clearInterval(addThisTimer); 1137 addthis.layers.refresh(); 1138 } 1139 }, 100); 1140 } 1141 1142 }, 1143 beforeSend: function() {}, 1144 complete:function() {} 1145 }); 1146} 1147 1148function spider_showpopup( description, lifetime, popup, duration, lightbox_ctrl_btn_pos ) { 1149 var data = gallery_box_data['data']; 1150 var cur_image_key = parseInt(jQuery('#bwg_current_image_key').val()); 1151 if ( typeof data[cur_image_key] != 'undefined' ) { 1152 isPopUpOpened = true; 1153 var is_embed = data[cur_image_key]['filetype'].indexOf("EMBED_") > -1 ? true : false; 1154 if ( !is_embed ) { 1155 if ( jQuery('#spider_popup_wrap .bwg_popup_image_spun img').prop('complete') ) { 1156 /* Already loaded. */ 1157 bwg_first_image_load(popup, lightbox_ctrl_btn_pos); 1158 } 1159 else { 1160 jQuery('#spider_popup_wrap .bwg_popup_image_spun img').on('load error', function () { 1161 bwg_first_image_load(popup, lightbox_ctrl_btn_pos); 1162 }); 1163 } 1164 } 1165 else { 1166 bwg_first_image_load(popup, lightbox_ctrl_btn_pos); 1167 } 1168 if ( data[cur_image_key]['filetype'] == 'EMBED_OEMBED_INSTAGRAM_POST' ) { 1169 /* Uses Instagram oEmbed data to create iframe tag. */ 1170 if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) { 1171 instgrm.Embeds.process(); 1172 var embed_max_height = parseInt(jQuery('#bwg_image_container').height()); 1173 jQuery('.bwg_embed_frame .instagram-media').css({ 1174 'max-height': embed_max_height + 'px' 1175 }); 1176 } 1177 } 1178 } 1179} 1180 1181function bwg_first_image_load(popup, lightbox_ctrl_btn_pos) { 1182 popup.show(); 1183 1184 if ( gallery_box_data['data'][key]['alt'] == '' && gallery_box_data['data'][key]['description'] == '' ) { 1185 jQuery(".bwg_info").hide(); 1186 } 1187 else { 1188 jQuery(".bwg_info").show(); 1189 } 1190
1191 var bwg_ctrl_btn_container_height = jQuery(".bwg_ctrl_btn_container").height(); 1192 if (lightbox_ctrl_btn_pos == 'bottom') { 1193 jQuery(".bwg_toggle_container").css("bottom", bwg_ctrl_btn_container_height + "px"); 1194 } 1195 else if (lightbox_ctrl_btn_pos == 'top') { 1196 jQuery(".bwg_toggle_container").css("top", bwg_ctrl_btn_container_height + "px"); 1197 } 1198 jQuery( ".bwg_spider_popup_loading" ).hide(); 1199 if ( gallery_box_data['preload_images'] == 1 ) { 1200 bwg_preload_images( parseInt( jQuery( '#bwg_current_image_key' ).val() ) ); 1201 } 1202 bwg_load_filmstrip(); 1203 bwg_info_height_set(); 1204} 1205 1206function spider_isunsupporteduseragent() { 1207 return (!window.XMLHttpRequest); 1208} 1209 1210function spider_destroypopup(duration) { 1211 jQuery(".addthis-smartlayers").hide(); 1212 if (document.getElementById("spider_popup_wrap") != null) { 1213 if (typeof jQuery().fullscreen !== 'undefined' && jQuery.isFunction(jQuery().fullscreen)) { 1214 if (jQuery.fullscreen.isFullScreen()) { 1215 jQuery.fullscreen.exit(); 1216 } 1217 } 1218 if (typeof enable_addthis != "undefined" && enable_addthis) { 1219 jQuery(".at4-share-outer").hide(); 1220 } 1221 setTimeout(function () { 1222 jQuery(".spider_popup_wrap").remove(); 1223 jQuery(".bwg_spider_popup_loading").css({display: "none"}); 1224 jQuery(".spider_popup_overlay").css({display: "none"}); 1225 jQuery(document).off("keydown"); 1226 if ( bwg_overflow_initial_value !== false ) { 1227 jQuery("html").css("overflow", bwg_overflow_initial_value); 1228 } 1229 if ( bwg_overflow_x_initial_value !== false ) { 1230 jQuery("html").css("overflow-x", bwg_overflow_x_initial_value); 1231 } 1232 if ( bwg_overflow_y_initial_value !== false ) { 1233 jQuery("html").css("overflow-y", bwg_overflow_y_initial_value); 1234 } 1235 }, 20); 1236 } 1237 isPopUpOpened = false; 1238 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 1239 var viewportmeta = document.querySelector('meta[name="viewport"]'); 1240 if (isMobile && viewportmeta) { 1241 viewportmeta.content = 'width=device-width, initial-scale=1'; 1242 } 1243 var scrrr = jQuery(document).scrollTop(); 1244 history.pushState(history.state, null, window.location.origin + window.location.pathname + window.location.search); 1245 jQuery(document).scrollTop(scrrr); 1246 if ( typeof gallery_box_data['bwg_playInterval'] != "undefined" ) { 1247 clearInterval(gallery_box_data['bwg_playInterval']); 1248 } 1249} 1250 1251function get_ajax_pricelist(){ 1252 var post_data = {}; 1253 jQuery(".add_to_cart_msg").html(""); 1254 post_data["ajax_task"] = "display"; 1255 post_data["image_id"] = jQuery('#bwg_popup_image').attr('image_id'); 1256 1257 /* Loading. */ 1258 jQuery("#ecommerce_ajax_loading").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 1259 jQuery("#ecommerce_opacity_div").css('width', jQuery(".bwg_ecommerce_panel").css('width')); 1260 jQuery("#ecommerce_opacity_div").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 1261 jQuery("#ecommerce_loading_div").css('width', jQuery(".bwg_ecommerce_panel").css('width')); 1262 jQuery("#ecommerce_loading_div").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 1263 1264 jQuery("#ecommerce_opacity_div").css('display', 'block'); 1265 jQuery("#ecommerce_loading_div").css('display', 'table-cell'); 1266 jQuery.ajax({ 1267 type: "POST", 1268 url: jQuery('#bwg_ecommerce_form').attr('action'), 1269 data: post_data, 1270 success: function (data) { 1271 jQuery(".pge_tabs li a").on("click", function(){ 1272 jQuery(".pge_tabs_container > div").hide(); 1273 jQuery(".pge_tabs li").removeClass("pge_active"); 1274 jQuery(jQuery(this).attr("href")).show(); 1275 jQuery(this).closest("li").addClass("pge_active"); 1276 jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)); 1277 return false; 1278 }); 1279 var manual = jQuery(data).find('.manual').html(); 1280 jQuery('.manual').html(manual); 1281 1282 var downloads = jQuery(data).find('.downloads').html(); 1283 jQuery('.downloads').html(downloads); 1284 1285 var pge_options = jQuery(data).find('.pge_options').html(); 1286 jQuery('.pge_options').html(pge_options); 1287 1288 var pge_add_to_cart = jQuery(data).find('.pge_add_to_cart').html(); 1289 jQuery('.pge_add_to_cart').html(pge_add_to_cart); 1290 }, 1291 beforeSend: function(){ 1292 }, 1293 complete:function(){ 1294 jQuery("#ecommerce_opacity_div").css('display', 'none'); 1295 jQuery("#ecommerce_loading_div").css('display', 'none'); 1296 1297 /* 1298 Update scrollbar. 1299 jQuery(".bwg_ecommece_panel").mCustomScrollbar({scrollInertia: 150 }); 1300 jQuery(".bwg_ecommerce_close_btn").click(bwg_ecommerce); 1301 */ 1302 } 1303 }); 1304 return false;
1305} 1306 1307/* Submit popup. */ 1308function spider_ajax_save(form_id) { 1309 var post_data = {}; 1310 post_data["bwg_name"] = jQuery("#bwg_name").val(); 1311 post_data["bwg_comment"] = jQuery("#bwg_comment").val(); 1312 post_data["bwg_email"] = jQuery("#bwg_email").val(); 1313 post_data["bwg_captcha_input"] = jQuery("#bwg_captcha_input").val(); 1314 post_data["ajax_task"] = jQuery("#ajax_task").val(); 1315 post_data["image_id"] = jQuery("#image_id").val(); 1316 post_data["comment_id"] = jQuery("#comment_id").val(); 1317 1318 /* Loading. */ 1319 jQuery("#ajax_loading").css('height', jQuery(".bwg_comments").css('height')); 1320 jQuery("#opacity_div").css('width', jQuery(".bwg_comments").css('width')); 1321 jQuery("#opacity_div").css('height', jQuery(".bwg_comments").css('height')); 1322 jQuery("#loading_div").css('width', jQuery(".bwg_comments").css('width')); 1323 jQuery("#loading_div").css('height', jQuery(".bwg_comments").css('height')); 1324 document.getElementById("opacity_div").style.display = ''; 1325 document.getElementById("loading_div").style.display = 'table-cell'; 1326 jQuery.ajax({ 1327 type: "POST", 1328 url: jQuery('#' + form_id).attr('action'), 1329 data: post_data, 1330 success: function (data) { 1331 jQuery('.bwg_comments').mCustomScrollbar('destroy'); 1332 var str = jQuery(data).find('.bwg_comments').html(); 1333 jQuery('.bwg_comments').html(str); 1334 }, 1335 beforeSend: function(){ 1336 }, 1337 complete:function(){ 1338 document.getElementById("opacity_div").style.display = 'none'; 1339 document.getElementById("loading_div").style.display = 'none'; 1340 /* Update scrollbar. */ 1341 jQuery(".bwg_comments").mCustomScrollbar({ 1342 scrollInertia: 150, 1343 theme: 'dark-thick', 1344 advanced:{ 1345 updateOnContentResize: true 1346 } 1347 }); 1348 /* Bind comment container close function to close button. */ 1349 jQuery(".bwg_comments_close_btn").click(bwg_comment); 1350 bwg_captcha_refresh('bwg_captcha'); 1351 } 1352 }); 1353 return false; 1354} 1355 1356/* Submit rating. */ 1357function spider_rate_ajax_save(form_id, rate) { 1358 var post_data = {}; 1359 post_data["image_id"] = jQuery("#rate_image_id").val(); 1360 post_data["rate"] = (typeof rate != "undefined") ? rate : jQuery("#" + form_id + " input[name='score']").val(); 1361 post_data["ajax_task"] = jQuery("#rate_ajax_task").val(); 1362 var action_url = jQuery("#bwg_image_container").data("action"); 1363 return jQuery.ajax({ 1364 type: "POST", 1365 url: action_url, 1366 data: post_data, 1367 success: function (data) { 1368 var str = jQuery(data).find('#' + form_id).html(); 1369 jQuery('#' + form_id).html(str); 1370 }, 1371 beforeSend: function(){ 1372 }, 1373 complete:function(){} 1374 }); 1375} 1376 1377/* Set value by ID. */ 1378function spider_set_input_value(input_id, input_value) { 1379 if (document.getElementById(input_id)) { 1380 document.getElementById(input_id).value = input_value; 1381 } 1382} 1383 1384/* Submit form by ID. */ 1385function spider_form_submit(event, form_id) { 1386 if (document.getElementById(form_id)) { 1387 document.getElementById(form_id).submit(); 1388 } 1389 if (event.preventDefault) { 1390 event.preventDefault(); 1391 } 1392 else { 1393 event.returnValue = false; 1394 } 1395} 1396 1397/* Check if required field is empty. */ 1398function spider_check_required(id, name) { 1399 if (jQuery('#' + id).val() == '') { 1400 alert(name + ' ' + bwg_objectsL10n.bwg_field_required); 1401 jQuery('#' + id).attr('style', 'border-color: #FF0000;'); 1402 jQuery('#' + id).focus(); 1403 return true; 1404 } 1405 else { 1406 return false; 1407 } 1408} 1409 1410/* Check if privacy polic field is checked. */ 1411function comment_check_privacy_policy() { 1412 var bwg_submit = jQuery('#bwg_submit'); 1413 bwg_submit.removeClass('bwg-submit-disabled'); 1414 bwg_submit.removeAttr("disabled"); 1415 if ( !jQuery('#bwg_comment_privacy_policy').is(':checked') ) { 1416 bwg_submit.addClass('bwg-submit-disabled'); 1417 bwg_submit.attr('disabled', 'disabled'); 1418 } 1419} 1420 1421/* Check Email. */ 1422function spider_check_email(id) { 1423 if (jQuery('#' + id).val() != '') { 1424 var email = jQuery('#' + id).val().replace(/^\s+|\s+$/g, ''); 1425 if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { 1426 alert(bwg_objectsL10n.bwg_mail_validation); 1427 return true; 1428 } 1429 return false;
1430 } 1431} 1432 1433/* Refresh captcha. */ 1434function bwg_captcha_refresh(id) { 1435 if (document.getElementById(id + "_img") && document.getElementById(id + "_input")) { 1436 srcArr = document.getElementById(id + "_img").src.split("&r="); 1437 document.getElementById(id + "_img").src = srcArr[0] + '&r=' + Math.floor(Math.random() * 100); 1438 document.getElementById(id + "_img").style.display = "inline-block"; 1439 document.getElementById(id + "_input").value = ""; 1440 } 1441} 1442 1443function bwg_play_instagram_video(obj,bwg) { 1444 jQuery(obj).parent().find("video").each(function () { 1445 if (jQuery(this).get(0).paused) { 1446 jQuery(this).get(0).play(); 1447 jQuery(obj).children().hide(); 1448 } 1449 else { 1450 jQuery(this).get(0).pause(); 1451 jQuery(obj).children().show(); 1452 } 1453 }) 1454} 1455 1456/** 1457 * Add comment. 1458 * 1459 * @returns {boolean} 1460 */ 1461function bwg_add_comment() { 1462 var form = jQuery('#bwg_comment_form'); 1463 var url = form.attr('action'); 1464 var post_data = {}; 1465 post_data['ajax_task'] = 'add_comment'; 1466 post_data['comment_name'] = form.find('#bwg_name').val(); 1467 post_data['comment_email'] = form.find('#bwg_email').val(); 1468 post_data['comment_text'] = form.find('#bwg_comment').val(); 1469 post_data['comment_captcha'] = form.find('#bwg_captcha_input').val(); 1470 post_data['popup_enable_captcha'] = form.find('#bwg_popup_enable_captcha').val(); 1471 post_data['privacy_policy'] = ( form.find('#bwg_comment_privacy_policy').is(":checked") ) ? 1 : 0; 1472 post_data['comment_image_id'] = jQuery('#bwg_popup_image').attr('image_id'); 1473 post_data['comment_moderation'] = form.find('#bwg_comment_moderation').val(); 1474 jQuery('.bwg_spider_ajax_loading').hide(); 1475 jQuery.ajax({ 1476 url: url, 1477 type: "POST", 1478 dataType: 'json', 1479 data: post_data, 1480 success: function ( res ) { 1481 jQuery('.bwg_comment_error').text(''); 1482 if ( res.error == true ) { 1483 jQuery.each(res.error_messages, function( index, value ) { 1484 if ( value ) { 1485 jQuery('.bwg_comment_'+ index +'_error').text(value); 1486 } 1487 }); 1488 } 1489 else { 1490 form.find('#bwg_comment').val(''); 1491 jQuery('.bwg_comment_waiting_message').hide(); 1492 if( res.published == 0 ) { 1493 jQuery('.bwg_comment_waiting_message').show(); 1494 } 1495 if ( res.html_comments_block != '' ) { 1496 jQuery('#bwg_added_comments').html(res.html_comments_block).show(); 1497 } 1498 } 1499 }, 1500 beforeSend: function() { 1501 jQuery('.bwg_spider_ajax_loading').show(); 1502 }, 1503 complete: function() { 1504 if ( form.find('#bwg_comment_privacy_policy').length > 0 ) { 1505 form.find('#bwg_comment_privacy_policy').prop('checked', false); 1506 comment_check_privacy_policy(); 1507 } 1508 bwg_captcha_refresh('bwg_captcha'); 1509 jQuery('.bwg_spider_ajax_loading').hide(); 1510 }, 1511 error:function() {} 1512 }); 1513 return false; 1514} 1515 1516/** 1517 * Remove comment. 1518 * 1519 * @param id_comment 1520 * @returns {boolean} 1521 */ 1522function bwg_remove_comment( id_comment ) { 1523 var form = jQuery('#bwg_comment_form'); 1524 var url = form.attr('action'); 1525 var post_data = {}; 1526 post_data['ajax_task'] = 'delete_comment'; 1527 post_data['id_image'] = jQuery('#bwg_popup_image').attr('image_id'); 1528 post_data['id_comment'] = id_comment; 1529 jQuery.ajax({ 1530 url: url, 1531 type: "POST", 1532 dataType: 'json', 1533 data: post_data, 1534 success: function ( res ) { 1535 if ( res.error == false) { 1536 jQuery('#bwg_comment_block_' + id_comment ).fadeOut( "slow").remove(); 1537 } 1538 }, 1539 beforeSend: function() { 1540 }, 1541 complete:function() { 1542 }, 1543 error:function() {} 1544 }); 1545 return false; 1546} 1547 1548function bwg_gallery_box( image_id, bwg_container, openEcommerce, gallery_id ) { 1549 jQuery(".bwg-validate").each(function() { 1550 jQuery(this).on("keypress change", function () { 1551 jQuery(this).parent().next().find(".bwg_comment_error").html(""); 1552 }); 1553 }); 1554 if ( typeof openEcommerce == "undefined" ) { 1555 openEcommerce = false;
1556 } 1557 var bwg = bwg_container.data('bwg'); 1558 var bwg_lightbox_url; 1559 if ( bwg_container.find(".bwg-container").data('lightbox-url') ) { 1560 /* To read from updated container after ajax (e.g. open lightbox from gallery in albums).*/ 1561 bwg_lightbox_url = bwg_container.find(".bwg-container").data('lightbox-url'); 1562 } 1563 else { 1564 bwg_lightbox_url = bwg_container.data('lightbox-url'); 1565 } 1566 var cur_gal_id = bwg_container.find('.cur_gal_id').val(); 1567 var filterTags = jQuery('#bwg_tag_id_' + cur_gal_id).val(); 1568 filterTags = filterTags ? filterTags : 0; 1569 var ecommerce = openEcommerce == true ? "&open_ecommerce=1" : ""; 1570 var filtersearchname = jQuery("#bwg_search_input_" + bwg ).val(); 1571 var filtersortby = jQuery("#bwg_order_" + bwg).val() ? "&filtersortby=" + jQuery("#bwg_order_" + bwg).val() : ''; 1572 filtersearchname = filtersearchname ? filtersearchname : ''; 1573 1574 if ( typeof gallery_id != "undefined" ) { 1575 /* Open lightbox with hash.*/ 1576 bwg_lightbox_url += '&gallery_id=' + gallery_id; 1577 } 1578 var open_comment = ''; 1579 var open_comment_attr = jQuery('#bwg_blog_style_share_buttons_' + image_id).attr('data-open-comment'); 1580 if (typeof open_comment_attr !== typeof undefined && open_comment_attr !== false) { 1581 open_comment = '&open_comment=1'; 1582 } 1583 var bwg_random_seed = jQuery("#bwg_random_seed_"+bwg).val(); 1584 spider_createpopup(bwg_lightbox_url + '&bwg_gallery_type=' + bwg_container.data('gallery-type') + '&bwg_random_seed='+bwg_random_seed+'&image_id=' + image_id + "&filter_tag=" + filterTags + ecommerce + open_comment + '&filter_search_name=' + filtersearchname + filtersortby, bwg, bwg_container.data('popup-width'), bwg_container.data('popup-height'), 1, 'testpopup', 5, bwg_container.data('buttons-position')); 1585} 1586 1587function bwg_change_image_lightbox(current_key, key, data, from_effect) { 1588 jQuery("#rate_image_id").val(data[key]["id"]); 1589 bwg_current_key = gallery_box_data['bwg_current_key']; 1590 /* var bwg_image_info_pos = jQuery(".bwg_ctrl_btn_container").height(); */ 1591 if ( gallery_box_data['data'][key]['alt'] == '' && gallery_box_data['data'][key]['description'] == '' ) { 1592 jQuery(".bwg_info").hide(); 1593 } 1594 else { 1595 jQuery(".bwg_info").show(); 1596 } 1597 1598 jQuery(".bwg_image_info").css("height","auto"); 1599 setTimeout(function(){ 1600 bwg_info_height_set(); 1601 if(jQuery('.bwg_image_description').height() > jQuery('.bwg_image_info').height() && jQuery('.mCSB_container').hasClass('mCS_no_scrollbar')){ 1602 jQuery(".bwg_image_info").mCustomScrollbar("destroy"); 1603 } 1604 if (!jQuery('.bwg_image_info').hasClass('mCustomScrollbar')) { 1605 if (typeof jQuery().mCustomScrollbar !== 'undefined' && jQuery.isFunction(jQuery().mCustomScrollbar)) { 1606 jQuery(".bwg_image_info").mCustomScrollbar({ 1607 scrollInertia: 150, 1608 theme: 'dark-thick', 1609 advanced:{ 1610 updateOnContentResize: true 1611 } 1612 }); 1613 } 1614 } 1615 }, 200); 1616 jQuery("#spider_popup_left").show(); 1617 jQuery("#spider_popup_right").show(); 1618 jQuery(".bwg_image_info").hide(); 1619 if (gallery_box_data['enable_loop'] == 0) { 1620 if (key == (parseInt(data.length) - 1)) { 1621 jQuery("#spider_popup_right").hide(); 1622 } 1623 if (key == 0) { 1624 jQuery("#spider_popup_left").hide(); 1625 } 1626 } 1627 var ecommerceACtive = gallery_box_data['ecommerceACtive']; 1628 if( ecommerceACtive == 1 && gallery_box_data['enable_image_ecommerce'] == 1 ) { 1629 if( gallery_box_data['data'][key]["pricelist"] == 0) { 1630 jQuery(".bwg_ecommerce").hide(); 1631 } 1632 else { 1633 jQuery(".bwg_ecommerce").show(); 1634 jQuery(".pge_tabs li").hide(); 1635 jQuery("#downloads").hide(); 1636 jQuery("#manual").hide(); 1637 var pricelistSections = gallery_box_data['data'][key]["pricelist_sections"].split(","); 1638 1639 if(pricelistSections){ 1640 jQuery("#" + pricelistSections[0]).show(); 1641 jQuery("[name=type]").val(pricelistSections[0]); 1642 if(pricelistSections.length > 1){ 1643 jQuery(".pge_tabs").show(); 1644 for( k=0 ; k<pricelistSections.length; k++ ){ 1645 jQuery("#" + pricelistSections[k] + "_li").show(); 1646 } 1647 } 1648 else{ 1649 jQuery(".pge_tabs").hide(); 1650 } 1651 } 1652 else{ 1653 jQuery("[name=type]").val(""); 1654 } 1655 } 1656 } 1657 /* Pause videos.*/ 1658 jQuery("#bwg_image_container").find("iframe").each(function () { 1659 jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); 1660 jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }', "*"); 1661 jQuery(this)[0].contentWindow.postMessage('pause', '*'); 1662 }); 1663 jQuery("#bwg_image_container").find("video").each(function () { 1664 jQuery(this).trigger('pause'); 1665 }); 1666 if(typeof data == 'undefined') { 1667 data = gallery_box_data['data']; 1668 } 1669 if ( typeof data[key] != 'undefined' ) { 1670 if ( typeof data[current_key] != 'undefined' ) { 1671 if (jQuery(".bwg_play_pause").length && !jQuery(".bwg_play_pause").hasClass("bwg-icon-play")) { 1672 bwg_play( data ); 1673 } 1674 if (!from_effect) { 1675 /* Change image key.*/ 1676 jQuery("#bwg_current_image_key").val(key); 1677 /*if (current_key == '-1') { 1678 current_key = jQuery(".bwg_thumb_active").children("img").attr("image_key"); 1679 }*/ 1680 } 1681 if (gallery_box_data['bwg_trans_in_progress']) { 1682 gallery_box_data['event_stack'].push(current_key + '-' + key); 1683 return; 1684 } 1685 var direction = 'right'; 1686 if (bwg_current_key > key) { 1687 var direction = 'left'; 1688 } 1689 else if (bwg_current_key == key) { 1690 return; 1691 } 1692 1693 jQuery(".bwg_image_count").html(data[key]["number"]); 1694 /* Set filmstrip initial position.*/ 1695 jQuery(".bwg_watermark").css({display: 'none'}); 1696 /* Set active thumbnail position.*/ 1697 if ( gallery_box_data['width_or_height'] == 'width' ) { 1698 bwg_current_filmstrip_pos = key * (jQuery(".bwg_filmstrip_thumbnail").width() + 2 + 2 * gallery_box_data['lightbox_filmstrip_thumb_border_width']); 1699 } else if ( gallery_box_data['width_or_height'] == 'height' ) { 1700 bwg_current_filmstrip_pos = key * (jQuery(".bwg_filmstrip_thumbnail").height() + 2 + 2 * gallery_box_data['lightbox_filmstrip_thumb_border_width']); 1701 } 1702 gallery_box_data['bwg_current_key'] = key; 1703 /* Change hash.*/ 1704 /*window.location.hash = "bwg"+gallery_box_data['gallery_id'] +"/" + data[key]["id"];*/ 1705 location.replace("#bwg" + gallery_box_data['gallery_id'] + "/" + data[key]["id"]); 1706 history.replaceState(undefined, undefined, "#bwg" + gallery_box_data['gallery_id'] + "/" + data[key]["id"]); 1707 jQuery("#rate_image_id").val(data[key]["id"]); 1708 /* Increase image hit counter.*/ 1709 spider_set_input_value('rate_ajax_task', 'save_hit_count'); 1710 spider_rate_ajax_save('bwg_rate_form'); 1711 1712 /* Change image id for rating. */ 1713 if ( gallery_box_data['popup_enable_rate'] ) { 1714 jQuery("#bwg_star").attr("data-score", data[key]["avg_rating"]); 1715 jQuery("#bwg_star").removeAttr("title"); 1716 data[key]['cur_key'] = key; 1717 bwg_rating( data[key]["rate"], data[key]["rate_count"], data[key]["avg_rating"], key ); 1718 } 1719 1720 jQuery(".bwg_image_hits span").html(++data[key]["hit_count"]); 1721 1722 /* Change image id.*/ 1723 jQuery("#bwg_popup_image").attr('image_id', data[key]["id"]); 1724 /* Change image title, description.*/ 1725 jQuery(".bwg_image_title").html(jQuery('<span />').html(data[key]["alt"]).text()); 1726 jQuery(".bwg_image_description").html(jQuery('<span />').html(data[key]["description"]).text()); 1727 /* Set active thumbnail.*/ 1728 1729 jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"); 1730 jQuery("#bwg_filmstrip_thumbnail_" + key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"); 1731 jQuery(".bwg_image_info").css("opacity", 1); 1732 if (data[key]["alt"].trim() == "") { 1733 if (data[key]["description"].trim() == "") { 1734 jQuery(".bwg_image_info").css("opacity", 0); 1735 } 1736 } 1737 if (jQuery(".bwg_image_info_container1").css("display") != 'none') { 1738 jQuery(".bwg_image_info_container1").css("display", "table-cell"); 1739 } 1740 else { 1741 jQuery(".bwg_image_info_container1").css("display", "none"); 1742 } 1743 /* Change image rating.*/ 1744 if (jQuery(".bwg_image_rate_container1").css("display") != 'none') { 1745 jQuery(".bwg_image_rate_container1").css("display", "table-cell"); 1746 } 1747 else { 1748 jQuery(".bwg_image_rate_container1").css("display", "none"); 1749 } 1750 var current_image_class = jQuery(".bwg_popup_image_spun").css("zIndex") == 2 ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun"; 1751 var next_image_class = current_image_class == ".bwg_popup_image_second_spun" ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun"; 1752 1753 var is_embed = data[key]['filetype'].indexOf("EMBED_") > -1 ? true : false;
1754 var is_embed_instagram_post = data[key]['filetype'].indexOf('INSTAGRAM_POST') > -1 ? true : false; 1755 var is_embed_instagram_video = data[key]['filetype'].indexOf('INSTAGRAM_VIDEO') > -1 ? true : false; 1756 var is_ifrem = ( jQuery.inArray( data[key]['filetype'] , ['EMBED_OEMBED_YOUTUBE_VIDEO', 'EMBED_OEMBED_VIMEO_VIDEO', 'EMBED_OEMBED_FACEBOOK_VIDEO', 'EMBED_OEMBED_DAILYMOTION_VIDEO'] ) !== -1 ) ? true : false; 1757 var cur_height = jQuery(current_image_class).height(); 1758 var cur_width = jQuery(current_image_class).width(); 1759 var innhtml = '<span class="bwg_popup_image_spun1" style="display: ' + ( !is_embed ? 'table' : 'block' ) + '; width: inherit; height: inherit;"><span class="bwg_popup_image_spun2" style="display:' + (!is_embed ? 'table-cell' : 'block') + '; vertical-align: middle;text-align: center;height: 100%;">'; 1760 if ( !is_embed ) { 1761 jQuery(".bwg-loading").removeClass("bwg-hidden"); 1762 jQuery("#bwg_download").removeClass("bwg-hidden"); 1763 var link = "'" + (gallery_box_data['site_url']+jQuery('<span />').html(decodeURIComponent(data[key]["image_url"])).text()).split('?bwg')[0] + "'"; 1764 if (gallery_box_data['popup_enable_zoom']) { 1765 innhtml += '<figure style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px; background-image: url(' + link + '); background-repeat: no-repeat" class="bwg_popup_image bwg_popup_watermark" alt="' + data[key]["alt"] + '" />' 1766 } 1767 innhtml += '<img style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px;" class="bwg_popup_image bwg_popup_watermark" src="' + gallery_box_data['site_url'] + jQuery('<span />').html(decodeURIComponent(data[key]["image_url"])).text() + '" alt="' + data[key]["alt"] + '" />'; 1768 } 1769 else { /*is_embed*/ 1770 /* hide download button if image source is embed */ 1771 jQuery("#bwg_download").addClass("bwg-hidden"); 1772 innhtml += '<span class="bwg_popup_embed bwg_popup_watermark" style="display: ' + (is_ifrem ? 'block' : 'table') + '; table-layout: fixed; height: 100%;">' + (is_embed_instagram_video ? '<div class="bwg_inst_play_btn_cont" onclick="bwg_play_instagram_video(this)" ><div class="bwg_inst_play"></div></div>' : ' '); 1773 if ( is_embed_instagram_post ) { 1774 var instagram_embed = jQuery('.instagram-media'); 1775 var embed_frame = jQuery('.bwg_embed_frame'); 1776 /* HoverCard, Feedback, SocialProof height from Instagram */ 1777 var feedback_social_proof_height = 109; 1778 var maxWidth = jQuery('.bwg_image_container').width() - (gallery_box_data.filmstrip_direction == 'vertical' ? gallery_box_data.image_filmstrip_width : 0); 1779 var maxHeight = jQuery('.bwg_image_container').height() - (gallery_box_data.filmstrip_direction == 'horizontal' ? gallery_box_data.image_filmstrip_height : 0); 1780 var srcWidth = data[key].image_width; 1781 var srcHeight = data[key].image_height; 1782 1783 // Add the resizing logic 1784 var instagram_resizing = bwg_resizing_ratio(srcWidth, srcHeight, maxWidth, maxHeight); 1785 embed_frame.attr('data-width', maxWidth); 1786 embed_frame.attr('data-height', maxHeight); 1787 var instagram_width = instagram_resizing.width; 1788 var instagram_height = instagram_resizing.height; 1789 if ( instagram_height > instagram_width ) { 1790 instagram_width = instagram_width - feedback_social_proof_height; 1791 } 1792 else { 1793 instagram_width = instagram_width + feedback_social_proof_height; 1794 } 1795 innhtml += spider_display_embed(data[key]['filetype'], data[key]['image_url'], data[key]['filename'], { 1796 class: 'bwg_embed_frame', 1797 'data-width': maxWidth, 1798 'data-height': maxHeight, 1799 'data-instagram-width': srcWidth, 1800 'data-instagram-height': srcHeight, 1801 style: 'width:' + instagram_width + 'px; height:' + instagram_height + 'px; vertical-align:middle; display:inline-block; position:relative;' 1802 }); 1803 instagram_embed.css({ 1804 'max-height': instagram_height + 'px', 1805 'min-width': instagram_width + 'px !important' 1806 }); 1807 } 1808 else { 1809 innhtml += spider_display_embed(data[key]['filetype'], data[key]['image_url'], data[key]['filename'], { 1810 class:'bwg_embed_frame', 1811 frameborder:'0', 1812 allowfullscreen:'allowfullscreen', 1813 style: 'display:' + ( is_ifrem ? 'block' : 'table-cell' ) + '; width:inherit; height:inherit; vertical-align:middle;' 1814 }); 1815 } 1816 innhtml += "</span>"; 1817 } 1818 if(gallery_box_data['popup_enable_zoom']) { 1819 innhtml += '</figure></span></span>'; 1820 } 1821 else { 1822 innhtml += '</span></span>'; 1823 } 1824 jQuery(next_image_class).html(innhtml); 1825 1826 jQuery(next_image_class).find("img").on("load error", function () { 1827 jQuery(".bwg-loading").addClass("bwg-hidden"); 1828 }); 1829 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1830 maxWidth: cur_width, 1831 maxHeight: cur_height, 1832 height: 'auto', 1833 }); 1834 1835 function bwg_afterload() { 1836 if (gallery_box_data['preload_images']) { 1837 bwg_preload_images(key); 1838 } 1839 window['bwg_'+gallery_box_data['bwg_image_effect']](current_image_class, next_image_class, direction); 1840 jQuery(current_image_class).find('.bwg_fb_video').each(function () { 1841 jQuery(this).attr('src', ''); 1842 }); 1843 if ( !is_embed ) { 1844 jQuery("#bwg_fullsize_image").attr("href", gallery_box_data['site_url'] + decodeURIComponent(data[key]['image_url'])); 1845 jQuery("#bwg_download").attr("href", gallery_box_data['site_url'] + decodeURIComponent(data[key]['thumb_url']).replace('/thumb/', '/.original/')); 1846 } 1847 else { 1848 jQuery("#bwg_fullsize_image").attr("href", decodeURIComponent(data[key]['image_url'])); 1849 } 1850 var image_arr = decodeURIComponent(data[key]['image_url']).split("/"); 1851 jQuery("#bwg_download").attr("download", image_arr[image_arr.length - 1].replace(/\?bwg=(\d+)$/, "")); 1852 /* Change image social networks urls.*/ 1853 var bwg_share_url = encodeURIComponent(gallery_box_data['bwg_share_url'].replace("image_id", "image_id=" + + data[key]['id'])); 1854 1855 if (is_embed) { 1856 var bwg_share_image_url = encodeURIComponent(data[key]['thumb_url']); 1857 } 1858 else { 1859 var bwg_share_image_url = gallery_box_data['bwg_share_image_url'] + encodeURIComponent(encodeURIComponent(data[key]['pure_image_url'])); 1860 } 1861 bwg_share_image_url = bwg_share_image_url.replace(/%252F|%25252F/g, '%2F'); 1862 if (typeof addthis_share != "undefined") { 1863 addthis_share.url = bwg_share_url; 1864 } 1865 jQuery("#bwg_facebook_a").attr("href", "https://www.facebook.com/sharer/sharer.php?u=" + bwg_share_url); 1866 jQuery("#bwg_twitter_a").attr("href", "https://twitter.com/intent/tweet?url=" + bwg_share_url); 1867 jQuery("#bwg_pinterest_a").attr("href", "http://pinterest.com/pin/create/button/?s=100&url=" + bwg_share_url + "&media=" + bwg_share_image_url + "&description=" + data[key]['alt'] + '%0A' + data[key]['description']); 1868 jQuery("#bwg_tumblr_a").attr("href", "https://www.tumblr.com/share/photo?source=" + bwg_share_image_url + "&caption=" + data[key]['alt'] + "&clickthru=" + bwg_share_url); 1869 /* Load comments.*/ 1870 if (jQuery(".bwg_comment_container").hasClass("bwg_open")) { 1871 jQuery(".bwg_comments .mCSB_container").css("top","0");
1872 /* Todo: do not call comments if it's empty */ 1873 /* if (data[key]["comment_count"] == 0) { 1874 jQuery("#bwg_added_comments").hide(); 1875 } 1876 else {*/ 1877 jQuery("#bwg_added_comments").show(); 1878 spider_set_input_value('ajax_task', 'display'); 1879 spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id')); 1880 spider_ajax_save('bwg_comment_form'); 1881 /* }*/ 1882 } 1883 if (jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 1884 /* Pricelist */ 1885 if(data[key]["pricelist"] == 0){ 1886 /* Close ecommerce.*/ 1887 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 1888 bwg_animate_image_box_for_hide_sidebar(); 1889 1890 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 1891 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 1892 jQuery(".spider_popup_close_fullscreen").show(); 1893 } 1894 else{ 1895 get_ajax_pricelist(); 1896 } 1897 } 1898 /* Update custom scroll.*/ 1899 if (typeof jQuery().mCustomScrollbar !== 'undefined') { 1900 if (jQuery.isFunction(jQuery().mCustomScrollbar)) { 1901 jQuery(".bwg_comments").mCustomScrollbar({ 1902 advanced:{ 1903 updateOnContentResize: true 1904 } 1905 }); 1906 } 1907 } 1908 jQuery(".bwg_comments .mCSB_scrollTools").hide(); 1909 // Slideshow filmstrip type is Fix dimension. 1910 if ( gallery_box_data['enable_image_filmstrip'] ) { 1911 bwg_slideshow_filmstrip_fix_dimension(); 1912 setTimeout(function () { 1913 bwg_disable_lightbox_filmstrip_left_right_arrow(gallery_box_data); 1914 }, 100); 1915 } 1916 bwg_resize_instagram_post(); 1917 } 1918 if ( !is_embed ) { 1919 var cur_img = jQuery(next_image_class).find('img'); 1920 cur_img.one('load', function() { 1921 bwg_afterload(); 1922 }).each(function() { 1923 if(this.complete) jQuery(this).load(); 1924 }); 1925 } 1926 else { 1927 bwg_afterload(); 1928 } 1929 /* Uses Instagram oEmbed data to create iframe tag. */ 1930 if ( typeof instgrm !== 'undefined' && typeof instgrm.Embeds !== 'undefined' ) { 1931 jQuery('.instagram-media').hide(); 1932 instgrm.Embeds.process(); 1933 jQuery('.instagram-media').show(); 1934 } 1935 } 1936 } 1937} 1938 1939function bwg_preload_images_lightbox( key ) { 1940 var data = gallery_box_data['data']; 1941 var count_all = data.length; 1942 var preloadCount = ( gallery_box_data['preload_images_count'] == 0 || gallery_box_data['preload_images_count'] >= count_all ) ? count_all : gallery_box_data['preload_images_count']; 1943 var indexedImgCount = 0; 1944 for ( var i = 1; indexedImgCount < preloadCount; i++ ) { 1945 var sign = 1; 1946 do { 1947 var index = ( key + i * sign + count_all ) % count_all; 1948 if ( typeof data[index] != "undefined" ) { 1949 var is_embed = data[index]['filetype'].indexOf( "EMBED_" ) > -1 ? true : false; 1950 if ( !is_embed ) { 1951 jQuery( "<img/>" ).attr( "src", gallery_box_data['site_url'] + jQuery( '<span />' ).html(decodeURIComponent(data[index]["image_url"])).text() ); 1952 } 1953 } 1954 sign *= -1; 1955 indexedImgCount++; 1956 } 1957 while ( sign != 1 ); 1958 } 1959} 1960 1961/* open popup sidebar */ 1962function bwg_popup_sidebar_open(obj){ 1963 var comment_container_width = gallery_box_data['lightbox_comment_width']; 1964 var lightbox_comment_pos = gallery_box_data['lightbox_comment_pos']; 1965 if (comment_container_width > jQuery(window).width()) { 1966 comment_container_width = jQuery(window).width(); 1967 obj.css({ 1968 width: comment_container_width, 1969 }); 1970 jQuery(".spider_popup_close_fullscreen").hide(); 1971 jQuery(".spider_popup_close").hide(); 1972 if (jQuery(".bwg_ctrl_btn").hasClass("bwg-icon-pause")) { 1973 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 1974 jQuery(".bwg_play_pause").trigger(isMobile ? 'touchend' : 'click'); 1975 } 1976 } 1977 else { 1978 jQuery(".spider_popup_close_fullscreen").show(); 1979 } 1980 1981 if(lightbox_comment_pos == 'left') { 1982 obj.animate({left: 0}, 100); 1983 } else { 1984 obj.animate({right: 0}, 100); 1985 } 1986} 1987 1988/* Open/close comments.*/ 1989function bwg_comment() { 1990 jQuery(".bwg_watermark").css({display: 'none'}); 1991 jQuery(".bwg_ecommerce_wrap").css("z-index","-1"); 1992 jQuery(".bwg_comment_wrap").css("z-index","25"); 1993 if(jQuery(".bwg_ecommerce_container").hasClass("bwg_open") ){ 1994 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 1995 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 1996 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 1997 1998 } 1999 if (jQuery(".bwg_comment_container").hasClass("bwg_open") ) { 2000 /* Close comment.*/ 2001 /* Check if lightbox was play before oppening comment container */ 2002 if( jQuery(".bwg_comment_container").attr("data-play-status") == "1" ) {
2003 jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-play").addClass("bwg-icon-pause").attr('title',bwg_objectsL10n.bwg_pause); 2004 } 2005 bwg_popup_sidebar_close(jQuery(".bwg_comment_container")); 2006 bwg_animate_image_box_for_hide_sidebar(); 2007 jQuery(".bwg_comment_wrap").css("z-index","-1"); 2008 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_close"); 2009 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_show_comments); 2010 jQuery(".spider_popup_close_fullscreen").show(); 2011 } 2012 else { 2013 /* Open comment.*/ 2014 /* Check if lightbox is playing before oppening comment and set status */ 2015 if ( jQuery(".bwg_play_pause").hasClass("bwg-icon-pause") ) { 2016 jQuery(".bwg_comment_container").attr("data-play-status", "1"); 2017 } else { 2018 jQuery(".bwg_comment_container").attr("data-play-status", "0"); 2019 } 2020 jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("bwg-icon-pause").addClass("bwg-icon-play").attr('title', bwg_objectsL10n.bwg_play); 2021 bwg_popup_sidebar_open(jQuery(".bwg_comment_container")); 2022 bwg_animate_image_box_for_show_sidebar(); 2023 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_open"); 2024 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_hide_comments); 2025 /* Load comments.*/ 2026 var cur_image_key = parseInt(jQuery("#bwg_current_image_key").val()); 2027 if ( typeof gallery_box_data['current_image_key'] != "undefined" && gallery_box_data['data'][cur_image_key]['comment_count'] != 0) { 2028 jQuery("#bwg_added_comments").show(); 2029 spider_set_input_value('ajax_task', 'display'); 2030 spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id')); 2031 spider_ajax_save('bwg_comment_form'); 2032 } 2033 } 2034 jQuery(".bwg_comments").mCustomScrollbar("update", { 2035 scrollInertia: 150, 2036 theme: 'dark-thick', 2037 advanced:{ 2038 updateOnContentResize: true 2039 } 2040 }); 2041} 2042 2043/* Open/close ecommerce.*/ 2044function bwg_ecommerce() { 2045 jQuery(".bwg_watermark").css({display: 'none'}); 2046 jQuery(".bwg_ecommerce_wrap").css("z-index","25"); 2047 jQuery(".bwg_comment_wrap").css("z-index","-1"); 2048 if (jQuery(".bwg_comment_container").hasClass("bwg_open")) { 2049 bwg_popup_sidebar_close(jQuery(".bwg_comment_container")); 2050 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_close"); 2051 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_show_comments); 2052 } 2053 if (jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 2054 /* Close ecommerce.*/ 2055 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 2056 bwg_animate_image_box_for_hide_sidebar(); 2057 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 2058 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 2059 } 2060 else { 2061 /* Open ecommerce.*/ 2062 bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")); 2063 bwg_animate_image_box_for_show_sidebar(); 2064 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_open"); 2065 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_hide_ecommerce); 2066 get_ajax_pricelist(); 2067 } 2068} 2069 2070function bwg_popup_sidebar_close(obj){ 2071 var border_width = parseInt(obj.css('borderRightWidth')); 2072 if (!border_width) { 2073 border_width = 0; 2074 } 2075 if ( lightbox_comment_pos == 'left' ) { 2076 obj.animate({left: -obj.width() - border_width}, 100); 2077 } 2078 else if ( lightbox_comment_pos == 'right' ) { 2079 obj.animate({right: -obj.width() - border_width}, 100); 2080 } 2081} 2082 2083function bwg_animate_image_box_for_hide_sidebar() { 2084 if ( lightbox_comment_pos == 'left' ) { 2085 jQuery( ".bwg_image_wrap" ).animate( { 2086 left: 0, 2087 width: jQuery( "#spider_popup_wrap" ).width() 2088 }, 100 ); 2089 } else if ( lightbox_comment_pos == 'right' ) { 2090 jQuery( ".bwg_image_wrap" ).animate( { 2091 right: 0, 2092 width: jQuery( "#spider_popup_wrap" ).width() 2093 }, 100 ); 2094 } 2095 jQuery( ".bwg_image_container" ).animate( { 2096 width: jQuery( "#spider_popup_wrap" ).width() - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) 2097 }, 100 ); 2098 jQuery( ".bwg_popup_image" ).animate( { 2099 maxWidth: jQuery( "#spider_popup_wrap" ).width() - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) 2100 }, { 2101 duration: 100, 2102 complete: function () { 2103 bwg_change_watermark_container(); 2104 } 2105 } ); 2106 2107 jQuery( ".bwg_popup_embed" ).animate( { 2108 width: jQuery( "#spider_popup_wrap" ).width() - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) 2109 }, { 2110 duration: 100, 2111 complete: function () { 2112 bwg_resize_instagram_post(); 2113 bwg_change_watermark_container(); 2114 } 2115 } ); 2116 if ( gallery_box_data['width_or_height'] == 'width' ) { 2117 jQuery( ".bwg_filmstrip_container" ).animate( { width: jQuery( ".spider_popup_wrap" ).width() }, 100 ); 2118 jQuery( ".bwg_filmstrip" ).animate( { width: jQuery( ".spider_popup_wrap" ).width() - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()) }, 100 ); 2119 } else if ( gallery_box_data['width_or_height'] == 'height' ) { 2120 jQuery( ".bwg_filmstrip_container" ).animate( { height: jQuery( ".spider_popup_wrap" ).width() }, 100 ); 2121 jQuery( ".bwg_filmstrip" ).animate( { height: jQuery( ".spider_popup_wrap" ).width() - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()) }, 100 ); 2122 } 2123 /* Set filmstrip initial position.*/ 2124 bwg_set_filmstrip_pos( jQuery( ".spider_popup_wrap" ).width() - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data ); 2125 jQuery( ".spider_popup_close_fullscreen" ).show( 100 ); 2126} 2127 2128function bwg_animate_image_box_for_show_sidebar() {
2129 var bwg_comment_container = jQuery( ".bwg_comment_container" ).width() || jQuery( ".bwg_ecommerce_container" ).width(); 2130 if ( lightbox_comment_pos == 'left' ) { 2131 jQuery( ".bwg_image_wrap" ).animate( { 2132 left: bwg_comment_container, 2133 width: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container 2134 }, 100 ); 2135 } else if ( lightbox_comment_pos == 'right' ) { 2136 jQuery( ".bwg_image_wrap" ).animate( { 2137 right: bwg_comment_container, 2138 width: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container 2139 }, 100 ); 2140 } 2141 jQuery( ".bwg_image_container" ).animate( { 2142 width: jQuery( "#spider_popup_wrap" ).width() - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) - bwg_comment_container 2143 }, 100 ); 2144 jQuery( ".bwg_popup_image" ).animate( { 2145 maxWidth: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) 2146 }, { 2147 duration: 100, 2148 complete: function () { 2149 bwg_change_watermark_container(); 2150 } 2151 } ); 2152 jQuery( ".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video" ).animate( { 2153 maxWidth: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0 ) 2154 }, { 2155 duration: 100, 2156 complete: function () { 2157 bwg_resize_instagram_post(); 2158 bwg_change_watermark_container(); 2159 } 2160 } ); 2161 if ( gallery_box_data['width_or_height'] == 'width' ) { 2162 jQuery( ".bwg_filmstrip_container" ).css( { width: jQuery( "#spider_popup_wrap" ).width() - ( gallery_box_data['filmstrip_direction'] == 'vertical' ? 0 : bwg_comment_container ) } ); 2163 jQuery( ".bwg_filmstrip" ).animate( { width: jQuery( ".bwg_filmstrip_container" ).width() - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()) }, 100 ); 2164 /* Set filmstrip initial position.*/ 2165 bwg_set_filmstrip_pos( jQuery( ".bwg_filmstrip_container" ).width() - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data ); 2166 } 2167} 2168 2169function bwg_reset_zoom() { 2170 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 2171 var viewportmeta = document.querySelector('meta[name="viewport"]'); 2172 if (isMobile) { 2173 if (viewportmeta) { 2174 viewportmeta.content = 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0'; 2175 } 2176 } 2177} 2178 2179/* Open with fullscreen.*/ 2180function bwg_open_with_fullscreen() { 2181 jQuery(".bwg_watermark").css({display: 'none'}); 2182 var comment_container_width = 0; 2183 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 2184 comment_container_width = jQuery(".bwg_comment_container").width() || jQuery(".bwg_ecommerce_container").width(); 2185 } 2186 bwg_popup_current_width = jQuery(window).width(); 2187 bwg_popup_current_height = window.innerHeight; 2188 jQuery("#spider_popup_wrap").css({ 2189 width: jQuery(window).width(), 2190 height: window.innerHeight, 2191 left: 0, 2192 top: 0, 2193 margin: 0, 2194 zIndex: 100002 2195 }); 2196 jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)}); 2197 jQuery(".bwg_image_container").css({height: (bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0)), width: bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)}); 2198 jQuery(".bwg_popup_image").css({ 2199 maxWidth: jQuery(window).width() - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2200 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_he
2200ight'] : 0) 2201 }, { 2202 complete: function () { bwg_change_watermark_container(); } 2203 }); 2204 jQuery(".bwg_popup_video").css({ 2205 width: jQuery(window).width() - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2206 height: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2207 }, { 2208 complete: function () { bwg_change_watermark_container(); } 2209 }); 2210 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 2211 maxWidth: jQuery(window).width() - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2212 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2213 }, { 2214 complete: function () { 2215 bwg_resize_instagram_post(); 2216 bwg_change_watermark_container(); } 2217 }); 2218 if ( gallery_box_data['width_or_height'] == 'width' ) { 2219 jQuery(".bwg_filmstrip_container").css({width: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 2220 jQuery(".bwg_filmstrip").css({width: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}); 2221 /* Set filmstrip initial position.*/ 2222 bwg_set_filmstrip_pos(jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2223 } else { 2224 jQuery(".bwg_filmstrip_container").css({height: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 2225 jQuery(".bwg_filmstrip").css({height: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}); 2226 /* Set filmstrip initial position.*/ 2227 bwg_set_filmstrip_pos(window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2228 } 2229 jQuery(".bwg_resize-full").attr("class", "bwg-icon-compress bwg_ctrl_btn bwg_resize-full"); 2230 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_restore); 2231 jQuery(".spider_popup_close").attr("class", "spider_popup_close_fullscreen"); 2232} 2233 2234function bwg_resize_full() { 2235 jQuery(".bwg_watermark").css({display: 'none'}); 2236 var comment_container_width = 0; 2237 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open") ) { 2238 comment_container_width = jQuery(".bwg_comment_container").width() || jQuery(".bwg_ecommerce_container").width(); 2239 } 2240 /* Resize to small from full.*/ 2241 if ( jQuery(".bwg_resize-full").hasClass("bwg-icon-compress") ) { 2242 if ( jQuery(window).width() > gallery_box_data['image_width'] ) { 2243 bwg_popup_current_width = gallery_box_data['image_width']; 2244 } 2245 if ( window.innerHeight > gallery_box_data['image_height'] ) { 2246 bwg_popup_current_height = gallery_box_data['image_height']; 2247 } 2248 /* Minimize.*/ 2249 jQuery("#spider_popup_wrap").animate({ 2250 width: bwg_popup_current_width, 2251 height: bwg_popup_current_height, 2252 left: '50%', 2253 top: '50%', 2254 marginLeft: -bwg_popup_current_width / 2, 2255 marginTop: -bwg_popup_current_height / 2, 2256 zIndex: 100002 2257 }, 500); 2258 jQuery(".bwg_image_wrap").animate({width: bwg_popup_current_width - comment_container_width}, 500);
2259 jQuery(".bwg_image_container").animate({height: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0), width: bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)}, 500); 2260 jQuery(".bwg_popup_image").animate({ 2261 maxWidth: bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2262 maxHeight: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2263 }, { 2264 duration: 500, 2265 complete: function () { 2266 bwg_change_watermark_container(); 2267 if ((jQuery("#spider_popup_wrap").width() < jQuery(window).width())) { 2268 if (jQuery("#spider_popup_wrap").height() < window.innerHeight) { 2269 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 2270 } 2271 } 2272 } 2273 }); 2274 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({ 2275 maxWidth: bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2276 maxHeight: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2277 }, { 2278 duration: 500, 2279 complete: function () { 2280 bwg_resize_instagram_post(); 2281 bwg_change_watermark_container(); 2282 if (jQuery("#spider_popup_wrap").width() < jQuery(window).width()) { 2283 if (jQuery("#spider_popup_wrap").height() < window.innerHeight) { 2284 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 2285 } 2286 } 2287 } 2288 }); 2289 if ( gallery_box_data['width_or_height'] == 'width' ) { 2290 jQuery(".bwg_filmstrip_container").animate({width: bwg_popup_current_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 2291 jQuery(".bwg_filmstrip").animate({width: bwg_popup_current_width - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}, 500); 2292 /* Set filmstrip initial position.*/ 2293 bwg_set_filmstrip_pos(bwg_popup_current_width - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2294 } else { 2295 jQuery(".bwg_filmstrip_container").animate({height: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 2296 jQuery(".bwg_filmstrip").animate({height: bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}, 500); 2297 /* Set filmstrip initial position.*/ 2298 bwg_set_filmstrip_pos(bwg_popup_current_height - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2299 gallery_box_data['filmstrip_direction'] == 'horizontal' ? '' : jQuery(".bwg_filmstrip_right").css({ top: (bwg_popup_current_height - jQuery('.bwg_filmstrip_right').height() ) }); 2300 } 2301 jQuery(".bwg_resize-full").attr("class", "bwg-icon-expand bwg_ctrl_btn bwg_resize-full"); 2302 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_maximize); 2303 setTimeout(function () { 2304 bwg_info_height_set(); 2305 }, 500); 2306 } 2307 else { /* Resize to full from small.*/ 2308 bwg_popup_current_width = jQuery(window).width(); 2309 bwg_popup_current_height = window.innerHeight; 2310 /* Maximize.*/ 2311 jQuery("#spider_popup_wrap").animate({ 2312 width: jQuery(window).width(), 2313 height: window.innerHeight, 2314 left: 0, 2315 top: 0, 2316 margin: 0, 2317 zIndex: 100002 2318 }, 500); 2319 jQuery(".bwg_image_wrap").animate({width: (jQuery(window).width() - comment_container_width)}, 500); 2320 jQuery(".bwg_image_container").animate({height: (bwg_popup_current_height - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_he
2320ight'] : 0)), width: bwg_popup_current_width - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0)}, 500); 2321 jQuery(".bwg_popup_image").animate({ 2322 maxWidth: jQuery(window).width() - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2323 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2324 }, { 2325 duration: 500, 2326 complete: function () { bwg_change_watermark_container(); } 2327 }); 2328 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({ 2329 maxWidth: jQuery(window).width() - comment_container_width - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0), 2330 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2331 }, { 2332 duration: 500, 2333 complete: function () { 2334 bwg_resize_instagram_post(); 2335 bwg_change_watermark_container(); } 2336 }); 2337 if ( gallery_box_data['width_or_height'] == 'width' ) { 2338 jQuery(".bwg_filmstrip_container").animate({width: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 2339 jQuery(".bwg_filmstrip").animate({width: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}, 500); 2340 /* Set filmstrip initial position.*/ 2341 bwg_set_filmstrip_pos(jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2342 } else { 2343 jQuery(".bwg_filmstrip_container").animate({height: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 2344 jQuery(".bwg_filmstrip").animate({height: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height())}, 500); 2345 /* Set filmstrip initial position.*/ 2346 bwg_set_filmstrip_pos(window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()), '', gallery_box_data); 2347 gallery_box_data['filmstrip_direction'] == 'horizontal' ? '' : jQuery(".bwg_filmstrip_right").css({ top: (window.innerHeight - jQuery('.bwg_filmstrip_right').height() ) }); 2348 } 2349 jQuery(".bwg_resize-full").attr("class", "bwg-icon-compress bwg_ctrl_btn bwg_resize-full"); 2350 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_restore); 2351 jQuery(".spider_popup_close").attr("class", "spider_popup_close_fullscreen"); 2352 } 2353 setTimeout(function () { 2354 bwg_info_height_set(); 2355 }, 500); 2356} 2357 2358function bwg_popup_resize_lightbox() { 2359 if (typeof jQuery().fullscreen !== 'undefined') { 2360 if (jQuery.isFunction(jQuery().fullscreen)) { 2361 if (!jQuery.fullscreen.isFullScreen()) { 2362 jQuery(".bwg_resize-full").show(); 2363 if(!jQuery('.bwg_resize-full').hasClass('bwg-icon-compress')) { 2364 jQuery(".bwg_resize-full").attr("class", "bwg-icon-expand bwg_ctrl_btn bwg_resize-full"); 2365 } 2366 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_maximize); 2367 jQuery(".bwg_fullscreen").attr("class", "bwg-icon-arrows-out bwg_ctrl_btn bwg_fullscreen"); 2368 jQuery(".bwg_fullscreen").attr("title", bwg_objectsL10n.fullscreen); 2369 } 2370 } 2371 } 2372 var comment_container_width = 0; 2373 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 2374 comment_container_width = gallery_box_data['lightbox_comment_width']; 2375 } 2376 if (comment_container_width > jQuery(window).width()) { 2377 comment_container_width = jQuery(window).width(); 2378 jQuery(".bwg_comment_container").css({ 2379 width: comment_container_width 2380 }); 2381 jQuery(".bwg_ecommerce_container").css({ 2382 width: comment_container_width 2383 }); 2384 jQuery(".spider_popup_close_fullscreen").hide(); 2385 } 2386 else { 2387 jQuery(".spider_popup_close_fullscreen").show(); 2388 } 2389 if (!(!(window.innerHeight > gallery_box_data['image_height']) || !(gallery_box_data['open_with_fullscreen'] != 1)) && !jQuery('.bwg_resize-full').hasClass('bwg-icon-compress')) { 2390 jQuery("#spider_popup_wrap").css({ 2391 height: gallery_box_data['image_height'], 2392 top: '50%', 2393 marginTop: -gallery_box_data['image_height'] / 2, 2394 zIndex: 100002 2395 }); 2396 jQuery(".bwg_image_container").css({height: (gallery_box_data['image_height'] - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_he
2396ight'] : 0))}); 2397 jQuery(".bwg_image_info").css("height","auto"); 2398 bwg_info_height_set(); 2399 jQuery(".bwg_popup_image").css({ 2400 maxHeight: gallery_box_data['image_height'] - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2401 }); 2402 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 2403 maxHeight: gallery_box_data['image_height'] - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2404 }); 2405 if (gallery_box_data['filmstrip_direction'] == 'vertical') { 2406 jQuery(".bwg_filmstrip_container").css({height: gallery_box_data['image_height']}); 2407 jQuery(".bwg_filmstrip").css({height: (gallery_box_data['image_height'] - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()))}) 2408 } 2409 bwg_popup_current_height = gallery_box_data['image_height']; 2410 } 2411 else { 2412 jQuery("#spider_popup_wrap").css({ 2413 height: window.innerHeight, 2414 top: 0, 2415 marginTop: 0, 2416 zIndex: 100002 2417 }); 2418 jQuery(".bwg_image_container").css({height: (window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0))}); 2419 jQuery(".bwg_image_info").css("height","auto"); 2420 bwg_info_height_set(); 2421 jQuery(".bwg_popup_image").css({ 2422 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2423 }); 2424 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 2425 maxHeight: window.innerHeight - (gallery_box_data['filmstrip_direction'] == 'horizontal' ? gallery_box_data['image_filmstrip_height'] : 0) 2426 }); 2427 if (gallery_box_data['filmstrip_direction'] == 'vertical') { 2428 jQuery(".bwg_filmstrip_container").css({height: (window.innerHeight)}); 2429 jQuery(".bwg_filmstrip").css({height: (window.innerHeight - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()))}); 2430 } 2431 bwg_popup_current_height = window.innerHeight; 2432 } 2433 if (!(!(jQuery(window).width() >= gallery_box_data['image_width']) || !(gallery_box_data['open_with_fullscreen'] != 1))) { 2434 jQuery("#spider_popup_wrap").css({ 2435 width: gallery_box_data['image_width'], 2436 left: '50%', 2437 marginLeft: -gallery_box_data['image_width'] / 2, 2438 zIndex: 100002 2439 }); 2440 jQuery(".bwg_image_wrap").css({width: gallery_box_data['image_width'] - comment_container_width}); 2441 jQuery(".bwg_image_container").css({width: (gallery_box_data['image_width'] - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width)}); 2442 jQuery(".bwg_image_info").css("height","auto"); 2443 bwg_info_height_set(); 2444 jQuery(".bwg_popup_image").css({ 2445 maxWidth: gallery_box_data['image_width'] - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width 2446 }); 2447 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 2448 maxWidth: gallery_box_data['image_width'] - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width 2449 }); 2450 if (gallery_box_data['filmstrip_direction'] == 'horizontal') { 2451 jQuery(".bwg_filmstrip_container").css({width: gallery_box_data['image_width'] - comment_container_width}); 2452 jQuery(".bwg_filmstrip").css({width: (gallery_box_data['image_width'] - comment_container_width- 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()))}); 2453 } 2454 bwg_popup_current_width = gallery_box_data['image_width']; 2455 } 2456 else { 2457 jQuery("#spider_popup_wrap").css({ 2458 width: jQuery(window).width(), 2459 left: 0, 2460 marginLeft: 0, 2461 zIndex: 100002 2462 }); 2463 jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)}); 2464 jQuery(".bwg_image_container").css({width: (jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width)}); 2465 jQuery(".bwg_popup_image").css({ 2466 maxWidth: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width 2467 }); 2468 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 2469 maxWidth: jQuery(window).width() - (gallery_box_data['filmstrip_direction'] == 'vertical' ? gallery_box_data['image_filmstrip_width'] : 0) - comment_container_width 2470 }); 2471 if (gallery_box_data['filmstrip_direction'] == 'horizontal') { 2472 jQuery(".bwg_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)}); 2473 jQuery(".bwg_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 2* (gallery_box_data['filmstrip_direction'] == 'horizontal' ? jQuery('.bwg_filmstrip_right').width():jQuery('.bwg_filmstrip_right').height()))}); 2474 } 2475 bwg_popup_current_width = jQuery(window).width(); 2476 } 2477 /* Set watermark container size.*/ 2478 bwg_resize_instagram_post(); 2479 bwg_change_watermark_container(); 2480 2481 /* Change close button position to IN LIGHTBOX, 2482 if fullscreen lightbox is disabled, 2483 lightbox width/height is smaller than window 2484 and the button by default is out of lightbox.*/ 2485 if ( gallery_box_data['open_with_fullscreen'] != 1 ) { 2486 if ( (gallery_box_data['lightbox_close_btn_right'] < 0 && jQuery("#spider_popup_wrap").width() - 2 * gallery_box_data['lightbox_close_btn_right'] >= jQuery(window).width()) 2487 || (gallery_box_data['lightbox_close_btn_top'] < 0 && jQuery("#spider_popup_wrap").height() - 2 * gallery_box_data['lightbox_close_btn_top'] >= jQuery(window).height()) ) { 2488 jQuery(".spider_popup_close").attr("class", "spider_popup_close_fullscreen"); 2489 } 2490 else { 2491 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 2492 } 2493 } 2494
2495 var bwg_ctrl_btn_container_height = jQuery(".bwg_ctrl_btn_container").height(); 2496 if ( gallery_box_data['lightbox_ctrl_btn_pos'] == 'bottom' ) { 2497 if (jQuery(".bwg_toggle_container i").hasClass('bwg-icon-caret-down')) { 2498 jQuery(".bwg_toggle_container").css("bottom", bwg_ctrl_btn_container_height + "px"); 2499 } 2500 } 2501 if ( gallery_box_data['lightbox_ctrl_btn_pos'] == 'top') { 2502 if (jQuery(".bwg_toggle_container i").hasClass('bwg-icon-caret-up')) { 2503 jQuery(".bwg_toggle_container").css("top", bwg_ctrl_btn_container_height + "px"); 2504 } 2505 } 2506} 2507 2508function bwg_rating( current_rate, rate_count, avg_rating, cur_key ) { 2509 lightbox_rate_stars_count = gallery_box_data['lightbox_rate_stars_count']; 2510 lightbox_rate_size = gallery_box_data['lightbox_rate_size']; 2511 lightbox_rate_icon = gallery_box_data['lightbox_rate_icon']; 2512 var avg_rating_message = "Not rated yet."; 2513 if ( avg_rating != 0 ) { 2514 if ( avg_rating != "" ) { 2515 avg_rating_message = parseFloat(avg_rating).toFixed(1) + "\n Votes: " + rate_count; 2516 } 2517 } 2518 if ( typeof jQuery().raty !== 'undefined' ) { 2519 if ( jQuery.isFunction(jQuery().raty) ) { 2520 var curr_score = parseFloat(jQuery("#bwg_star").attr("data-score")); 2521 jQuery("#bwg_star").removeAttr("data-score").html(''); 2522 var rate_params = { 2523 starType: 'i', 2524 number: lightbox_rate_stars_count, 2525 size: lightbox_rate_size, 2526 noRatedMsg: "Not rated yet.", 2527 readOnly: false, 2528 score: curr_score, 2529 starHalf: 'bwg-icon-' + lightbox_rate_icon + ((lightbox_rate_icon == 'star') ? '-half' : '') + '-o', 2530 starOff: 'bwg-icon-' + lightbox_rate_icon + '-o', 2531 starOn: 'bwg-icon-' + lightbox_rate_icon, 2532 cancelOff: 'bwg-icon-minus-square-o', 2533 cancelOn: 'bwg-icon-minus-square-o', 2534 cancel: false, 2535 // target : '#bwg_hint', 2536 // targetType : 'number', 2537 // targetKeep : true, 2538 cancelHint: 'Cancel your rating.', 2539 hints: [avg_rating_message, avg_rating_message, avg_rating_message, avg_rating_message, avg_rating_message], 2540 alreadyRatedMsg: parseFloat(avg_rating).toFixed(1) + "\n" + "You have already rated.\nVotes: " + rate_count, 2541 }; 2542 if (!current_rate) { 2543 rate_params.click = function (score, evt) { 2544 jQuery("#bwg_star").hide(); 2545 jQuery("#bwg_rated").show(); 2546 spider_set_input_value('rate_ajax_task', 'save_rate'); 2547 jQuery.when(spider_rate_ajax_save('bwg_rate_form', score)).then(function () { 2548 gallery_box_data['data'][cur_key]["rate"] = score; 2549 ++gallery_box_data['data'][cur_key]["rate_count"]; 2550 gallery_box_data['data'][cur_key]["avg_rating"] = curr_score ? ((curr_score + score) / 2).toFixed(1) : score.toFixed(1); 2551 bwg_rating(gallery_box_data['data'][cur_key]["rate"], gallery_box_data['data'][cur_key]["rate_count"], gallery_box_data['data'][cur_key]["avg_rating"], gallery_box_data['current_image_key']); 2552 }); 2553 }; 2554 } 2555 2556 jQuery("#bwg_star").raty(rate_params); 2557 jQuery('.bwg_image_rate_disabled').hide(); 2558 if ( current_rate ) { 2559 jQuery('.bwg_image_rate_disabled').show(); 2560 } 2561 } 2562 } 2563} 2564 2565function changeDownloadsTotal(obj) { 2566 var totalPrice = 0; 2567 var showdigitalItemsCount = jQuery("[name=option_show_digital_items_count]").val(); 2568 if( showdigitalItemsCount == 0 ){ 2569 jQuery("[name=selected_download_item]:checked").each(function(){ 2570 totalPrice += Number(jQuery(this).closest("tr").attr("data-price")); 2571 }); 2572 } 2573 else{ 2574 jQuery(".digital_image_count").each(function(){ 2575 if(Number(jQuery(this).val()) != 0){ 2576 totalPrice += Number(jQuery(this).closest("tr").attr("data-price")) * Number(jQuery(this).val()); 2577 } 2578 }); 2579 } 2580 totalPrice = totalPrice.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); 2581 jQuery(".product_downloads_price").html(totalPrice); 2582} 2583 2584function changeMenualTotal(obj) { 2585 if(Number(jQuery(obj).val()) <= 0){ 2586 jQuery(obj).val("1"); 2587 } 2588 var count = Number(jQuery(obj).val()); 2589 var totalPrice = Number(jQuery(".product_manual_price").attr("data-actual-price")); 2590 totalPrice = count*totalPrice; 2591 2592 totalPrice = totalPrice.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); 2593 jQuery(".product_manual_price").html(totalPrice); 2594} 2595 2596function onSelectableParametersChange(obj) { 2597 var parametersPrise = 0; 2598 var productPrice = gallery_box_data["data"][jQuery('#bwg_current_image_key').val()]["pricelist_manual_price"] ? gallery_box_data["data"][jQuery('#bwg_current_image_key').val()]["pricelist_manual_price"] : '0'; 2599 productPrice = parseFloat(productPrice.replace(",","")); 2600 2601 var type = jQuery(obj).closest('.image_selected_parameter').attr("data-parameter-type"); 2602 var priceInfo = jQuery(obj).val(); 2603 priceInfo = priceInfo.split("*"); 2604 var priceValue = parseFloat(priceInfo[1]); 2605 var sign = priceInfo[0]; 2606 var alreadySelectedValues = Number(jQuery(obj).closest('.image_selected_parameter').find(".already_selected_values").val()); 2607 if ( type == "4" || type == "5" ) { 2608 var newPriceVlaueSelectRadio = parseFloat( sign + priceValue ); 2609 jQuery(obj).closest('.image_selected_parameter').find(".already_selected_values").val(newPriceVlaueSelectRadio); 2610 } 2611 else if ( type == "6" ) { 2612 if ( jQuery(obj).is(":checked") == false ) { 2613 var newPriceVlaueCheckbox = alreadySelectedValues - parseFloat( sign + priceValue ); 2614 } 2615 else { 2616 var newPriceVlaueCheckbox = alreadySelectedValues + parseFloat( sign + priceValue ); 2617 } 2618 jQuery(obj).closest('.image_selected_parameter').find(".already_selected_values").val(newPriceVlaueCheckbox); 2619 } 2620 2621 jQuery(".already_selected_values").each( function() { 2622 parametersPrise += Number(jQuery(this).val()); 2623 }); 2624 productPrice = productPrice + parametersPrise; 2625 jQuery(".product_manual_price").attr("data-actual-price",productPrice); 2626 var count = Number(jQuery(".image_count").val()) <= 0 ? 1 : Number(jQuery(".image_count").val()); 2627 productPrice = count * productPrice; 2628 productPrice = productPrice.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); 2629 jQuery(".product_manual_price").html(productPrice); 2630} 2631 2632function onBtnClickAddToCart() { 2633 var type = jQuery("[name=type]").val(); 2634 if ( type != "" ) { 2635 var data = {}; 2636 if ( type == "manual" ) { 2637 var count = jQuery(".image_count").val(); 2638 var parameters = {}; 2639 jQuery(".manual").find(".image_selected_parameter").each(function () { 2640 var parameterId = jQuery(this).attr("data-parameter-id"); 2641 var parameterTypeId = jQuery(this).attr("data-parameter-type"); 2642 var parameterValue = ""; 2643 switch (parameterTypeId) { 2644 case '2': 2645 parameterValue = jQuery(this).find("input").val(); 2646 break; 2647 case '3': 2648 parameterValue = jQuery(this).find("textarea").val(); 2649 break; 2650 case '4': 2651 parameterValue = jQuery(this).find('select :selected').val(); 2652 break; 2653 case '5': 2654 parameterValue = jQuery(this).find('[type=radio]:checked').val(); 2655 break; 2656 case '6': 2657 var checkbox_parameter_values = []; 2658 jQuery(this).find("[type=checkbox]:checked").each(function () { 2659 checkbox_parameter_values.push(jQuery(this).val()); 2660 }); 2661 parameterValue = checkbox_parameter_values; 2662 break; 2663 } 2664 2665 parameters[parameterId] = parameterValue; 2666 }); 2667 data.count = count; 2668 data.parameters = parameters; 2669 data.price = jQuery(".product_manual_price").attr("data-price").replace(",",""); 2670 } 2671 else { 2672 var downloadItems = []; 2673 var showdigitalItemsCount = jQuery("[name=option_show_digital_items_count]").val(); 2674 if( showdigitalItemsCount == 0 ){ 2675 if(jQuery("[name=selected_download_item]:checked").length == 0){ 2676 jQuery(".add_to_cart_msg").html("You must select at least one item."); 2677 return; 2678 } 2679 jQuery("[name=selected_download_item]:checked").each(function () { 2680 var downloadItem = {}; 2681 downloadItem.id = jQuery(this).val(); 2682 downloadItem.count = 1; 2683 downloadItem.price = jQuery(this).closest("tr").attr("data-price"); 2684 downloadItems.push(downloadItem); 2685 }); 2686 } 2687 else{ 2688 jQuery(".digital_image_count").each(function () { 2689 var downloadItem = {}; 2690 if(jQuery(this).val() > 0){ 2691 downloadItem.id = jQuery(this).closest("tr").attr("data-id"); 2692 downloadItem.price = jQuery(this).closest("tr").attr("data-price"); 2693 downloadItem.count = jQuery(this).val(); 2694 downloadItems.push(downloadItem); 2695 } 2696 }); 2697 } 2698 data.downloadItems = downloadItems; 2699 if(downloadItems.length == 0) { 2700 jQuery(".add_to_cart_msg").html("Please select at least one item"); 2701 return ; 2702 } 2703 } 2704 2705 var ajaxurl = jQuery("#ajax_url").val(); 2706 var post_data = { 2707 'action': 'add_cart', 2708 'task': 'add_cart', 2709 'controller': 'checkout', 2710 "image_id": jQuery('#bwg_popup_image').attr('image_id'), 2711 "type": type, 2712 "data": JSON.stringify(data) 2713 }; 2714 2715 jQuery.ajax({ 2716 type: "POST", 2717 url: ajaxurl, 2718 data: post_data, 2719 success: function (response) { 2720 responseData = JSON.parse(response); 2721 jQuery(".add_to_cart_msg").html(responseData["msg"]); 2722 jQuery(".products_in_cart").html(responseData["products_in_cart"]); 2723 if(responseData["redirect"] == 1){ 2724 window.location.href = "<?php echo get_permalink($options->checkout_page);?>"; 2725 } 2726 }, 2727 beforeSend: function(){ 2728 }, 2729 complete:function(){ 2730 } 2731 }); 2732 } 2733 else { 2734 jQuery(".add_to_cart_msg").html("Please select Prints and products or Downloads"); 2735 } 2736} 2737 2738function onBtnViewCart(){ 2739 var checkoutPage = jQuery("[name=option_checkout_page]").val(); 2740 jQuery("#bwg_ecommerce_form").attr("action",checkoutPage); 2741 jQuery("#bwg_ecommerce_form").submit(); 2742} 2743 2744/* Load visible images in filmstrip.*/ 2745function bwg_load_visible_images( key, preloadCount, total_thumbnail_count ) { 2746 if((key - preloadCount) >= 0) { 2747 startPoint = key - preloadCount; 2748 } 2749 if((key + preloadCount) > total_thumbnail_count) { 2750 endPoint = total_thumbnail_count; 2751 } 2752 for( var i = startPoint; i <= endPoint; i++) { 2753 var filmstrip_image = jQuery("#bwg_filmstrip_thumbnail_" + i + " img"); 2754 filmstrip_image.removeClass('bwg-hidden'); 2755 filmstrip_image.attr('src', filmstrip_image.data('url')); 2756 } 2757} 2758 2759/* Load filmstrip not visible images. */ 2760function bwg_load_filmstrip() { 2761 for(var i = 1; i <= total_thumbnail_count; i++) { 2762 leftIndex = startPoint - i; 2763 rightIndex = endPoint + i; 2764 2765 if ( rightIndex < total_thumbnail_count ) { /* check if right index is greater than max index */ 2766 var filmstrip_image = jQuery("#bwg_filmstrip_thumbnail_" + rightIndex + " img"); 2767 filmstrip_image.removeClass('bwg-hidden'); 2768 filmstrip_image.attr('src', filmstrip_image.data('url')); 2769 } 2770 /* Left from key indexes */ 2771 if ( leftIndex >= 0 ) { 2772 var filmstrip_image = jQuery("#bwg_filmstrip_thumbnail_" + leftIndex + " img"); 2773 filmstrip_image.removeClass('bwg-hidden'); 2774 filmstrip_image.attr('src', filmstrip_image.data('url')); 2775 } 2776 } 2777 jQuery(".bwg_filmstrip_thumbnail").each(function () { 2778 var image = jQuery(this).find("img"); 2779 /* For embed types */ 2780 if (typeof image.attr("style") != 'undefined') { 2781 return; 2782 } 2783 var bwg_filmstrip_thumbnail; 2784 if (image.width() == 0) { 2785 image.on("load", function () { 2786 bwg_filmstrip_thumbnail = jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"); 2787 bwg_filmstrip_thumb_view( image ); 2788 }); 2789 } 2790 else { 2791 bwg_filmstrip_thumbnail = jQuery(this).find(".bwg_filmstrip_thumbnail_img_wrap"); 2792 bwg_filmstrip_thumb_view( image ); 2793 } 2794 }); 2795} 2796 2797/* thumb size and position correction for filmstrip*/ 2798function bwg_filmstrip_thumb_view( image ) {
2799 var image_filmstrip_height_space = gallery_box_data['image_filmstrip_height']; 2800 var image_filmstrip_width_space = gallery_box_data['image_filmstrip_width']; 2801 2802 var image_filmstrip_width = image_filmstrip_width_space - gallery_box_data['filmstrip_thumb_right_left_space']; 2803 var image_filmstrip_height = image_filmstrip_height_space; 2804 2805 var scale = Math.max(image_filmstrip_width_space / image.width(), image_filmstrip_height_space / image.height()); 2806 var image_width = image.width() * scale; 2807 var image_height = image.height() * scale; 2808 2809 image.css({ 2810 width:image_width, 2811 height: image_height, 2812 marginLeft: (image_filmstrip_width - image_width) / 2, 2813 marginTop: (image_filmstrip_height - image_height) / 2 2814 }); 2815} 2816 2817/* Set image info height */ 2818function bwg_info_height_set(){ 2819 bwg_info_position( false ); 2820 if ( jQuery(".mCustomScrollBox").length && jQuery(".bwg_image_info_container1").height() < jQuery(".mCustomScrollBox").height() + jQuery(".bwg_toggle_container").height() + bwg_image_info_pos + 2*( parseInt(gallery_box_data['lightbox_info_margin']))){ 2821 jQuery(".bwg_image_info").css({height:jQuery(".bwg_image_info_container1").height()- jQuery(".bwg_toggle_container").height()- bwg_image_info_pos - 2*(parseInt(gallery_box_data['lightbox_info_margin']))}); 2822 } 2823} 2824 2825/* Set image info position */ 2826function bwg_info_position( toggle ) { 2827 var number = 0; 2828 var type = 'none'; 2829 2830 if (gallery_box_data['lightbox_ctrl_btn_pos'] == 'top') { 2831 if (gallery_box_data['lightbox_info_pos'] == 'top') { 2832 type = 'top'; 2833 } 2834 } 2835 else { 2836 if (gallery_box_data['lightbox_info_pos'] == 'bottom') { 2837 type = 'bottom'; 2838 } 2839 } 2840 2841 if ( !jQuery('.bwg_ctrl_btn_container').hasClass('closed') ) { 2842 if (gallery_box_data['lightbox_ctrl_btn_pos'] == 'top') { 2843 if (gallery_box_data['lightbox_info_pos'] == 'top') { 2844 number = jQuery(".bwg_ctrl_btn_container").height(); 2845 } 2846 } 2847 else { 2848 if (gallery_box_data['lightbox_info_pos'] == 'bottom') { 2849 number = jQuery(".bwg_ctrl_btn_container").height(); 2850 } 2851 } 2852 } 2853 2854 if (type == 'top') { 2855 if (toggle == false) { 2856 jQuery(".bwg_image_info").css('top', number); 2857 } 2858 else { 2859 jQuery(".bwg_image_info").animate({top: number + "px"}, 500); 2860 } 2861 } 2862 else if (type == 'bottom') { 2863 if (toggle == false) { 2864 jQuery(".bwg_image_info").css('bottom', number); 2865 } 2866 else { 2867 jQuery(".bwg_image_info").animate({bottom: number + "px"}, 500); 2868 } 2869 } 2870} 2871 2872/** 2873 * Disable left arrow. 2874 * 2875 * @param args 2876 */ 2877function bwg_disable_lightbox_filmstrip_left_arrow( args ) { 2878 if ( args['left_or_top'] == 'left' ) { 2879 if ( parseInt(jQuery(".bwg_filmstrip_thumbnails").position().left) == 0 ) { 2880 jQuery(".bwg_filmstrip_left").css({ opacity: 0.3 }); 2881 } 2882 } 2883 else { 2884 if ( jQuery(".bwg_filmstrip_thumbnails").position().top == 0 ) { 2885 jQuery(".bwg_filmstrip_left").css({ opacity: 0.3 }); 2886 } 2887 } 2888} 2889 2890/** 2891 * Disable right arrow. 2892 * 2893 * @param args 2894 */ 2895function bwg_disable_lightbox_filmstrip_right_arrow( args ) { 2896 if ( args['left_or_top'] == 'left' ) { 2897 if ( args['width_or_height'] == 'width' ) { 2898 if ( parseInt(jQuery(".bwg_filmstrip_thumbnails").position().left) <= ((jQuery(".bwg_filmstrip").width() - jQuery(".bwg_filmstrip_thumbnails").width()) + args['filmstrip_thumb_right_left_space'] + args['all_images_right_left_space']) ) { 2899 jQuery(".bwg_filmstrip_right").css({ opacity: 0.3 }); 2900 } 2901 } 2902 else { 2903 if ( jQuery(".bwg_filmstrip_thumbnails").position().left == -(jQuery(".bwg_filmstrip_thumbnails").height() - jQuery(".bwg_filmstrip").height()) ) { 2904 jQuery(".bwg_filmstrip_right").css({ opacity: 0.3 }); 2905 } 2906 } 2907 } 2908 else { 2909 if ( args['width_or_height'] == 'width' ) { 2910 if ( jQuery(".bwg_filmstrip_thumbnails").position().left == -(jQuery(".bwg_filmstrip_thumbnails").width() - jQuery(".bwg_filmstrip").width()) ) { 2911 jQuery(".bwg_filmstrip_right").css({ opacity: 0.3 }); 2912 } 2913 } 2914 else { 2915 if ( parseInt(jQuery(".bwg_filmstrip_thumbnails").position().top) <= ((jQuery(".bwg_filmstrip").height() - jQuery(".bwg_filmstrip_thumbnails").height()) + gallery_box_data['filmstrip_thumb_right_left_space'] + gallery_box_data['all_images_right_left_space']) ) { 2916 jQuery(".bwg_filmstrip_right").css({ opacity: 0.3 }); 2917 } 2918 } 2919 } 2920} 2921 2922/** 2923 * Disable left right arrow. 2924 */ 2925function bwg_disable_lightbox_filmstrip_left_right_arrow( args ) { 2926 var filmstrip_top_left_position = jQuery(".bwg_filmstrip_thumbnails").position().left; 2927 var disable_two_arrow = (jQuery(".bwg_filmstrip").width() > jQuery(".bwg_filmstrip_thumbnails").width()) ? true : false;
2928 if ( args['left_or_top'] == 'top' ) { 2929 filmstrip_top_left_position = jQuery(".bwg_filmstrip_thumbnails").position().top; 2930 disable_two_arrow = (jQuery(".bwg_filmstrip").height() > jQuery(".bwg_filmstrip_thumbnails").height()) ? true : false; 2931 } 2932 jQuery('.bwg_filmstrip_container .bwg_filmstrip_left').css({ 'opacity': '1' }); 2933 jQuery('.bwg_filmstrip_container .bwg_filmstrip_right').css({ 'opacity': '1' }); 2934 if ( jQuery('.bwg_filmstrip_thumbnails .bwg_filmstrip_thumbnail:first-child').index() == jQuery('.bwg_filmstrip_thumbnails .bwg_filmstrip_thumbnail.bwg_thumb_active').index() || filmstrip_top_left_position == 0 ) { 2935 jQuery('.bwg_filmstrip_container .bwg_filmstrip_left').css({ 'opacity': '0.3' }); 2936 } 2937 if ( jQuery('.bwg_filmstrip_thumbnails .bwg_filmstrip_thumbnail:last-child').index() == jQuery('.bwg_filmstrip_thumbnails .bwg_filmstrip_thumbnail.bwg_thumb_active').index() ) { 2938 jQuery('.bwg_filmstrip_container .bwg_filmstrip_right').css({ 'opacity': '0.3' }); 2939 } 2940 if ( jQuery(".bwg_filmstrip").width() > jQuery(".bwg_filmstrip_thumbnails").width() ) { 2941 jQuery('.bwg_filmstrip_container .bwg_filmstrip_left, .bwg_filmstrip_container .bwg_filmstrip_right').css({ 'opacity': '0.3' }); 2942 } 2943 if ( disable_two_arrow ) { 2944 jQuery('.bwg_filmstrip_container .bwg_filmstrip_left, .bwg_filmstrip_container .bwg_filmstrip_right').css({ 'opacity': '0.3' }); 2945 } 2946}; 2947// source --> https://www.mediatop.hu/wp-content/plugins/photo-gallery/js/bwg_embed.js?ver=1.8.13 2948/*server side analogue is function display_embed in WDWLibraryEmbed*/ 2949/*params 2950 embed_type: string , one of predefined accepted types 2951 embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host 2952 attrs: object with html attributes and values format e.g. {width:'100px', style:"display:inline;"} 2953*/ 2954 2955function spider_display_embed(embed_type, file_url, embed_id, attrs) { 2956 var html_to_insert = ''; 2957 switch(embed_type) { 2958 case 'EMBED_OEMBED_YOUTUBE_VIDEO': 2959 var oembed_youtube_html ='<iframe '; 2960 if(embed_id!=''){ 2961 oembed_youtube_html += ' src="' + '//www.youtube.com/embed/'+ embed_id + '?enablejsapi=1&wmode=transparent"'; 2962 } 2963 for (attr in attrs) { 2964 if(!(/src/i).test(attr)){ 2965 if(attr != '' && attrs[attr] != ''){ 2966 oembed_youtube_html += ' '+ attr + '="' + attrs[attr] + '"'; 2967 } 2968 } 2969 } 2970 oembed_youtube_html += " ></iframe>"; 2971 html_to_insert += oembed_youtube_html; 2972 2973 break; 2974 case 'EMBED_OEMBED_VIMEO_VIDEO': 2975 var oembed_vimeo_html ='<iframe '; 2976 if(embed_id!=''){ 2977 oembed_vimeo_html += ' src="' + '//player.vimeo.com/video/' + embed_id + '?enablejsapi=1"'; 2978 } 2979 for (attr in attrs) { 2980 if(!(/src/i).test(attr)){ 2981 if(attr != '' && attrs[attr] != ''){ 2982 oembed_vimeo_html += ' '+ attr + '="' + attrs[attr] + '"'; 2983 } 2984 } 2985 } 2986 oembed_vimeo_html += " ></iframe>"; 2987 html_to_insert += oembed_vimeo_html; 2988 2989 break; 2990 case 'EMBED_OEMBED_FLICKR_IMAGE': 2991 var oembed_flickr_html ='<div '; 2992 for (attr in attrs) { 2993 if(!(/src/i).test(attr)){ 2994 if(attr != '' && attrs[attr] != ''){ 2995 oembed_flickr_html += ' '+ attr + '="'+ attrs[attr] + '"'; 2996 } 2997 } 2998 } 2999 oembed_flickr_html += " >"; 3000 if(embed_id!=''){ 3001 3002 oembed_flickr_html += '<img src="'+embed_id+'"'+ 3003 ' style="'+ 3004 'max-width:'+'100%'+" !important"+ 3005 '; max-height:'+'100%'+" !important"+ 3006 '; width:'+'auto !important'+ 3007 '; height:'+ 'auto !important' + 3008 ';">'; 3009 } 3010 3011 oembed_flickr_html +="</div>"; 3012 3013 html_to_insert += oembed_flickr_html; 3014 break; 3015 case 'EMBED_OEMBED_FLICKR_VIDEO': 3016 /* code...*/ 3017 break; 3018 case 'EMBED_OEMBED_INSTAGRAM_VIDEO': 3019 var oembed_instagram_html = '<div '; 3020 for ( attr in attrs ) { 3021 if ( !(/src/i).test(attr) ) { 3022 if ( attr != '' && attrs[attr] != '' ) { 3023 oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"'; 3024 } 3025 } 3026 } 3027 oembed_instagram_html += " >"; 3028 if ( file_url != '' ) { 3029 /*oembed_instagram_html += '<iframe src="'+embed_id+'"'+ 3030 ' style="'+ 3031 'max-width:'+'100%'+" !important"+ 3032 '; max-height:'+'100%'+" !important"+ 3033 '; width:'+'auto'+ 3034 '; height:'+ '100%' + " "+ 3035 '; margin:0;"'+ 3036 'frameborder="0" scrolling="no" allowtransparency="false"></iframe>'; 3037 */ 3038 3039 oembed_instagram_html += '<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>' + 3040 '<source src="' + decodeURIComponent(file_url) + 3041 '" type="video/mp4"> Your browser does not support the video tag. </video>'; 3042 } 3043 oembed_instagram_html += "</div>"; 3044 html_to_insert += oembed_instagram_html; 3045 break; 3046 case 'EMBED_OEMBED_INSTAGRAM_IMAGE': 3047 var max_width = attrs['data-max-width']; 3048 var max_height = attrs['data-max-height']; 3049 var oembed_instagram_html = '<div '; 3050 for ( attr in attrs ) { 3051 if ( !(/src/i).test(attr) ) { 3052 if ( attr != '' && attrs[attr] != '' ) { 3053 oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"'; 3054 } 3055 } 3056 } 3057 oembed_instagram_html += " >"; 3058 if ( file_url != '' ) { 3059 oembed_instagram_html += '<img src="' + decodeURIComponent(file_url) + '"' + ' style="max-width:' + max_width + 'px; max-height:' + max_height + 'px; width: auto; height: auto">'; 3060 } 3061 oembed_instagram_html += "</div>"; 3062 html_to_insert += oembed_instagram_html; 3063 break; 3064 case 'EMBED_OEMBED_INSTAGRAM_POST': 3065 var oembed_instagram_html = '<div '; 3066 var id = ''; 3067 for ( attr in attrs ) { 3068 if ( !(/src/i).test(attr) ) { 3069 if ( attr != '' && attrs[attr] != '' ) { 3070 oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"'; 3071 if ( attr == 'CLASS' || attr == 'class' || attr == 'Class' ) { 3072 obj_class = attrs[attr]; 3073 } 3074 } 3075 } 3076 } 3077 oembed_instagram_html += ">"; 3078 if ( file_url != '' ) { 3079 oembed_instagram_html += '<div class="inner_instagram_iframe_' + obj_class + '" style="max-width: 100% !important; max-height: 100% !important; width: 100%; height: 100%; margin:0; vertical-align:middle;">' 3080 + atob(file_url) 3081 + '</div>'; 3082 } 3083 oembed_instagram_html += "</div>"; 3084 html_to_insert += oembed_instagram_html; 3085 break; 3086 case 'EMBED_OEMBED_FACEBOOK_IMAGE': 3087 var oembed_facebook_html ='<span '; 3088 for (attr in attrs) { 3089 if(!(/src/i).test(attr)){ 3090 if(attr != '' && attrs[attr] != ''){ 3091 oembed_facebook_html += ' '+ attr + '="'+ attrs[attr] + '"'; 3092 } 3093 } 3094 } 3095 oembed_facebook_html += " >"; 3096 if(embed_id!=''){ 3097 oembed_facebook_html += '<img src="'+file_url+'"'+ 3098 ' style=" '+ 3099 'max-width:'+'100%'+" !important"+ 3100 '; max-height:'+'100%'+" !important"+ 3101 '; width:'+'auto'+ 3102 '; height:'+ '100%' + 3103 ';">'; 3104 } 3105 oembed_facebook_html +="</span>"; 3106 html_to_insert += oembed_facebook_html; 3107 break; 3108 case 'EMBED_OEMBED_FACEBOOK_VIDEO': 3109 var oembed_facebook_video_html ='<div '; 3110 for (attr in attrs) { 3111 if(!(/src/i).test(attr)){ 3112 if(attr != '' && attrs[attr] != ''){ 3113 oembed_facebook_video_html += ' '+ attr + '="'+ attrs[attr] + '"'; 3114 } 3115 } 3116 } 3117 oembed_facebook_video_html += " >"; 3118 if(embed_id!=''){ 3119 oembed_facebook_video_html += '<iframe src="//www.facebook.com/video/embed?video_id='+file_url+'&enablejsapi=1&wmode=transparent"' + 3120 ' style="'+ 3121 'max-width:'+'100%'+" !important"+ 3122 '; max-height:'+'100%'+" !important"+ 3123 '; width:'+'100%'+ 3124 '; height:'+ '100%' + 3125 '; margin:0'+ 3126 '; display:table-cell; vertical-align:middle;"'+ 3127 'frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen'+ 3128 '></iframe>'; 3129 } 3130 oembed_facebook_video_html +="</div>"; 3131 html_to_insert += oembed_facebook_video_html; 3132 break; 3133 case 'EMBED_OEMBED_DAILYMOTION_VIDEO': 3134 var oembed_dailymotion_html ='<iframe '; 3135 if(embed_id!=''){ 3136 oembed_dailymotion_html += ' src="' + '//www.dailymotion.com/embed/video/'+embed_id + '?api=postMessage"'; 3137 } 3138 for (attr in attrs) { 3139 if(!(/src/i).test(attr)){ 3140 if(attr != '' && attrs[attr] != ''){ 3141 oembed_dailymotion_html += ' '+ attr + '="'+ attrs[attr] + '"'; 3142 } 3143 } 3144 } 3145 oembed_dailymotion_html += " ></iframe>"; 3146 html_to_insert += oembed_dailymotion_html; 3147 3148 break; 3149 case 'EMBED_OEMBED_IMGUR': 3150 /*not working yet*/ 3151 var oembed_imgur_html ='<div '; 3152 for (attr in attrs) { 3153 if(!(/src/i).test(attr)){ 3154 if(attr != '' && attrs[attr] != ''){ 3155 oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"'; 3156 } 3157 } 3158 } 3159 oembed_imgur_html += " >"; 3160 if(embed_id!=''){ 3161 3162 oembed_imgur_html += '<img src="'+embed_id+'"'+ 3163 ' style="'+ 3164 'max-width:'+'100%'+" !important"+ 3165 '; max-height:'+'100%'+" !important"+ 3166 '; width:'+'auto'+ 3167 '; height:'+ 'auto' + " !important"+ 3168 ';">'; 3169 } 3170 oembed_imgur_html +="</div>"; 3171 3172 html_to_insert += oembed_imgur_html; 3173 3174 break; 3175 case 'EMBED_OEMBED_GOOGLE_PHOTO_IMAGE': 3176 var oembed_google_photos_html ='<div '; 3177 for (attr in attrs) { 3178 if(!(/src/i).test(attr)){ 3179 if(attr != '' && attrs[attr] != ''){ 3180 oembed_google_photos_html += ' '+ attr + '="'+ attrs[attr] + '"'; 3181 } 3182 } 3183 } 3184 oembed_google_photos_html += " >"; 3185 if(embed_id!=''){ 3186 3187 oembed_google_photos_html += '<img src="'+file_url+'"'+ 3188 ' style=" '+ 3189 'max-width:'+'100%'+" !important"+ 3190 '; max-height:'+'100%'+" !important"+ 3191 '; width:'+'auto'+ 3192 '; height:'+ 'auto' + 3193 ';">'; 3194 } 3195 oembed_google_photos_html +="</div>"; 3196 3197 html_to_insert += oembed_google_photos_html; 3198 3199 break; 3200 default: 3201 var html = {content: ''}; 3202 jQuery(document).trigger('bwg_display_embed', [html, embed_type, file_url, embed_id, attrs]); 3203 html_to_insert = html.content; 3204 } 3205 3206 return html_to_insert 3207} 3208 3209/** 3210 * @param from_popup: optional, true if from bulk embed popup, false(default) if from instagram gallery 3211 * @return "ok" if adds instagram gallery, false if any error when adding instagram gallery 3212 */ 3213function bwg_add_instagram_gallery(instagram_access_token, from_popup){ 3214 from_popup = typeof from_popup !== 'undefined' ? from_popup : false;
3215 /*if bulk_embed action*/ 3216 if (from_popup === true) { 3217 if (bwg_check_instagram_gallery_input(instagram_access_token, from_popup)){ 3218 return false; 3219 } 3220 var whole_post = '0'; 3221 if(jQuery("input[name=popup_instagram_post_gallery]:checked").val() == 1){ 3222 whole_post = '1'; 3223 }; 3224 var instagram_user = encodeURI(jQuery("#popup_instagram_gallery_source").val()); 3225 var autogallery_image_number = encodeURI(jQuery("#popup_instagram_image_number").val()); 3226 } 3227 else{ 3228 /*check if there is problem with input*/ 3229 if ( bwg_check_instagram_gallery_input(instagram_access_token, from_popup) ) { 3230 return false; 3231 } 3232 if ( !bwg_check_gallery_empty(false, true) ) { 3233 return false; 3234 } 3235 var whole_post = '0'; 3236 if ( jQuery("input[name=instagram_post_gallery]:checked").val() == 1 ) { 3237 whole_post = '1'; 3238 } 3239 3240 var instagram_user = encodeURI(jQuery("#gallery_source").val()); // @ToDo if content type instagram only then user is undefined. 3241 var update_flag = jQuery("input[name=update_flag]:checked").val(); 3242 var autogallery_image_number = encodeURI(jQuery("#autogallery_image_number").val()); 3243 } 3244 jQuery('#bulk_embed').hide(); 3245 jQuery('#loading_div').show(); 3246 3247 /*prepare data for request*/ 3248 var filesValid = []; 3249 var data = { 3250 'action': 'addInstagramGallery', 3251 'instagram_user': instagram_user, // @ToDo instagram user is undefined 3252 'instagram_access_token': instagram_access_token, 3253 'whole_post': whole_post, 3254 'autogallery_image_number':autogallery_image_number, 3255 'update_flag': update_flag, 3256 'async':true 3257 }; 3258 3259 /* get response data. Here we use the server as a proxy, since Cross-Origin Resource Sharing AJAX is forbidden. */ 3260 jQuery.post(bwg_ajax_url_nonce, data, function ( response ) { 3261 if ( response == false ) { 3262 alert('Error: cannot get response from the server.'); 3263 jQuery('#loading_div').hide(); 3264 if ( from_popup ) { 3265 jQuery('#bulk_embed').show(); 3266 } 3267 return false; 3268 } 3269 else { 3270 var index_start = response.indexOf("WD_delimiter_start"); 3271 var index_end = response.indexOf("WD_delimiter_end"); 3272 if ( index_start == -1 || index_end == -1 ) { 3273 jQuery('#loading_div').hide(); 3274 if ( from_popup ) { 3275 jQuery('#bulk_embed').show(); 3276 } 3277 return false; 3278 } 3279 /*filter out other echoed characters*/ 3280 /*18 is the length of "wd_delimiter_start"*/ 3281 response = response.substring(index_start + 18, index_end); 3282 response_JSON = JSON.parse(response); 3283 if ( !response_JSON ) { 3284 alert('There is some error. Cannot add Instagram gallery.'); 3285 jQuery('#loading_div').hide(); 3286 if ( from_popup ) { 3287 jQuery('#bulk_embed').show(); 3288 } 3289 return false; 3290 } 3291 else { 3292 if ( response_JSON[0] == 'error' ) { 3293 alert('Error: ' + JSON.parse(response)[1]); 3294 jQuery('#loading_div').hide(); 3295 if ( from_popup ) { 3296 jQuery('#bulk_embed').show(); 3297 } 3298 return false; 3299 } 3300 else { 3301 var len = response_JSON.length; 3302 for ( var i = 1; i <= len; i++ ) { 3303 if ( response_JSON[len - i] != false ) { 3304 var item = response_JSON[len - i]; 3305 filesValid.push(item); 3306 } 3307 } 3308 bwg_add_image( filesValid, 'instagram' ); 3309 if ( !from_popup ) { 3310 bwg_gallery_update_flag(); 3311 jQuery('#tr_instagram_gallery_add_button').hide(); 3312 } 3313 jQuery('#loading_div').hide(); 3314 if ( from_popup ) { 3315 jQuery('.opacity_bulk_embed').hide(); 3316 } 3317 return "ok"; 3318 } 3319 } 3320 }/*end of considering all cases*/ 3321 }); 3322};
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.