dashboard-review-ask.js
4 years ago
ewd-us-admin.js
3 years ago
ewd-us-blocks.js
3 years ago
ewd-us-helper-install-notice.js
4 years ago
ewd-us-welcome-screen.js
4 years ago
ewd-us.js
4 years ago
jquery.iframetracker.js
4 years ago
plugin-deactivation.js
1 month ago
ultimate-lightbox.js
4 years ago
ultimate-lightbox.js
596 lines
| 1 | /* Simple JavaScript Inheritance |
| 2 | * By John Resig http://ejohn.org/ |
| 3 | * MIT Licensed. |
| 4 | */ |
| 5 | // Inspired by base2 and Prototype |
| 6 | (function(){ |
| 7 | var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; |
| 8 | |
| 9 | // The base Class implementation (does nothing) |
| 10 | this.Class = function(){}; |
| 11 | |
| 12 | // Create a new Class that inherits from this class |
| 13 | Class.extend = function(prop) { |
| 14 | var _super = this.prototype; |
| 15 | |
| 16 | // Instantiate a base class (but only create the instance, |
| 17 | // don’t run the init constructor) |
| 18 | initializing = true; |
| 19 | var prototype = new this(); |
| 20 | initializing = false; |
| 21 | |
| 22 | // Copy the properties over onto the new prototype |
| 23 | for (var name in prop) { |
| 24 | // Check if we’re overwriting an existing function |
| 25 | prototype[name] = typeof prop[name] == "function" && |
| 26 | typeof _super[name] == "function" && fnTest.test(prop[name]) ? |
| 27 | (function(name, fn){ |
| 28 | return function() { |
| 29 | var tmp = this._super; |
| 30 | |
| 31 | // Add a new ._super() method that is the same method |
| 32 | // but on the super-class |
| 33 | this._super = _super[name]; |
| 34 | |
| 35 | // The method only need to be bound temporarily, so we |
| 36 | // remove it when we’re done executing |
| 37 | var ret = fn.apply(this, arguments); |
| 38 | this._super = tmp; |
| 39 | |
| 40 | return ret; |
| 41 | }; |
| 42 | })(name, prop[name]) : |
| 43 | prop[name]; |
| 44 | } |
| 45 | |
| 46 | // The dummy class constructor |
| 47 | function Class() { |
| 48 | // All construction is actually done in the init method |
| 49 | if ( !initializing && this.init ) |
| 50 | this.init.apply(this, arguments); |
| 51 | } |
| 52 | |
| 53 | // Populate our constructed prototype object |
| 54 | Class.prototype = prototype; |
| 55 | |
| 56 | // Enforce the constructor to be what we expect |
| 57 | Class.prototype.constructor = Class; |
| 58 | |
| 59 | // And make this class extendable |
| 60 | Class.extend = arguments.callee; |
| 61 | |
| 62 | return Class; |
| 63 | }; |
| 64 | })(); |
| 65 | |
| 66 | var lightbox; |
| 67 | |
| 68 | var defaults = { |
| 69 | |
| 70 | transition_class: 'ewd-ulb-horizontal-slide', |
| 71 | |
| 72 | speed: 600, |
| 73 | height: '100%', |
| 74 | width: '100%', |
| 75 | |
| 76 | closable: true, |
| 77 | loop: true, |
| 78 | keyboard_controls: true, |
| 79 | |
| 80 | show_thumbnails: 'bottom', |
| 81 | |
| 82 | hideElements: ['description', 'thumbnails'], |
| 83 | |
| 84 | autoplay: false, |
| 85 | autoplayInterval: 4000, |
| 86 | |
| 87 | zoomLevel: 0, |
| 88 | fullsize: false, |
| 89 | |
| 90 | ulb_arrow: 'a', |
| 91 | ulb_icon_set: 'a', |
| 92 | |
| 93 | controls: {'top_right_controls': ['exit'], |
| 94 | 'top_left_controls': ['autoplay', 'zoom', 'zoom_out', 'download', 'fullscreen'], |
| 95 | 'bottom_right_controls': ['slide_counter'], |
| 96 | 'bottom_left_controls': []} |
| 97 | }; |
| 98 | |
| 99 | var EWD_ULB_LightboxSlide = Class.extend({ |
| 100 | init: function(element, length) { |
| 101 | this.element = element; |
| 102 | this.source = jQuery(element).data("ulbsource"); |
| 103 | this.title = jQuery(element).data("ulbtitle"); |
| 104 | this.description = jQuery(element).data("ulbdescription"); |
| 105 | this.gallery = jQuery(element).data("ulbGallery"); |
| 106 | |
| 107 | if (this.source) { |
| 108 | var youtube = this.source.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i); |
| 109 | if (youtube) { |
| 110 | this.video = "youtube"; |
| 111 | this.source = this.source.replace("watch?v=", "embed/"); |
| 112 | } |
| 113 | else { |
| 114 | this.video = false; |
| 115 | } |
| 116 | } |
| 117 | else { |
| 118 | this.video = false; |
| 119 | } |
| 120 | |
| 121 | if (jQuery(element).data("ulbheight")) {this.height = jQuery(element).data("ulbheight");} |
| 122 | else {this.height = 315;} |
| 123 | if (jQuery(element).data("ulbwidth")) {this.width = jQuery(element).data("ulbwidth");} |
| 124 | else {this.width = 560;} |
| 125 | } |
| 126 | }); |
| 127 | |
| 128 | var UltimateLightbox = Class.extend({ |
| 129 | init: function(options) { |
| 130 | this.settings = jQuery.extend({}, defaults, options); |
| 131 | |
| 132 | this.displaying = false; |
| 133 | |
| 134 | var elements = []; |
| 135 | jQuery('.ewd-ulb-lightbox, .ewd-ulb-lightbox-noclick-image').each(function(index, value) { |
| 136 | var Slide = new EWD_ULB_LightboxSlide(this, elements.length); |
| 137 | jQuery(this).data('slideIndex', elements.length); |
| 138 | elements.push(Slide); |
| 139 | }); |
| 140 | this.elements = elements; |
| 141 | |
| 142 | this.currentSlide = 0; |
| 143 | |
| 144 | this.maxSlide = this.elements.length - 1; |
| 145 | |
| 146 | this.setMobileClasses(); |
| 147 | }, |
| 148 | |
| 149 | setMobileClasses: function() { |
| 150 | if (jQuery.inArray('description', this.settings.hideElements) !== -1) {this.settings.descriptionClass = 'ewd-ulb-mobile-hide';} |
| 151 | else {this.settings.descriptionClass = '';} |
| 152 | if (jQuery.inArray('title', this.settings.hideElements) !== -1) {this.settings.titleClass = 'ewd-ulb-mobile-hide';} |
| 153 | else {this.settings.titleClass = '';} |
| 154 | if (jQuery.inArray('thumbnails', this.settings.hideElements) !== -1) {this.settings.thumbnailsClass = 'ewd-ulb-mobile-hide';} |
| 155 | else {this.settings.thumbnailsClass = '';} |
| 156 | |
| 157 | if (this.settings.descriptionClass == 'ewd-ulb-mobile-hide' && this.settings.titleClass == 'ewd-ulb-mobile-hide') {this.settings.overlayClass = 'ewd-ulb-mobile-hide';} |
| 158 | else {this.settings.overlayClass = '';} |
| 159 | }, |
| 160 | |
| 161 | setCurrentSlide: function(targetElement) { |
| 162 | jQuery(this.elements).each(function(index, element) { |
| 163 | if (element.source == jQuery(targetElement).data('ulbsource')) {lightbox.currentSlide = index;} |
| 164 | }) |
| 165 | }, |
| 166 | |
| 167 | toggle: function() { |
| 168 | if (this.displaying) {this.closeLightbox();} |
| 169 | else {this.openLightbox();} |
| 170 | }, |
| 171 | |
| 172 | closeLightbox: function() { |
| 173 | this.displaying = false; |
| 174 | jQuery('.ewd-ulb-background').css('display', 'none'); |
| 175 | jQuery('.ewd-ulb-lightbox-container').css('display', 'none'); |
| 176 | this.switchSlide(); |
| 177 | jQuery('.ewd-ulb-active-slide').removeClass('ewd-ulb-active-slide'); |
| 178 | jQuery('.ewd-ulb-active-thumbnail').removeClass('ewd-ulb-active-thumbnail'); |
| 179 | }, |
| 180 | |
| 181 | openLightbox: function () { |
| 182 | this.displaying = true; |
| 183 | jQuery('.ewd-ulb-background').css('display', 'inline'); |
| 184 | jQuery('.ewd-ulb-lightbox-container').css('display', 'inline'); |
| 185 | if (this.settings.autoplay) {this.startAutoplay();} |
| 186 | this.switchSlide(); |
| 187 | this.selectThumbnails(); |
| 188 | lightbox.noZoom(); |
| 189 | }, |
| 190 | |
| 191 | nextSlide: function() { |
| 192 | var oldSlide = this.currentSlide; |
| 193 | do { |
| 194 | if (this.currentSlide == this.maxSlide) {this.currentSlide = 0;} |
| 195 | else {this.currentSlide = this.currentSlide + 1;} |
| 196 | } |
| 197 | while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); |
| 198 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-next'); |
| 199 | this.switchSlide(oldSlide); |
| 200 | }, |
| 201 | |
| 202 | previousSlide: function() { |
| 203 | var oldSlide = this.currentSlide; |
| 204 | do { |
| 205 | if (this.currentSlide == 0) {this.currentSlide = this.maxSlide;} |
| 206 | else {this.currentSlide = this.currentSlide - 1;} |
| 207 | } |
| 208 | while (this.elements[oldSlide].gallery != this.elements[this.currentSlide].gallery); |
| 209 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-previous'); |
| 210 | this.switchSlide(oldSlide); |
| 211 | }, |
| 212 | |
| 213 | goToSlide: function(slideIndex) { |
| 214 | var oldSlide = this.currentSlide; |
| 215 | this.currentSlide = slideIndex; |
| 216 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-transition-next'); |
| 217 | this.switchSlide(oldSlide); |
| 218 | }, |
| 219 | |
| 220 | switchSlide: function(oldSlide) { |
| 221 | if (typeof oldSlide !== "undefined") { |
| 222 | jQuery(".ewd-ulb-slide-thumbnail[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-active-thumbnail'); |
| 223 | jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-image-displaying') |
| 224 | jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").addClass('ewd-ulb-old-active-slide'); |
| 225 | setTimeout(function(){ |
| 226 | jQuery(".ewd-ulb-slide[data-slideindex='" + oldSlide + "']").removeClass('ewd-ulb-active-slide ewd-ulb-old-active-slide'); |
| 227 | }, 500); |
| 228 | } |
| 229 | jQuery(".ewd-ulb-slide-thumbnail[data-slideindex='" + this.currentSlide + "']").addClass('ewd-ulb-active-thumbnail'); |
| 230 | jQuery(".ewd-ulb-slide[data-slideindex='" + this.currentSlide + "']").addClass('ewd-ulb-active-slide ewd-ulb-image-displaying'); |
| 231 | var slideNumber = this.currentSlide + 1; |
| 232 | jQuery(".ewd-ulb-current-count-indicator").each(function() {jQuery(this).html(slideNumber);}); |
| 233 | |
| 234 | setTimeout(function(){ |
| 235 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-transition-next ewd-ulb-transition-previous'); |
| 236 | }, 500); |
| 237 | |
| 238 | lightbox.resizeOverlay(); |
| 239 | lightbox.setDownloadLinks(); |
| 240 | }, |
| 241 | |
| 242 | selectThumbnails: function() { |
| 243 | var gallery = this.getCurrentGallery(); |
| 244 | |
| 245 | jQuery('.ewd-ulb-slide-thumbnail').addClass('ewd-ulb-thumbnail-hidden'); |
| 246 | jQuery('.ewd-ulb-slide-thumbnail[data-ulbGallery="' + gallery + '"]').removeClass('ewd-ulb-thumbnail-hidden'); |
| 247 | }, |
| 248 | |
| 249 | getCurrentGallery: function() { |
| 250 | var gallery = ""; |
| 251 | var currentSlide = this.currentSlide; |
| 252 | jQuery(this.elements).each(function(index, element) { |
| 253 | if (index == currentSlide) {gallery = element.gallery;} |
| 254 | }); |
| 255 | |
| 256 | return gallery; |
| 257 | }, |
| 258 | |
| 259 | resizeOverlay: function() { |
| 260 | var imgWidth = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying img").first().width(); console.log("Image width: " + imgWidth); |
| 261 | var containerWidth = jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying").first().width(); console.log("Container width: " + containerWidth); |
| 262 | var marginWidth = (containerWidth - imgWidth) / 2; |
| 263 | jQuery(".ewd-ulb-slide-overlay").css('width', jQuery(".ewd-ulb-active-slide.ewd-ulb-image-displaying img").first().width()); |
| 264 | jQuery(".ewd-ulb-slide-overlay").css('margin', '0px ' + marginWidth + 'px'); |
| 265 | }, |
| 266 | |
| 267 | toggleAutoplay: function() { |
| 268 | if (this.settings.autoplay) {this.stopAutoplay();} |
| 269 | else {this.startAutoplay();} |
| 270 | }, |
| 271 | |
| 272 | startAutoplay: function() { |
| 273 | if (this.interval) {clearInterval(this.interval);} |
| 274 | this.settings.autoplay = true; |
| 275 | this.interval = setInterval(function() { |
| 276 | lightbox.nextSlide(); |
| 277 | }, this.settings.autoplayInterval); |
| 278 | }, |
| 279 | |
| 280 | stopAutoplay: function() { |
| 281 | this.settings.autoplay = false; |
| 282 | clearInterval(this.interval); |
| 283 | }, |
| 284 | |
| 285 | ZoomOut: function() { |
| 286 | if (this.settings.zoomLevel == 2) {this.zoomOne();} |
| 287 | else if (this.settings.zoomLevel == 1) {this.noZoom();} |
| 288 | |
| 289 | this.removeFullSize(); |
| 290 | }, |
| 291 | |
| 292 | toggleZoom: function() { |
| 293 | if (this.settings.zoomLevel == 0) {this.zoomOne();} |
| 294 | else if (this.settings.zoomLevel == 1) {this.zoomTwo();} |
| 295 | else {this.noZoom();} |
| 296 | |
| 297 | this.removeFullSize(); |
| 298 | }, |
| 299 | |
| 300 | zoomOne: function() { |
| 301 | this.settings.zoomLevel = 1; |
| 302 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-zoom-one'); |
| 303 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-two'); |
| 304 | }, |
| 305 | |
| 306 | zoomTwo: function() { |
| 307 | this.settings.zoomLevel = 2; |
| 308 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-one'); |
| 309 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-zoom-two'); |
| 310 | }, |
| 311 | |
| 312 | noZoom: function() { |
| 313 | this.settings.zoomLevel = 0; |
| 314 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-one'); |
| 315 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-zoom-two'); |
| 316 | }, |
| 317 | |
| 318 | fullscreen: function() { |
| 319 | if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { |
| 320 | jQuery('ewd-ulb-fullscreen').addClass('ewd-ulb-regular_screen'); |
| 321 | if (document.documentElement.requestFullscreen) { |
| 322 | document.documentElement.requestFullscreen(); |
| 323 | } else if (document.documentElement.msRequestFullscreen) { |
| 324 | document.documentElement.msRequestFullscreen(); |
| 325 | } else if (document.documentElement.mozRequestFullScreen) { |
| 326 | document.documentElement.mozRequestFullScreen(); |
| 327 | } else if (document.documentElement.webkitRequestFullscreen) { |
| 328 | document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); |
| 329 | } |
| 330 | } else { |
| 331 | jQuery('ewd-ulb-fullscreen').removeClass('ewd-ulb-regular_screen'); |
| 332 | if (document.exitFullscreen) { |
| 333 | document.exitFullscreen(); |
| 334 | } else if (document.msExitFullscreen) { |
| 335 | document.msExitFullscreen(); |
| 336 | } else if (document.mozCancelFullScreen) { |
| 337 | document.mozCancelFullScreen(); |
| 338 | } else if (document.webkitExitFullscreen) { |
| 339 | document.webkitExitFullscreen(); |
| 340 | } |
| 341 | } |
| 342 | }, |
| 343 | |
| 344 | toggleFullSize: function() { |
| 345 | this.noZoom(); |
| 346 | if (this.settings.fullsize) {this.removeFullSize();} |
| 347 | else {this.goFullSize();} |
| 348 | }, |
| 349 | |
| 350 | goFullSize: function() { |
| 351 | jQuery('.ewd-ulb-slide').addClass('ewd-ulb-fullsize-image'); |
| 352 | this.settings.fullsize = true; |
| 353 | }, |
| 354 | |
| 355 | removeFullSize: function() { |
| 356 | jQuery('.ewd-ulb-slide').removeClass('ewd-ulb-fullsize-image'); |
| 357 | this.settings.fullsize = false; |
| 358 | }, |
| 359 | |
| 360 | setDownloadLinks: function() { |
| 361 | jQuery('.ewd-ulb-download-link').attr('href', jQuery('.ewd-ulb-active-slide div img').attr('src')); |
| 362 | }, |
| 363 | }); |
| 364 | |
| 365 | jQuery(document).ready(function() { |
| 366 | if (typeof ewd_ulb_php_data == "undefined") {ewd_ulb_php_data = [];} |
| 367 | lightbox = new UltimateLightbox(ewd_ulb_php_data); |
| 368 | |
| 369 | jQuery('.ewd-ulb-lightbox, .ewd-ulb-open-lightbox').on('click', function(event) { |
| 370 | if (jQuery(event.currentTarget).hasClass('ewd-ulb-lightbox')) {lightbox.currentSlide = jQuery(event.currentTarget).data('slideIndex');} |
| 371 | else {lightbox.setCurrentSlide(event.currentTarget);} |
| 372 | lightbox.toggle(); |
| 373 | event.preventDefault(); |
| 374 | }); |
| 375 | |
| 376 | if (jQuery('.ewd-ulb-lightbox, .ewd-ulb-lightbox-noclick-image').length) { |
| 377 | EWD_ULB_Add_Lightbox_HTML(lightbox); |
| 378 | EWD_ULB_Add_Lightbox_Custom_CSS(); |
| 379 | |
| 380 | jQuery('.ewd-ulb-slide-container').on('click.background', function(event) { |
| 381 | if (event.toElement.nodeName == "IMG" || ewd_ulb_php_data.background_close == "false") {return;} |
| 382 | lightbox.toggle(); |
| 383 | }); |
| 384 | |
| 385 | jQuery('.ewd-ulb-slide-control-next').on('click.next', function() { |
| 386 | lightbox.noZoom(); |
| 387 | lightbox.stopAutoplay(); |
| 388 | lightbox.nextSlide(); |
| 389 | }); |
| 390 | jQuery('.ewd-ulb-slide-control-previous').on('click.prev', function() { |
| 391 | lightbox.noZoom(); |
| 392 | lightbox.stopAutoplay(); |
| 393 | lightbox.previousSlide(); |
| 394 | }); |
| 395 | |
| 396 | jQuery('.ewd-ulb-slide-thumbnail').on('click.thumbnail', function() { |
| 397 | var slideIndex = jQuery(this).data("slideindex"); |
| 398 | lightbox.noZoom(); |
| 399 | lightbox.stopAutoplay(); |
| 400 | lightbox.goToSlide(slideIndex); |
| 401 | }); |
| 402 | |
| 403 | jQuery(window).on('resize', function() { |
| 404 | lightbox.resizeOverlay() |
| 405 | }); |
| 406 | |
| 407 | jQuery('.ewd-ulb-exit').on('click.exit', function() { |
| 408 | lightbox.toggle(); |
| 409 | }); |
| 410 | jQuery('.ewd-ulb-autoplay').on('click.autoplay', function() { |
| 411 | lightbox.toggleAutoplay(); |
| 412 | }); |
| 413 | jQuery('.ewd-ulb-zoom').on('click.zoom', function() { |
| 414 | lightbox.toggleZoom(); |
| 415 | }); |
| 416 | jQuery('.ewd-ulb-zoom_out').on('click.zoom_out', function() { |
| 417 | lightbox.ZoomOut(); |
| 418 | }); |
| 419 | jQuery('.ewd-ulb-fullsize').on('click.fullsize', function() { |
| 420 | lightbox.toggleFullSize(); |
| 421 | }); |
| 422 | jQuery('.ewd-ulb-fullscreen').on('click.zoom_out', function() { |
| 423 | lightbox.fullscreen(); |
| 424 | }); |
| 425 | jQuery('.ewd-ulb-download').wrap('<a class="ewd-ulb-download-link" href="empty.png" download></a>'); |
| 426 | |
| 427 | if (lightbox.settings.keyboard_controls) { |
| 428 | jQuery(document).on('keyup', function(e) { |
| 429 | if (e.which == 27) {lightbox.closeLightbox();} |
| 430 | if (e.which == 37) { |
| 431 | lightbox.noZoom(); |
| 432 | lightbox.stopAutoplay(); |
| 433 | lightbox.previousSlide(); |
| 434 | } |
| 435 | if (e.which == 39) { |
| 436 | lightbox.noZoom(); |
| 437 | lightbox.stopAutoplay(); |
| 438 | lightbox.nextSlide(); |
| 439 | } |
| 440 | }); |
| 441 | } |
| 442 | } |
| 443 | }); |
| 444 | |
| 445 | function EWD_ULB_Add_Lightbox_HTML(lightbox) { |
| 446 | var Top_Toolbar_HTML = '<div class="ewd-ulb-top-toolbar">'; |
| 447 | Top_Toolbar_HTML += '<div class="ewd-ulb-left-top-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.top_left_controls, lightbox.maxSlide) + '</div>'; |
| 448 | Top_Toolbar_HTML += '<div class="ewd-ulb-right-top-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.top_right_controls, lightbox.maxSlide) + '</div>'; |
| 449 | Top_Toolbar_HTML += '</div>'; |
| 450 | |
| 451 | var Top_Thumbnail_Bar_HTML = '<div class="ewd-ulb-top-thumbnail-bar ' + lightbox.settings.thumbnailsClass + '">'; |
| 452 | Top_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-left">a</div>'; |
| 453 | Top_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-right">b</div>'; |
| 454 | Top_Thumbnail_Bar_HTML += '<div class="ewd-ulb-top-thumbnails">'; |
| 455 | if (lightbox.settings.show_thumbnails == "top") {Top_Thumbnail_Bar_HTML += EWD_ULB_Thumbnails_HTML(lightbox.elements);} |
| 456 | Top_Thumbnail_Bar_HTML += '</div>'; |
| 457 | Top_Thumbnail_Bar_HTML += '</div>'; |
| 458 | |
| 459 | var Slide_Area_HTML = '<div class="ewd-ulb-slide-area">'; |
| 460 | Slide_Area_HTML += '<div class="ewd-ulb-slide-control ewd-ulb-slide-control-previous ewd-ulb-arrow">' + lightbox.settings.ulb_arrow + '</div>'; |
| 461 | Slide_Area_HTML += '<div class="ewd-ulb-slide-container">'; |
| 462 | jQuery(lightbox.elements).each(function(index, value){ |
| 463 | Slide_Area_HTML += '<div class="ewd-ulb-slide ' + lightbox.settings.transition_class + '" data-slideindex="' + index + '">'; |
| 464 | Slide_Area_HTML += '<div class="ewd-ulb-slide-img">'; |
| 465 | if (this.video == "youtube") { |
| 466 | Slide_Area_HTML += '<iframe width="' + this.width + '" height="' + this.height + '" src="' + this.source + '" frameborder="0" allowfullscreen></iframe>' |
| 467 | } |
| 468 | else { |
| 469 | Slide_Area_HTML += '<img src="' + this.source + '" />'; |
| 470 | } |
| 471 | Slide_Area_HTML += '</div>'; |
| 472 | if ((this.title != undefined && this.title != "") || (this.description != undefined && this.description != "")) { |
| 473 | Slide_Area_HTML += '<div class="ewd-ulb-slide-overlay ' + lightbox.settings.overlayClass + '">'; |
| 474 | if (this.title != undefined && this.title != "") {Slide_Area_HTML += '<div class="ewd-ulb-slide-title ' + lightbox.settings.titleClass + '">' + this.title + '</div>';} |
| 475 | if (this.description != undefined && this.description != "") {Slide_Area_HTML += '<div class="ewd-ulb-slide-description ' + lightbox.settings.descriptionClass + '">' + this.description + '</div>';} |
| 476 | Slide_Area_HTML += '</div>'; |
| 477 | } |
| 478 | Slide_Area_HTML += '</div>'; |
| 479 | }); |
| 480 | Slide_Area_HTML += '</div>'; |
| 481 | 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>'; |
| 482 | Slide_Area_HTML += '</div>'; |
| 483 | |
| 484 | var Botton_Thumbnail_Bar_HTML = '<div class="ewd-ulb-bottom-thumbnail-bar ' + lightbox.settings.thumbnailsClass + '">'; |
| 485 | Botton_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-left">a</div>'; |
| 486 | Botton_Thumbnail_Bar_HTML += '<div class="ewd-thumbnail-scroll-button ewd-thumbnail-scroll-button-right">b</div>'; |
| 487 | Botton_Thumbnail_Bar_HTML += '<div class="ewd-ulb-bottom-thumbnails"><div class="ewd-ulb-thumbnails-inside">'; |
| 488 | if (lightbox.settings.show_thumbnails == "bottom") {Botton_Thumbnail_Bar_HTML += EWD_ULB_Thumbnails_HTML(lightbox.elements);} |
| 489 | Botton_Thumbnail_Bar_HTML += '</div></div>'; |
| 490 | Botton_Thumbnail_Bar_HTML += '</div>'; |
| 491 | |
| 492 | var Bottom_Toolbar_HTML = '<div class="ewd-ulb-bottom-toolbar">'; |
| 493 | Bottom_Toolbar_HTML += '<div class="ewd-ulb-left-bottom-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.bottom_left_controls, lightbox.maxSlide) + '</div>'; |
| 494 | Bottom_Toolbar_HTML += '<div class="ewd-ulb-right-bottom-toolbar">' + EWD_ULB_Add_Controls(lightbox.settings.controls.bottom_right_controls, lightbox.maxSlide) + '</div>'; |
| 495 | Bottom_Toolbar_HTML += '</div>'; |
| 496 | |
| 497 | var HTML = '<div class="ewd-ulb-background" style="display:none;width:' + lightbox.settings.width + ';height:' + lightbox.settings.height + '"></div>'; |
| 498 | HTML += '<div class="ewd-ulb-lightbox-container ewd-ulb-thumbnails-' + lightbox.settings.show_thumbnails + '" style="display:none;">'; |
| 499 | HTML += Top_Toolbar_HTML; |
| 500 | HTML += Top_Thumbnail_Bar_HTML; |
| 501 | HTML += Slide_Area_HTML; |
| 502 | HTML += Botton_Thumbnail_Bar_HTML; |
| 503 | HTML += Bottom_Toolbar_HTML; |
| 504 | HTML += "</div>"; |
| 505 | |
| 506 | jQuery('body').append(HTML); |
| 507 | } |
| 508 | |
| 509 | function EWD_ULB_Thumbnails_HTML(slides) { |
| 510 | var Slide_HTML = ''; |
| 511 | jQuery(slides).each(function(index, value) { |
| 512 | Slide_HTML += '<div class="ewd-ulb-slide-thumbnail" data-slideindex="' + index + '" data-ulbGallery="' + this.gallery + '">'; |
| 513 | if (this.video == "youtube") {Slide_HTML += '<img src="http://img.youtube.com/vi/' + /[^/]*$/.exec(this.source)[0] + '/default.jpg" />';} |
| 514 | else {Slide_HTML += '<img src="' + this.source + '" />';} |
| 515 | Slide_HTML += '</div>'; |
| 516 | }); |
| 517 | |
| 518 | return Slide_HTML; |
| 519 | } |
| 520 | |
| 521 | function EWD_ULB_Add_Controls(controls, maxSlide) { |
| 522 | var Controls_HTML = ''; |
| 523 | jQuery(controls).each(function() { |
| 524 | 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>';} |
| 525 | else {Controls_HTML += '<div class="ewd-ulb-control ewd-ulb-' + this + '">' + lightbox.settings.ulb_icon_set + '</div>';} |
| 526 | }); |
| 527 | |
| 528 | return Controls_HTML; |
| 529 | } |
| 530 | |
| 531 | function EWD_ULB_Add_Lightbox_Custom_CSS() { |
| 532 | var data = '&action=ulb_get_custom_css'; |
| 533 | jQuery.post(ajaxurl, data, function(response) { |
| 534 | jQuery('body').append(response); |
| 535 | }); |
| 536 | } |
| 537 | |
| 538 | |
| 539 | /**************************************** |
| 540 | THUMBNAIL SCROLLING |
| 541 | ****************************************/ |
| 542 | jQuery(document).ready(function($){ |
| 543 | $('.ewd-ulb-bottom-thumbnail-bar').each(function(){ |
| 544 | var thisThumbBar = $(this); |
| 545 | var numberOfThumbs = thisThumbBar.find('.ewd-ulb-slide-thumbnail').length; |
| 546 | var widthOfThumbsInside = numberOfThumbs * 144; |
| 547 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('width', widthOfThumbsInside+'px'); |
| 548 | thisThumbBar.find('.ewd-thumbnail-scroll-button-right').click(function(){ |
| 549 | var widthOfThumbs = thisThumbBar.find('.ewd-ulb-bottom-thumbnails').width(); |
| 550 | if(widthOfThumbs >= widthOfThumbsInside){ |
| 551 | var rightClickStop = 0; |
| 552 | } |
| 553 | else{ |
| 554 | var rightClickStop = widthOfThumbs - 576; |
| 555 | } |
| 556 | var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; |
| 557 | if(thumbsInsideLeft != rightClickStop){ |
| 558 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '-=144'); |
| 559 | } |
| 560 | }); |
| 561 | thisThumbBar.find('.ewd-thumbnail-scroll-button-left').click(function(){ |
| 562 | var leftClickStop = 0; |
| 563 | var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; |
| 564 | if(thumbsInsideLeft != leftClickStop){ |
| 565 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '+=144'); |
| 566 | } |
| 567 | }); |
| 568 | }); |
| 569 | $('.ewd-ulb-top-thumbnail-bar').each(function(){ |
| 570 | var thisThumbBar = $(this); |
| 571 | var numberOfThumbs = thisThumbBar.find('.ewd-ulb-slide-thumbnail').length; |
| 572 | var widthOfThumbsInside = numberOfThumbs * 144; |
| 573 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('width', widthOfThumbsInside+'px'); |
| 574 | thisThumbBar.find('.ewd-thumbnail-scroll-button-right').click(function(){ |
| 575 | var widthOfThumbs = thisThumbBar.find('.ewd-ulb-top-thumbnails').width(); |
| 576 | if(widthOfThumbs >= widthOfThumbsInside){ |
| 577 | var rightClickStop = 0; |
| 578 | } |
| 579 | else{ |
| 580 | var rightClickStop = widthOfThumbs - 576; |
| 581 | } |
| 582 | var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; |
| 583 | if(thumbsInsideLeft != rightClickStop){ |
| 584 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '-=144'); |
| 585 | } |
| 586 | }); |
| 587 | thisThumbBar.find('.ewd-thumbnail-scroll-button-left').click(function(){ |
| 588 | var leftClickStop = 0; |
| 589 | var thumbsInsideLeft = thisThumbBar.find('.ewd-ulb-thumbnails-inside').position().left; |
| 590 | if(thumbsInsideLeft != leftClickStop){ |
| 591 | thisThumbBar.find('.ewd-ulb-thumbnails-inside').css('left', '+=144'); |
| 592 | } |
| 593 | }); |
| 594 | }); |
| 595 | }); |
| 596 |