1// ColorBox v1.3.7 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 2// c) 2009 Jack Moore - www.colorpowered.com - [email protected] 3// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 4 5/*jslint browser: true */ 6 7(function ($) { 8 // Shortcuts (to increase compression) 9 var colorbox = 'colorbox', 10 hover = 'hover', 11 TRUE = true, 12 FALSE = false, 13 cboxPublic, 14 isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser 15 isIE6 = isIE && $.browser.version < 7, 16 17 // Event Strings (to increase compression) 18 cbox_open = 'cbox_open', 19 cbox_load = 'cbox_load', 20 cbox_complete = 'cbox_complete', 21 cbox_cleanup = 'cbox_cleanup', 22 cbox_closed = 'cbox_closed', 23 24 // Cached jQuery Object Variables 25 $overlay, 26 $cbox, 27 $wrap, 28 $content, 29 $topBorder, 30 $leftBorder, 31 $rightBorder, 32 $bottomBorder, 33 $related, 34 $window, 35 $loaded, 36 $loadingBay, 37 $loadingOverlay, 38 $title, 39 $current, 40 $slideshow, 41 $next, 42 $prev, 43 $close, 44 45 // Variables for cached values or use across multiple functions 46 interfaceHeight, 47 interfaceWidth, 48 loadedHeight, 49 loadedWidth, 50 element, 51 bookmark, 52 index, 53 settings, 54 open, 55 active, 56 57 // ColorBox Default Settings. 58 // See http://colorpowered.com/colorbox for details. 59 defaults = { 60 transition: "elastic", 61 speed: 350, 62 width: FALSE, 63 height: FALSE, 64 innerWidth: FALSE, 65 innerHeight: FALSE, 66 initialWidth: "400", 67 initialHeight: "400", 68 maxWidth: FALSE, 69 maxHeight: FALSE, 70 scalePhotos: TRUE, 71 scrolling: TRUE, 72 inline: FALSE, 73 html: FALSE, 74 iframe: FALSE, 75 photo: FALSE, 76 href: FALSE, 77 title: FALSE, 78 rel: FALSE, 79 opacity: 0.9, 80 preloading: TRUE, 81 current: "image {current} of {total}", 82 previous: "previous", 83 next: "next", 84 close: "close", 85 open: FALSE, 86 overlayClose: TRUE, 87 loop: TRUE, 88 89 slideshow: FALSE, 90 slideshowAuto: TRUE, 91 slideshowSpeed: 2500, 92 slideshowStart: "start slideshow", 93 slideshowStop: "stop slideshow", 94 95 onOpen: FALSE, 96 onLoad: FALSE, 97 onComplete: FALSE, 98 onCleanup: FALSE, 99 onClosed: FALSE, 100 101 escKey: TRUE, 102 arrowKey: TRUE 103 }; 104 105 // **************** 106 // HELPER FUNCTIONS 107 // **************** 108 109 // Convert % values to pixels 110 function setSize(size, dimension) { 111 dimension = dimension === 'x' ? $window.width() : $window.height();//document.documentElement.clientWidth : document.documentElement.clientHeight; 112 return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size; 113 } 114 115 // Checks an href to see if it is a photo. 116 // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. 117 function isImage(url) { 118 url = $.isFunction(url) ? url.call(element) : url; 119 return settings.photo || url.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i); 120 } 121 122 // Assigns functions results to their respective settings. This allows functions to be used to set ColorBox options. 123 function process() { 124 for (var i in settings) { 125 if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. 126 settings[i] = settings[i].call(element); 127 } 128 } 129 settings.rel = settings.rel || element.rel || 'nofollow'; 130 settings.href = settings.href || $(element).attr('href'); 131 settings.title = settings.title || element.title; 132 } 133 134 function launch(elem) { 135 136 element = elem; 137 138 settings = $.extend({}, $(element).data(colorbox)); 139 140 process(); // Convert functions to their returned values. 141 142 if (settings.rel !== 'nofollow') { 143 $related = $('.cboxElement').filter(function () { 144 var relRelated = $(this).data(colorbox).rel || this.rel; 145 return (relRelated === settings.rel); 146 }); 147 index = $related.index(element); 148 149 // Check direct calls to ColorBox. 150 if (index < 0) { 151 $related = $related.add(element); 152 index = $related.length - 1; 153 } 154 } else { 155 $related = $(element); 156 index = 0; 157 } 158 159 if (!open) { 160 open = TRUE; 161 162 active = TRUE; // Prevents the page-change action from queuing up if the visitor holds down the left or right
162keys. 163 164 bookmark = element; 165 166 try { 167 bookmark.blur(); // Remove the focus from the calling element. 168 }catch (e) {} 169 170 $.event.trigger(cbox_open); 171 if (settings.onOpen) { 172 settings.onOpen.call(element); 173 } 174 175 $overlay.css({"opacity": parseFloat(settings.opacity), "cursor": settings.overlayClose ? "pointer" : "auto"}).show(); 176 177 // Opens inital empty ColorBox prior to content being loaded. 178 settings.w = setSize(settings.initialWidth, 'x'); 179 settings.h = setSize(settings.initialHeight, 'y'); 180 cboxPublic.position(0); 181 182 if (isIE6) { 183 $window.bind('resize.cboxIE6 scroll.cboxIE6', function () { 184 $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); 185 }).trigger("scroll.cboxIE6"); 186 } 187 } 188 189 $current.add($prev).add($next).add($slideshow).add($title).hide(); 190 191 $close.html(settings.close).show(); 192 193 cboxPublic.slideshow(); 194 195 cboxPublic.load(); 196 } 197 198 // **************** 199 // PUBLIC FUNCTIONS 200 // Usage format: $.fn.colorbox.close(); 201 // Usage from within an iframe: parent.$.fn.colorbox.close(); 202 // **************** 203 204 cboxPublic = $.fn.colorbox = $.colorbox = function (options, callback) { 205 var $this = this; 206 207 if ($this.selector && !$this.length) { 208 return $this; 209 } 210 211 options = options || {}; 212 213 if (callback) { 214 options.onComplete = callback; 215 } 216 217 if (!$this.length || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox() 218 $this = $('<a/>'); 219 options.open = TRUE; // assume an immediate open 220 } 221 222 $this.each(function () { 223 $(this).data(colorbox, $.extend({}, $(this).data(colorbox) || defaults, options)).addClass("cboxElement"); 224 }); 225 226 if (options.open) { 227 launch($this[0]); 228 } 229 230 return $this; 231 }; 232 233 // Initialize ColorBox: store common calculations, preload the interface graphics, append the html. 234 // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only 235 // having to run once, instead of each time colorbox is opened. 236 cboxPublic.init = function () { 237 238 // jQuery object generator to save a bit of space 239 function $div(id) { 240 return $('<div id="cbox' + id + '"/>'); 241 } 242 243 // Create & Append jQuery Objects 244 $window = $(window); 245 $cbox = $('<div id="colorbox"/>'); 246 $overlay = $div("Overlay").hide(); 247 $wrap = $div("Wrapper"); 248 $content = $div("Content").append( 249 $loaded = $div("LoadedContent").css({width: 0, height: 0}), 250 $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")), 251 $title = $div("Title"), 252 $current = $div("Current"), 253 $next = $div("Next"), 254 $prev = $div("Previous"), 255 $slideshow = $div("Slideshow"), 256 $close = $div("Close") 257 ); 258 $wrap.append( // The 3x3 Grid that makes up ColorBox 259 $('<div/>').append( 260 $div("TopLeft"), 261 $topBorder = $div("TopCenter"), 262 $div("TopRight") 263 ), 264 $('<div/>').append( 265 $leftBorder = $div("MiddleLeft"), 266 $content, 267 $rightBorder = $div("MiddleRight") 268 ), 269 $('<div/>').append( 270 $div("BottomLeft"), 271 $bottomBorder = $div("BottomCenter"), 272 $div("BottomRight") 273 ) 274 ).children().children().css({'float': 'left'}); 275 276 $loadingBay = $("<div id='cboxLoadingBay' style='position:absolute; width:9999px;'/>"); 277 278 $('body').prepend($overlay, $cbox.append($wrap, $loadingBay)); 279 280 if (isIE) { 281 $cbox.addClass('cboxIE'); 282 if (isIE6) { 283 $overlay.css('position', 'absolute'); 284 } 285 } 286 287 $content.children() 288 .hover(function () { 289 $(this).addClass(hover); 290 }, function () { 291 $(this).removeClass(hover); 292 }).addClass(hover); 293 294 // Cache values needed for size calculations 295 interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(TRUE) - $content.height();//Subtraction needed for IE6 296 interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(TRUE) - $content.width(); 297 loadedHeight = $loaded.outerHeight(TRUE); 298 loadedWidth = $loaded.outerWidth(TRUE); 299 300 // Setting padding to remove the need to do size conversions during the animation step. 301 $cbox.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide(); 302 303 // Setup button events. 304 $next.click(cboxPublic.next); 305 $prev.click(cboxPublic.prev); 306 $close.click(cboxPublic.close); 307 308 // Adding the 'hover' class allowed the browser to load the hover-state 309 // background graphics. The class can now can be removed. 310 $content.children().removeClass(hover); 311 312 $('.cboxElement').live('click', function (e) { 313 // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt. 314 if ((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey) { 315 return TRUE; 316 } else { 317 launch(this); 318 return FALSE; 319 } 320 }); 321 322 $overlay.click(function () { 323 if (settings.overlayClose) { 324 cboxPublic.close(); 325 } 326 }); 327 328 // Set Navigation Key Bindings 329 $(document).bind("keydown", function (e) { 330 if (open && settings.escKey && e.keyCode === 27) { 331 e.preventDefault(); 332 cboxPublic.close(); 333 } 334 if (open && settings.arrowKey && !active && $related.length > 1) { 335 if (e.keyCode === 37 && (index > 0 || settings.loop)) { 336 e.preventDefault(); 337 $prev.click(); 338 } else if (e.keyCode === 39 && (index < $related.length - 1 || settings.loop)) { 339 e.preventDefault(); 340 $next.click(); 341 } 342 } 343 }); 344 }; 345 346 cboxPublic.remove = function () { 347 $cbox.add($overlay).remove(); 348 $('.cboxElement').removeData(colorbox).removeClass('cboxElement'); 349 }; 350 351 cboxPublic.position = function (speed, loadedCallback) { 352 var 353 animate_speed, 354 // keeps the top and left positions within the browser's viewport. 355 posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(), 356 posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft(); 357 358 // setting the speed to 0 to reduce the delay between same-sized content. 359 animate_speed = ($cbox.width() === settings.w + loadedWidth && $cbox.height() === settings.h + loadedHeight) ? 0 : speed; 360 361 // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, 362 // but it has to be shrank down around the size of div#colorbox when it's done. If not, 363 // it can invoke an obscure IE bug when using iframes. 364 $wrap[0].style.width = $wrap[0].style.height = "9999px"; 365 366 function modalDimensions(that) { 367 // loading overlay height has to be explicitly set for IE6. 368 $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; 369 $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; 370 } 371 372 $cbox.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, { 373 duration: animate_speed, 374 complete: function () { 375 modalDimensions(this); 376 377 active = FALSE; 378 379 // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. 380 $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; 381 $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; 382 383 if (loadedCallback) { 384 loadedCallback(); 385 } 386 }, 387 step: function () { 388 modalDimensions(this); 389 } 390 }); 391 }; 392 393 cboxPublic.resize = function (options) { 394 if (open) { 395 options = options || {}; 396 397 if (options.width) { 398 settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; 399 } 400 if (options.innerWidth) { 401 settings.w = setSize(options.innerWidth, 'x'); 402 } 403 $loaded.css({width: settings.w}); 404 405 if (options.height) { 406 settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; 407 } 408 if (options.innerHeight) { 409 settings.h = setSize(options.innerHeight, 'y'); 410 } 411 if (!options.innerHeight && !options.height) { 412 var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be. 413 settings.h = $child.height(); 414 $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation 415 } 416 $loaded.css({height: settings.h}); 417 418 cboxPublic.position(settings.transition === "none" ? 0 : settings.speed); 419 } 420 }; 421 422 cboxPublic.prep = function (object) { 423 if (!open) { 424 return; 425 } 426 427 var photo, 428 speed = settings.transition === "none" ? 0 : settings.speed; 429 430 $window.unbind('resize.cbox'); 431 432 $loaded.remove(); 433 $loaded = $('<div id="cboxLoadedContent"/>').html(object); 434 435 function getWidth() { 436 settings.w = settings.w || $loaded.width(); 437 settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; 438 return settings.w; 439 } 440 function getHeight() { 441 settings.h = settings.h || $loaded.height(); 442 settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; 443 return settings.h; 444 } 445 446 $loaded.hide() 447 .appendTo($loadingBay)// content has to be appended to the DOM for accurate size calculations. 448 .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'}) 449 .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
450 .prependTo($content); 451 452 $('#cboxPhoto').css({cssFloat: 'none'});// 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. 453 454 // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. 455 if (isIE6) { 456 $('select:not(#colorbox select)').filter(function () { 457 return this.style.visibility !== 'hidden'; 458 }).css({'visibility': 'hidden'}).one(cbox_cleanup, function () { 459 this.style.visibility = 'inherit'; 460 }); 461 } 462 463 function setPosition(s) { 464 var prev, prevSrc, next, nextSrc, total = $related.length, loop = settings.loop; 465 cboxPublic.position(s, function () { 466 function defilter() { 467 if (isIE) { 468 //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs. 469 $cbox[0].style.removeAttribute("filter"); 470 } 471 } 472 473 if (!open) { 474 return; 475 } 476 477 if (isIE) { 478 //This fadeIn helps the bicubic resampling to kick-in. 479 if (photo) { 480 $loaded.fadeIn(100); 481 } 482 } 483 484 //Waited until the iframe is added to the DOM & it is visible before setting the src. 485 //This increases compatability with pages using DOM dependent JavaScript. 486 if (settings.iframe) { 487 $("<iframe frameborder=0" + (settings.scrolling ? "" : " scrolling='no'") + (isIE ? " allowtransparency='true'" : '') + "/>") 488 .appendTo($loaded) 489 .attr({src: settings.href, id: 'cboxIframe', name: new Date().getTime()}); 490 } 491 492 $loaded.show(); 493
494 $title.show().html(settings.title); 495 496 if (total > 1) { // handle grouping 497 $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show(); 498 499 $next[(loop || index < total - 1) ? "show" : "hide"]().html(settings.next); 500 $prev[(loop || index > 0) ? "show" : "hide"]().html(settings.previous); 501 502 prev = index > 0 ? $related[index - 1] : $related[total - 1]; 503 next = index < total - 1 ? $related[index + 1] : $related[0]; 504 505 if (settings.slideshow) { 506 $slideshow.show(); 507 if (index === total - 1 && !loop && $cbox.is('.cboxSlideshow_on')) { 508 $slideshow.click(); 509 } 510 } 511 512 // Preloads images within a rel group 513 if (settings.preloading) { 514 nextSrc = $(next).data(colorbox).href || next.href; 515 prevSrc = $(prev).data(colorbox).href || prev.href; 516 517 if (isImage(nextSrc)) { 518 $('<img/>')[0].src = nextSrc; 519 } 520 521 if (isImage(prevSrc)) { 522 $('<img/>')[0].src = prevSrc; 523 } 524 } 525 } 526 527 $loadingOverlay.hide(); 528 529 if (settings.transition === 'fade') { 530 $cbox.fadeTo(speed, 1, function () { 531 defilter(); 532 }); 533 } else { 534 defilter(); 535 } 536 537 $window.bind('resize.cbox', function () { 538 cboxPublic.position(0); 539 }); 540 541 $.event.trigger(cbox_complete); 542 if (settings.onComplete) { 543 settings.onComplete.call(element); 544 } 545 }); 546 } 547 548 if (settings.transition === 'fade') { 549 $cbox.fadeTo(speed, 0, function () { 550 setPosition(0); 551 }); 552 } else { 553 setPosition(speed); 554 } 555 }; 556 557 cboxPublic.load = function () { 558 var href, img, setResize, prep = cboxPublic.prep; 559 560 active = TRUE; 561 562 element = $related[index]; 563 564 settings = $.extend({}, $(element).data(colorbox)); 565 566 //convert functions to static values 567 process(); 568 569 $.event.trigger(cbox_load); 570 if (settings.onLoad) { 571 settings.onLoad.call(element); 572 } 573 574 // Evaluate the height based on the optional height and width settings. 575 settings.h = settings.height ? 576 setSize(settings.height, 'y') - loadedHeight - interfaceHeight : 577 settings.innerHeight ? 578 setSize(settings.innerHeight, 'y') : 579 FALSE; 580 settings.w = settings.width ? 581 setSize(settings.width, 'x') - loadedWidth - interfaceWidth : 582 settings.innerWidth ? 583 setSize(settings.innerWidth, 'x') : 584 FALSE; 585 586 // Sets the minimum dimensions for use in image scaling 587 settings.mw = settings.w; 588 settings.mh = settings.h; 589 590 // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. 591 // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. 592 if (settings.maxWidth) { 593 settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; 594 settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; 595 } 596 if (settings.maxHeight) { 597 settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; 598 settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; 599 } 600 601 href = settings.href; 602 603 $loadingOverlay.show(); 604 605 if (settings.inline) { 606 // Inserts an empty placeholder where inline content is being pulled from. 607 // An event is bound to put inline content back when ColorBox closes or loads new content. 608 $('<div id="cboxInlineTemp"/>').hide().insertBefore($(href)[0]).bind(cbox_load + ' ' + cbox_cleanup, function () { 609 $(this).replaceWith($loaded.children()); 610 }); 611 prep($(href)); 612 } else if (settings.iframe) { 613 // IFrame element won't be added to the DOM until it is ready to be displayed, 614 // to avoid problems with DOM-ready JS that might be trying to run in that iframe. 615 prep(" "); 616 } else if (settings.html) { 617 prep(settings.html); 618 } else if (isImage(href)) { 619 img = new Image(); 620 img.onload = function () { 621 var percent; 622 623 img.onload = null; 624 img.id = 'cboxPhoto'; 625 $(img).css({margin: 'auto', border: 'none', display: 'block', cssFloat: 'left'}); 626 627 if (settings.scalePhotos) { 628 setResize = function () { 629 img.height -= img.height * percent; 630 img.width -= img.width * percent; 631 }; 632 if (settings.mw && img.width > settings.mw) { 633 percent = (img.width - settings.mw) / img.width; 634 setResize(); 635 } 636 if (settings.mh && img.height > settings.mh) { 637 percent = (img.height - settings.mh) / img.height; 638 setResize(); 639 } 640 } 641 642 if (settings.h) {
643 img.style.marginTop = Math.max(settings.h - img.height, 0) / 2 + 'px'; 644 } 645 646 prep(img); 647 648 if ($related.length > 1) { 649 $(img).css({cursor: 'pointer'}).click(cboxPublic.next); 650 } 651 652 if (isIE) { 653 img.style.msInterpolationMode = 'bicubic'; 654 } 655 }; 656 img.src = href; 657 } else { 658 $('<div>Request unsuccessful.</div>').appendTo($loadingBay).load(href, function (data, textStatus) { 659 prep(this); 660 }); 661 } 662 }; 663 664 // Navigates to the next page/image in a set. 665 cboxPublic.next = function () { 666 if (!active) { 667 index = index < $related.length - 1 ? index + 1 : 0; 668 cboxPublic.load(); 669 } 670 }; 671 672 cboxPublic.prev = function () { 673 if (!active) { 674 index = index > 0 ? index - 1 : $related.length - 1; 675 cboxPublic.load(); 676 } 677 }; 678 679 cboxPublic.slideshow = function () { 680 var stop, timeOut, className = 'cboxSlideshow_'; 681 682 $slideshow.bind(cbox_closed, function () { 683 $slideshow.unbind(); 684 clearTimeout(timeOut); 685 $cbox.removeClass(className + "off " + className + "on"); 686 }); 687 688 function start() { 689 $slideshow 690 .text(settings.slideshowStop) 691 .bind(cbox_complete, function () { 692 timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed); 693 }) 694 .bind(cbox_load, function () { 695 clearTimeout(timeOut); 696 }).one("click", function () { 697 stop(); 698 }); 699 $cbox.removeClass(className + "off").addClass(className + "on"); 700 } 701 702 stop = function () { 703 clearTimeout(timeOut); 704 $slideshow 705 .text(settings.slideshowStart) 706 .unbind(cbox_complete + ' ' + cbox_load) 707 .one("click", function () { 708 start(); 709 timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed); 710 }); 711 $cbox.removeClass(className + "on").addClass(className + "off"); 712 }; 713 714 if (settings.slideshow && $related.length > 1) { 715 if (settings.slideshowAuto) { 716 start(); 717 } else { 718 stop(); 719 } 720 } 721 }; 722 723 // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close(); 724 cboxPublic.close = function () { 725 if (open) { 726 open = FALSE; 727 728 $.event.trigger(cbox_cleanup); 729 730 if (settings.onCleanup) { 731 settings.onCleanup.call(element); 732 } 733 734 $window.unbind('.cbox .cboxIE6'); 735 736 $cbox.add($overlay) 737 .stop() 738 .fadeTo('fast', 0, function () { 739 $('#colorbox iframe').attr('src', 'about:blank'); // change the location of the iframe to avoid a problem in IE with flash objects not clearing. 740 741 $loaded.remove(); 742 743 $cbox.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide(); 744 745 try { 746 bookmark.focus(); 747 } catch (e) { 748 // do nothing 749 } 750 751 setTimeout(function () { 752 $.event.trigger(cbox_closed); 753 if (settings.onClosed) { 754 settings.onClosed.call(element); 755 } 756 }, 1); 757 }); 758 } 759 }; 760 761 // A method for fetching the current element ColorBox is referencing. 762 // returns a jQuery object. 763 cboxPublic.element = function () { 764 return $(element); 765 }; 766 767 cboxPublic.settings = defaults; 768 769 // Initializes ColorBox when the DOM has loaded 770 $(cboxPublic.init); 771 772}(jQuery));
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.