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