1/*! 2 Colorbox v1.5.10 - 2014-06-26 3 jQuery lightbox and modal window plugin 4 (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox 5 license: http://www.opensource.org/licenses/mit-license.php 6*/ 7 8jQuery.each(hugeit_lightbox_obj, function(index, value) { 9 if(value.indexOf('true')>-1 || value.indexOf('false')>-1) 10 hugeit_lightbox_obj[index] = value == "true"; 11}); 12jQuery.each(hugeit_gen_lightbox_obj, function(index, value) { 13 if(value.indexOf('true')>-1 || value.indexOf('false')>-1) 14 hugeit_gen_lightbox_obj[index] = value == "true"; 15}); 16 17var maxWidth = jQuery(window).width(); 18if(maxWidth > hugeit_lightbox_obj.hugeit_lightbox_maxwidth){ 19 maxWidth = hugeit_lightbox_obj.hugeit_lightbox_maxwidth; 20} 21if(hugeit_lightbox_obj.hugeit_lightbox_sizeFix == 'true'){ 22 hugeit_lightbox_obj.hugeit_lightbox_maxwidth = '100%'; 23 hugeit_lightbox_obj.hugeit_lightbox_maxheight = '100%'; 24} 25else{ 26 hugeit_lightbox_obj.hugeit_lightbox_maxwidth = maxWidth; 27} 28 29(function ($, document, window) { 30 var 31 // Default settings object. 32 defaults = { 33 // data sources 34 html: hugeit_lightbox_obj.hugeit_lightbox_html, 35 photo: hugeit_lightbox_obj.hugeit_lightbox_photo, 36 iframe: false, 37 inline: false, 38 39 // behavior and appearance 40 transition: hugeit_gen_lightbox_obj.hugeit_lightbox_transition, 41 speed: hugeit_gen_lightbox_obj.hugeit_lightbox_speed, 42 fadeOut: hugeit_gen_lightbox_obj.hugeit_lightbox_fadeout, 43 width: hugeit_lightbox_obj.hugeit_lightbox_width, 44 initialWidth: hugeit_lightbox_obj.hugeit_lightbox_initialwidth, 45 innerWidth: hugeit_lightbox_obj.hugeit_lightbox_innerwidth, 46 maxWidth: hugeit_lightbox_obj.hugeit_lightbox_maxwidth, 47 height: hugeit_lightbox_obj.hugeit_lightbox_height, 48 initialHeight: hugeit_lightbox_obj.hugeit_lightbox_initialheight, 49 innerHeight: hugeit_lightbox_obj.hugeit_lightbox_innerheight, 50 maxHeight: hugeit_lightbox_obj.hugeit_lightbox_maxheight, 51 scalePhotos: true, 52 scrolling: hugeit_lightbox_obj.hugeit_lightbox_scrolling, 53 opacity: hugeit_lightbox_obj.hugeit_lightbox_opacity, 54 preloading: true, 55 className: false, 56 overlayClose: hugeit_lightbox_obj.hugeit_lightbox_overlayclose, 57 escKey: hugeit_lightbox_obj.hugeit_lightbox_esckey, 58 arrowKey: hugeit_lightbox_obj.hugeit_lightbox_arrowkey, 59 top: hugeit_lightbox_obj.hugeit_lightbox_top, 60 bottom: hugeit_lightbox_obj.hugeit_lightbox_bottom, 61 left: hugeit_lightbox_obj.hugeit_lightbox_left, 62 right: hugeit_lightbox_obj.hugeit_lightbox_right, 63 fixed: hugeit_lightbox_obj.hugeit_lightbox_fixed, 64 data: undefined, 65 closeButton: hugeit_lightbox_obj.hugeit_lightbox_closebutton, 66 fastIframe: hugeit_lightbox_obj.hugeit_lightbox_fastiframe, 67 open: hugeit_lightbox_obj.hugeit_lightbox_open, 68 reposition: hugeit_lightbox_obj.hugeit_lightbox_reposition, 69 loop: hugeit_lightbox_obj.hugeit_lightbox_loop, 70 slideshow: hugeit_lightbox_obj.hugeit_lightbox_slideshow, 71 slideshowAuto: hugeit_lightbox_obj.hugeit_lightbox_slideshowauto, 72 slideshowSpeed: hugeit_lightbox_obj.hugeit_lightbox_slideshowspeed, 73 slideshowStart: hugeit_lightbox_obj.hugeit_lightbox_slideshowstart, 74 slideshowStop: hugeit_lightbox_obj.hugeit_lightbox_slideshowstop, 75 photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i, 76 77 // alternate image paths for high-res displays 78 retinaImage: hugeit_lightbox_obj.hugeit_lightbox_retinaimage, 79 retinaUrl: hugeit_lightbox_obj.hugeit_lightbox_retinaurl, 80 retinaSuffix: hugeit_lightbox_obj.hugeit_lightbox_retinasuffix, 81 82 // internationalization 83 current: "image {current} of {total}", 84 previous: hugeit_lightbox_obj.hugeit_lightbox_previous, 85 next: hugeit_lightbox_obj.hugeit_lightbox_next, 86 close: "close", 87 xhrError: "This content failed to load.", 88 imgError: "This image failed to load.", 89 90 // accessbility 91 returnFocus: hugeit_lightbox_obj.hugeit_lightbox_returnfocus, 92 trapFocus: hugeit_lightbox_obj.hugeit_lightbox_trapfocus, 93 94 // callbacks 95 onOpen: false, 96 onLoad: false, 97 onComplete: false, 98 onCleanup: false,
vendor: 24,760 bytes, lines 99-978
99 onClosed: false, 100 101 rel: function() { 102 return this.rel; 103 }, 104 href: function() { 105 // using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container') 106 return $(this).attr('href'); 107 }, 108 109 title: function() { 110 if (hugeit_lightbox_obj.hugeit_lightbox_title == true) { 111 return this.title; 112 } 113 } 114 }, 115 116 // Abstracting the HTML and event identifiers for easy rebranding 117 colorbox = 'colorbox', 118 prefix = 'cbox', 119 boxElement = prefix + 'Element', 120 121 // Events 122 event_open = prefix + '_open', 123 event_load = prefix + '_load', 124 event_complete = prefix + '_complete', 125 event_cleanup = prefix + '_cleanup', 126 event_closed = prefix + '_closed', 127 event_purge = prefix + '_purge', 128 129 // Cached jQuery Object Variables 130 $overlay, 131 $box, 132 $wrap, 133 $content, 134 $topBorder, 135 $leftBorder, 136 $rightBorder, 137 $bottomBorder, 138 $related, 139 $window, 140 $loaded, 141 $loadingBay, 142 $loadingOverlay, 143 $title, 144 $current, 145 $slideshow, 146 $next, 147 $prev, 148 $close, 149 $groupControls, 150 $events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2 151 152 // Variables for cached values or use across multiple functions 153 settings, 154 interfaceHeight, 155 interfaceWidth, 156 loadedHeight, 157 loadedWidth, 158 index, 159 photo, 160 open, 161 active, 162 closing, 163 loadingTimer, 164 publicMethod, 165 div = "div", 166 requests = 0, 167 previousCSS = {}, 168 init; 169 // **************** 170 // HELPER FUNCTIONS 171 // **************** 172 173 // Convenience function for creating new jQuery objects 174 function $tag(tag, id, css) { 175 var element = document.createElement(tag); 176 177 if (id) { 178 element.id = prefix + id; 179 } 180 181 if (css) { 182 element.style.cssText = css; 183 } 184 185 return $(element); 186 } 187 188 // Get the window height using innerHeight when available to avoid an issue with iOS 189 // http://bugs.jquery.com/ticket/6724 190 function winheight() { 191 return window.innerHeight ? window.innerHeight : $(window).height(); 192 } 193 194 function Settings(element, options) { 195 if (options !== Object(options)) { 196 options = {}; 197 } 198 199 this.cache = {}; 200 this.el = element; 201 202 this.value = function(key) { 203 var dataAttr; 204 205 if (this.cache[key] === undefined) { 206 dataAttr = $(this.el).attr('data-cbox-'+key); 207 208 if (dataAttr !== undefined) { 209 this.cache[key] = dataAttr; 210 } else if (options[key] !== undefined) { 211 this.cache[key] = options[key]; 212 } else if (defaults[key] !== undefined) { 213 this.cache[key] = defaults[key]; 214 } 215 } 216 217 return this.cache[key]; 218 }; 219 220 this.get = function(key) { 221 var value = this.value(key); 222 return $.isFunction(value) ? value.call(this.el, this) : value; 223 }; 224 } 225 226 // Determine the next and previous members in a group. 227 function getIndex(increment) { 228 var 229 max = $related.length, 230 newIndex = (index + increment) % max; 231 232 return (newIndex < 0) ? max + newIndex : newIndex; 233 } 234 235 // Convert '%' and 'px' values to integers 236 function setSize(size, dimension) { 237 return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10)); 238 } 239 240 // Checks an href to see if it is a photo. 241 // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex. 242 function isImage(settings, url) { 243 return settings.get('photo') || settings.get('photoRegex').test(url); 244 } 245 246 function retinaUrl(settings, url) { 247 return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url; 248 } 249 250 function trapFocus(e) { 251 if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) { 252 e.stopPropagation(); 253 $box.focus(); 254 } 255 } 256 257 function setClass(str) { 258 if (setClass.str !== str) { 259 $box.add($overlay).removeClass(setClass.str).addClass(str); 260 setClass.str = str; 261 } 262 } 263 264 function getRelated(rel) { 265 index = 0; 266 267 if (rel && rel !== false && rel !== 'nofollow') { 268 $related = $('.' + boxElement).filter(function () { 269 var options = $.data(this, colorbox); 270 var settings = new Settings(this, options); 271 return (settings.get('rel') === rel); 272 }); 273 index = $related.index(settings.el); 274 275 // Check direct calls to Colorbox. 276 if (index === -1) { 277 $related = $related.add(settings.el); 278 index = $related.length - 1; 279 } 280 } else { 281 $related = $(settings.el); 282 } 283 } 284 285 function trigger(event) { 286 // for external use 287 $(document).trigger(event); 288 // for internal use 289 $events.triggerHandler(event); 290 } 291 292 var slideshow = (function(){ 293 var active, 294 className = prefix + "Slideshow_", 295 click = "click." + prefix, 296 timeOut; 297 298 function clear () { 299 clearTimeout(timeOut); 300 } 301 302 function set() { 303 if (settings.get('loop') || $related[index + 1]) { 304 clear(); 305 timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed')); 306 } 307 } 308 309 function start() { 310 $slideshow 311 .html(settings.get('slideshowStop')) 312 .unbind(click) 313 .one(click, stop); 314 315 $events 316 .bind(event_complete, set) 317 .bind(event_load, clear); 318 319 $box.removeClass(className + "off").addClass(className + "on"); 320 } 321 322 function stop() { 323 clear(); 324 325 $events 326 .unbind(event_complete, set) 327 .unbind(event_load, clear); 328 329 $slideshow 330 .html(settings.get('slideshowStart')) 331 .unbind(click) 332 .one(click, function () { 333 publicMethod.next(); 334 start(); 335 }); 336 337 $box.removeClass(className + "on").addClass(className + "off"); 338 } 339 340 function reset() { 341 active = false; 342 $slideshow.hide(); 343 clear(); 344 $events 345 .unbind(event_complete, set) 346 .unbind(event_load, clear); 347 $box.removeClass(className + "off " + className + "on"); 348 } 349 350 return function(){ 351 if (active) { 352 if (!settings.get('slideshow')) { 353 $events.unbind(event_cleanup, reset); 354 reset(); 355 } 356 } else { 357 if (settings.get('slideshow') && $related[1]) { 358 active = true; 359 $events.one(event_cleanup, reset); 360 if (settings.get('slideshowAuto')) { 361 start(); 362 } else { 363 stop(); 364 } 365 $slideshow.show(); 366 } 367 } 368 }; 369 370 }()); 371 372 373 function launch(element) { 374 var options; 375 376 if (!closing) { 377 378 options = $(element).data(colorbox); 379 380 settings = new Settings(element, options); 381 382 getRelated(settings.get('rel')); 383 384 if (!open) { 385 open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. 386 387 setClass(settings.get('className')); 388 389 // Show colorbox so the sizes can be calculated in older versions of jQuery 390 $box.css({visibility:'hidden', display:'block', opacity:''}); 391 392 $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden'); 393 $content.css({width:'', height:''}).append($loaded); 394 395 // Cache values needed for size calculations 396 interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height(); 397 interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); 398 loadedHeight = $loaded.outerHeight(true); 399 loadedWidth = $loaded.outerWidth(true); 400 401 // Opens inital empty Colorbox prior to content being loaded. 402 var initialWidth = setSize(settings.get('initialWidth'), 'x'); 403 var initialHeight = setSize(settings.get('initialHeight'), 'y'); 404 var maxWidth = settings.get('maxWidth'); 405 var maxHeight = settings.get('maxHeight'); 406 407 settings.w = (maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth; 408 settings.h = (maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight; 409 410 $loaded.css({width:'', height:settings.h}); 411 publicMethod.position(); 412 413 trigger(event_open); 414 settings.get('onOpen'); 415 416 $groupControls.add($title).hide(); 417 418 $box.focus(); 419 420 if (settings.get('trapFocus')) { 421 // Confine focus to the modal 422 // Uses event capturing that is not supported in IE8- 423 if (document.addEventListener) { 424 425 document.addEventListener('focus', trapFocus, true); 426 427 $events.one(event_closed, function () { 428 document.removeEventListener('focus', trapFocus, true); 429 }); 430 } 431 } 432 433 // Return focus on closing 434 if (settings.get('returnFocus')) { 435 $events.one(event_closed, function () { 436 $(settings.el).focus(); 437 }); 438 } 439 } 440 441 $overlay.css({ 442 opacity: parseFloat(settings.get('opacity')) || '', 443 cursor: settings.get('overlayClose') ? 'pointer' : '', 444 visibility: 'visible' 445 }).show(); 446 447 if (settings.get('closeButton')) { 448 $close.html(settings.get('close')).appendTo($content); 449 } else { 450 $close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4 451 } 452 453 load(); 454 } 455 } 456 457 // Colorbox's markup needs to be added to the DOM prior to being called 458 // so that the browser will go ahead and load the CSS background images. 459 function appendHTML() { 460 if (!$box && document.body) { 461 init = false; 462 $window = $(window); 463 $box = $tag(div).attr({ 464 id: colorbox, 465 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS. 466 role: 'dialog', 467 tabindex: '-1' 468 }).hide(); 469 $overlay = $tag(div, "Overlay").hide(); 470 $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]); 471 $wrap = $tag(div, "Wrapper"); 472 $content = $tag(div, "Content").append( 473 $title = $tag(div, "Title"), 474 $current = $tag(div, "Current"), 475 $prev = $('<button type="button"/>').attr({id:prefix+'Previous'}), 476 $next = $('<button type="button"/>').attr({id:prefix+'Next'}), 477 $slideshow = $tag('button', "Slideshow"), 478 $loadingOverlay 479 ); 480 481 $close = $('<button type="button"/>').attr({id:prefix+'Close'}); 482 483 $wrap.append( // The 3x3 Grid that makes up Colorbox 484 $tag(div).append( 485 $tag(div, "TopLeft"), 486 $topBorder = $tag(div, "TopCenter"), 487 $tag(div, "TopRight") 488 ), 489 $tag(div, false, 'clear:left').append( 490 $leftBorder = $tag(div, "MiddleLeft"), 491 $content, 492 $rightBorder = $tag(div, "MiddleRight") 493 ), 494 $tag(div, false, 'clear:left').append( 495 $tag(div, "BottomLeft"), 496 $bottomBorder = $tag(div, "BottomCenter"), 497 $tag(div, "BottomRight") 498 ) 499 ).find('div div').css({'float': 'left'}); 500 501 $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;'); 502 503 $groupControls = $next.add($prev).add($current).add($slideshow); 504 505 $(document.body).append($overlay, $box.append($wrap, $loadingBay)); 506 } 507 } 508 509 // Add Colorbox's event bindings 510 function addBindings() { 511 function clickHandler(e) { 512 // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt. 513 // See: http://jacklmoore.com/notes/click-events/ 514 if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) { 515 e.preventDefault(); 516 launch(this); 517 } 518 } 519 520 if ($box) { 521 if (!init) { 522 init = true; 523 524 // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly. 525 $next.click(function () { 526 publicMethod.next(); 527 }); 528 $prev.click(function () { 529 publicMethod.prev(); 530 }); 531 $close.click(function () { 532 publicMethod.close(); 533 }); 534 $overlay.click(function () { 535 if (settings.get('overlayClose')) { 536 publicMethod.close(); 537 } 538 }); 539 540 // Key Bindings 541 $(document).bind('keydown.' + prefix, function (e) { 542 var key = e.keyCode; 543 if (open && settings.get('escKey') && key === 27) { 544 e.preventDefault(); 545 publicMethod.close(); 546 } 547 if (open && settings.get('arrowKey') && $related[1] && !e.altKey) { 548 if (key === 37) { 549 e.preventDefault(); 550 $prev.click(); 551 } else if (key === 39) { 552 e.preventDefault(); 553 $next.click(); 554 } 555 } 556 }); 557 558 if ($.isFunction($.fn.on)) { 559 // For jQuery 1.7+ 560 $(document).on('click.'+prefix, '.'+boxElement, clickHandler); 561 } else { 562 // For jQuery 1.3.x -> 1.6.x 563 // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed. 564 // This is not here for jQuery 1.9, it's here for legacy users. 565 $('.'+boxElement).live('click.'+prefix, clickHandler); 566 } 567 } 568 return true; 569 } 570 return false; 571 } 572 573 // Don't do anything if Colorbox already exists. 574 if ($[colorbox]) { 575 return; 576 } 577 578 // Append the HTML when the DOM loads 579 $(appendHTML); 580 581 582 // **************** 583 // PUBLIC FUNCTIONS 584 // Usage format: $.colorbox.close(); 585 // Usage from within an iframe: parent.jQuery.colorbox.close(); 586 // **************** 587 588 publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { 589 var settings; 590 var $obj = this; 591 592 options = options || {}; 593 594 if ($.isFunction($obj)) { // assume a call to $.colorbox 595 $obj = $('<a/>'); 596 options.open = true; 597 } else if (!$obj[0]) { // colorbox being applied to empty collection 598 return $obj; 599 } 600 601 602 if (!$obj[0]) { // colorbox being applied to empty collection 603 return $obj; 604 } 605 606 appendHTML(); 607 608 if (addBindings()) { 609 610 if (callback) { 611 options.onComplete = callback; 612 } 613 614 $obj.each(function () { 615 var old = $.data(this, colorbox) || {}; 616 $.data(this, colorbox, $.extend(old, options)); 617 }).addClass(boxElement); 618 619 settings = new Settings($obj[0], options); 620 621 if (settings.get('open')) { 622 launch($obj[0]); 623 } 624 } 625 626 return $obj; 627 }; 628 629 publicMethod.position = function (speed, loadedCallback) { 630 var 631 css, 632 top = 0, 633 left = 0, 634 offset = $box.offset(), 635 scrollTop, 636 scrollLeft; 637 638 $window.unbind('resize.' + prefix); 639 640 // remove the modal so that it doesn't influence the document width/height 641 $box.css({top: -9e4, left: -9e4}); 642 643 scrollTop = $window.scrollTop(); 644 scrollLeft = $window.scrollLeft(); 645 646 if (settings.get('fixed')) { 647 offset.top -= scrollTop; 648 offset.left -= scrollLeft; 649 $box.css({position: 'fixed'}); 650 } else { 651 top = scrollTop; 652 left = scrollLeft; 653 $box.css({position: 'absolute'}); 654 } 655 656 // keeps the top and left positions within the browser's viewport. 657 if (settings.get('right') !== false) { 658 left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0); 659 } else if (settings.get('left') !== false) { 660 left += setSize(settings.get('left'), 'x'); 661 } else { 662 left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2); 663 } 664 665 if (settings.get('bottom') !== false) { 666 top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0); 667 } else if (settings.get('top') !== false) { 668 top += setSize(settings.get('top'), 'y'); 669 } else { 670 top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2); 671 } 672 673 $box.css({top: offset.top, left: offset.left, visibility:'visible'}); 674 675 // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, 676 // but it has to be shrank down around the size of div#colorbox when it's done. If not, 677 // it can invoke an obscure IE bug when using iframes. 678 $wrap[0].style.width = $wrap[0].style.height = "9999px"; 679 680 function modalDimensions() { 681 $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px'; 682 $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px'; 683 } 684 685 css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left}; 686 687 // setting the speed to 0 if the content hasn't changed size or position 688 if (speed) { 689 var tempSpeed = 0; 690 $.each(css, function(i){ 691 if (css[i] !== previousCSS[i]) { 692 tempSpeed = speed; 693 return; 694 } 695 }); 696 speed = tempSpeed; 697 } 698 699 previousCSS = css; 700 701 if (!speed) { 702 $box.css(css); 703 } 704 705 $box.dequeue().animate(css, { 706 duration: speed || 0, 707 complete: function () { 708 modalDimensions(); 709 710 active = false; 711 712 // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. 713 $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; 714 $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; 715 716 if (settings.get('reposition')) { 717 setTimeout(function () { // small delay before binding onresize due to an IE8 bug. 718 $window.bind('resize.' + prefix, publicMethod.position); 719 }, 1); 720 } 721 722 if (loadedCallback) { 723 loadedCallback(); 724 } 725 }, 726 step: modalDimensions 727 }); 728 }; 729 730 publicMethod.resize = function (options) { 731 var scrolltop; 732 733 if (open) { 734 options = options || {}; 735 736 if (options.width) { 737 settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; 738 } 739 740 if (options.innerWidth) { 741 settings.w = setSize(options.innerWidth, 'x'); 742 } 743 744 $loaded.css({width: settings.w}); 745 746 if (options.height) { 747 settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; 748 } 749 750 if (options.innerHeight) { 751 settings.h = setSize(options.innerHeight, 'y'); 752 } 753 754 if (!options.innerHeight && !options.height) { 755 scrolltop = $loaded.scrollTop(); 756 $loaded.css({height: "auto"}); 757 settings.h = $loaded.height(); 758 } 759 760 $loaded.css({height: settings.h}); 761 762 if(scrolltop) { 763 $loaded.scrollTop(scrolltop); 764 } 765 766 publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed')); 767 } 768 }; 769 770 publicMethod.prep = function (object) { 771 if (!open) { 772 return; 773 } 774 775 var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed'); 776 777 $loaded.remove(); 778 779 $loaded = $tag(div, 'LoadedContent').append(object); 780 781 function getWidth() { 782 settings.w = settings.w || $loaded.width(); 783 settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; 784 return settings.w; 785 } 786 function getHeight() { 787 settings.h = settings.h || $loaded.height(); 788 settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; 789 return settings.h; 790 } 791 792 $loaded.hide() 793 .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. 794 .css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'}) 795 .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. 796 .prependTo($content); 797 798 $loadingBay.hide(); 799 800 // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. 801 802 $(photo).css({'float': 'none'}); 803 804 setClass(settings.get('className')); 805 806 callback = function () { 807 var total = $related.length, 808 iframe, 809 complete; 810 811 if (!open) { 812 return; 813 } 814 815 function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2 816 if ($.support.opacity === false) { 817 $box[0].style.removeAttribute('filter'); 818 } 819 } 820 821 complete = function () { 822 clearTimeout(loadingTimer); 823 $loadingOverlay.hide(); 824 trigger(event_complete); 825 settings.get('onComplete'); 826 }; 827 828 829 $title.html(settings.get('title')).show(); 830 $loaded.show(); 831 832 if (total > 1) { // handle grouping 833 if (typeof settings.get('current') === "string") { 834 $current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show(); 835 } 836 837 $next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next')); 838 $prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous')); 839 840 slideshow(); 841 842 // Preloads images within a rel group 843 if (settings.get('preloading')) { 844 $.each([getIndex(-1), getIndex(1)], function(){ 845 var img, 846 i = $related[this], 847 settings = new Settings(i, $.data(i, colorbox)), 848 src = settings.get('href'); 849 850 if (src && isImage(settings, src)) { 851 src = retinaUrl(settings, src); 852 img = document.createElement('img'); 853 img.src = src; 854 } 855 }); 856 } 857 } else { 858 $groupControls.hide(); 859 } 860 861 if (settings.get('iframe')) { 862 iframe = document.createElement('iframe'); 863 864 if ('frameBorder' in iframe) { 865 iframe.frameBorder = 0; 866 } 867 868 if ('allowTransparency' in iframe) { 869 iframe.allowTransparency = "true"; 870 } 871 872 if (!settings.get('scrolling')) { 873 iframe.scrolling = "no"; 874 } 875 876 $(iframe) 877 .attr({ 878 src: settings.get('href'), 879 name: (new Date()).getTime(), // give the iframe a unique name to prevent caching 880 'class': prefix + 'Iframe', 881 allowFullScreen : true // allow HTML5 video to go fullscreen 882 }) 883 .one('load', complete) 884 .appendTo($loaded); 885 886 $events.one(event_purge, function () { 887 iframe.src = "//about:blank"; 888 }); 889 890 if (settings.get('fastIframe')) { 891 $(iframe).trigger('load'); 892 } 893 } else { 894 complete(); 895 } 896 897 if (settings.get('transition') === 'fade') { 898 $box.fadeTo(speed, 1, removeFilter); 899 } else { 900 removeFilter(); 901 } 902 }; 903 904 if (settings.get('transition') === 'fade') { 905 $box.fadeTo(speed, 0, function () { 906 publicMethod.position(0, callback); 907 }); 908 } else { 909 publicMethod.position(speed, callback); 910 } 911 }; 912 913 function load () { 914 var href, setResize, prep = publicMethod.prep, $inline, request = ++requests; 915 916 active = true; 917 918 photo = false; 919 920 trigger(event_purge); 921 trigger(event_load); 922 settings.get('onLoad'); 923 924 settings.h = settings.get('height') ? 925 setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight : 926 settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y'); 927 928 settings.w = settings.get('width') ? 929 setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth : 930 settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x'); 931 932 // Sets the minimum dimensions for use in image scaling 933 settings.mw = settings.w; 934 settings.mh = settings.h; 935 936 // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. 937 // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. 938 if (settings.get('maxWidth')) { 939 settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth; 940 settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; 941 } 942 if (settings.get('maxHeight')) { 943 settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight; 944 settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; 945 } 946 947 href = settings.get('href'); 948 949 loadingTimer = setTimeout(function () { 950 $loadingOverlay.show(); 951 }, 100); 952 953 if (settings.get('inline')) { 954 var $target = $(href); 955 // Inserts an empty placeholder where inline content is being pulled from. 956 // An event is bound to put inline content back when Colorbox closes or loads new content. 957 $inline = $('<div>').hide().insertBefore($target); 958 959 $events.one(event_purge, function () { 960 $inline.replaceWith($target); 961 }); 962 963 prep($target); 964 } else if (settings.get('iframe')) { 965 // IFrame element won't be added to the DOM until it is ready to be displayed, 966 // to avoid problems with DOM-ready JS that might be trying to run in that iframe. 967 prep(" "); 968 } else if (settings.get('html')) { 969 prep(settings.get('html')); 970 } else if (isImage(settings, href)) { 971 972 href = retinaUrl(settings, href); 973 974 photo = new Image(); 975 976 $(photo) 977 .addClass(prefix + 'Photo') 978 .bind('error',function () {
979 prep($tag(div, 'Error').html(settings.get('imgError'))); 980 }) 981 .one('load', function () { 982 if (request !== requests) { 983 return; 984 } 985 986 // A small pause because some browsers will occassionaly report a 987 // img.width and img.height of zero immediately after the img.onload fires 988 setTimeout(function(){ 989 var percent; 990 991 $.each(['alt', 'longdesc', 'aria-describedby'], function(i,val){ 992 var attr = $(settings.el).attr(val) || $(settings.el).attr('data-'+val); 993 if (attr) { 994 photo.setAttribute(val, attr); 995 } 996 }); 997 998 var isRetina = false; 999 if (settings.get('retinaImage') && window.devicePixelRatio > 1) { 1000 isRetina = true; 1001 if(isRetina){ 1002 if(photo.width < jQuery(window).width() && photo.height < jQuery(window).height()){ 1003 photo.height = 2 * photo.height / window.devicePixelRatio; 1004 photo.width = 2 * photo.width / window.devicePixelRatio; 1005 }else{ 1006 if(jQuery(window).width() < jQuery(window).height()){ 1007 var k = (photo.height / window.devicePixelRatio) / (photo.width / window.devicePixelRatio); 1008 photo.height = 2 * (k*jQuery(window).width() - 70); 1009 photo.width = 2 * (jQuery(window).width() - 70); 1010 }else{ 1011 if(photo.height > photo.width){ 1012 var k = (photo.width / window.devicePixelRatio) / (photo.height / window.devicePixelRatio); 1013 photo.height = 2 * (jQuery(window).height() - 70); 1014 photo.width = 2 * (k*jQuery(window).height() - 70); 1015 }else{ 1016 var k = (photo.height / window.devicePixelRatio) / (photo.width / window.devicePixelRatio); 1017 photo.height = 2 * (k*jQuery(window).width() - 70); 1018 photo.width = 2 * (jQuery(window).width() - 70); 1019 } 1020 1021 } 1022 } 1023 } 1024 } 1025 1026 if (settings.get('scalePhotos')) { 1027 setResize = function () { 1028 photo.height -= photo.height * percent; 1029 photo.width -= photo.width * percent; 1030 }; 1031 if (settings.mw && photo.width > settings.mw) { 1032 percent = (photo.width - settings.mw) / photo.width; 1033 setResize(); 1034 } 1035 if (settings.mh && photo.height > settings.mh) { 1036 percent = (photo.height - settings.mh) / photo.height; 1037 setResize(); 1038 } 1039 } 1040 1041 if (settings.h) { 1042 photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px'; 1043 } 1044 1045 if ($related[1] && (settings.get('loop') || $related[index + 1])) { 1046 photo.style.cursor = 'pointer'; 1047 photo.onclick = function () { 1048 publicMethod.next(); 1049 }; 1050 } 1051 if(!isRetina){ 1052 if(photo.width < jQuery(window).width() && photo.height < jQuery(window).height()){ 1053 photo.height = photo.height / window.devicePixelRatio; 1054 photo.width = photo.width / window.devicePixelRatio; 1055 }else{ 1056 if(jQuery(window).width() < jQuery(window).height()){ 1057 var k = (photo.height / window.devicePixelRatio) / (photo.width / window.devicePixelRatio); 1058 photo.height = k*jQuery(window).width() - 70; 1059 photo.width = jQuery(window).width() - 70; 1060 }else{ 1061 var k = (photo.width / window.devicePixelRatio) / (photo.height / window.devicePixelRatio); 1062 photo.height = jQuery(window).height() - 70; 1063 photo.width = k*jQuery(window).height() - 70; 1064 } 1065 } 1066 } 1067 1068 photo.style.width = photo.width + 'px'; 1069 photo.style.height = photo.height + 'px'; 1070 prep(photo); 1071 }, 1); 1072 }); 1073 1074 photo.src = href; 1075 1076 } else if (href) { 1077 $loadingBay.load(href, settings.get('data'), function (data, status) { 1078 if (request === requests) {
1079 prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents()); 1080 } 1081 }); 1082 } 1083 } 1084 1085 // Navigates to the next page/image in a set. 1086 publicMethod.next = function () { 1087 if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) { 1088 index = getIndex(1); 1089 launch($related[index]); 1090 } 1091 }; 1092 1093 publicMethod.prev = function () { 1094 if (!active && $related[1] && (settings.get('loop') || index)) { 1095 index = getIndex(-1); 1096 launch($related[index]); 1097 } 1098 }; 1099 1100 // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close(); 1101 publicMethod.close = function () { 1102 if (open && !closing) { 1103 1104 closing = true; 1105 open = false; 1106 trigger(event_cleanup); 1107 settings.get('onCleanup'); 1108 $window.unbind('.' + prefix); 1109 $overlay.fadeTo(settings.get('fadeOut') || 0, 0); 1110 1111 $box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () { 1112 $box.hide(); 1113 $overlay.hide(); 1114 trigger(event_purge); 1115 $loaded.remove(); 1116 1117 setTimeout(function () { 1118 closing = false; 1119 //trigger(event_closed); 1120 settings.get('onClosed'); 1121 }, 1); 1122 }); 1123 } 1124 }; 1125 1126 // Removes changes Colorbox made to the document, but does not remove the plugin. 1127 publicMethod.remove = function () { 1128 if (!$box) { return; } 1129 1130 $box.stop(); 1131 $[colorbox].close(); 1132 $box.stop(false, true).remove(); 1133 $overlay.remove(); 1134 closing = false; 1135 $box = null; 1136 $('.' + boxElement) 1137 .removeData(colorbox) 1138 .removeClass(boxElement); 1139 1140 $(document).unbind('click.'+prefix).unbind('keydown.'+prefix); 1141 }; 1142 1143 // A method for fetching the current element Colorbox is referencing. 1144 // returns a jQuery object. 1145 publicMethod.element = function () { 1146 return $(settings.el); 1147 }; 1148 1149 publicMethod.settings = defaults; 1150 1151}(jQuery, document, window)); 1152 1153var logo_div = document.createElement('div'); 1154var img = document.createElement('img'); 1155jQuery(logo_div).attr("id","lightbox_logo"); 1156jQuery(img).attr('src',hugeit_lightbox_obj.hugeit_lightbox_watermark_img_src); 1157jQuery(logo_div).append(img); 1158jQuery(logo_div).attr("class","huge_it_" + hugeit_lightbox_obj.hugeit_lightbox_watermark_position); 1159jQuery(img).width(hugeit_lightbox_obj.hugeit_lightbox_watermark_width); 1160logo_opacity = hugeit_lightbox_obj.hugeit_lightbox_watermark_opacity * 0.01; 1161jQuery(logo_div).css("opacity",logo_opacity); 1162jQuery(document).ready(function(){ 1163if(hugeit_lightbox_obj.hugeit_lightbox_watermarket_image == true){ 1164 1165 jQuery("#cboxNext").click(function(){ 1166 setTimeout(function(){ 1167 jQuery("#cboxLoadedContent").before(logo_div); 1168 0},500); 1169 }); 1170 jQuery("#cboxPrevious").click(function(){ 1171 setTimeout(function(){ 1172 jQuery("#cboxLoadedContent").before(logo_div); 1173 0},500); 1174 }); 1175 jQuery(".cboxElement").click(function (){ 1176 setTimeout(function(){ 1177 jQuery("#cboxLoadedContent").before(logo_div); 1178 0},500); 1179 }); 1180 1181 } 1182 }); 1183 1184
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.