1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/* 11 * FancyBox - jQuery Plugin 12 * Simple and fancy lightbox alternative 13 * 14 * Examples and documentation at: http://fancybox.net 15 * 16 * Copyright (c) 2008 - 2010 Janis Skarnelis 17 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. 18 * 19 * Version: 1.3.4 (11/11/2010) 20 * Requires: jQuery v1.3+ 21 * 22 * Dual licensed under the MIT and GPL licenses: 23 * http://www.opensource.org/licenses/mit-license.php 24 * http://www.gnu.org/licenses/gpl.html 25 */ 26 27;(function($) { 28 var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right, 29 30 selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [], 31 32 ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i, 33 34 loadingTimer, loadingFrame = 1, 35 36 titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx
36= $.extend($('<div/>')[0], { prop: 0 }), 37 38 isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest, 39 40 /* 41 * Private methods 42 */ 43 44 _abort = function() { 45 loading.hide(); 46 47 imgPreloader.onerror = imgPreloader.onload = null; 48 49 if (ajaxLoader) { 50 ajaxLoader.abort(); 51 } 52 53 tmp.empty(); 54 }, 55 56 _error = function() { 57 if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) { 58 loading.hide(); 59 busy = false; 60 return; 61 } 62 63 selectedOpts.titleShow = false; 64 65 selectedOpts.width = 'auto'; 66 selectedOpts.height = 'auto'; 67 68 tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' ); 69 70 _process_inline(); 71 }, 72 73 _start = function() { 74 var obj = selectedArray[ selectedIndex ], 75 href, 76 type, 77 title, 78 str, 79 emb, 80 ret; 81 82 _abort(); 83 84 selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox'))); 85 86 ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts); 87 88 if (ret === false) { 89 busy = false; 90 return; 91 } else if (typeof ret == 'object') { 92 selectedOpts = $.extend(selectedOpts, ret); 93 } 94 95 title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || ''; 96 97 if (obj.nodeName && !selectedOpts.orig) { 98 selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj); 99 } 100 101 if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) { 102 title = selectedOpts.orig.attr('alt'); 103 } 104 105 href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null; 106 107 if ((/^(?:javascript)/i).test(href) || href == '#') { 108 href = null; 109 } 110 111 if (selectedOpts.type) { 112 type = selectedOpts.type; 113 114 if (!href) { 115 href = selectedOpts.content; 116 } 117 118 } else if (selectedOpts.content) { 119 type = 'html'; 120 121 } else if (href) { 122 if (href.match(imgRegExp)) { 123 type = 'image'; 124 125 } else if (href.match(swfRegExp)) { 126 type = 'swf'; 127 128 } else if ($(obj).hasClass("iframe")) { 129 type = 'iframe'; 130 131 } else if (href.indexOf("#") === 0) { 132 type = 'inline'; 133 134 } else { 135 type = 'ajax'; 136 } 137 } 138 139 if (!type) { 140 _error(); 141 return; 142 } 143 144 if (type == 'inline') { 145 obj = href.substr(href.indexOf("#")); 146 type = $(obj).length > 0 ? 'inline' : 'ajax'; 147 } 148 149 selectedOpts.type = type; 150 selectedOpts.href = href; 151 selectedOpts.title = title; 152 153 if (selectedOpts.autoDimensions) { 154 if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') { 155 selectedOpts.width = 'auto'; 156 selectedOpts.height = 'auto'; 157 } else { 158 selectedOpts.autoDimensions = false; 159 } 160 } 161 162 if (selectedOpts.modal) { 163 selectedOpts.overlayShow = true; 164 selectedOpts.hideOnOverlayClick = false; 165 selectedOpts.hideOnContentClick = false; 166 selectedOpts.enableEscapeButton = false; 167 selectedOpts.showCloseButton = false; 168 } 169 170 selectedOpts.padding = parseInt(selectedOpts.padding, 10); 171 selectedOpts.margin = parseInt(selectedOpts.margin, 10); 172 173 tmp.css('padding', (selectedOpts.padding + selectedOpts.margin)); 174 175 $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() { 176 $(this).replaceWith(content.children()); 177 }); 178 179 switch (type) { 180 case 'html' : 181 tmp.html( selectedOpts.content ); 182 _process_inline(); 183 break; 184 185 case 'inline' : 186 if ( $(obj).parent().is('#fancybox-content') === true) { 187 busy = false; 188 return; 189 } 190 191 $('<div class="fancybox-inline-tmp" />') 192 .hide() 193 .insertBefore( $(obj) ) 194 .bind('fancybox-cleanup', function() { 195 $(this).replaceWith(content.children()); 196 }).bind('fancybox-cancel', function() { 197 $(this).replaceWith(tmp.children()); 198 }); 199 200 $(obj).appendTo(tmp); 201 202 _process_inline(); 203 break; 204 205 case 'image': 206 busy = false; 207 208 $.fancybox.showActivity(); 209 210 imgPreloader = new Image(); 211 212 imgPreloader.onerror = function() { 213 _error(); 214 }; 215 216 imgPreloader.onload = function() { 217 busy = true; 218 219 imgPreloader.onerror = imgPreloader.onload = null; 220 221 _process_image(); 222 }; 223 224 imgPreloader.src = href; 225 break; 226
227 case 'swf': 228 selectedOpts.scrolling = 'no'; 229 230 str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>'; 231 emb = ''; 232 233 $.each(selectedOpts.swf, function(name, val) { 234 str += '<param name="' + name + '" value="' + val + '"></param>'; 235 emb += ' ' + name + '="' + val + '"'; 236 }); 237 238 str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>'; 239 240 tmp.html(str); 241 242 _process_inline(); 243 break; 244 245 case 'ajax': 246 busy = false; 247 248 $.fancybox.showActivity(); 249 250 selectedOpts.ajax.win = selectedOpts.ajax.success; 251 252 ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, { 253 url : href, 254 data : selectedOpts.ajax.data || {}, 255 error : function(XMLHttpRequest, textStatus, errorThrown) { 256 if ( XMLHttpRequest.status > 0 ) { 257 _error(); 258 } 259 }, 260 success : function(data, textStatus, XMLHttpRequest) { 261 var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader; 262 if (o.status == 200) { 263 if ( typeof selectedOpts.ajax.win == 'function' ) { 264 ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest); 265 266 if (ret === false) { 267 loading.hide(); 268 return; 269 } else if (typeof ret == 'string' || typeof ret == 'object') { 270 data = ret; 271 } 272 } 273 274 tmp.html( data ); 275 _process_inline(); 276 } 277 } 278 })); 279 280 break; 281 282 case 'iframe': 283 _show(); 284 break; 285 } 286 }, 287 288 _process_inline = function() { 289 var 290 w = selectedOpts.width, 291 h = selectedOpts.height; 292 293 if (w.toString().indexOf('%') > -1) { 294 w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px'; 295 296 } else { 297 w = w == 'auto' ? 'auto' : w + 'px'; 298 } 299 300 if (h.toString().indexOf('%') > -1) { 301 h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px'; 302 303 } else { 304 h = h == 'auto' ? 'auto' : h + 'px'; 305 } 306 307 tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>'); 308 309 selectedOpts.width = tmp.width(); 310 selectedOpts.height = tmp.height(); 311 312 _show(); 313 }, 314 315 _process_image = function() { 316 selectedOpts.width = imgPreloader.width; 317 selectedOpts.height = imgPreloader.height; 318 319 $("<img />").attr({ 320 'id' : 'fancybox-img', 321 'src' : imgPreloader.src, 322 'alt' : selectedOpts.title 323 }).appendTo( tmp ); 324 325 _show(); 326 }, 327 328 _show = function() { 329 var pos, equal; 330 331 loading.hide(); 332 333 if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { 334 $.event.trigger('fancybox-cancel'); 335 336 busy = false; 337 return; 338 } 339 340 busy = true; 341 342 $(content.add( overlay )).unbind(); 343 344 $(window).unbind("resize.fb scroll.fb"); 345 $(document).unbind('keydown.fb'); 346 347 if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') { 348 wrap.css('height', wrap.height()); 349 } 350 351 currentArray = selectedArray; 352 currentIndex = selectedIndex; 353 currentOpts = selectedOpts; 354 355 if (currentOpts.overlayShow) { 356 overlay.css({ 357 'background-color' : currentOpts.overlayColor, 358 'opacity' : currentOpts.overlayOpacity, 359 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto', 360 'height' : $(document).height() 361 }); 362 363 if (!overlay.is(':visible')) { 364 if (isIE6) { 365 $('select:not(#fancybox-tmp select)').filter(function() { 366 return this.style.visibility !== 'hidden'; 367 }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() { 368 this.style.visibility = 'inherit'; 369 }); 370 } 371 372 overlay.show(); 373 } 374 } else { 375 overlay.hide(); 376 } 377 378 final_pos = _get_zoom_to(); 379 380 _process_title(); 381 382 if (wrap.is(":visible")) { 383 $( close.add( nav_left ).add( nav_right ) ).hide(); 384 385 pos = wrap.position(), 386 387 start_pos = { 388 top : pos.top, 389 left : pos.left, 390 width : wrap.width(), 391 height : wrap.height() 392 }; 393 394 equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height); 395 396 content.fadeTo(currentOpts.changeFade, 0.3, function() { 397 var finish_resizing = function() { 398 content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish); 399 }; 400 401 $.event.trigger('fancybox-change'); 402 403 content 404 .empty() 405 .removeAttr('filter') 406 .css({ 407 'border-width' : currentOpts.padding, 408 'width' : final_pos.width - currentOpts.padding * 2, 409 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2 410 }); 411 412 if (equal) {
413 finish_resizing(); 414 415 } else { 416 fx.prop = 0; 417 418 $(fx).animate({prop: 1}, { 419 duration : currentOpts.changeSpeed, 420 easing : currentOpts.easingChange, 421 step : _draw, 422 complete : finish_resizing 423 }); 424 } 425 }); 426 427 return; 428 } 429 430 wrap.removeAttr("style"); 431 432 content.css('border-width', currentOpts.padding); 433 434 if (currentOpts.transitionIn == 'elastic') { 435 start_pos = _get_zoom_from(); 436 437 content.html( tmp.contents() ); 438 439 wrap.show(); 440 441 if (currentOpts.opacity) { 442 final_pos.opacity = 0; 443 } 444 445 fx.prop = 0; 446 447 $(fx).animate({prop: 1}, { 448 duration : currentOpts.speedIn, 449 easing : currentOpts.easingIn, 450 step : _draw, 451 complete : _finish 452 }); 453 454 return; 455 } 456 457 if (currentOpts.titlePosition == 'inside' && titleHeight > 0) { 458 title.show(); 459 } 460 461 content 462 .css({ 463 'width' : final_pos.width - currentOpts.padding * 2, 464 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2 465 }) 466 .html( tmp.contents() ); 467 468 wrap 469 .css(final_pos) 470 .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish ); 471 }, 472 473 _format_title = function(title) { 474 if (title && title.length) { 475 if (currentOpts.titlePosition == 'float') { 476 return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>'; 477 } 478 479 return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>'; 480 } 481 482 return false; 483 }, 484 485 _process_title = function() { 486 titleStr = currentOpts.title || ''; 487 titleHeight = 0; 488 489 title 490 .empty() 491 .removeAttr('style') 492 .removeClass(); 493 494 if (currentOpts.titleShow === false) { 495 title.hide(); 496 return; 497 } 498 499 titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr); 500 501 if (!titleStr || titleStr === '') { 502 title.hide(); 503 return; 504 } 505 506 title 507 .addClass('fancybox-title-' + currentOpts.titlePosition) 508 .html( titleStr ) 509 .appendTo( 'body' ) 510 .show(); 511 512 switch (currentOpts.titlePosition) { 513 case 'inside': 514 title 515 .css({ 516 'width' : final_pos.width - (currentOpts.padding * 2), 517 'marginLeft' : currentOpts.padding, 518 'marginRight' : currentOpts.padding 519 }); 520 521 titleHeight = title.outerHeight(true); 522 523 title.appendTo( outer ); 524 525 final_pos.height += titleHeight; 526 break; 527 528 case 'over': 529 title 530 .css({ 531 'marginLeft' : currentOpts.padding, 532 'width' : final_pos.width - (currentOpts.padding * 2), 533 'bottom' : currentOpts.padding 534 }) 535 .appendTo( outer ); 536 break; 537 538 case 'float': 539 title 540 .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1) 541 .appendTo( wrap ); 542 break; 543 544 default: 545 title 546 .css({ 547 'width' : final_pos.width - (currentOpts.padding * 2), 548 'paddingLeft' : currentOpts.padding, 549 'paddingRight' : currentOpts.padding 550 }) 551 .appendTo( wrap ); 552 break; 553 } 554 555 title.hide(); 556 }, 557 558 _set_navigation = function() { 559 if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) { 560 $(document).bind('keydown.fb', function(e) { 561 if (e.keyCode == 27 && currentOpts.enableEscapeButton) { 562 e.preventDefault(); 563 $.fancybox.close(); 564 565 } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { 566 e.preventDefault(); 567 $.fancybox[ e.keyCode == 37 ? 'prev' : 'next'](); 568 } 569 }); 570 } 571 572 if (!currentOpts.showNavArrows) { 573 nav_left.hide(); 574 nav_right.hide(); 575 return; 576 } 577 578 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) { 579 nav_left.show(); 580 } 581 582 if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) { 583 nav_right.show(); 584 } 585 }, 586 587 _finish = function () { 588 if (!$.support.opacity) { 589 content.get(0).style.removeAttribute('filter'); 590 wrap.get(0).style.removeAttribute('filter'); 591 } 592 593 if (selectedOpts.autoDimensions) { 594 content.css('height', 'auto'); 595 } 596 597 wrap.css('height', 'auto'); 598 599 if (titleStr && titleStr.length) { 600 title.show(); 601 } 602 603 if (currentOpts.showCloseButton) { 604 close.show(); 605 } 606 607 _set_navigation(); 608 609 if (currentOpts.hideOnContentClick) { 610 content.bind('click', $.fancybox.close); 611 } 612 613 if (currentOpts.hideOnOverlayClick) { 614 overlay.bind('click', $.fancybox.close); 615 } 616 617 $(window).bind("resize.fb", $.fancybox.resize); 618 619 if (currentOpts.centerOnScroll) { 620 $(window).bind("scroll.fb", $.fancybox.center); 621 } 622 623 if (currentOpts.type == 'iframe') { 624 $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content); 625 } 626 627 wrap.show(); 628 629 busy = false;
630 631 $.fancybox.center(); 632 633 currentOpts.onComplete(currentArray, currentIndex, currentOpts); 634 635 _preload_images(); 636 }, 637 638 _preload_images = function() { 639 var href, 640 objNext; 641 642 if ((currentArray.length -1) > currentIndex) { 643 href = currentArray[ currentIndex + 1 ].href; 644 645 if (typeof href !== 'undefined' && href.match(imgRegExp)) { 646 objNext = new Image(); 647 objNext.src = href; 648 } 649 } 650 651 if (currentIndex > 0) { 652 href = currentArray[ currentIndex - 1 ].href; 653 654 if (typeof href !== 'undefined' && href.match(imgRegExp)) { 655 objNext = new Image(); 656 objNext.src = href; 657 } 658 } 659 }, 660 661 _draw = function(pos) { 662 var dim = { 663 width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10), 664 height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10), 665 666 top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10), 667 left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10) 668 }; 669 670 if (typeof final_pos.opacity !== 'undefined') { 671 dim.opacity = pos < 0.5 ? 0.5 : pos; 672 } 673 674 wrap.css(dim); 675 676 content.css({ 677 'width' : dim.width - currentOpts.padding * 2, 678 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2 679 }); 680 }, 681 682 _get_viewport = function() { 683 return [ 684 $(window).width() - (currentOpts.margin * 2), 685 $(window).height() - (currentOpts.margin * 2), 686 $(document).scrollLeft() + currentOpts.margin, 687 $(document).scrollTop() + currentOpts.margin 688 ]; 689 }, 690 691 _get_zoom_to = function () { 692 var view = _get_viewport(), 693 to = {}, 694 resize = currentOpts.autoScale, 695 double_padding = currentOpts.padding * 2, 696 ratio; 697 698 if (currentOpts.width.toString().indexOf('%') > -1) { 699 to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10); 700 } else { 701 to.width = currentOpts.width + double_padding; 702 } 703 704 if (currentOpts.height.toString().indexOf('%') > -1) { 705 to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10); 706 } else { 707 to.height = currentOpts.height + double_padding; 708 } 709 710 if (resize && (to.width > view[0] || to.height > view[1])) { 711 if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') { 712 ratio = (currentOpts.width ) / (currentOpts.height ); 713 714 if ((to.width ) > view[0]) { 715 to.width = view[0]; 716 to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10); 717 } 718 719 if ((to.height) > view[1]) { 720 to.height = view[1]; 721 to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10); 722 } 723 724 } else { 725 to.width = Math.min(to.width, view[0]); 726 to.height = Math.min(to.height, view[1]); 727 } 728 } 729 730 to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10); 731 to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10); 732 733 return to; 734 }, 735 736 _get_obj_pos = function(obj) { 737 var pos = obj.offset(); 738 739 pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0; 740 pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0; 741 742 pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0; 743 pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0; 744 745 pos.width = obj.width(); 746 pos.height = obj.height(); 747 748 return pos; 749 }, 750 751 _get_zoom_from = function() { 752 var orig = selectedOpts.orig ? $(selectedOpts.orig) : false, 753 from = {}, 754 pos, 755 view; 756 757 if (orig && orig.length) { 758 pos = _get_obj_pos(orig); 759 760 from = { 761 width : pos.width + (currentOpts.padding * 2), 762 height : pos.height + (currentOpts.padding * 2), 763 top : pos.top - currentOpts.padding - 20, 764 left : pos.left - currentOpts.padding - 20 765 }; 766 767 } else { 768 view = _get_viewport(); 769 770 from = { 771 width : currentOpts.padding * 2, 772 height : currentOpts.padding * 2, 773 top : parseInt(view[3] + view[1] * 0.5, 10), 774 left : parseInt(view[2] + view[0] * 0.5, 10) 775 }; 776 } 777 778 return from; 779 }, 780 781 _animate_loading = function() { 782 if (!loading.is(':visible')){ 783 clearInterval(loadingTimer); 784 return; 785 } 786 787 $('div', loading).css('top', (loadingFrame * -40) + 'px'); 788 789 loadingFrame = (loadingFrame + 1) % 12; 790 }; 791 792 /* 793 * Public methods 794 */ 795 796 $.fn.fancybox = function(options) { 797 if (!$(this).length) { 798 return this; 799 } 800 801 $(this) 802 .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {}))) 803 .unbind('click.fb') 804 .bind('click.fb', function(e) { 805 e.preventDefault(); 806 807 if (busy) { 808 return; 809 } 810 811 busy = true; 812 813 $(this).blur(); 814 815 selectedArray = []; 816 selectedIndex = 0; 817 818 var rel = $(this).attr('rel') || ''; 819 820 if (!rel || rel == '' || rel === 'nofollow') { 821 selectedArray.push(this); 822 823 } else { 824 selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]"); 825 selectedIndex = selectedArray.index( this ); 826 } 827 828 _start(); 829 830 return; 831 }); 832 833 return this; 834 }; 835 836 $.fancybox = function(obj) { 837 var opts; 838 839 if (busy) { 840 return; 841 } 842 843 busy = true; 844 opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {}; 845 846 selectedArray = []; 847 selectedIndex = parseInt(opts.index, 10) || 0; 848 849 if ($.isArray(obj)) { 850 for (var i = 0, j = obj.length; i < j; i++) { 851 if (typeof obj[i] == 'object') { 852 $(obj[i]).data('fancybox', $.extend({}, opts, obj[i])); 853 } else { 854 obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts)); 855 } 856 } 857 858 selectedArray = jQuery.merge(selectedArray, obj); 859 860 } else { 861 if (typeof obj == 'object') { 862 $(obj).data('fancybox', $.extend({}, opts, obj)); 863 } else { 864 obj = $({}).data('fancybox', $.extend({content : obj}, opts)); 865 } 866 867 selectedArray.push(obj); 868 } 869 870 if (selectedIndex > selectedArray.length || selectedIndex < 0) { 871 selectedIndex = 0; 872 } 873 874 _start(); 875 }; 876 877 $.fancybox.showActivity = function() { 878 clearInterval(loadingTimer); 879 880 loading.show(); 881 loadingTimer = setInterval(_animate_loading, 66); 882 }; 883 884 $.fancybox.hideActivity = function() { 885 loading.hide(); 886 }; 887 888 $.fancybox.next = function() { 889 return $.fancybox.pos( currentIndex + 1); 890 }; 891 892 $.fancybox.prev = function() { 893 return $.fancybox.pos( currentIndex - 1); 894 }; 895 896 $.fancybox.pos = function(pos) { 897 if (busy) { 898 return; 899 } 900 901 pos = parseInt(pos); 902 903 selectedArray = currentArray; 904 905 if (pos > -1 && pos < currentArray.length) { 906 selectedIndex = pos; 907 _start(); 908 909 } else if (currentOpts.cyclic && currentArray.length > 1) { 910 selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1; 911 _start(); 912 } 913 914 return; 915 }; 916 917 $.fancybox.cancel = function() { 918 if (busy) { 919 return; 920 } 921 922 busy = true; 923 924 $.event.trigger('fancybox-cancel'); 925 926 _abort(); 927 928 selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts); 929 930 busy = false;
931 }; 932 933 // Note: within an iframe use - parent.$.fancybox.close(); 934 $.fancybox.close = function() { 935 if (busy || wrap.is(':hidden')) { 936 return; 937 } 938 939 busy = true; 940 941 if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) { 942 busy = false; 943 return; 944 } 945 946 _abort(); 947 948 $(close.add( nav_left ).add( nav_right )).hide(); 949 950 $(content.add( overlay )).unbind(); 951 952 $(window).unbind("resize.fb scroll.fb"); 953 $(document).unbind('keydown.fb'); 954 955 content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank'); 956 957 if (currentOpts.titlePosition !== 'inside') { 958 title.empty(); 959 } 960 961 wrap.stop(); 962 963 function _cleanup() { 964 overlay.fadeOut('fast'); 965 966 title.empty().hide(); 967 wrap.hide(); 968 969 $.event.trigger('fancybox-cleanup'); 970 971 content.empty(); 972 973 currentOpts.onClosed(currentArray, currentIndex, currentOpts); 974 975 currentArray = selectedOpts = []; 976 currentIndex = selectedIndex = 0; 977 currentOpts = selectedOpts = {}; 978 979 busy = false; 980 } 981 982 if (currentOpts.transitionOut == 'elastic') { 983 start_pos = _get_zoom_from(); 984 985 var pos = wrap.position(); 986 987 final_pos = { 988 top : pos.top , 989 left : pos.left, 990 width : wrap.width(), 991 height : wrap.height() 992 }; 993 994 if (currentOpts.opacity) { 995 final_pos.opacity = 1; 996 } 997 998 title.empty().hide(); 999 1000 fx.prop = 1; 1001 1002 $(fx).animate({ prop: 0 }, { 1003 duration : currentOpts.speedOut, 1004 easing : currentOpts.easingOut, 1005 step : _draw, 1006 complete : _cleanup 1007 }); 1008 1009 } else { 1010 wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup); 1011 } 1012 }; 1013 1014 $.fancybox.resize = function() { 1015 if (overlay.is(':visible')) { 1016 overlay.css('height', $(document).height()); 1017 } 1018 1019 $.fancybox.center(true); 1020 }; 1021 1022 $.fancybox.center = function() { 1023 var view, align; 1024 1025 if (busy) { 1026 return; 1027 } 1028 1029 align = arguments[0] === true ? 1 : 0; 1030 view = _get_viewport(); 1031 1032 if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) { 1033 return; 1034 } 1035 1036 wrap 1037 .stop() 1038 .animate({ 1039 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)), 1040 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding)) 1041 }, typeof arguments[0] == 'number' ? arguments[0] : 200); 1042 }; 1043 1044 $.fancybox.init = function() { 1045 if ($("#fancybox-wrap").length) { 1046 return; 1047 } 1048 1049 $('body').append( 1050 tmp = $('<div id="fancybox-tmp"></div>'), 1051 loading = $('<div id="fancybox-loading"><div></div></div>'), 1052 overlay = $('<div id="fancybox-overlay"></div>'), 1053 wrap = $('<div id="fancybox-wrap"></div>') 1054 ); 1055 1056 outer = $('<div id="fancybox-outer"></div>') 1057 .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>') 1058 .appendTo( wrap ); 1059 1060 outer.append( 1061 content = $('<div id="fancybox-content"></div>'), 1062 close = $('<a id="fancybox-close"></a>'), 1063 title = $('<div id="fancybox-title"></div>'), 1064 1065 nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'), 1066 nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>') 1067 ); 1068 1069 close.click($.fancybox.close); 1070 loading.click($.fancybox.cancel); 1071 1072 nav_left.click(function(e) { 1073 e.preventDefault(); 1074 $.fancybox.prev(); 1075 }); 1076 1077 nav_right.click(function(e) { 1078 e.preventDefault(); 1079 $.fancybox.next(); 1080 }); 1081 1082 if ($.fn.mousewheel) { 1083 wrap.bind('mousewheel.fb', function(e, delta) { 1084 if (busy) { 1085 e.preventDefault(); 1086 1087 } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) { 1088 e.preventDefault(); 1089 $.fancybox[ delta > 0 ? 'prev' : 'next'](); 1090 } 1091 }); 1092 } 1093 1094 if (!$.support.opacity) { 1095 wrap.addClass('fancybox-ie'); 1096 } 1097 1098 if (isIE6) { 1099 loading.addClass('fancybox-ie6'); 1100 wrap.addClass('fancybox-ie6'); 1101 1102 $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer); 1103 } 1104 }; 1105 1106 $.fn.fancybox.defaults = { 1107 padding : 1, 1108 margin : 1, 1109 opacity : false, 1110 modal : false, 1111 cyclic : false, 1112 scrolling : 'auto', // 'auto', 'yes' or 'no' 1113 1114 width : 900, 1115 height : 850, 1116 1117 autoScale : true, 1118 autoDimensions : true, 1119 centerOnScroll : true, 1120 1121 ajax : {}, 1122 swf : { wmode: 'transparent' }, 1123 1124 hideOnOverlayClick : true, 1125 hideOnContentClick : false, 1126 1127 overlayShow : true, 1128 overlayOpacity : 0.9, 1129 overlayColor : '#000', 1130 1131 titleShow : true, 1132 titlePosition : 'float', // 'float', 'outside', 'inside' or 'over' 1133 titleFormat : null, 1134 titleFromAlt : true, 1135 1136 transitionIn : 'elastic', // 'elastic', 'fade' or 'none' 1137 transitionOut : 'elastic', // 'elastic', 'fade' or 'none' 1138 1139 speedIn : 300, 1140 speedOut : 300, 1141 1142 changeSpeed : 300, 1143 changeFade : 'fast', 1144 1145 easingIn : 'swing', 1146 easingOut : 'swing', 1147 1148 showCloseButton : true, 1149 showNavArrows : true, 1150 enableEscapeButton : true, 1151 enableKeyboardNav : true, 1152 1153 onStart : function(){}, 1154 onCancel : function(){}, 1155 onComplete : function(){}, 1156 onCleanup : function(){}, 1157 onClosed : function(){}, 1158 onError : function(){} 1159 }; 1160 1161 $(document).ready(function() { 1162 $.fancybox.init(); 1163 }); 1164 1165})(jQuery); 1166}
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.