1var isPopUpOpened = false; 2var bwg_overflow_initial_value = false; 3var bwg_overflow_x_initial_value = false; 4var bwg_overflow_y_initial_value = false; 5 6function spider_createpopup(url, current_view, width, height, duration, description, lifetime, lightbox_ctrl_btn_pos) { 7 url = url.replace(/&/g, '&'); 8 if (isPopUpOpened) { return }; 9 isPopUpOpened = true; 10 if (spider_hasalreadyreceivedpopup(description) || spider_isunsupporteduseragent()) { 11 return; 12 } 13 bwg_overflow_initial_value = jQuery("html").css("overflow"); 14 bwg_overflow_x_initial_value = jQuery("html").css("overflow-x"); 15 bwg_overflow_y_initial_value = jQuery("html").css("overflow-y"); 16 jQuery("html").attr("style", "overflow:hidden !important;"); 17 jQuery("#bwg_spider_popup_loading_" + current_view).show(); 18 jQuery("#spider_popup_overlay_" + current_view).css({display: "block"}); 19 jQuery.ajax({ 20 type: "GET", 21 url: url, 22 success: function (data) { 23 var popup = jQuery( 24 '<div id="spider_popup_wrap" class="spider_popup_wrap" style="' + 25 ' width:' + width + 'px;' + 26 ' height:' + height + 'px;' + 27 ' margin-top:-' + height / 2 + 'px;' + 28 ' margin-left: -' + width / 2 + 'px; ">' + 29 data + 30 '</div>') 31 .hide() 32 .appendTo("body"); 33 spider_showpopup(description, lifetime, popup, duration, lightbox_ctrl_btn_pos); 34 }, 35 beforeSend: function() {}, 36 complete:function() {} 37 }); 38} 39 40function spider_showpopup(description, lifetime, popup, duration, lightbox_ctrl_btn_pos) { 41 var cur_image_key = parseInt( jQuery( '#bwg_current_image_key' ).val() ); 42 if ( typeof data[cur_image_key] != 'undefined' ) { 43 isPopUpOpened = true; 44 var is_embed = data[cur_image_key]['filetype'].indexOf( "EMBED_" ) > -1 ? true : false; 45 if ( !is_embed ) { 46 if ( jQuery( '#spider_popup_wrap .bwg_popup_image_spun img' ).prop( 'complete' ) ) { 47 /* Already loaded. */ 48 bwg_first_image_load( popup ); 49 } 50 else { 51 jQuery( '#spider_popup_wrap .bwg_popup_image_spun img' ).on( 'load error', function () { 52 bwg_first_image_load( popup ); 53 } ); 54 } 55 } 56 else { 57 bwg_first_image_load( popup ); 58 } 59 spider_receivedpopup( description, lifetime, lightbox_ctrl_btn_pos ); 60 } 61} 62 63function bwg_first_image_load(popup) { 64 popup.show(); 65 jQuery( ".bwg_spider_popup_loading" ).hide(); 66 if ( bwg_param['preload_images'] ) { 67 bwg_preload_images( parseInt( jQuery( '#bwg_current_image_key' ).val() ) ); 68 } 69 bwg_load_filmstrip(); 70} 71 72function spider_hasalreadyreceivedpopup(description) { 73 if (document.cookie.indexOf(description) > -1) { 74 delete document.cookie[document.cookie.indexOf(description)]; 75 } 76 return false; 77} 78 79function spider_receivedpopup(description, lifetime, lightbox_ctrl_btn_pos) { 80 var date = new Date(); 81 date.setDate(date.getDate() + lifetime); 82 document.cookie = description + "=true;expires=" + date.toUTCString() + ";path=/"; 83 if (lightbox_ctrl_btn_pos == 'bottom') { 84 jQuery(".bwg_toggle_container").css("bottom", jQuery(".bwg_ctrl_btn_container").height() + "px"); 85 } 86 else if (lightbox_ctrl_btn_pos == 'top') { 87 jQuery(".bwg_toggle_container").css("top", jQuery(".bwg_ctrl_btn_container").height() + "px"); 88 } 89} 90 91function spider_isunsupporteduseragent() { 92 return (!window.XMLHttpRequest); 93} 94 95function spider_destroypopup(duration) { 96 if (document.getElementById("spider_popup_wrap") != null) { 97 if (typeof jQuery().fullscreen !== 'undefined' && jQuery.isFunction(jQuery().fullscreen)) { 98 if (jQuery.fullscreen.isFullScreen()) { 99 jQuery.fullscreen.exit(); 100 } 101 } 102 if (typeof enable_addthis != "undefined" && enable_addthis) { 103 jQuery(".at4-share-outer").hide(); 104 } 105 setTimeout(function () { 106 jQuery(".spider_popup_wrap").remove(); 107 jQuery(".bwg_spider_popup_loading").css({display: "none"}); 108 jQuery(".spider_popup_overlay").css({display: "none"}); 109 jQuery(document).off("keydown"); 110 if ( bwg_overflow_initial_value !== false ) { 111 jQuery("html").css("overflow", bwg_overflow_initial_value); 112 } 113 if ( bwg_overflow_x_initial_value !== false ) { 114 jQuery("html").css("overflow-x", bwg_overflow_x_initial_value); 115 } 116 if ( bwg_overflow_y_initial_value !== false ) { 117 jQuery("html").css("overflow-y", bwg_overflow_y_initial_value); 118 } 119 }, 20); 120 }
121 isPopUpOpened = false; 122 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 123 var viewportmeta = document.querySelector('meta[name="viewport"]'); 124 if (isMobile && viewportmeta) { 125 viewportmeta.content = 'width=device-width, initial-scale=1'; 126 } 127 var scrrr = jQuery(document).scrollTop(); 128 if ( bwg_objectL10n.is_pro ) { 129 /*window.location.hash = "";*/ 130 location.replace("#"); 131 } 132 jQuery(document).scrollTop(scrrr); 133 if ( typeof bwg_param['bwg_playInterval'] != "undefined" ) { 134 clearInterval(bwg_param['bwg_playInterval']); 135 } 136} 137function get_ajax_pricelist(){ 138 var post_data = {}; 139 jQuery(".add_to_cart_msg").html(""); 140 post_data["ajax_task"] = "display"; 141 post_data["image_id"] = jQuery('#bwg_popup_image').attr('image_id'); 142 143 /* Loading. */ 144 jQuery("#ecommerce_ajax_loading").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 145 jQuery("#ecommerce_opacity_div").css('width', jQuery(".bwg_ecommerce_panel").css('width')); 146 jQuery("#ecommerce_opacity_div").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 147 jQuery("#ecommerce_loading_div").css('width', jQuery(".bwg_ecommerce_panel").css('width')); 148 jQuery("#ecommerce_loading_div").css('height', jQuery(".bwg_ecommerce_panel").css('height')); 149 document.getElementById("ecommerce_opacity_div").style.display = ''; 150 document.getElementById("ecommerce_loading_div").style.display = 'table-cell'; 151 jQuery.ajax({ 152 type: "POST", 153 url: jQuery('#bwg_ecommerce_form').attr('action'), 154 data: post_data, 155 success: function (data) { 156 jQuery(".pge_tabs li a").on("click", function(){ 157 jQuery(".pge_tabs_container > div").hide(); 158 jQuery(".pge_tabs li").removeClass("pge_active"); 159 jQuery(jQuery(this).attr("href")).show(); 160 jQuery(this).closest("li").addClass("pge_active"); 161 jQuery("[name=type]").val(jQuery(this).attr("href").substr(1)); 162 return false; 163 }); 164 var manual = jQuery(data).find('.manual').html(); 165 jQuery('.manual').html(manual); 166 167 var downloads = jQuery(data).find('.downloads').html(); 168 jQuery('.downloads').html(downloads); 169 170 var pge_options = jQuery(data).find('.pge_options').html(); 171 jQuery('.pge_options').html(pge_options); 172 173 var pge_add_to_cart = jQuery(data).find('.pge_add_to_cart').html(); 174 jQuery('.pge_add_to_cart').html(pge_add_to_cart); 175 }, 176 beforeSend: function(){ 177 }, 178 complete:function(){ 179 document.getElementById("ecommerce_opacity_div").style.display = 'none'; 180 document.getElementById("ecommerce_loading_div").style.display = 'none'; 181 /* 182 Update scrollbar. 183 jQuery(".bwg_ecommece_panel").mCustomScrollbar({scrollInertia: 150 }); 184 jQuery(".bwg_ecommerce_close_btn").click(bwg_ecommerce); 185 */ 186 } 187 }); 188 return false; 189} 190 191/* Submit popup. */ 192function spider_ajax_save(form_id) { 193 var post_data = {}; 194 post_data["bwg_name"] = jQuery("#bwg_name").val(); 195 post_data["bwg_comment"] = jQuery("#bwg_comment").val(); 196 post_data["bwg_email"] = jQuery("#bwg_email").val(); 197 post_data["bwg_captcha_input"] = jQuery("#bwg_captcha_input").val(); 198 post_data["ajax_task"] = jQuery("#ajax_task").val(); 199 post_data["image_id"] = jQuery("#image_id").val(); 200 post_data["comment_id"] = jQuery("#comment_id").val(); 201 202 /* Loading. */ 203 jQuery("#ajax_loading").css('height', jQuery(".bwg_comments").css('height')); 204 jQuery("#opacity_div").css('width', jQuery(".bwg_comments").css('width')); 205 jQuery("#opacity_div").css('height', jQuery(".bwg_comments").css('height')); 206 jQuery("#loading_div").css('width', jQuery(".bwg_comments").css('width')); 207 jQuery("#loading_div").css('height', jQuery(".bwg_comments").css('height')); 208 document.getElementById("opacity_div").style.display = ''; 209 document.getElementById("loading_div").style.display = 'table-cell'; 210 jQuery.ajax({ 211 type: "POST", 212 url: jQuery('#' + form_id).attr('action'), 213 data: post_data, 214 success: function (data) { 215 var str = jQuery(data).find('.bwg_comments').html(); 216 jQuery('.bwg_comments').html(str); 217 }, 218 beforeSend: function(){ 219 }, 220 complete:function(){ 221 document.getElementById("opacity_div").style.display = 'none'; 222 document.getElementById("loading_div").style.display = 'none';
223 /* Update scrollbar. */ 224 jQuery(".bwg_comments").mCustomScrollbar({scrollInertia: 150, 225 advanced:{ 226 updateOnContentResize: true 227 } 228 }); 229 /* Bind comment container close function to close button. */ 230 jQuery(".bwg_comments_close_btn").click(bwg_comment); 231 bwg_captcha_refresh('bwg_captcha'); 232 } 233 }); 234 return false; 235} 236 237/* Submit rating. */ 238function spider_rate_ajax_save(form_id) { 239 var post_data = {}; 240 post_data["image_id"] = jQuery("#" + form_id + " input[name='image_id']").val(); 241 post_data["rate"] = jQuery("#" + form_id + " input[name='score']").val(); 242 post_data["ajax_task"] = jQuery("#rate_ajax_task").val(); 243 jQuery.ajax({ 244 type: "POST", 245 url: jQuery('#' + form_id).attr('action'), 246 data: post_data, 247 success: function (data) { 248 var str = jQuery(data).find('#' + form_id).html(); 249 jQuery('#' + form_id).html(str); 250 }, 251 beforeSend: function(){ 252 }, 253 complete:function(){} 254 }); 255 return false; 256} 257 258/* Set value by ID. */ 259function spider_set_input_value(input_id, input_value) { 260 if (document.getElementById(input_id)) { 261 document.getElementById(input_id).value = input_value; 262 } 263} 264 265/* Submit form by ID. */ 266function spider_form_submit(event, form_id) { 267 if (document.getElementById(form_id)) { 268 document.getElementById(form_id).submit(); 269 } 270 if (event.preventDefault) { 271 event.preventDefault(); 272 } 273 else { 274 event.returnValue = false; 275 } 276} 277 278/* Check if required field is empty. */ 279function spider_check_required(id, name) { 280 if (jQuery('#' + id).val() == '') { 281 alert(name + ' ' + bwg_objectL10n.bwg_field_required); 282 jQuery('#' + id).attr('style', 'border-color: #FF0000;'); 283 jQuery('#' + id).focus(); 284 return true; 285 } 286 else { 287 return false; 288 } 289} 290 291/* Check if privacy polic field is checked. */ 292function comment_check_privacy_policy() { 293 var bwg_submit = jQuery('#bwg_submit'); 294 bwg_submit.removeClass('bwg-submit-disabled'); 295 bwg_submit.removeAttr("disabled"); 296 if ( !jQuery('#bwg_comment_privacy_policy').is(':checked') ) { 297 bwg_submit.addClass('bwg-submit-disabled'); 298 bwg_submit.attr('disabled', 'disabled'); 299 } 300} 301 302/* Check Email. */ 303function spider_check_email(id) { 304 if (jQuery('#' + id).val() != '') { 305 var email = jQuery('#' + id).val().replace(/^\s+|\s+$/g, ''); 306 if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { 307 alert(bwg_objectL10n.bwg_mail_validation); 308 return true; 309 } 310 return false; 311 } 312} 313 314/* Refresh captcha. */ 315function bwg_captcha_refresh(id) { 316 if (document.getElementById(id + "_img") && document.getElementById(id + "_input")) { 317 srcArr = document.getElementById(id + "_img").src.split("&r="); 318 document.getElementById(id + "_img").src = srcArr[0] + '&r=' + Math.floor(Math.random() * 100); 319 document.getElementById(id + "_img").style.display = "inline-block"; 320 document.getElementById(id + "_input").value = ""; 321 } 322} 323 324function bwg_play_instagram_video(obj,bwg) { 325 jQuery(obj).parent().find("video").each(function () { 326 if (jQuery(this).get(0).paused) { 327 jQuery(this).get(0).play(); 328 jQuery(obj).children().hide(); 329 } 330 else { 331 jQuery(this).get(0).pause(); 332 jQuery(obj).children().show(); 333 } 334 }) 335} 336 337/** 338 * Add comment. 339 * 340 * @returns {boolean} 341 */ 342function bwg_add_comment() { 343 var form = jQuery('#bwg_comment_form'); 344 var url = form.attr('action'); 345 var post_data = {}; 346 post_data['ajax_task'] = 'add_comment'; 347 post_data['comment_name'] = form.find('#bwg_name').val(); 348 post_data['comment_email'] = form.find('#bwg_email').val(); 349 post_data['comment_text'] = form.find('#bwg_comment').val(); 350 post_data['comment_captcha'] = form.find('#bwg_captcha_input').val(); 351 post_data['privacy_policy'] = ( form.find('#bwg_comment_privacy_policy').is(":checked") ) ? 1 : 0; 352 post_data['comment_image_id'] = jQuery('#bwg_popup_image').attr('image_id'); 353 post_data['comment_moderation'] = form.find('#bwg_comment_moderation').val(); 354 jQuery('.bwg_spider_ajax_loading').hide(); 355 jQuery.ajax({ 356 url: url, 357 type: "POST", 358 dataType: 'json', 359 data: post_data, 360 success: function ( res ) { 361 jQuery('.bwg_comment_error').text(''); 362 if ( res.error == true ) { 363 jQuery.each(res.error_messages, function( index, value ) { 364 if ( value ) { 365 jQuery('.bwg_comment_'+ index +'_error').text(value); 366 } 367 }); 368 } 369 else { 370 form.find('#bwg_comment').val(''); 371 jQuery('.bwg_comment_waiting_message').hide(); 372 if( res.published == 0 ) { 373 jQuery('.bwg_comment_waiting_message').show(); 374 } 375 if ( res.html_comments_block != '' ) { 376 jQuery('#bwg_added_comments').html(res.html_comments_block).show(); 377 } 378 } 379 }, 380 beforeSend: function() { 381 jQuery('.bwg_spider_ajax_loading').show(); 382 }, 383 complete: function() { 384 if ( form.find('#bwg_comment_privacy_policy').length > 0 ) { 385 form.find('#bwg_comment_privacy_policy').prop('checked', false); 386 comment_check_privacy_policy(); 387 } 388 bwg_captcha_refresh('bwg_captcha'); 389 jQuery('.bwg_spider_ajax_loading').hide(); 390 }, 391 error:function() {} 392 }); 393 return false;
394} 395 396/** 397 * Remove comment. 398 * 399 * @param id_comment 400 * @returns {boolean} 401 */ 402function bwg_remove_comment( id_comment ) { 403 var form = jQuery('#bwg_comment_form'); 404 var url = form.attr('action'); 405 var post_data = {}; 406 post_data['ajax_task'] = 'delete_comment'; 407 post_data['id_image'] = jQuery('#bwg_popup_image').attr('image_id'); 408 post_data['id_comment'] = id_comment; 409 jQuery.ajax({ 410 url: url, 411 type: "POST", 412 dataType: 'json', 413 data: post_data, 414 success: function ( res ) { 415 if ( res.error == false) { 416 jQuery('#bwg_comment_block_' + id_comment ).fadeOut( "slow").remove(); 417 } 418 }, 419 beforeSend: function() { 420 }, 421 complete:function() { 422 }, 423 error:function() {} 424 }); 425 return false; 426} 427 428function bwg_gallery_box( image_id, bwg_container, openEcommerce, gallery_id ) { 429 jQuery(".bwg-validate").each(function() { 430 jQuery(this).on("keypress change", function () { 431 console.log("bbbb"); 432 jQuery(this).parent().next().find(".bwg_comment_error").html(""); 433 }); 434 }); 435 if ( typeof openEcommerce == "undefined" ) { 436 openEcommerce = false;
437 } 438 var bwg = bwg_container.data('bwg'); 439 var bwg_lightbox_url; 440 if ( bwg_container.find(".bwg-container").data('lightbox-url') ) { 441 /* To read from updated container after ajax (e.g. open lightbox from gallery in albums).*/ 442 bwg_lightbox_url = bwg_container.find(".bwg-container").data('lightbox-url'); 443 } 444 else { 445 bwg_lightbox_url = bwg_container.data('lightbox-url'); 446 } 447 var filterTags = jQuery("#bwg_tag_id_" + bwg).val(); 448 filterTags = filterTags ? filterTags : 0; 449 var ecommerce = openEcommerce == true ? "&open_ecommerce=1" : ""; 450 var filtersearchname = jQuery("#bwg_search_input_" + bwg ).val(); 451 var filtersortby = jQuery("#bwg_order_" + bwg).val() ? "&filtersortby=" + jQuery("#bwg_order_" + bwg).val() : ''; 452 filtersearchname = filtersearchname ? filtersearchname : ''; 453 454 if ( typeof gallery_id != "undefined" ) { 455 /* Open lightbox with hash.*/ 456 bwg_lightbox_url += '&gallery_id=' + gallery_id; 457 } 458 var open_comment = ''; 459 var open_comment_attr = jQuery('#bwg_blog_style_share_buttons_' + image_id).attr('data-open-comment'); 460 if (typeof open_comment_attr !== typeof undefined && open_comment_attr !== false) { 461 open_comment = '&open_comment=1'; 462 } 463 spider_createpopup(bwg_lightbox_url + '&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')); 464} 465 466function bwg_change_image_lightbox(current_key, key, data, from_effect) { 467 bwg_current_key = bwg_param['bwg_current_key']; 468 /* var bwg_image_info_pos = jQuery(".bwg_ctrl_btn_container").height(); */ 469 jQuery(".bwg_image_info").css("height","auto"); 470 setTimeout(function(){ 471 if(jQuery(".bwg_image_info_container1").height() < (jQuery(".bwg_image_info").height() + jQuery(".bwg_toggle_container").height() + bwg_image_info_pos + 2*(parseInt(bwg_param['lightbox_info_margin'])))) { 472 if(bwg_param['lightbox_ctrl_btn_pos'] == 'top') { 473 jQuery(".bwg_image_info").css("top",bwg_image_info_pos + "px"); 474 } 475 jQuery(".bwg_image_info").height(jQuery(".bwg_image_info_container1").height() - jQuery(".bwg_toggle_container").height() - bwg_image_info_pos - 2*(parseInt(bwg_param['lightbox_info_margin']))); 476 } 477 }, 200); 478 jQuery("#spider_popup_left").show(); 479 jQuery("#spider_popup_right").show(); 480 jQuery(".bwg_image_info").hide(); 481 if (bwg_param['enable_loop'] == 0) { 482 if (key == (parseInt(data.length) - 1)) { 483 jQuery("#spider_popup_right").hide(); 484 } 485 if (key == 0) { 486 jQuery("#spider_popup_left").hide(); 487 } 488 } 489 var ecommerceACtive = bwg_param['ecommerceACtive']; 490 if( ecommerceACtive == 1 && bwg_param['enable_image_ecommerce'] == 1 ) { 491 if( data[key]["pricelist"] == 0) { 492 jQuery(".bwg_ecommerce").hide(); 493 } 494 else { 495 jQuery(".bwg_ecommerce").show(); 496 jQuery(".pge_tabs li").hide(); 497 jQuery("#downloads").hide(); 498 jQuery("#manual").hide(); 499 var pricelistSections = data[key]["pricelist_sections"].split(","); 500 501 if(pricelistSections){ 502 jQuery("#" + pricelistSections[0]).show(); 503 jQuery("[name=type]").val(pricelistSections[0]); 504 if(pricelistSections.length > 1){ 505 jQuery(".pge_tabs").show(); 506 for( k=0 ; k<pricelistSections.length; k++ ){ 507 jQuery("#" + pricelistSections[k] + "_li").show(); 508 } 509 } 510 else{ 511 jQuery(".pge_tabs").hide(); 512 } 513 } 514 else{ 515 jQuery("[name=type]").val(""); 516 } 517 } 518 } 519 /* Pause videos.*/ 520 jQuery("#bwg_image_container").find("iframe").each(function () { 521 jQuery(this)[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); 522 jQuery(this)[0].contentWindow.postMessage('{ "method": "pause" }', "*"); 523 jQuery(this)[0].contentWindow.postMessage('pause', '*'); 524 }); 525 jQuery("#bwg_image_container").find("video").each(function () { 526 jQuery(this).trigger('pause'); 527 }); 528 if ( typeof data[key] != 'undefined' ) { 529 if (typeof data[current_key] != 'undefined') { 530 if (jQuery(".bwg_play_pause").length && !jQuery(".bwg_play_pause").hasClass("fa-play")) { 531 bwg_play( data ); 532 } 533 534 if (!from_effect) { 535 /* Change image key.*/ 536 jQuery("#bwg_current_image_key").val(key); 537 /*if (current_key == '-1') { 538 current_key = jQuery(".bwg_thumb_active").children("img").attr("image_key"); 539 }*/ 540 } 541 if (bwg_param['bwg_trans_in_progress']) { 542 bwg_param['event_stack'].push(current_key + '-' + key); 543 return; 544 } 545 var direction = 'right'; 546 if (bwg_current_key > key) { 547 var direction = 'left'; 548 } 549 else if (bwg_current_key == key) { 550 return; 551 } 552 /* 553 jQuery("#spider_popup_left").hover().css({"display": "inline"}); 554 jQuery("#spider_popup_right").hover().css({"display": "inline"}); 555 */ 556 557 jQuery(".bwg_image_count").html(data[key]["number"]); 558 /* Set filmstrip initial position.*/ 559 jQuery(".bwg_watermark").css({display: 'none'}); 560 /* Set active thumbnail position.*/ 561 if ( bwg_param['width_or_height'] == 'width' ) { 562 bwg_current_filmstrip_pos = key * (jQuery(".bwg_filmstrip_thumbnail").width() + 2 + 2 * bwg_param['lightbox_filmstrip_thumb_border_width']); 563 } else if ( bwg_param['width_or_height'] == 'height' ) { 564 bwg_current_filmstrip_pos = key * (jQuery(".bwg_filmstrip_thumbnail").height() + 2 + 2 * bwg_param['lightbox_filmstrip_thumb_border_width']); 565 } 566 bwg_param['bwg_current_key'] = key; 567 if ( bwg_objectL10n.is_pro ) { 568 /* Change hash.*/ 569 /*window.location.hash = "bwg"+bwg_param['gallery_id'] +"/" + data[key]["id"];*/ 570 location.replace("#bwg" + bwg_param['gallery_id'] + "/" + data[key]["id"]); 571 history.replaceState(undefined, undefined, "#bwg" + bwg_param['gallery_id'] + "/" + data[key]["id"]); 572 } 573 /* Change image id for rating.*/ 574 if (bwg_param['popup_enable_rate']) { 575 jQuery("#bwg_rate_form input[name='image_id']").val(data[key]["id"]); 576 jQuery("#bwg_star").attr("data-score", data[key]["avg_rating"]); 577 jQuery("#bwg_star").removeAttr("title"); 578 bwg_rating(data[key]["rate"], data[key]["rate_count"], data[key]["avg_rating"], key); 579 } 580 /* Increase image hit counter.*/ 581 spider_set_input_value('rate_ajax_task', 'save_hit_count'); 582 583 spider_rate_ajax_save('bwg_rate_form'); 584 jQuery(".bwg_image_hits span").html(++data[key]["hit_count"]); 585 /* Change image id.*/ 586 jQuery("#bwg_popup_image").attr('image_id', data[key]["id"]); 587 /* Change image title, description.*/ 588 jQuery(".bwg_image_title").html(jQuery('<span style="display: block;" />').html(data[key]["alt"]).text()); 589 jQuery(".bwg_image_description").html(jQuery('<span style="display: block;" />').html(data[key]["description"]).text()); 590 /*jQuery(".bwg_image_info").removeAttr("style");*/ 591 /* Set active thumbnail.*/ 592 593 jQuery(".bwg_filmstrip_thumbnail").removeClass("bwg_thumb_active").addClass("bwg_thumb_deactive"); 594 jQuery("#bwg_filmstrip_thumbnail_" + key).removeClass("bwg_thumb_deactive").addClass("bwg_thumb_active"); 595 jQuery(".bwg_image_info").css("opacity", 1); 596 if (data[key]["alt"].trim() == "") { 597 if (data[key]["description"].trim() == "") { 598 jQuery(".bwg_image_info").css("opacity", 0); 599 } 600 } 601 if (jQuery(".bwg_image_info_container1").css("display") != 'none') { 602 jQuery(".bwg_image_info_container1").css("display", "table-cell"); 603 } 604 else { 605 jQuery(".bwg_image_info_container1").css("display", "none"); 606 } 607 /* Change image rating.*/ 608 if (jQuery(".bwg_image_rate_container1").css("display") != 'none') { 609 jQuery(".bwg_image_rate_container1").css("display", "table-cell"); 610 } 611 else { 612 jQuery(".bwg_image_rate_container1").css("display", "none"); 613 } 614 var current_image_class = jQuery(".bwg_popup_image_spun").css("zIndex") == 2 ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun"; 615 var next_image_class = current_image_class == ".bwg_popup_image_second_spun" ? ".bwg_popup_image_spun" : ".bwg_popup_image_second_spun"; 616 617 var is_embed = data[key]['filetype'].indexOf("EMBED_") > -1 ? true : false;
618 var is_embed_instagram_post = data[key]['filetype'].indexOf('INSTAGRAM_POST') > -1 ? true : false; 619 var is_embed_instagram_video = data[key]['filetype'].indexOf('INSTAGRAM_VIDEO') > -1 ? true : false; 620 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; 621 var cur_height = jQuery(current_image_class).height(); 622 var cur_width = jQuery(current_image_class).width(); 623 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%;">'; 624 if ( !is_embed ) { 625 jQuery(".bwg-loading").removeClass("hidden"); 626 jQuery("#bwg_download").removeClass("hidden"); 627 innhtml += '<img style="max-height: ' + cur_height + 'px; max-width: ' + cur_width + 'px;" class="bwg_popup_image bwg_popup_watermark" src="' + bwg_param['site_url'] + jQuery('<span style="display: block;" />').html(data[key]["image_url"]).text() + '" alt="' + data[key]["alt"] + '" />'; 628 } 629 else { /*is_embed*/ 630 /* hide download button if image source is embed */ 631 jQuery("#bwg_download").addClass("hidden"); 632 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>' : ' '); 633 if (is_embed_instagram_post) { 634 var post_width = 0; 635 var post_height = 0; 636 if (cur_height < cur_width + 88) { 637 post_height = cur_height; 638 post_width = post_height - 88; 639 } 640 else { 641 post_width = cur_width; 642 post_height = post_width + 88; 643 } 644 innhtml += spider_display_embed(data[key]['filetype'], data[key]['image_url'], data[key]['filename'], { class:"bwg_embed_frame", 'data-width': data[key]['image_width'], 'data-height': data[key]['image_height'], frameborder: "0", allowfullscreen: "allowfullscreen", style: "width:" + post_width + "px; height:" + post_height + "px; vertical-align:middle; display:inline-block; position:relative;"}); 645 } 646 else { 647 innhtml += spider_display_embed(data[key]['filetype'],data[key]['image_url'], data[key]['filename'], { class:"bwg_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style: "display:" + ( is_ifrem ? 'block' : 'table-cell' ) + "; width:inherit; height:inherit; vertical-align:middle;" }); 648 } 649 innhtml += "</span>"; 650 } 651 innhtml += '</span></span>'; 652 jQuery(next_image_class).html(innhtml); 653 jQuery(next_image_class).find("img").on("load error", function () { 654 jQuery(".bwg-loading").addClass("hidden"); 655 }); 656 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 657 maxWidth: cur_width, 658 maxHeight: cur_height, 659 height: 'auto', 660 }); 661 662 function bwg_afterload() { 663 if (bwg_param['preload_images']) { 664 bwg_preload_images(key); 665 } 666 667 window['bwg_'+bwg_param['bwg_image_effect']](current_image_class, next_image_class, direction); 668 jQuery(current_image_class).find('.bwg_fb_video').each(function () { 669 jQuery(this).attr('src', ''); 670 }); 671 if ( !is_embed ) { 672 jQuery("#bwg_fullsize_image").attr("href", bwg_param['site_url'] + data[key]['image_url']); 673 jQuery("#bwg_download").attr("href", bwg_param['site_url'] + data[key]['thumb_url'].replace('/thumb/', '/.original/')); 674 } 675 else { 676 jQuery("#bwg_fullsize_image").attr("href", data[key]['image_url']); 677 } 678 var image_arr = data[key]['image_url'].split("/"); 679 jQuery("#bwg_download").attr("download", image_arr[image_arr.length - 1].replace(/\?bwg=(\d+)$/, "")); 680 /* Change image social networks urls.*/ 681 var bwg_share_url = encodeURIComponent(bwg_param['bwg_share_url']) + "=" + data[key]['id'] + encodeURIComponent('#bwg'+bwg_param['gallery_id']+'/') + data[key]['id']; 682 683 if (is_embed) { 684 var bwg_share_image_url = encodeURIComponent(data[key]['thumb_url']); 685 } 686 else { 687 var bwg_share_image_url = bwg_param['bwg_share_image_url'] + encodeURIComponent(encodeURIComponent(data[key]['image_url'])); 688 } 689 bwg_share_image_url = bwg_share_image_url.replace(/%252F/g, '%2F'); 690 if (typeof addthis_share != "undefined") { 691 addthis_share.url = bwg_share_url; 692 } 693 jQuery("#bwg_facebook_a").attr("href", "https://www.facebook.com/sharer/sharer.php?u=" + bwg_share_url); 694 jQuery("#bwg_twitter_a").attr("href", "https://twitter.com/share?url=" + bwg_share_url); 695 jQuery("#bwg_google_a").attr("href", "https://plus.google.com/share?url=" + bwg_share_url); 696 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']); 697 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); 698 /* Load comments.*/ 699 if (jQuery(".bwg_comment_container").hasClass("bwg_open")) { 700 if (data[key]["comment_count"] == 0) { 701 jQuery("#bwg_added_comments").hide(); 702 } 703 else { 704 jQuery("#bwg_added_comments").show(); 705 spider_set_input_value('ajax_task', 'display'); 706 spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id')); 707 spider_ajax_save('bwg_comment_form'); 708 } 709 } 710 if (jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 711 /* Pricelist */ 712 if(data[key]["pricelist"] == 0){ 713 /* Close ecommerce.*/ 714 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 715 bwg_animate_image_box_for_hide_sidebar(); 716 717 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 718 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 719 jQuery(".spider_popup_close_fullscreen").show(); 720 } 721 else{ 722 get_ajax_pricelist(); 723 } 724 }
725 /* Update custom scroll.*/ 726 if (typeof jQuery().mCustomScrollbar !== 'undefined') { 727 if (jQuery.isFunction(jQuery().mCustomScrollbar)) { 728 jQuery(".bwg_comments").mCustomScrollbar({ 729 advanced:{ 730 updateOnContentResize: true 731 } 732 }); 733 } 734 } 735 jQuery(".bwg_comments .mCSB_scrollTools").hide(); 736 if (bwg_param['enable_image_filmstrip']) { 737 bwg_move_filmstrip(); 738 } 739 bwg_resize_instagram_post(); 740 } 741 if ( !is_embed ) { 742 var cur_img = jQuery(next_image_class).find('img'); 743 cur_img.one('load', function() { 744 bwg_afterload(); 745 }).each(function() { 746 if(this.complete) jQuery(this).load(); 747 }); 748 } 749 else { 750 bwg_afterload(); 751 } 752 } 753 } 754} 755 756function bwg_preload_images_lightbox( key ) { 757 var count_all = data.length; 758 var preloadCount = ( bwg_param['preload_images_count'] == 0 || bwg_param['preload_images_count'] >= count_all ) ? count_all : bwg_param['preload_images_count']; 759 var indexedImgCount = 0; 760 for ( var i = 1; indexedImgCount < preloadCount; i++ ) { 761 var sign = 1; 762 do { 763 var index = ( key + i * sign + count_all ) % count_all; 764 if ( typeof data[index] != "undefined" ) { 765 var is_embed = data[index]['filetype'].indexOf( "EMBED_" ) > -1 ? true : false; 766 if ( !is_embed ) { 767 jQuery( "<img/>" ).attr( "src", bwg_param['site_url'] + jQuery( '<span style="display: block;" />' ).html( data[index]["image_url"] ).text() ); 768 } 769 } 770 sign *= -1; 771 indexedImgCount++; 772 } 773 while ( sign != 1 ); 774 } 775} 776 777/* open popup sidebar */ 778function bwg_popup_sidebar_open(obj){ 779 var comment_container_width = bwg_param['lightbox_comment_width']; 780 var lightbox_comment_pos = bwg_param['lightbox_comment_pos']; 781 if (comment_container_width > jQuery(window).width()) { 782 comment_container_width = jQuery(window).width(); 783 obj.css({ 784 width: comment_container_width, 785 }); 786 jQuery(".spider_popup_close_fullscreen").hide(); 787 jQuery(".spider_popup_close").hide(); 788 if (jQuery(".bwg_ctrl_btn").hasClass("fa-pause")) { 789 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 790 jQuery(".bwg_play_pause").trigger(isMobile ? 'touchend' : 'click'); 791 } 792 } 793 else { 794 jQuery(".spider_popup_close_fullscreen").show(); 795 } 796 797 if(lightbox_comment_pos == 'left') { 798 obj.animate({left: 0}, 100); 799 } else { 800 obj.animate({right: 0}, 100); 801 } 802} 803 804/* Open/close comments.*/ 805function bwg_comment() { 806 jQuery(".bwg_watermark").css({display: 'none'}); 807 jQuery(".bwg_ecommerce_wrap").css("z-index","-1"); 808 jQuery(".bwg_comment_wrap").css("z-index","25"); 809 if(jQuery(".bwg_ecommerce_container").hasClass("bwg_open") ){ 810 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 811 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 812 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 813 814 } 815 if (jQuery(".bwg_comment_container").hasClass("bwg_open") ) { 816 /* Close comment.*/ 817 /* Check if lightbox was play before oppening comment container */ 818 if( jQuery(".bwg_comment_container").attr("data-play-status") == "1" ) { 819 jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("fa-play").addClass("fa-pause").attr('title','Pause'); 820 } 821 bwg_popup_sidebar_close(jQuery(".bwg_comment_container")); 822 bwg_animate_image_box_for_hide_sidebar(); 823 jQuery(".bwg_comment_wrap").css("z-index","-1"); 824 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_close"); 825 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_show_comments); 826 jQuery(".spider_popup_close_fullscreen").show(); 827 } 828 else { 829 /* Open comment.*/ 830 /* Check if lightbox is playing before oppening comment and set status */ 831 if ( jQuery(".bwg_play_pause").hasClass("fa-pause") ) { 832 jQuery(".bwg_comment_container").attr("data-play-status", "1"); 833 } else { 834 jQuery(".bwg_comment_container").attr("data-play-status", "0"); 835 }
836 jQuery(".bwg_ctrl_btn.bwg_play_pause").removeClass("fa-pause").addClass("fa-play").attr('title','Play'); 837 bwg_popup_sidebar_open(jQuery(".bwg_comment_container")); 838 bwg_animate_image_box_for_show_sidebar(); 839 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_open"); 840 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_hide_comments); 841 /* Load comments.*/ 842 var cur_image_key = parseInt(jQuery("#bwg_current_image_key").val()); 843 if ( typeof data[cur_image_key] != "undefined" && data[cur_image_key]["comment_count"] != 0) { 844 jQuery("#bwg_added_comments").show(); 845 spider_set_input_value('ajax_task', 'display'); 846 spider_set_input_value('image_id', jQuery('#bwg_popup_image').attr('image_id')); 847 spider_ajax_save('bwg_comment_form'); 848 } 849 } 850 jQuery(".bwg_comments").mCustomScrollbar({scrollInertia: 150, 851 advanced:{ 852 updateOnContentResize: true 853 } 854 }); 855} 856 857/* Open/close ecommerce.*/ 858function bwg_ecommerce() { 859 jQuery(".bwg_watermark").css({display: 'none'}); 860 jQuery(".bwg_ecommerce_wrap").css("z-index","25"); 861 jQuery(".bwg_comment_wrap").css("z-index","-1"); 862 if (jQuery(".bwg_comment_container").hasClass("bwg_open")) { 863 bwg_popup_sidebar_close(jQuery(".bwg_comment_container")); 864 jQuery(".bwg_comment_container").attr("class", "bwg_comment_container bwg_close"); 865 // Must be translatable 866 jQuery(".bwg_comment").attr("title", bwg_objectsL10n.bwg_how_comments); 867 } 868 if (jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 869 /* Close ecommerce.*/ 870 bwg_popup_sidebar_close(jQuery(".bwg_ecommerce_container")); 871 bwg_animate_image_box_for_hide_sidebar(); 872 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_close"); 873 // Must be translatable 874 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_show_ecommerce); 875 // jQuery(".spider_popup_close_fullscreen").show(); 876 } 877 else { 878 /* Open ecommerce.*/ 879 bwg_popup_sidebar_open(jQuery(".bwg_ecommerce_container")); 880 bwg_animate_image_box_for_show_sidebar(); 881 jQuery(".bwg_ecommerce_container").attr("class", "bwg_ecommerce_container bwg_open"); 882 jQuery(".bwg_ecommerce").attr("title", bwg_objectsL10n.bwg_hide_ecommerce); 883 get_ajax_pricelist(); 884 } 885} 886 887function bwg_popup_sidebar_close(obj){ 888 var border_width = parseInt(obj.css('borderRightWidth')); 889 if (!border_width) { 890 border_width = 0; 891 } 892 if( lightbox_comment_pos == 'left' ) { 893 obj.animate({left: -obj.width() - border_width}, 100); 894 } else if ( lightbox_comment_pos == 'right' ) { 895 obj.animate({right: -obj.width() - border_width}, 100); 896 } 897} 898 899function bwg_animate_image_box_for_hide_sidebar() { 900 if ( lightbox_comment_pos == 'left' ) { 901 jQuery( ".bwg_image_wrap" ).animate( { 902 left: 0, 903 width: jQuery( "#spider_popup_wrap" ).width() 904 }, 100 ); 905 } else if ( lightbox_comment_pos == 'right' ) { 906 jQuery( ".bwg_image_wrap" ).animate( { 907 right: 0, 908 width: jQuery( "#spider_popup_wrap" ).width() 909 }, 100 ); 910 } 911 jQuery( ".bwg_image_container" ).animate( { 912 width: jQuery( "#spider_popup_wrap" ).width() - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) 913 }, 100 ); 914 jQuery( ".bwg_popup_image" ).animate( { 915 maxWidth: jQuery( "#spider_popup_wrap" ).width() - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) 916 }, { 917 duration: 100, 918 complete: function () { 919 bwg_change_watermark_container(); 920 } 921 } ); 922 jQuery( ".bwg_popup_embed" ).animate( { 923 width: jQuery( "#spider_popup_wrap" ).width() - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) 924 }, { 925 duration: 100, 926 complete: function () { 927 bwg_resize_instagram_post(); 928 bwg_change_watermark_container(); 929 } 930 } ); 931 if ( bwg_param['width_or_height'] == 'width' ) { 932 jQuery( ".bwg_filmstrip_container" ).animate( { width: jQuery( ".spider_popup_wrap" ).width() }, 100 ); 933 jQuery( ".bwg_filmstrip" ).animate( { width: jQuery( ".spider_popup_wrap" ).width() - 40 }, 100 ); 934 } else if ( bwg_param['width_or_height'] == 'height' ) { 935 jQuery( ".bwg_filmstrip_container" ).animate( { height: jQuery( ".spider_popup_wrap" ).width() }, 100 ); 936 jQuery( ".bwg_filmstrip" ).animate( { height: jQuery( ".spider_popup_wrap" ).width() - 40 }, 100 ); 937 } 938 /* Set filmstrip initial position.*/ 939 bwg_set_filmstrip_pos( jQuery( ".spider_popup_wrap" ).width() - 40 ); 940 jQuery( ".spider_popup_close_fullscreen" ).show( 100 ); 941} 942 943function bwg_animate_image_box_for_show_sidebar() {
944 var bwg_comment_container = jQuery( ".bwg_comment_container" ).width() || jQuery( ".bwg_ecommerce_container" ).width(); 945 if ( lightbox_comment_pos == 'left' ) { 946 jQuery( ".bwg_image_wrap" ).animate( { 947 left: bwg_comment_container, 948 width: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container 949 }, 100 ); 950 } else if ( lightbox_comment_pos == 'right' ) { 951 jQuery( ".bwg_image_wrap" ).animate( { 952 right: bwg_comment_container, 953 width: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container 954 }, 100 ); 955 } 956 jQuery( ".bwg_image_container" ).animate( { 957 width: jQuery( "#spider_popup_wrap" ).width() - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) - bwg_comment_container 958 }, 100 ); 959 jQuery( ".bwg_popup_image" ).animate( { 960 maxWidth: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) 961 }, { 962 duration: 100, 963 complete: function () { 964 bwg_change_watermark_container(); 965 } 966 } ); 967 jQuery( ".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video" ).animate( { 968 maxWidth: jQuery( "#spider_popup_wrap" ).width() - bwg_comment_container - ( bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0 ) 969 }, { 970 duration: 100, 971 complete: function () { 972 bwg_resize_instagram_post(); 973 bwg_change_watermark_container(); 974 } 975 } ); 976 if ( bwg_param['width_or_height'] == 'width' ) { 977 jQuery( ".bwg_filmstrip_container" ).css( { width: jQuery( "#spider_popup_wrap" ).width() - ( bwg_param['filmstrip_direction'] == 'vertical' ? 0 : bwg_comment_container ) } ); 978 jQuery( ".bwg_filmstrip" ).animate( { width: jQuery( ".bwg_filmstrip_container" ).width() - 40 }, 100 ); 979 /* Set filmstrip initial position.*/ 980 bwg_set_filmstrip_pos( jQuery( ".bwg_filmstrip_container" ).width() - 40 ); 981 } 982} 983 984function bwg_reset_zoom() { 985 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 986 var viewportmeta = document.querySelector('meta[name="viewport"]'); 987 if (isMobile) { 988 if (viewportmeta) { 989 viewportmeta.content = 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0'; 990 } 991 } 992} 993 994/* Open with fullscreen.*/ 995function bwg_open_with_fullscreen() { 996 jQuery(".bwg_watermark").css({display: 'none'}); 997 var comment_container_width = 0; 998 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 999 comment_container_width = jQuery(".bwg_comment_container").width() || jQuery(".bwg_ecommerce_container").width(); 1000 } 1001 bwg_popup_current_width = jQuery(window).width(); 1002 bwg_popup_current_height = window.innerHeight; 1003 jQuery("#spider_popup_wrap").css({ 1004 width: jQuery(window).width(), 1005 height: window.innerHeight, 1006 left: 0, 1007 top: 0, 1008 margin: 0, 1009 zIndex: 100002 1010 }); 1011 jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)}); 1012 jQuery(".bwg_image_container").css({height: (bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0)), width: bwg_popup_current_width - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0)}); 1013 jQuery(".bwg_popup_image").css({ 1014 maxWidth: jQuery(window).width() - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1015 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1016 }, { 1017 complete: function () { bwg_change_watermark_container(); } 1018 }); 1019 jQuery(".bwg_popup_video").css({ 1020 width: jQuery(window).width() - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1021 height: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_he
1021ight'] : 0) 1022 }, { 1023 complete: function () { bwg_change_watermark_container(); } 1024 }); 1025 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1026 maxWidth: jQuery(window).width() - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1027 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1028 }, { 1029 complete: function () { 1030 bwg_resize_instagram_post(); 1031 bwg_change_watermark_container(); } 1032 }); 1033 if ( bwg_param['width_or_height'] == 'width' ) { 1034 jQuery(".bwg_filmstrip_container").css({width: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 1035 jQuery(".bwg_filmstrip").css({width: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 40}); 1036 /* Set filmstrip initial position.*/ 1037 bwg_set_filmstrip_pos(jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 40); 1038 } else { 1039 jQuery(".bwg_filmstrip_container").css({height: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0)}); 1040 jQuery(".bwg_filmstrip").css({height: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 40}); 1041 /* Set filmstrip initial position.*/ 1042 bwg_set_filmstrip_pos(window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? 'comment_container_width' : 0) - 40); 1043 } 1044 jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-small"); 1045 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_restore); 1046 jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen"); 1047} 1048 1049function bwg_resize_full() { 1050 jQuery(".bwg_watermark").css({display: 'none'}); 1051 var comment_container_width = 0; 1052 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open") ) { 1053 comment_container_width = jQuery(".bwg_comment_container").width() || jQuery(".bwg_ecommerce_container").width(); 1054 } 1055 // resize to small from full 1056 if (jQuery(".bwg_resize-full").hasClass("fa-resize-small")) { 1057 if (jQuery(window).width() > bwg_param['image_width']) { 1058 bwg_popup_current_width = bwg_param['image_width']; 1059 } 1060 if (window.innerHeight > bwg_param['image_height']) { 1061 bwg_popup_current_height = bwg_param['image_height']; 1062 } 1063 /* Minimize.*/ 1064 jQuery("#spider_popup_wrap").animate({ 1065 width: bwg_popup_current_width, 1066 height: bwg_popup_current_height, 1067 left: '50%', 1068 top: '50%', 1069 marginLeft: -bwg_popup_current_width / 2, 1070 marginTop: -bwg_popup_current_height / 2, 1071 zIndex: 100002 1072 }, 500); 1073 jQuery(".bwg_image_wrap").animate({width: bwg_popup_current_width - comment_container_width}, 500); 1074 jQuery(".bwg_image_container").animate({height: bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0), width: bwg_popup_current_width - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0)}, 500); 1075 jQuery(".bwg_popup_image").animate({ 1076 maxWidth: bwg_popup_current_width - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1077 maxHeight: bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1078 }, { 1079 duration: 500, 1080 complete: function () { 1081 bwg_change_watermark_container(); 1082 if ((jQuery("#spider_popup_wrap").width() < jQuery(window).width())) { 1083 if (jQuery("#spider_popup_wrap").height() < window.innerHeight) { 1084 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 1085 } 1086 } 1087 } 1088 }); 1089 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({ 1090 maxWidth: bwg_popup_current_width - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0),
1091 maxHeight: bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1092 }, { 1093 duration: 500, 1094 complete: function () { 1095 bwg_resize_instagram_post(); 1096 bwg_change_watermark_container(); 1097 if (jQuery("#spider_popup_wrap").width() < jQuery(window).width()) { 1098 if (jQuery("#spider_popup_wrap").height() < window.innerHeight) { 1099 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 1100 } 1101 } 1102 } 1103 }); 1104 if ( bwg_param['width_or_height'] == 'width' ) { 1105 jQuery(".bwg_filmstrip_container").animate({width: bwg_popup_current_width - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 1106 jQuery(".bwg_filmstrip").animate({width: bwg_popup_current_width - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40}, 500); 1107 /* Set filmstrip initial position.*/ 1108 bwg_set_filmstrip_pos(bwg_popup_current_width - 40); 1109 } else { 1110 jQuery(".bwg_filmstrip_container").animate({height: bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 1111 jQuery(".bwg_filmstrip").animate({height: bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40}, 500); 1112 /* Set filmstrip initial position.*/ 1113 bwg_set_filmstrip_pos(bwg_popup_current_height - 40); 1114 } 1115 jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-full"); 1116 jQuery(".bwg_resize-full").attr("title", "<?php echo __('Maximize', BWG()->prefix); ?>"); 1117 1118 } 1119 else { // resize to full from small 1120 bwg_popup_current_width = jQuery(window).width(); 1121 bwg_popup_current_height = window.innerHeight; 1122 /* Maximize.*/ 1123 jQuery("#spider_popup_wrap").animate({ 1124 width: jQuery(window).width(), 1125 height: window.innerHeight, 1126 left: 0, 1127 top: 0, 1128 margin: 0, 1129 zIndex: 100002 1130 }, 500); 1131 jQuery(".bwg_image_wrap").animate({width: (jQuery(window).width() - comment_container_width)}, 500); 1132 jQuery(".bwg_image_container").animate({height: (bwg_popup_current_height - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0)), width: bwg_popup_current_width - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0)}, 500); 1133 jQuery(".bwg_popup_image").animate({ 1134 maxWidth: jQuery(window).width() - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1135 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1136 }, { 1137 duration: 500, 1138 complete: function () { bwg_change_watermark_container(); } 1139 }); 1140 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").animate({ 1141 maxWidth: jQuery(window).width() - comment_container_width - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0), 1142 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1143 }, { 1144 duration: 500, 1145 complete: function () { 1146 bwg_resize_instagram_post(); 1147 bwg_change_watermark_container(); } 1148 }); 1149 if ( bwg_param['width_or_height'] == 'width' ) { 1150 jQuery(".bwg_filmstrip_container").animate({width: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 1151 jQuery(".bwg_filmstrip").animate({width: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40}, 500); 1152 /* Set filmstrip initial position.*/ 1153 bwg_set_filmstrip_pos(jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40); 1154 } else { 1155 jQuery(".bwg_filmstrip_container").animate({height: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0)}, 500); 1156 jQuery(".bwg_filmstrip").animate({height: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40}, 500); 1157 /* Set filmstrip initial position.*/ 1158 bwg_set_filmstrip_pos(window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? comment_container_width : 0) - 40); 1159 }
1160 jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-small"); 1161 jQuery(".bwg_resize-full").attr("title", "<?php echo __('Restore', BWG()->prefix); ?>"); 1162 jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen"); 1163 } 1164} 1165 1166function bwg_popup_resize_lightbox() { 1167 if (typeof jQuery().fullscreen !== 'undefined') { 1168 if (jQuery.isFunction(jQuery().fullscreen)) { 1169 if (!jQuery.fullscreen.isFullScreen()) { 1170 jQuery(".bwg_resize-full").show(); 1171 if(!jQuery('.bwg_resize-full').hasClass('fa-resize-small')) { 1172 jQuery(".bwg_resize-full").attr("class", "bwg_ctrl_btn bwg_resize-full fa fa-resize-full"); 1173 } 1174 jQuery(".bwg_resize-full").attr("title", bwg_objectsL10n.bwg_maximize); 1175 jQuery(".bwg_fullscreen").attr("class", "bwg_ctrl_btn bwg_fullscreen fa fa-fullscreen"); 1176 jQuery(".bwg_fullscreen").attr("title", bwg_objectsL10n.fulscreen); 1177 } 1178 } 1179 } 1180 var comment_container_width = 0; 1181 if (jQuery(".bwg_comment_container").hasClass("bwg_open") || jQuery(".bwg_ecommerce_container").hasClass("bwg_open")) { 1182 comment_container_width = bwg_param['lightbox_comment_width']; 1183 } 1184 if (comment_container_width > jQuery(window).width()) { 1185 comment_container_width = jQuery(window).width(); 1186 jQuery(".bwg_comment_container").css({ 1187 width: comment_container_width 1188 }); 1189 jQuery(".bwg_ecommerce_container").css({ 1190 width: comment_container_width 1191 }); 1192 jQuery(".spider_popup_close_fullscreen").hide(); 1193 } 1194 else { 1195 jQuery(".spider_popup_close_fullscreen").show(); 1196 } 1197 if (!(!(window.innerHeight > bwg_param['image_height']) || !(bwg_param['open_with_fullscreen'] != 1)) && !jQuery('.bwg_resize-full').hasClass('fa-resize-small')) { 1198 jQuery("#spider_popup_wrap").css({ 1199 height: bwg_param['image_height'], 1200 top: '50%', 1201 marginTop: -bwg_param['image_height'] / 2, 1202 zIndex: 100002 1203 }); 1204 jQuery(".bwg_image_container").css({height: (bwg_param['image_height'] - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0))}); 1205 jQuery(".bwg_popup_image").css({ 1206 maxHeight: bwg_param['image_height'] - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1207 }); 1208 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1209 maxHeight: bwg_param['image_height'] - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1210 }); 1211 if (bwg_param['filmstrip_direction'] == 'vertical') { 1212 jQuery(".bwg_filmstrip_container").css({height: bwg_param['image_height']}); 1213 jQuery(".bwg_filmstrip").css({height: (bwg_param['image_height'] - 40)}) 1214 } 1215 bwg_popup_current_height = bwg_param['image_height']; 1216 } 1217 else { 1218 jQuery("#spider_popup_wrap").css({ 1219 height: window.innerHeight, 1220 top: 0, 1221 marginTop: 0, 1222 zIndex: 100002 1223 }); 1224 1225 jQuery(".bwg_image_container").css({height: (window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0))}); 1226 jQuery(".bwg_popup_image").css({ 1227 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1228 }); 1229 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1230 maxHeight: window.innerHeight - (bwg_param['filmstrip_direction'] == 'horizontal' ? bwg_param['image_filmstrip_height'] : 0) 1231 }); 1232 if (bwg_param['filmstrip_direction'] == 'vertical') { 1233 jQuery(".bwg_filmstrip_container").css({height: (window.innerHeight)}); 1234 jQuery(".bwg_filmstrip").css({height: (window.innerHeight - 40)}); 1235 } 1236 bwg_popup_current_height = window.innerHeight; 1237 } 1238 if (!(!(jQuery(window).width() >= bwg_param['image_width']) || !(bwg_param['open_with_fullscreen'] != 1))) { 1239 jQuery("#spider_popup_wrap").css({ 1240 width: bwg_param['image_width'], 1241 left: '50%', 1242 marginLeft: -bwg_param['image_width'] / 2, 1243 zIndex: 100002 1244 }); 1245 jQuery(".bwg_image_wrap").css({width: bwg_param['image_width'] - comment_container_width}); 1246 jQuery(".bwg_image_container").css({width: (bwg_param['image_width'] - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width)}); 1247 jQuery(".bwg_popup_image").css({ 1248 maxWidth: bwg_param['image_width'] - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width 1249 }); 1250 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1251 maxWidth: bwg_param['image_width'] - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width 1252 }); 1253 if (bwg_param['filmstrip_direction'] == 'horizontal') { 1254 jQuery(".bwg_filmstrip_container").css({width: bwg_param['image_width'] - comment_container_width}); 1255 jQuery(".bwg_filmstrip").css({width: (bwg_param['image_width'] - comment_container_width- 40)}); 1256 } 1257 bwg_popup_current_width = bwg_param['image_width']; 1258 } 1259 else { 1260 jQuery("#spider_popup_wrap").css({ 1261 width: jQuery(window).width(), 1262 left: 0, 1263 marginLeft: 0, 1264 zIndex: 100002 1265 }); 1266 jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)}); 1267 jQuery(".bwg_image_container").css({width: (jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width)}); 1268 jQuery(".bwg_popup_image").css({ 1269 maxWidth: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width 1270 }); 1271 jQuery(".bwg_popup_embed > .bwg_embed_frame > img, .bwg_popup_embed > .bwg_embed_frame > video").css({ 1272 maxWidth: jQuery(window).width() - (bwg_param['filmstrip_direction'] == 'vertical' ? bwg_param['image_filmstrip_width'] : 0) - comment_container_width 1273 }); 1274 if (bwg_param['filmstrip_direction'] == 'horizontal') { 1275 jQuery(".bwg_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)}); 1276 jQuery(".bwg_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)}); 1277 } 1278 bwg_popup_current_width = jQuery(window).width(); 1279 } 1280 /* Set watermark container size.*/ 1281 bwg_resize_instagram_post(); 1282 bwg_change_watermark_container(); 1283 if (!(!(window.innerHeight > bwg_param['image_height'] - 2 * bwg_param['lightbox_close_btn_top']) || !(jQuery(window).width() >= bwg_param['image_width'] - 2 * bwg_param['lightbox_close_btn_right']) || !(bwg_param['open_with_fullscreen'] != 1))) { 1284 jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close"); 1285 } 1286 else { 1287 if (!(!(jQuery("#spider_popup_wrap").width() < jQuery(window).width()) || !(jQuery("#spider_popup_wrap").height() < jQuery(window).height()))) {
1288 jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen"); 1289 } 1290 } 1291 if ( bwg_param['lightbox_ctrl_btn_pos'] == 'bottom' ) { 1292 if (jQuery(".bwg_toggle_container i").hasClass('fa-angle-down')) { 1293 jQuery(".bwg_toggle_container").css("bottom", jQuery(".bwg_ctrl_btn_container").height() + "px"); 1294 } 1295 } 1296 if ( bwg_param['lightbox_ctrl_btn_pos'] == 'top') { 1297 if (jQuery(".bwg_toggle_container i").hasClass('fa-angle-up')) { 1298 jQuery(".bwg_toggle_container").css("top", jQuery(".bwg_ctrl_btn_container").height() + "px"); 1299 } 1300 } 1301}
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.