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