1 2////////////////////////////////////Carousel 3(function ($) { 4 5 var methods = { 6 getItemWidth: function () { 7 return getObjDimensions(this.find("li").first()).width; 8 }, 9 Settings: { 10 startPosition: null, 11 endPosition: null, 12 TargetElement: null, 13 TargetElementStart: null, 14 Pages: null, 15 PageWidth: null, 16 Next: null, 17 Prev: null, 18 isMouseDown:null, 19 visibleItems:5 20 }, 21 TouchInit: function (options) { 22 methods.Settings.TargetElement = options.TargetElement; 23 methods.Settings.Next = $(methods.Settings.TargetElement).find(".NextCarouselNext a"); 24 methods.Settings.Prev = $(methods.Settings.TargetElement).find(".NextCarouselPrevious"); 25 methods.Settings.Pages = $(methods.Settings.TargetElement).find(".CarouselContent.NextCarousel"); 26 methods.Settings.PageWidth = $(methods.Settings.TargetElement).find(".CarouselContent.NextCarousel .carousel-image").width() + parseInt($(methods.Settings.TargetElement).find(".CarouselContent.NextCarousel li").css("margin-right").replace("px", "")); 27 28 methods.AddTouch(); 29 // This is required to swipe the carousel with mouse on desktop to test, uncomment it to enable on desktop, comment it before checking in the code 30 //$( methods.Settings.TargetElement).find("a").each(function () { 31 // $(this).removeAttr("onclick").click(function () { 32 // return false; 33 // }); 34 // }); 35 36 }, 37 38 AddTouch: function () { 39 40 var config = { 41 touchStart: methods.touchStart, 42 touchMove: methods.touchMove, 43 touchEnd: methods.touchEnd, 44 touchLeave: methods.touchLeave, 45 useMouse: true 46 } 47 48 $(methods.Settings.TargetElement).NXTouch(config); 49 }, 50 touchStart: function (e, NXTouchObj) { 51 52 methods.Settings.isMouseDown = true; 53 methods.Settings.startPosition = NXTouchObj.X; 54 55 methods.Settings.TargetElementStart = parseInt(methods.Settings.Pages.css("left")); 56 if (isNaN(methods.Settings.TargetElementStart)) 57 methods.Settings.TargetElementStart = 0; 58 59 60 }, 61 62 touchMove: function (e, NXTouchObj) { 63 if (methods.Settings.isMouseDown) { 64 var targetLeft = methods.Settings.TargetElementStart + NXTouchObj.DistanceX; 65 66 if (targetLeft > 0) 67 targetLeft = 0; 68 69 if (targetLeft < -(methods.Settings.Pages.width() -methods.Settings.PageWidth*methods.Settings.visibleItems)) 70 targetLeft = -(methods.Settings.Pages.width() - methods.Settings.PageWidth*methods.Settings.visibleItems); 71 72 methods.Settings.Pages.css("left", targetLeft); 73 74 75 } 76 }, 77 78 touchEnd: function (e,NXTouchObj) { 79 if (methods.Settings.isMouseDown) { 80 81 methods.Settings.endPosition = NXTouchObj.X; 82 83 //console.log('start:' + methods.Settings.startPosition) 84 //console.log('end:' + methods.Settings.endPosition) 85 if (Math.abs(methods.Settings.startPosition - methods.Settings.endPosition) > methods.Settings.PageWidth / 2) { 86 87 if (methods.Settings.endPosition < methods.Settings.startPosition) { 88 $(methods.Settings.TargetElement).find(".NextCarouselNext a").click(); 89 } 90 else { 91 $(methods.Settings.TargetElement).find(".NextCarouselPrevious a").click(); 92 } 93 94 } 95 else 96 { 97 var distanceDragged = parseInt(methods.Settings.Pages.css("left")); 98 99 if((methods.Settings.startPosition - methods.Settings.endPosition) != 0) 100 distanceDragged +=(methods.Settings.startPosition - methods.Settings.endPosition); 101
102 methods.Settings.Pages.animate({ "left": distanceDragged },300); 103 104 } 105 106 methods.Settings.isMouseDown = false; 107 } 108 }, 109 scrollCarouselRegion: function (carousel, index) { 110 var currentView = parseInt($(carousel).attr("data-viewindex")); 111 112 if (index == currentView) { 113 return false; 114 } 115 var totalViews = parseInt($(carousel).attr("data-viewcount")); 116 var viewPortWidth = $(carousel).parent().width(); 117 var itemMargin = methods.getObjDimensions($(carousel).find("li").first()).marginRight; 118 119 if (index == 'prev') { 120 index = parseInt(currentView - 1); 121 } 122 if (index == 'next') { 123 index = parseInt(currentView + 1); 124 } 125 126 if (index == 0) { 127 $(carousel).closest(".NextCarouselWrapper").find("li.NextCarouselPrevious").addClass("disabled"); 128 129 } 130 131 if (index > 0) { 132 $(carousel).closest(".NextCarouselWrapper").find("li.NextCarouselPrevious").removeClass("disabled"); 133 } 134 135 136 if (index == totalViews - 1) { 137 $(carousel).closest(".NextCarouselWrapper").find("li.NextCarouselNext").addClass("disabled"); 138 139 } 140 141 if (index < totalViews - 1) { 142 $(carousel).closest(".NextCarouselWrapper").find("li.NextCarouselNext").removeClass("disabled"); 143 } 144 145 146 if (index < 0) { return false; } 147 if (index == totalViews) { return false; } 148 var diff = index - currentView; 149 var distance = (diff * viewPortWidth) + (diff * itemMargin); 150 151 if((methods.Settings.startPosition - methods.Settings.endPosition) != 0) 152 distance -=(methods.Settings.startPosition - methods.Settings.endPosition); 153 154 155 //console.log(distance); 156 $(carousel).animate({ 157 left: '-=' + distance 158 }, 500, function () { 159 }); 160 161 $(carousel).attr("data-viewindex", index); 162 163 var curLinkIndex = -1; 164 var navList = $(carousel).parent().parent().find(".NextNavWrapper").find("ul"); 165 $(navList).find("li").each(function () { 166 $(this).removeClass("NextCarouselLinkActive"); 167 if (curLinkIndex == index) { 168 $(this).addClass("NextCarouselLinkActive"); 169 } 170 curLinkIndex++; 171 }); 172 173 return false; 174 }, 175 getIntFromPixelValue: function (pixelValue) { 176 if (!pixelValue) { return 0; } 177 pixelValue = pixelValue.replace('px', ''); 178 return parseInt(pixelValue); 179 }, 180 getObjDimensions: function (obj) { 181 //width 182 var Width = methods.getIntFromPixelValue($(obj).css("width")); 183 var PaddingLeft = methods.getIntFromPixelValue($(obj).css("padding-left")); 184 var PaddingRight = methods.getIntFromPixelValue($(obj).css("padding-left")); 185 var marginLeft = methods.getIntFromPixelValue($(obj).css("margin-left")); 186 var marginRight = methods.getIntFromPixelValue($(obj).css("margin-right")); 187 var borderLeft = methods.getIntFromPixelValue($(obj).css("border-left-width")); 188 var borderRight = methods.getIntFromPixelValue($(obj).css("border-right-width")); 189 var totalWidth = Width + PaddingLeft + PaddingRight + marginLeft + marginRight + borderLeft + borderRight; 190 191 //height 192 var Height = methods.getIntFromPixelValue($(obj).css("height")); 193 var PaddingTop = methods.getIntFromPixelValue($(obj).css("padding-top")); 194 var PaddingBottom = methods.getIntFromPixelValue($(obj).css("padding-bottom")); 195 var marginTop = methods.getIntFromPixelValue($(obj).css("margin-top")); 196 var marginBottom = methods.getIntFromPixelValue($(obj).css("margin-bottom")); 197 var borderTop = methods.getIntFromPixelValue($(obj).css("border-top-width")); 198 var borderBottom = methods.getIntFromPixelValue($(obj).css("border-bottom-width")); 199 var totalHeight = Height + PaddingTop + PaddingBottom + marginTop + marginBottom + borderTop + borderBottom; 200 201 var dimension = { "height": totalHeight, "width": totalWidth, "marginLeft": marginLeft, "marginRight": marginRight }; 202 203 return dimension; 204 } 205 }; 206 207 208 $.fn.NextCarousel = function (config) { 209 210 var settings = $.extend({ 211 'VisibleItems': 4, 212 'ItemsToScroll': 5, 213 'CompactNav': true, 214 'LeftRightNav': false, 215 'AutoWidth':true 216 }, config); 217 218 var NextCarousel = this; 219 220 221 //Remove any existing carousel nav 222 this.find(".NextNavWrapper").remove(); 223 224 $(NextCarousel).addClass("NextCarousel"); 225 var clippingDiv = $("<div />"); 226 $(clippingDiv).addClass("NextCarouselClippingRegion"); 227 this.wrap(clippingDiv); 228 229 var wrappingDiv = $("<div />"); 230 $(wrappingDiv).addClass("NextCarouselWrapper"); 231 this.parent().wrap(wrappingDiv); 232 233 var listItemDimensions = methods.getObjDimensions(this.find("li").first()); 234 var clippingRegionWidth = (listItemDimensions.width * settings.VisibleItems) - listItemDimensions.marginRight; 235 var itemCount = this.find("li").length; 236 237 var listWidth = listItemDimensions.width * itemCount;
238 var viewCount = Math.ceil(itemCount / settings.VisibleItems); 239 //console.log(listWidth + " " + listItemDimensions.marginRight + " " + clippingRegionWidth); 240 this.width(listWidth); 241 242 this.attr("data-viewindex", 0); 243 this.attr("data-viewcount", viewCount); 244 if (settings.AutoWidth) { 245 $(".NextCarouselWrapper").width(clippingRegionWidth); 246 $(".NextCarouselClippingRegion").width(clippingRegionWidth); 247 } 248 249 if ($(".NextCarouselWrapper").length) { 250 var options = { TargetElement: '.NextCarouselWrapper' }; 251 252 methods.TouchInit(options); 253 } 254 //Compact nav 255 if (settings.CompactNav && itemCount > settings.VisibleItems ) { 256 257 var navContainer = $("<div />"); 258 $(navContainer).addClass("NextNavWrapper"); 259 var navList = $("<ul />"); 260 var prevLinkItem = $("<li />"); 261 $(prevLinkItem).addClass("NextCarouselPrevious"); 262 $(prevLinkItem).addClass("disabled"); 263 var prevLink = $("<a href=\"#\">Previous</a>"); 264 $(prevLink).click(function () { 265 methods.scrollCarouselRegion(NextCarousel, 'prev'); 266 return false; 267 }); 268 $(prevLinkItem).append(prevLink); 269 $(navList).append(prevLinkItem); 270 271 272 273 for (i = 0; i < viewCount; i++) { 274 275 var navItem = $("<li />"); 276 if (i == 0) { 277 $(navItem).addClass("NextCarouselLinkActive"); 278 } 279 var navLink = $("<a href=\"#\" >" + i + "</a>"); 280 $(navLink).click(function () { 281 methods.scrollCarouselRegion(NextCarousel, $(this).text()); 282 return false; 283 }); 284 $(navItem).append(navLink); 285 $(navList).append(navItem); 286 } 287 288 var nextLinkItem = $("<li />"); 289 $(nextLinkItem).addClass("NextCarouselNext"); 290 291 var nextLink = $("<a href=\"#\">Next</a>"); 292 $(nextLink).click(function () { 293 methods.scrollCarouselRegion(NextCarousel, 'next'); 294 return false; 295 }); 296 297 $(nextLinkItem).append(nextLink); 298 $(navList).append(nextLinkItem); 299 300 $(navContainer).append(navList); 301 this.parent().after(navContainer); 302 303 var ulWidth = 0; 304 $(navList).find("li").each(function () { 305 ulWidth += $(this).outerWidth(true); 306 }) 307 $(navList).width(ulWidth); 308 $(navContainer).width(ulWidth); 309 310 } 311 312 313 if (settings.LeftRightNav && itemCount > settings.VisibleItems) { 314 315 var prevLinkLarge = $("<a class=\"NextCarouselLeft\" href=\"#\" >Previous</a>"); 316 $(prevLinkLarge).click(function () { 317 methods.scrollCarouselRegion(NextCarousel, 'prev'); 318 return false; 319 }); 320 var nextLinkLarge = $("<a class=\"NextCarouselRight\" href=\"#\" >Next</a>"); 321 $(nextLinkLarge).click(function () { 322 methods.scrollCarouselRegion(NextCarousel, 'next'); 323 return false; 324 }); 325 this.parent().before(prevLinkLarge); 326 this.parent().after(nextLinkLarge); 327 } 328 329 //console.log("classes added"); 330 331 }; 332})(jQuery); 333 334////////////////////////////////////SlideWindow 335(function ($) { 336 var methods = { 337 338 init: function (options) { 339 this.addClass("NextSlideWindow"); 340 var NextSlideWindow = this; 341 var heading = this.children().first(); 342 var $headingTitle = heading.find(".Title"); 343 var content = $(heading).next(); 344 var contentHeight = $(content).height(); 345 var openButton = $("<a href=\"#\" class=\"btnOpen\" >Show</a>"); 346 var closeButton = $("<a href=\"#\" class=\"btnClose\" >Hide</a>"); 347 348 var headingHeight = heading.outerHeight(true); 349 350 //Open/////////// 351 $(openButton).click(function () { 352 353 var targetHeight; 354 355 if($(NextSlideWindow).hasClass("ReviewContainer")) { 356 var reviewContent = $(".reviewContent"); 357 var containerHeight = $(reviewContent).height(); 358 if (containerHeight == 0 ) { 359 var itemCount = $(reviewContent).find("ul li.reviewBlock").size(); 360 containerHeight = itemCount * 265; 361 } 362 targetHeight = containerHeight + 17; 363 } 364 else if($(NextSlideWindow).hasClass("Categories")) { 365 targetHeight = 340; 366 } 367 else { 368 targetHeight = 170; 369 } 370 371 $(NextSlideWindow).animate({ 372 height: "+=" + targetHeight 373 }, 500, function(){ 374 $(NextSlideWindow).removeAttr("style"); 375 }); 376 377 378 if(!$(".ProductPage").length){ 379 $("html,body").animate({scrollTop: $(NextSlideWindow).offset().top - $(".PageHeader").height()}, "easeOutCubic"); 380 } 381 382 $(closeButton).show(); 383 $(openButton).hide(); 384 385 $(heading).next().fadeIn(300); 386 387 return false; 388 }); 389 390 //Close/////////// 391 $(closeButton).click(function () { 392 393 $(NextSlideWindow).animate({ 394 height: headingHeight 395 }, 500); 396 397 $(closeButton).hide(); 398 $(openButton).show(); 399 400 $(heading).next().fadeOut(300);
401 if ($(NextSlideWindow).hasClass("ReviewContainer")) { 402 $(".reviewPagination").fadeOut(300); 403 } 404 return false; 405 }); 406 407 408 409 $headingTitle.after(closeButton); 410 $headingTitle.after(openButton); 411 412 $(openButton).hide(); 413 }, 414 415 Open: function(){ 416 417 var targetHeight; 418 var animate = true; 419 if(this.hasClass("ReviewContainer")) { 420 animate = false; 421 this.removeAttr("style"); 422 } 423 else if(this.hasClass("Categories")) { 424 targetHeight = 340; 425 } 426 else { 427 targetHeight = 170; 428 } 429 430 431 432 if(animate){ 433 this.animate({ 434 height: "+=" + targetHeight 435 }, 500, function(){ 436 437 }); 438 } 439 440 var heading = this.children().first(); 441 442 this.find("a.btnOpen").hide(); 443 this.find("a.btnClose").show(); 444 445 $(heading).next().fadeIn(300); 446 447 }, 448 Close: function(){ 449 450 this.animate({ 451 height: 54 452 }, 500); 453 454 var heading = this.children().first(); 455 456 this.find("a.btnOpen").show(); 457 this.find("a.btnClose").hide(); 458 459 $(heading).next().fadeOut(300); 460 461 }, 462 DataBind: function (data, suppressAnimation) { 463 464 var heading = this.children().first(); 465 var content = $(heading).next(); 466 // var currentContentHeight = $(content).height(); 467 $(content).html(data); 468 469 470 471 if(!suppressAnimation){ 472 473 var openButton = $(this).find("a.btnOpen"); 474 475 if($(openButton).css('display') == 'block' || $(openButton).css('display') == 'inline') 476 { 477 $(openButton).click(); 478 }else{ 479 480 var targetHeight = $(".reviewContent").height() + 71; 481 $(this).animate({ 482 height: targetHeight 483 }, 500); 484 } 485 }else{ 486 $(this).find("a.btnClose").click(); 487 488 } 489 490 491 } 492 493 }; 494 495 496 $.fn.NextSlideWindow = function (method) { 497 498 if (methods[method]) { 499 return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 500 } else if (typeof method === 'object' || !method) { 501 return methods.init.apply(this, arguments); 502 } else { 503 $.error('Method ' + method + ' does not exist on jQuery.validateControl'); 504 } 505 }; 506 507})(jQuery); 508 509 510/////////////////////////////////////Helper PopUp 511(function ($) { 512 513 514 var methods = { 515 516 517 518 519 }; 520 521 $.fn.NextHelperPopUp = function (config) { 522 523 var settings = $.extend({ 524 'target': '', 525 'align': 'right', 526 'autoClose': true, 527 'width': 0 528 }, config); 529 530 531 532 this.mouseover(function () { 533 var $this = this; 534 $($this).addClass("popTargetOver"); 535 536 if(settings.delay){ 537 538 setTimeout(function(){ 539 if($($this).hasClass("popTargetOver")){ 540 showDialoguePopUp($this, settings); 541 } 542 543 },settings.delay); 544 545 }else{ 546 showDialoguePopUp($this, settings); 547 } 548 }); 549 550 this.mouseout(function(){ 551 var $this = this; 552 $($this).removeClass("popTargetOver"); 553 }); 554 555 556 }; 557})(jQuery); 558 559 560function hideDialoguePopUp(src) { 561 562 var customDdl = $(src).parent("div.dk_container"); 563 if (customDdl.length) { 564 src = customDdl; 565 } 566 567 var animateValue = "-=15"; 568 569 var dialougue = $(src).next(".NextHelperPopUp"); 570 571 if ($(dialougue).length) { 572 $(dialougue).animate({ 573 opacity: 'toggle', 574 left: animateValue 575 }, 200, function () { $(dialougue).remove(); }); 576 } 577 578} 579 580 581 582function showDialoguePopUp(src, settings) { 583 584 var customDdl = $(src).parent("div.dk_container"); 585 if (customDdl.length) { 586 customDdl.attr("data-description", $(src).attr("data-description")); 587 src = customDdl; 588 if (typeof settings !== "undefined") { 589 settings.marginTop = (settings.customMarginTop ? settings.customMarginTop : 0); 590 settings.marginLeft = (settings.customMarginLeft ? settings.customMarginLeft : 0) - 12; 591 } 592 593 } 594 //Don't add dialogue if it has already been added 595 if ($(src).next().hasClass("NextHelperPopUp")) { 596 return false; 597 } 598
599 var title = $(src).attr("data-name"); 600 var description = $(src).attr("data-description"); 601 var icon = $(src).attr("data-icon"); 602 603 if (title == null) { 604 if (typeof settings !== "undefined") { 605 title = settings.title; 606 } 607 } 608 609 if (description == null) { 610 if (typeof settings !== "undefined") { 611 description = settings.description; 612 } 613 614 } 615 616 if (icon == null) { 617 if (typeof settings !== "undefined") { 618 icon = settings.icon; 619 } 620 621 } 622 623 var dialougue = $("<div class=\"NextHelperPopUp\" />"); 624 if (typeof settings !== "undefined" && settings.errorMessage) { 625 $(dialougue).addClass("errorMessage"); 626 } 627 628 if (typeof settings !== "undefined" && settings.customCSS) { 629 $(dialougue).attr("style", settings.customCSS); 630 } 631 632 633 if (icon != null) { 634 var img = $("<img />"); 635 $(img).attr("src", icon).addClass("popIcon"); 636 $(dialougue).append(img); 637 } 638 639 640 var heading = $("<h3 />"); 641 var para = $("<p />"); 642 643 if (title != null) { 644 $(heading).html(title); 645 } 646 647 $(para).html(description); 648 649 650 if (typeof settings !== "undefined" && settings.color) { 651 $(para).css("color", settings.color); 652 } 653 654 if ($(src).attr("data-description-id")) 655 $(para).html($('#' + $(src).attr("data-description-id")).html()); 656 if (title != null) { 657 $(dialougue).append(heading); 658 } 659 $(dialougue).append(para); 660 661 //Apend dialogue to element 662 if (typeof settings !== "undefined" && ($(settings.target).length > 0)) { 663 $(target).append(dialougue); 664 } else { 665 $(src).after(dialougue); 666 } 667 668 if (typeof settings !== "undefined" && settings.width > 0) { 669 $(dialougue).width(settings.width); 670 } 671 672 var dialogueHeight = $(dialougue).height(); 673 674 if (icon != null) { 675 $(img).css("margin-bottom", dialogueHeight - $(img).height()); 676 } 677 678 var srcHeight = $(src).outerHeight(true); 679 var srcWidth = $(src).width(); 680 var srcOffset = $(src).offset(); 681 682 var animateValue = "-=15"; 683 var dialogueWidth = $(dialougue).width(); 684 685 var customLeftMargin = 0; 686 687 if (typeof settings !== "undefined" && settings.marginLeft) { 688 customLeftMargin = settings.marginLeft; 689 } 690 691 var customMarginTop = 0; 692 if (typeof settings !== "undefined" && settings.marginTop) { 693 customMarginTop = settings.marginTop; 694 } 695 696 if (typeof settings !== "undefined" && settings.customClassName) { 697 $(dialougue).addClass(settings.customClassName); 698 } 699 700 if (typeof settings !== "undefined") { 701 switch (settings.align) { 702 case 'top': 703 var offsetTop = srcOffset.top - (dialogueHeight + (srcHeight * 2)); 704 $(dialougue).offset({ left: srcOffset.left + customLeftMargin, top: offsetTop + customMarginTop }); 705 $(dialougue).addClass("popTop"); 706 break; 707 case 'right': 708 var offsetTop = srcOffset.top - (dialogueHeight / 2); 709 if (settings.errorMessage) { 710 offsetTop = srcOffset.top - (srcHeight / 2); 711 } 712 var offsetLeft = srcOffset.left + srcWidth + 35; 713 $(dialougue).offset({ left: offsetLeft + customLeftMargin, top: offsetTop + customMarginTop }); 714 $(dialougue).addClass("popRight"); 715 break; 716 case 'left': 717 var offsetTop = srcOffset.top - (dialogueHeight / 2); 718 var offsetLeft = srcOffset.left - $(dialougue).width() - 45; 719 $(dialougue).offset({ left: offsetLeft + customLeftMargin, top: offsetTop + customMarginTop }); 720 $(dialougue).addClass("popLeft"); 721 animateValue = "+=15"; 722 break; 723 case 'bottom': 724 var offsetTop = srcOffset.top + srcHeight + 13; 725 var offsetLeft = srcOffset.left - (dialogueWidth/2); 726 $(dialougue).offset({ left: offsetLeft + customLeftMargin, top: offsetTop + customMarginTop }); 727 $(dialougue).addClass("popBottom"); 728 animateValue = "+=15"; 729 break; 730 731 732 } 733 } 734 735 $(dialougue).hide(); 736 737 //Animate dialogue into view 738 $(dialougue).animate({ 739 opacity: 'toggle', 740 left: animateValue 741 }, 200 ); 742 743 if (typeof settings !== "undefined" && settings.autoClose) { 744 $(src).mouseleave(function () { 745 $(dialougue).animate({ 746 opacity: 'toggle', 747 left: animateValue 748 }, 200, function () { $(this).remove(); } 749 ); 750 }); 751 } 752 753 754 755 if (typeof settings !== "undefined" && settings.closeOnDialogueOut) { 756 $(dialougue).mouseleave(function () { 757 $(dialougue).animate({ 758 opacity: 'toggle', 759 left: animateValue 760 }, 200, function () { $(this).remove(); } 761 ); 762 }); 763 } 764 765 766 767} 768 769 770 771 772 773
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.