1/* Simple JavaScript Inheritance 2* By John Resig http://ejohn.org/ 3* MIT Licensed. 4*/ 5// Inspired by base2 and Prototype 6 7(function(){ 8 var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; 9 10 // The base Class implementation (does nothing) 11 this.Class = function(){}; 12 13 // Create a new Class that inherits from this class 14 Class.extend = function(prop) 15 { 16 var _super = this.prototype; 17 18 // Instantiate a base class (but only create the instance, 19 // donât run the init constructor) 20 initializing = true; 21 var prototype = new this(); 22 initializing = false; 23 24 // Copy the properties over onto the new prototype 25 for (var name in prop) 26 { 27 // Check if weâre overwriting an existing function 28 prototype[name] = typeof prop[name] == "function" && 29 typeof _super[name] == "function" && fnTest.test(prop[name]) ? 30 (function(name, fn) 31 { 32 return function() 33 { 34 var tmp = this._super; 35 36 // Add a new ._super() method that is the same method 37 // but on the super-class 38 this._super = _super[name]; 39 40 // The method only need to be bound temporarily, so we 41 // remove it when weâre done executing 42 var ret = fn.apply(this, arguments); 43 this._super = tmp; 44 45 return ret; 46 }; 47 })(name, prop[name]) : 48 prop[name]; 49 } 50 51 // The dummy class constructor 52 function Class() 53 { 54 // All construction is actually done in the init method 55 if ( !initializing && this.init ) 56 this.init.apply(this, arguments); 57 } 58 59 // Populate our constructed prototype object 60 Class.prototype = prototype; 61 62 // Enforce the constructor to be what we expect 63 Class.prototype.constructor = Class; 64 65 // And make this class extendable 66 Class.extend = arguments.callee; 67 68 return Class; 69 }; 70})(); 71 72 73var lightbox; 74 75//Finger Swipe Method 1 76 77var slider = { 78 79 // // The elements. 80 // el: { 81 // slider: jQuery(".ewd-ulb-slide-area"), 82 // holder: jQuery(".ewd-ulb-slide-container"), 83 // imgSlide: jQuery(".ewd-ulb-image-displaying img") 84 // }, 85 86 // The stuff that makes the slider work. 87 88 slideWidth: jQuery(".ewd-ulb-slide-container").width(), // Calculate the slider width. 89 90 // Define these as global variables so we can use them across the entire script. 91 touchstartx: undefined, 92 touchmovex: undefined, 93 movex: undefined, 94 index: 0, 95 longTouch: undefined, 96 97 // init: function() { 98 // this.bindUIEvents(); 99 // }, 100 101 // bindUIEvents: function(){ 102 // }, 103 104}; 105 106var defaults = { 107 108 custom_css: '', 109 110 transition_class: 'ewd-ulb-horizontal-slide', 111 112 speed: 600, 113 height: '100%', 114 width: '100%', 115 116 closable: true, 117 loop: true, 118 keyboard_controls: true, 119 120 show_thumbnails: 'bottom', 121 show_thumbnail_toggle: true, 122 123 curtain_slide: false, 124 125 hide_elements: ['description', 'thumbnails'], 126 127 autoplay: false, 128 autoplay_interval: 4000, 129 show_progress_bar: false, 130 131 mousewheel_navigation: true, 132 133 zoomLevel: 0, 134 fullsize: false, 135 136 ulb_arrow: 'a', 137 ulb_icon_set: 'a', 138 139 controls: {'top_right_controls': ['exit'], 140 'top_left_controls': ['autoplay', 'zoom', 'zoom_out', 'download', 'fullscreen'], 141 'bottom_right_controls': ['slide_counter'], 142 'bottom_left_controls': []} 143}; 144 145 146 147var EWD_ULB_LightboxSlide = Class.extend({ 148 init: function(element, length) { 149 this.element = element; 150 this.source = jQuery(element).data("ulbsource"); 151 this.title = jQuery(element).data("ulbtitle"); 152 this.description = jQuery(element).data("ulbdescription"); 153 this.gallery = jQuery(element).data("ulbGallery"); 154 155 156 if (this.source) { 157 var youtube = this.source.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); 158 if (youtube) { 159 this.video = "youtube"; 160 this.source = this.source.replace("watch?v=", "embed/"); 161 } 162 else { 163 this.video = false; 164 } 165 } 166 else { 167 this.video = false; 168 } 169 170 if (jQuery(element).data("ulbheight")) {this.height = jQuery(element).data("ulbheight");} 171 else {this.height = 315;} 172 if (jQuery(element).data("ulbwidth")) {this.width = jQuery(element).data("ulbwidth");} 173 else {this.width = 560;} 174 } 175}); 176 177var UltimateLightbox = Class.extend({ 178 179 init: function(options) 180 { 181 this.settings = jQuery.extend({}, defaults, options); 182 183 this.displaying = false; 184 185 186 var elements = []; 187 jQuery('.ewd-ulb-lightbox, .ewd-ulb-lightbox-noclick-image').each(function(index, value) { 188 var Slide = new EWD_ULB_LightboxSlide(this, elements.length); 189 jQuery(this).data('slideIndex', elements.length); 190 elements.push(Slide); 191 }); 192 this.elements = elements; 193 194 this.currentSlide = 0; 195 196 this.maxSlide = this.elements.length - 1; 197 198 this.setMobileClasses(); 199 200 if (this.settings.curtain_slide) { 201 this.getPairedImages(); 202 } 203 }, 204 205 206 207 getPairedImages: function() { 208 209 var sources = []; 210 jQuery(this.elements).each(function(index, element) { 211 sources.push(element.source); 212 }); 213 var data = 'image_sources=' + JSON.stringify(sources) + '&action=ulb_get_paired_images'; 214 jQuery.post(ajaxurl,data, function(response) 215 { 216 var paired_images = jQuery.parseJSON(response); 217 jQuery.each(paired_images, function(index, element) 218 { 219 if(element != "") // If a pair exists 220 { 221 //Wrapping img with 20-20 222 img_height = paired_images.height; 223 var bef_img = jQuery('.ewd-ulb-slide-img').children("img[src='"+ index + "']"); 224 bef_img.wrap( "<div class='twentytwenty-container' style='height:100%;width100%;vertical-align:middle;'></div>"); 225 bef_img.after("<img src= '"+ element +"'/>");
226 //jQuery('.twentytwenty-container').twentytwenty(); 227 } 228 229 }); 230 231 }); 232 233 234 }, 235 236 237 238 setMobileClasses: function() { 239 if (jQuery.inArray('description', this.settings.hide_elements) !== -1) {this.settings.descriptionClass = 'ewd-ulb-mobile-hide';} 240 else {this.settings.descriptionClass = '';} 241 if (jQuery.inArray('title', this.settings.hide_elements) !== -1) {this.settings.titleClass = 'ewd-ulb-mobile-hide';} 242 else {this.settings.titleClass = '';} 243 if (jQuery.inArray('thumbnails', this.settings.hide_elements) !== -1) {this.settings.thumbnailsClass = 'ewd-ulb-mobile-hide';} 244 else {this.settings.thumbnailsClass = '';} 245 246 if (this.settings.descriptionClass == 'ewd-ulb-mobile-hide' && this.settings.titleClass == 'ewd-ulb-mobile-hide') {this.settings.overlayClass = 'ewd-ulb-mobile-hide';} 247 else {this.settings.overlayClass = '';} 248 }, 249 250 setCurrentSlide: function(targetElement) { 251 jQuery(this.elements).each(function(index, element) { 252 if (element.source == jQuery(targetElement).data('ulbsource')) {lightbox.currentSlide = index;} 253 }) 254 }, 255 256 toggle: function() { 257 if (this.displaying) {this.closeLightbox();} 258 else {this.openLightbox();} 259 }, 260 261 closeLightbox: function() { 262 //if oldSlide is a video Stop playing 263 var checkForVid = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying") 264 if(checkForVid.find('iframe').length > 0) 265 { 266 267 if (checkForVid.find('iframe').attr('src').indexOf("autoplay") != -1) 268 { 269 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src').replace('?autoplay=1','')); 270 271 } 272 else 273 { 274 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src')); 275 276 } 277 } 278 this.displaying = false; 279 jQuery('.ewd-ulb-background').css('display', 'none'); 280 jQuery('.ewd-ulb-lightbox-container').css('display', 'none'); 281 // jQuery('.ewd-ulb-background').css('visibility', 'hidden'); 282 // jQuery('.ewd-ulb-lightbox-container').css('visibility', 'hidden'); 283 this.switchSlide(); 284 jQuery('.ewd-ulb-active-slide').removeClass('ewd-ulb-active-slide'); 285 jQuery('.ewd-ulb-active-thumbnail').removeClass('ewd-ulb-active-thumbnail'); 286 }, 287 288 289 290 openLightbox: function () { 291 this.displaying = true; 292 jQuery('.ewd-ulb-background').css('display', 'inline'); 293 jQuery('.ewd-ulb-lightbox-container').css('display', 'inline'); 294 if ( this.settings.autoplay ) {this.startAutoplay();} 295 296 //For each image check if Iframe exists 297 jQuery('.ewd-ulb-slide-img').each(function(){ 298 299 var thisSlideImg = jQuery(this); 300 if(thisSlideImg.find('iframe').length > 0) // If it is a video 301 { 302 303 thisSlideImg.find('iframe').css('height', 'calc(100% - 40px)'); 304 thisSlideImg.find('iframe').css('max-width', 'calc(100% - 40px)'); 305 } 306 }); 307 308 this.switchSlide(); 309 this.selectThumbnails(); 310 lightbox.noZoom(); 311 312 //To check If the current image is a frame. 313 var checkForVid = jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying'); 314 if(checkForVid.find('iframe').length > 0) 315 { 316 //console.log('check for vide0'); 317 // To autoplay video 318 if (checkForVid.find('iframe').attr('src').indexOf("autoplay") == -1) 319 { 320 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src') + '?autoplay=1'); 321 } 322 } 323 324 // Finger Swipe Method 2(slick) 325 //jQuery('.ewd-ulb-slide-img').slick(); 326 327 }, 328 329 enlargeImage: function () { 330 331 // Fetch the size of the window 332 // make the image full size by updating height and width. 333 this.displaying = true; 334 jQuery('.ewd-ulb-background').css('display', 'inline'); 335 jQuery('.ewd-ulb-lightbox-container').css('display', 'inline'); 336 if ( this.settings.autoplay ) {this.startAutoplay();} 337 this.switchSlide(); 338 this.selectThumbnails(); 339 lightbox.noZoom(); 340 }, 341 342 nextSlide: function() { 343 344 var oldSlide = this.currentSlide; 345 do { 346 347 348 //if (this.currentSlide == this.maxSlide && ewd_ulb_php_data.gallery_loop == "false" ) {return;} 349 // else {this.currentSlide = this.currentSlide + 1;} 350 // } 351 // while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); 352 // jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-next'); 353 // this.switchSlide(oldSlide); 354 355 //To check for loop on/off 356 // console.log("From next slide fn" + this.maxSlide); 357 358 if(this.currentSlide != this.maxSlide) 359 { 360 this.currentSlide = this.currentSlide + 1; 361 } 362 else if (this.currentSlide == this.maxSlide && ewd_ulb_php_data.gallery_loop) 363 { 364 if(this.maxSlide == 0){ 365 return; 366 } 367 this.currentSlide = 0; 368 } 369 else if(this.currentSlide == this.maxSlide && ! ewd_ulb_php_data.gallery_loop) 370 { 371 return; 372 } 373 }while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); 374 375 jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-next'); 376 this.switchSlide(oldSlide); 377 378 379 //if oldSlide is a video Stop playing it
380 var checkForVid = jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']"); 381 if(checkForVid.find('iframe').length > 0) 382 { 383 if (checkForVid.find('iframe').attr('src').indexOf("autoplay") != -1) 384 { 385 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src').replace('?autoplay=1','')); 386 return false; 387 } 388 else 389 { 390 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src')); 391 return false; 392 } 393 } 394 }, 395 396 previousSlide: function() { 397 var oldSlide = this.currentSlide; 398 do { 399 // if (this.currentSlide == 0) {this.currentSlide = this.maxSlide;} 400 // else {this.currentSlide = this.currentSlide - 1;} 401 // } 402 // while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); 403 // jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-previous'); 404 // this.switchSlide(oldSlide); 405 // console.log("From previous slide fn" + this.maxSlide); 406 if(this.currentSlide != 0 ) 407 { 408 this.currentSlide = this.currentSlide - 1; 409 } 410 else if (this.currentSlide == 0 && ewd_ulb_php_data.gallery_loop) 411 { 412 if(this.maxSlide == 0){ 413 return; 414 } 415 this.currentSlide = this.maxSlide; 416 } 417 else if(this.currentSlide == 0 && ! ewd_ulb_php_data.gallery_loop) 418 { 419 return; 420 } 421 422 }while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); 423 jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-previous'); 424 this.switchSlide(oldSlide); 425 426 //if oldSlide is a video Stop playing 427 var checkForVid = jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']"); 428 if(checkForVid.find('iframe').length > 0) 429 { 430 if (checkForVid.find('iframe').attr('src').indexOf("autoplay") != -1) 431 { 432 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src').replace('?autoplay=1','')); 433 return false; 434 } 435 else 436 { 437 checkForVid.find('iframe').attr('src', checkForVid.find('iframe').attr('src')); 438 return false; 439 } 440 } 441 442 }, 443 444 goToSlide: function(slideIndex) { 445 446 var oldSlide = this.currentSlide; 447 this.currentSlide = slideIndex; 448 jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-next'); 449 this.switchSlide(oldSlide); 450 }, 451 452 switchSlide: function(oldSlide) { 453 if (typeof oldSlide !== "undefined") { 454 jQuery(".ewd-ulb-slide-thumbnail[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-active-thumbnail'); 455 jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-image-displaying') 456 jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").addClass('ewd-ulb-old-active-slide'); 457 if (oldSlide != this.currentSlide) { 458 setTimeout(function(){ 459 jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-active-slide ewd-ulb-old-active-slide'); 460 }, 500); 461 } 462 } 463 jQuery(".ewd-ulb-slide-thumbnail[data-slideindex='" + this.currentSlide + "']").addClass('ewd-ulb-active-thumbnail'); 464 jQuery(".ewd-ulb-slide[data-slideindex='" + this.currentSlide + "']").addClass('ewd-ulb-active-slide ewd-ulb-image-displaying'); 465 var slideNumber = this.currentSlide + 1; 466 jQuery(".ewd-ulb-current-count-indicator").each(function() {jQuery(this).html(slideNumber);}); 467 468 setTimeout(function(){ 469 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-transition-next ewd-ulb-transition-previous'); 470 }, 500); 471 472 lightbox.resizeOverlay(); 473 lightbox.setDownloadLinks(); 474 475 476 }, 477 478 selectThumbnails: function() { 479 480 var gallery = this.getCurrentGallery(); 481 482 jQuery('.ewd-ulb-slide-thumbnail').addClass('ewd-ulb-thumbnail-hidden'); 483 jQuery('.ewd-ulb-slide-thumbnail[data-ulbGallery="' + gallery + '"]').removeClass('ewd-ulb-thumbnail-hidden'); 484 485 }, 486 487 getCurrentGallery: function() { 488 489 var gallery = ""; 490 var currentSlide = this.currentSlide; 491 jQuery(this.elements).each(function(index, element) { 492 if (index == currentSlide) {gallery = element.gallery;} 493 }); 494 495 return gallery; 496 }, 497 498 499 resizeOverlay: function() { 500 501 var imgWidth = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying img").first().width(); 502 var imgHeight = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying img").first().height(); 503 var containerWidth = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying").first().width(); 504 var containerHeight = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying").first().height(); 505 //alert("imageWidth:"+ imgWidth+"imageHeight:"+ imgHeight + "containerWidth:"+ containerWidth+ "containerHeight:" + containerHeight ); 506 var marginWidth = (containerWidth - imgWidth) / 2; 507 508 509 510 var TwentyConHeight = jQuery(".twentytwenty-container").height(); 511 var TwentyConWidth = jQuery(".twentytwenty-container").width(); 512 513 514 jQuery(".ewd-ulb-slide-overlay").css('width', imgWidth + 'px'); 515 jQuery(".ewd-ulb-slide-overlay").css('margin', '0px ' + marginWidth + 'px'); 516 517 518 //if the image is a curtain slider (ONLY WORKS 1ST TIME) 519 if(jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').length > 0) 520 { 521
522 if(imgWidth==0 && imgHeight==0)//openeing after CloseLightbox 523 { 524 return; 525 } 526 else if(imgWidth!=TwentyConWidth || imgHeight!=containerHeight) // 1st time no wrapping 527 { 528 jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').css('margin-left',marginWidth + 'px'); 529 jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').css('width',imgWidth + 'px'); 530 jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').css('height',containerHeight +'px'); 531 //jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').css('height',imgHeight +'px'); 532 533 if(!jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-wrapper').length > 0) //if twenty twenty is already wrapped 534 { 535 jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.ewd-ulb-slide-img').append('<style>.ewd-ulb-slide-img:before{height:0px;}</style>'); 536 jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').twentytwenty(); 537 } 538 } 539 540 } 541 542 }, 543 544 toggleThumbnailBar: function() { 545 546 jQuery( '.ewd-ulb-bottom-thumbnail-bar, .ewd-ulb-top-thumbnail-bar, .ewd-thumbnail-toggle-down, .ewd-thumbnail-toggle-up' ).toggleClass( 'ewd-ulb-thumbnail-bar-hidden' ); 547 jQuery( '.ewd-thumbnail-toggle-down, .ewd-thumbnail-toggle-up' ).toggleClass( 'ewd-ulb-hidden' ); 548 }, 549 550 toggleAutoplay: function() { 551 if (this.settings.autoplay) {this.stopAutoplay();} 552 else {this.startAutoplay();} 553 }, 554 555 startAutoplay: function() { 556 if (this.interval) {clearInterval(this.interval);} 557 this.settings.autoplay = true; 558 this.interval = setInterval(function() { 559 lightbox.nextSlide(); 560 }, this.settings.autoplay_interval); 561 }, 562 563 stopAutoplay: function() { 564 this.settings.autoplay = false; 565 clearInterval(this.interval); 566 }, 567 568 ZoomOut: function() { 569 if (this.settings.zoomLevel == 2) {this.zoomOne();} 570 else if (this.settings.zoomLevel == 1) {this.noZoom();} 571 572 this.removeFullSize(); 573 }, 574 575 toggleZoom: function() { 576 if (this.settings.zoomLevel == 0) {this.zoomOne();} 577 else if (this.settings.zoomLevel == 1) {this.zoomTwo();} 578 else {this.noZoom();} 579 580 this.removeFullSize(); 581 }, 582 583 zoomOne: function() { 584 this.settings.zoomLevel = 1; 585 jQuery('.ewd-ulb-slide').addClass('ewd-ulb-zoom-one'); 586 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-two'); 587 }, 588 589 zoomTwo: function() { 590 this.settings.zoomLevel = 2; 591 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-one'); 592 jQuery('.ewd-ulb-slide').addClass('ewd-ulb-zoom-two'); 593 }, 594 595 noZoom: function() { 596 this.settings.zoomLevel = 0; 597 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-one'); 598 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-two'); 599 }, 600 601 fullscreen: function() { 602 if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { 603 jQuery('ewd-ulb-fullscreen').addClass('ewd-ulb-regular_screen'); 604 if (document.documentElement.requestFullscreen) { 605 document.documentElement.requestFullscreen(); 606 } else if (document.documentElement.msRequestFullscreen) { 607 document.documentElement.msRequestFullscreen(); 608 } else if (document.documentElement.mozRequestFullScreen) { 609 document.documentElement.mozRequestFullScreen(); 610 } else if (document.documentElement.webkitRequestFullscreen) { 611 document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); 612 } 613 } else { 614 jQuery('ewd-ulb-fullscreen').removeClass('ewd-ulb-regular_screen'); 615 if (document.exitFullscreen) { 616 document.exitFullscreen(); 617 } else if (document.msExitFullscreen) { 618 document.msExitFullscreen(); 619 } else if (document.mozCancelFullScreen) { 620 document.mozCancelFullScreen(); 621 } else if (document.webkitExitFullscreen) { 622 document.webkitExitFullscreen(); 623 } 624 } 625 }, 626 627 toggleFullSize: function() { 628 this.noZoom(); 629 if (this.settings.fullsize) 630 {this.removeFullSize();} 631 else 632 {this.goFullSize();} 633 }, 634 635 goFullSize: function() { 636 var elem = jQuery('.ewd-ulb-active-slide .ewd-ulb-slide-img img')[0]; 637 638 if(jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').length > 0) // If it is a curtain slider just return 639 { 640 return; 641 } 642 if (!elem.fullscreenElement && !elem.mozFullScreenElement && !elem.webkitFullscreenElement && !elem.msFullscreenElement ) 643 { 644 645 jQuery('ewd-ulb-fullscreen').addClass('ewd-ulb-regular_screen'); 646 if (elem.requestFullscreen) { 647 elem.requestFullscreen(); 648 } else if (elem.msRequestFullscreen) { 649 elem.msRequestFullscreen(); 650 } else if (elem.mozRequestFullScreen) { 651 elem.mozRequestFullScreen(); 652 } else if (elem.webkitRequestFullscreen) { 653 elem.webkitRequestFullscreen(); 654 } 655 } 656 }, 657 658 removeFullSize: function() { 659 jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-fullsize-image'); 660 this.settings.fullsize = false; 661 }, 662 663 setDownloadLinks: function() {
664 jQuery('.ewd-ulb-download-link').attr('href', jQuery('.ewd-ulb-active-slide div img').attr('src')); 665 }, 666}); 667 668jQuery(document).ready(function($) { 669 670 if (typeof ewd_ulb_php_data == "undefined") 671 { 672 ewd_ulb_php_data = []; 673 } 674 lightbox = new UltimateLightbox(ewd_ulb_php_data); 675 676 jQuery('.ewd-ulb-lightbox, .ewd-ulb-open-lightbox').on('click', function(event) { 677 if ( typeof jQuery(event.currentTarget).data('slideIndex') !== 'undefined' ) 678 { 679 lightbox.currentSlide = jQuery(event.currentTarget).data('slideIndex'); 680 } 681 else 682 { 683 lightbox.setCurrentSlide(event.currentTarget); 684 } 685 lightbox.toggle(); 686 event.preventDefault(); 687 }); 688 689 690 if (jQuery('.ewd-ulb-lightbox, .ewd-ulb-lightbox-noclick-image').length) 691 { 692 EWD_ULB_Add_Lightbox_HTML(lightbox); 693 jQuery('.ewd-ulb-slide-container').on('click.background', function(event) 694 { 695 if ( event.target.nodeName !== undefined && ( event.target.nodeName == "IMG" || event.target.nodeName == "iframe" || ( ewd_ulb_php_data.hasOwnProperty( 'background_close' ) && ! ewd_ulb_php_data.background_close ) ) ) 696 {return;} 697 //alert(event.toElement.className); 698 699 lightbox.toggle(); 700 }); 701 702 jQuery('.ewd-ulb-slide-control-next').on('click.next', function() { 703 lightbox.noZoom(); 704 lightbox.stopAutoplay(); 705 lightbox.nextSlide(); 706 }); 707 jQuery('.ewd-ulb-slide-control-previous').on('click.prev', function() { 708 lightbox.noZoom(); 709 lightbox.stopAutoplay(); 710 lightbox.previousSlide(); 711 }); 712 713 //Wrong Interpretation - must be modified so the image move like a carousel 714 jQuery('.ewd-thumbnail-scroll-button-left').on('click.prev', function() { 715 lightbox.noZoom(); 716 lightbox.stopAutoplay(); 717 }); 718 jQuery('.ewd-thumbnail-scroll-button-right').on('click.next', function() { 719 lightbox.noZoom(); 720 lightbox.stopAutoplay(); 721 }); 722 723 724 jQuery('.ewd-ulb-slide-thumbnail').on('click.thumbnail', function() { 725 726 var slideIndex = jQuery(this).data("slideindex"); 727 lightbox.noZoom(); 728 lightbox.stopAutoplay(); 729 lightbox.goToSlide(slideIndex); 730 731 }); 732 733 jQuery( '.ewd-thumbnail-toggle' ).on( 'click.thumbnail_toggle', function() { 734 735 lightbox.toggleThumbnailBar(); 736 }); 737 738 jQuery(window).on('resize', function() { 739 lightbox.resizeOverlay() 740 }); 741 742 jQuery('.ewd-ulb-exit').on('click.exit', function() { 743 lightbox.toggle(); 744 }); 745 jQuery('.ewd-ulb-autoplay').on('click.autoplay', function() { 746 lightbox.toggleAutoplay(); 747 }); 748 jQuery('.ewd-ulb-zoom').on('click.zoom', function() { 749 lightbox.toggleZoom(); 750 }); 751 jQuery('.ewd-ulb-zoom_out').on('click.zoom_out', function() { 752 lightbox.ZoomOut(); 753 }); 754 jQuery('.ewd-ulb-fullsize').on('click.fullsize', function() { 755 lightbox.toggleFullSize(); 756 }); 757 jQuery('.ewd-ulb-fullscreen').on('click.zoom_out', function() { 758 lightbox.fullscreen(); 759 }); 760 jQuery('.ewd-ulb-download').wrap('<a class="ewd-ulb-download-link" href="empty.png" download></a>'); 761 762 if (lightbox.settings.keyboard_controls) { 763 jQuery(document).on('keyup', function(e) { 764 if (e.which == 27) {lightbox.closeLightbox();} 765 if (e.which == 37) { 766 lightbox.noZoom(); 767 lightbox.stopAutoplay(); 768 lightbox.previousSlide(); 769 } 770 if (e.which == 39) { 771 lightbox.noZoom(); 772 lightbox.stopAutoplay(); 773 lightbox.nextSlide(); 774 } 775 }); 776 } 777 778 //LISTENERS 779 780 jQuery(".ewd-ulb-slide-area").on("touchstart", function(event) { 781 slider.longTouch = false; 782 setTimeout(function() { // Since the root of setTimout is window we canât reference this. Thatâs why this variable says window.slider in front of it. 783 window.slider.longTouch = true; 784 }, 250); 785 786 // Get the original touch position. 787 slider.touchstartx = event.originalEvent.touches[0].pageX; 788 789 // if(jQuery('.animate').length>0) 790 // { 791 // jQuery('.animate').removeClass('animate'); 792 // } 793 }); 794 795 jQuery(".ewd-ulb-slide-area").on("touchmove", function(event) { 796 slider.touchmovex = event.originalEvent.touches[0].pageX; 797 //console.log("Index: " + slider.index); 798 799 // Calculate distance to translate holder.3 800 slider.slideWidth = jQuery(".ewd-ulb-slide-container").width(); 801 slider.movex = (slider.touchstartx - slider.touchmovex); 802 //console.log("Slider Move:" + slider.movex); 803 804 // Defines the speed the images should move at. 805 var panx = 100-slider.movex/6; 806 // If it is a curtain slider just return 807 if(jQuery('.ewd-ulb-active-slide.ewd-ulb-image-displaying').find('.twentytwenty-container').length > 0) 808 { 809 return; 810 } 811 if(slider.movex > 0)//swiping forward - this will move the image 812 { 813 if (slider.movex < 600) { // Makes the holder stop moving when there is no more content. 814 jQuery(".ewd-ulb-slide-container").css('transform','translate3d(-' + slider.movex + 'px,0,0)'); 815 } 816 if (panx < 100) { // Corrects an edge-case problem where the background image moves without the container moving. 817 jQuery(".ewd-ulb-image-displaying img").css('transform','translate3d(-' + panx + 'px,0,0)'); 818 } 819 } 820 else if (slider.movex < 0)//swiping backward - this will move the image 821 { 822 823 if (slider.movex < 600) { // Makes the holder stop moving when there is no more content. 824 jQuery(".ewd-ulb-slide-container").css('transform','translate3d(' + Math.abs(slider.movex)+ 'px,0,0)'); 825 } 826 if (panx < 100) { // Corrects an edge-case problem where the background image moves without the container moving. 827 jQuery(".ewd-ulb-image-displaying img").css('transform','translate3d(' + Math.abs(panx) + 'px,0,0)'); 828 } 829 830 } 831 832 }); 833 834 jQuery(".ewd-ulb-slide-area").on("touchend", function(event) { 835 // Calculate the distance swiped. 836 var absMove = Math.abs(slider.movex); 837 838 // Calculate the index. All other calculations are based on the index. 839 if (absMove > slider.slideWidth/2 || slider.longTouch === false) 840 { 841 //change image 842 if(slider.movex < 0) 843 { 844 lightbox.previousSlide(); // leftswipe - change to previous image 845 } 846 else if( slider.movex > 0) 847 { 848 lightbox.nextSlide(); // rightswipe - change to next image 849 } 850 851 } 852 //Because the boxes have moved from original location,we need to bring them back 853 jQuery(".ewd-ulb-slide-container").css('transform','none'); 854 jQuery(".ewd-ulb-image-displaying img").css('transform','none'); 855 856 857 }); 858 } 859}); 860 861function EWD_ULB_Add_Lightbox_HTML(lightbox) { 862 var Custom_CSS = '<style>'; 863 Custom_CSS += lightbox.settings.custom_css; 864 Custom_CSS += '</style>'; 865 Custom_CSS += lightbox.settings.styling_options; 866 867 var Top_Toolbar_HTML = '<div class="ewd-ulb-top-toolbar">'; 868 Top_Toolbar_HTML += '<div class="ewd-ulb-left-top-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.top_left_controls, lightbox.maxSlide) + '</div>'; 869 Top_Toolbar_HTML += '<div class="ewd-ulb-right-top-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.top_right_controls, lightbox.maxSlide) + '</div>'; 870 Top_Toolbar_HTML += '</div>'; 871
872 var Top_Thumbnail_Bar_HTML = '<div class="ewd-ulb-top-thumbnail-bar ' + lightbox.settings.thumbnailsClass + '">'; 873 Top_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-left">a</div>'; 874 Top_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-right">b</div>'; 875 Top_Thumbnail_Bar_HTML += '<div class="ewd-ulb-top-thumbnails"><div class="ewd-ulb-thumbnails-inside">'; 876 if (lightbox.settings.show_thumbnails == "top") {Top_Thumbnail_Bar_HTML += EWD_ULB_Thumbnails_HTML(lightbox.elements);} 877 Top_Thumbnail_Bar_HTML += '</div></div>'; 878 Top_Thumbnail_Bar_HTML += '</div>'; 879 if ( lightbox.settings.show_thumbnail_toggle && lightbox.settings.show_thumbnails == "top" ) { Top_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-toggle ewd-thumbnail-toggle-top ewd-thumbnail-toggle-down ewd-ulb-hidden">▼</div><div class="ewd-thumbnail-toggle ewd-thumbnail-toggle-top ewd-thumbnail-toggle-up">▲</div>'; } 880 881 var Slide_Area_HTML = '<div class="ewd-ulb-slide-area">'; 882 883 if ( lightbox.elements.length > 1 ) { 884 885 Slide_Area_HTML += '<div class="ewd-ulb-slide-control ewd-ulb-slide-control-previous ewd-ulb-arrow">' + lightbox.settings.ulb_arrow + '</div>'; 886 } 887 888 Slide_Area_HTML += '<div class="ewd-ulb-slide-container">'; 889 890 jQuery(lightbox.elements).each(function(index, value){ 891 892 Slide_Area_HTML += '<div class="ewd-ulb-slide ' + lightbox.settings.transition_class + '" data-slideindex="' + index + '">'; 893 Slide_Area_HTML += '<div class="ewd-ulb-slide-img">'; 894 895 if (this.video == "youtube") { 896 Slide_Area_HTML += '<iframe width="' + this.width + '" height="' + this.height + '" src="' + this.source + '" frameborder="0" allowfullscreen></iframe>' 897 } 898 else { 899 Slide_Area_HTML += '<img src="' + this.source + '" />'; 900 } 901 902 903 Slide_Area_HTML += '</div>'; 904 if ((this.title != undefined && this.title != "") || (this.description != undefined && this.description != "")) { 905 Slide_Area_HTML += '<div class="ewd-ulb-slide-overlay ' + lightbox.settings.overlayClass + '">'; 906 if (this.title != undefined && this.title != "") {Slide_Area_HTML += '<div class="ewd-ulb-slide-title ' + lightbox.settings.titleClass + '">' + this.title + '</div>';} 907 if (this.description != undefined && this.description != "") {Slide_Area_HTML += '<div class="ewd-ulb-slide-description ' + lightbox.settings.descriptionClass + '">' + this.description + '</div>';} 908 Slide_Area_HTML += '</div>'; 909 } 910 Slide_Area_HTML += '</div>'; 911 }); 912 Slide_Area_HTML += '</div>'; 913 914 if ( lightbox.elements.length > 1 ) { 915 916 Slide_Area_HTML += '<div class="ewd-ulb-slide-control ewd-ulb-slide-control-next ewd-ulb-arrow">' + String.fromCharCode(lightbox.settings.ulb_arrow.charCodeAt(lightbox.settings.ulb_arrow.length-1)+1) + '</div>'; 917 } 918 919 Slide_Area_HTML += '</div>'; 920 921 var Bottom_Thumbnail_Bar_HTML = ''; 922 if ( lightbox.settings.show_thumbnail_toggle && lightbox.settings.show_thumbnails == "bottom" ) { Bottom_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-toggle ewd-thumbnail-toggle-bottom ewd-thumbnail-toggle-down">▼</div><div class="ewd-thumbnail-toggle ewd-thumbnail-toggle-bottom ewd-thumbnail-toggle-up ewd-ulb-hidden">▲</div>'; } 923 Bottom_Thumbnail_Bar_HTML += '<div class="ewd-ulb-bottom-thumbnail-bar ' + lightbox.settings.thumbnailsClass + '">'; 924 Bottom_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-left">a</div>'; 925 Bottom_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-right">b</div>'; 926 Bottom_Thumbnail_Bar_HTML += '<div class="ewd-ulb-bottom-thumbnails"><div class="ewd-ulb-thumbnails-inside">'; 927 if (lightbox.settings.show_thumbnails == "bottom") {Bottom_Thumbnail_Bar_HTML += EWD_ULB_Thumbnails_HTML(lightbox.elements);} 928 Bottom_Thumbnail_Bar_HTML += '</div></div>'; 929 Bottom_Thumbnail_Bar_HTML += '</div>'; 930 931 var Bottom_Toolbar_HTML = '<div class="ewd-ulb-bottom-toolbar">'; 932 Bottom_Toolbar_HTML += '<div class="ewd-ulb-left-bottom-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.bottom_left_controls, lightbox.maxSlide) + '</div>'; 933 Bottom_Toolbar_HTML += '<div class="ewd-ulb-right-bottom-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.bottom_right_controls, lightbox.maxSlide) + '</div>'; 934 Bottom_Toolbar_HTML += '</div>'; 935 936 var HTML = '<div class="ewd-ulb-background' + lightbox.settings.lightbox_background_class + '" style="display:none;width:' + lightbox.settings.width + ';height:' + lightbox.settings.height + '"></div>'; 937 HTML += '<div class="ewd-ulb-lightbox-container ewd-ulb-thumbnails-' + ewd_ulb_php_data.show_thumbnails + lightbox.settings.lightbox_class + '" style="display:none;">'; 938 HTML += Custom_CSS; 939 HTML += Top_Toolbar_HTML; 940 HTML += Top_Thumbnail_Bar_HTML; 941 HTML += Slide_Area_HTML;
942 HTML += Bottom_Thumbnail_Bar_HTML; 943 HTML += Bottom_Toolbar_HTML; 944 HTML += "</div>"; 945 946 jQuery('body').append(HTML); 947} 948 949function EWD_ULB_Thumbnails_HTML(slides) { 950 var Slide_HTML = ''; 951 var prev_gallery ; 952 jQuery(slides).each(function(index, value) { 953 // if(this.gallery==undefined) // If youtube video is added it will be placed in the last 954 // { 955 // //alert(prev_gallery); 956 // //Slide_HTML += '<div class="ewd-ulb-slide-thumbnail" data-slideindex="' + index + '" data-ulbGallery="' + prev_gallery + '">'; 957 // } 958 // else 959 // { 960 Slide_HTML += '<div class="ewd-ulb-slide-thumbnail" data-slideindex="' + index + '" data-ulbGallery="' + this.gallery + '">'; 961 //} 962 963 if (this.video == "youtube") 964 { 965 966 Slide_HTML += '<img src="http://img.youtube.com/vi/' + /[^/]*$/.exec(this.source)[0].split('?')[0] + '/default.jpg" />'; 967 } 968 else 969 { 970 Slide_HTML += '<img src="' + this.source + '" />'; 971 } 972 Slide_HTML += '</div>'; 973 prev_gallery = this.gallery; 974 }); 975 976 return Slide_HTML; 977} 978 979function EWD_ULB_Add_Controls(controls, maxSlide) { 980 var Controls_HTML = ''; 981 jQuery(controls).each(function() { 982 if (this == 'slide_counter') {Controls_HTML += '<div class="ewd-ulb-control ewd-ulb-slide-counter"><span class="ewd-ulb-current-count-indicator">1</span>/<span class="ewd-ulb-max-count-indicator">' + (maxSlide + 1) + '</span></div>';} 983 else {Controls_HTML += '<div class="ewd-ulb-control ewd-ulb-' + this + '">' + lightbox.settings.ulb_icon_set + '</div>';} 984 }); 985 986 return Controls_HTML; 987} 988 989 990/**************************************** 991THUMBNAIL SCROLLING 992****************************************/ 993jQuery(document).ready(function($){ 994 995 $('.ewd-ulb-bottom-thumbnail-bar').each(function(){ 996 var thisThumbBar = $(this); 997 var numberOfThumbs = thisThumbBar.find('.ewd-ulb-slide-thumbnail').length; 998 var widthOfThumbsInside = numberOfThumbs * 144; 999 thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('width', widthOfThumbsInside+'px'); 1000 thisThumbBar.find('.ewd-thumbnail-scroll-button-right').click(function(){ 1001 var widthOfThumbs = thisThumbBar.find('.ewd-ulb-bottom-thumbnails').width(); 1002 if(widthOfThumbs >= widthOfThumbsInside){ 1003 var rightClickStop = 0; 1004 } 1005 else{ 1006 var rightClickStop = (widthOfThumbsInside * -1) + widthOfThumbs; 1007 } 1008 var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; 1009 if(thumbsInsideLeft != rightClickStop){ 1010 thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '-=144'); 1011 } 1012 }); 1013 thisThumbBar.find('.ewd-thumbnail-scroll-button-left').click(function(){ 1014 var leftClickStop = 0; 1015 var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; 1016 if(thumbsInsideLeft != leftClickStop){ 1017 thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '+=144'); 1018 } 1019 }); 1020 }); 1021 1022 $('.ewd-ulb-top-thumbnail-bar').each(function(){ 1023 var thisTopThumbBar = $(this); 1024 var numberOfTopThumbs = thisTopThumbBar.find('.ewd-ulb-slide-thumbnail').length; 1025 var widthOfTopThumbsInside = numberOfTopThumbs * 144; 1026 thisTopThumbBar.find('.ewd-ulb-thumbnails-inside').css('width', widthOfTopThumbsInside+'px'); 1027 thisTopThumbBar.find('.ewd-thumbnail-scroll-button-right').click(function(){ 1028 var widthOfTopThumbs = thisTopThumbBar.find('.ewd-ulb-top-thumbnails').width(); 1029 if(widthOfTopThumbs >= widthOfTopThumbsInside){ 1030 var rightClickStopTop = 0; 1031 } 1032 else{ 1033 var rightClickStopTop = (widthOfTopThumbsInside * -1) + widthOfTopThumbs; 1034 } 1035 var thumbsInsideLeftTop = thisTopThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; 1036 if(thumbsInsideLeftTop != rightClickStopTop){ 1037 thisTopThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '-=144'); 1038 } 1039 }); 1040 thisTopThumbBar.find('.ewd-thumbnail-scroll-button-left').click(function(){ 1041 var leftClickStopTop = 0; 1042 var thumbsInsideLeftTop = thisTopThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; 1043 if(thumbsInsideLeftTop != leftClickStopTop){ 1044 thisTopThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '+=144'); 1045 } 1046 }); 1047 }); 1048 1049}); 1050 1051 1052 1053//////////////////////////////////////
1054/////MARGIN OF VIDEOS IN LIGHTBOX///// 1055////////////////////////////////////// 1056jQuery(document).ready(function($) 1057{ 1058 1059 $('.ewd-ulb-slide-img').each(function() 1060 { 1061 var thisSlideImg = $(this); 1062 //thisSlideImg.slick(); 1063 if(thisSlideImg.find('iframe').length > 0) 1064 { 1065 1066 //thisSlideImg.find('iframe').css({"position":"absolute","top":"0px","left":"0px","display":"block"}) 1067 thisSlideImg.find('iframe').css({"display":"inline-block"}) 1068 1069 //thisSlideImg.find('iframe').css({"position":"absolute","centre":"both","float":"left","display":"block"}) 1070 1071 //var thisSlideIframeHalfHeight = ( ( thisSlideImg.find('iframe').height() ) / 2 ) * -1; 1072 //thisSlideImg.find('iframe').css('margin-top', thisSlideIframeHalfHeight+'px'); 1073 //thisSlideImg.append('<style>.ewd-ulb-slide-img:before{height:0%;}</style>'); // To remove the height above the videos 1074 } 1075 }); 1076 1077 //$('.ewd-ulb-slide-container').slick(); 1078 1079}); 1080 1081 1082
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.