1// Name: SlideShow.SlideShowBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.7.1213 4// FileVersion: 4.1.7.1213 5// (c) 2010 CodePlex Foundation 6 7 8 9/// <reference name="MicrosoftAjax.debug.js" /> 10/// <reference path="../ExtenderBase/BaseScripts.js" /> 11/// <reference path="../Common/Common.js" /> 12/// <reference path="../Compat/Timer/Timer.js" /> 13 14(function () { 15 var scriptName = "ExtendedSlideShow"; 16 17 function execute() { 18 19 Type.registerNamespace('Sys.Extended.UI'); 20 Sys.Extended.UI.SlideShowBehavior = function (element) { 21 /// <summary> 22 /// creates a new slide show behavior 23 /// </summary> 24 /// <param name="element" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false" /> 25 /// <returns /> 26 Sys.Extended.UI.SlideShowBehavior.initializeBase(this, [element]); 27 this._nextButtonID = null; 28 this._previousButtonID = null; 29 this._imageDescriptionLabelID = null; 30 this._imageTitleLabelID = null; 31 this._playButtonID = null; 32 this._playButtonValue = '||>'; 33 this._stopButtonValue = '[]'; 34 this._slideShowServicePath = location.pathname; 35 this._slideShowServiceMethod = null; 36 this._contextKey = null; 37 this._useContextKey = false; 38 this._playInterval = 3000; 39 this._tickHandler = null; 40 this._loop = false; 41 this._autoPlay = false; 42 this._slideShowAnimationType = Sys.Extended.UI.SlideShowAnimationType.None; 43 this._imageHeight = 300; 44 this._imageWidth = 400; 45 46 this._inPlayMode = false; 47 this._elementImage = null; 48 this._bNext = null; 49 this._bPrevious = null; 50 this._currentIndex = -1; 51 this._currentValue = null; 52 this._imageDescriptionLabel = null; 53 this._imageTitleLabel = null; 54 this._bPlay = null; 55 this._slides = null; 56 this._timer = null; 57 this._currentImageElement = null; 58 this._images = null; 59 this._cachedImageIndex = -1; 60 this._current = 0; 61 this._previousImage = null; 62 this._currentImage = null; 63 this._nextImage = null; 64 this._isNext = false; 65 66 this._clickNextHandler = null; 67 this._clickPreviousHandler = null; 68 this._clickPlayHandler = null; 69 this._tickHandler = null; 70 this._imageLoadedHandler = null; 71 72 } 73 Sys.Extended.UI.SlideShowBehavior.prototype = { 74 initialize: function () { 75 ///<summary> 76 /// Initialize the slide show. 77 /// </summary> 78 /// <returns /> 79 80 Sys.Extended.UI.SlideShowBehavior.callBaseMethod(this, 'initialize'); 81 var e = this.get_element(); 82 this._elementImage = e; 83 84 if (!this.supportsAnimation('transition')) { 85 this._slideShowAnimationType = Sys.Extended.UI.SlideShowAnimationType.None; 86 } 87 88 if (this._slideShowAnimationType != Sys.Extended.UI.SlideShowAnimationType.SlideRight || 89 this._slideShowAnimationType != Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 90 91 this._currentImageElement = document.createElement('IMG'); 92 this._currentImageElement.style.display = 'none'; 93 document.body.appendChild(this._currentImageElement); 94 95 var _divContent = document.createElement('DIV'); 96 e.parentNode.insertBefore(_divContent, e); 97 e.parentNode.removeChild(e); 98 _divContent.appendChild(e); 99 _divContent.align = 'center'; 100 101 this._imageLoadedHandler = Function.createDelegate(this, this._onImageLoaded); 102 $addHandler(this._currentImageElement, 'load', this._imageLoadedHandler); 103 } 104 105 this.controlsSetup(); 106 if (this._bNext) { 107 this._clickNextHandler = Function.createDelegate(this, this._onClickNext); 108 $addHandler(this._bNext, 'click', this._clickNextHandler); 109 } 110 if (this._bPrevious) { 111 this._clickPreviousHandler = Function.createDelegate(this, this._onClickPrevious); 112 $addHandler(this._bPrevious, 'click', this._clickPreviousHandler); 113 } 114 if (this._bPlay) { 115 this._clickPlayHandler = Function.createDelegate(this, this._onClickPlay); 116 $addHandler(this._bPlay, 'click', this._clickPlayHandler); 117 } 118 119 this._slideShowInit(); 120 }, 121 122 dispose: function () { 123 ///<summary> 124 /// Dispose the handlers and perform other slide show cleanup. 125 /// </summary> 126 /// <returns /> 127 128 if (this._clickNextHandler) { 129 $removeHandler(this._bNext, 'click', this._clickNextHandler); 130 this._clickNextHandler = null; 131 } 132 if (this._clickPreviousHandler) { 133 $removeHandler(this._bPrevious, 'click', this._clickPreviousHandler); 134 this._clickPreviousHandler = null; 135 } 136 if (this._clickPlayHandler) { 137 $removeHandler(this._bPlay, 'click', this._clickPlayHandler); 138 this._clickPlayHandler = null; 139 } 140 if (this._imageLoadedHandler) { 141 $removeHandler(this._currentImageElement, 'load', this._imageLoadedHandler); 142 this._imageLoadedHandler = null; 143 } 144 if (this._timer) { 145 this._timer.dispose(); 146 this._timer = null; 147 } 148 Sys.Extended.UI.SlideShowBehavior.callBaseMethod(this, 'dispose'); 149 }, 150 151 add_slideChanged: function (handler) { 152 ///<summary> 153 /// Add handler for the <code>slideChanged</code> Event. 154 /// </summary> 155 /// <param name="handler" type="Function" mayBeNull="false" /> 156 /// <returns /> 157 this.get_events().addHandler('slideChanged', handler); 158 }, 159 remove_slideChanged: function (handler) { 160 ///<summary> 161 /// Remove handler for the <code>slideChanged</code> Event. 162 /// </summary> 163 /// <param name="handler" type="Function" mayBeNull="false"/> 164 /// <returns /> 165 this.get_events().removeHandler('slideChanged', handler); 166 }, 167 raiseSlideChanged: function (eventArgs) { 168 ///<summary> 169 /// Raise the <code>slideChanged</code> Event. 170 /// </summary> 171 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true"/> 172 /// <returns /> 173 var handler = this.get_events().getHandler('slideChanged'); 174 if (handler) { 175 if (!eventArgs) { 176 eventArgs = Sys.EventArgs.Empty; 177 } 178 handler(this, eventArgs); 179 } 180 }, 181 182 add_slideChanging: function (handler) { 183 ///<summary> 184 /// Add handler for the <code>slideChanging</code> Event. 185 /// </summary> 186 /// <param name="handler" type="Function" mayBeNull="false" /> 187 /// <returns /> 188 this.get_events().addHandler('slideChanging', handler); 189 }, 190 remove_slideChanging: function (handler) { 191 ///<summary> 192 /// Remove handler for the <code>slideChanging</code> Event. 193 /// </summary> 194 /// <param name="handler" type="Function" mayBeNull="false"/> 195 /// <returns /> 196 this.get_events().removeHandler('slideChanging', handler); 197 }, 198 raiseSlideChanging: function (previousSlide, newSlide) { 199 ///<summary> 200 /// Raise the <code>slideChanging</code> Event. 201 /// </summary> 202 /// <param name="previousSlide" type="Object" mayBeNull="true"/> 203 /// <param name="nextSlide" type="Object" mayBeNull="true"/> 204 /// <returns type="Boolean" /> 205 var handler = this.get_events().getHandler('slideChanging'); 206 if (handler) { 207 var eventArgs = new Sys.Extended.UI.SlideShowEventArgs(previousSlide, newSlide, this._currentIndex); 208 handler(this, eventArgs); 209 return eventArgs.get_cancel(); 210 } 211 return false; 212 }, 213 214 get_contextKey: function () { 215 /// <value type="String" mayBeNull="true"> 216 /// User/page specific context provided to an optional overload of the 217 /// web method described by ServiceMethod/ServicePath. If the context 218 /// key is used, it should have the same signature with an additional 219 /// parameter named contextKey of type string. 220 /// </value> 221 return this._contextKey; 222 }, 223 set_contextKey: function (value) { 224 if (this._contextKey != value) { 225 this._contextKey = value; 226 this.set_useContextKey(true); 227 if (this._elementImage) { 228 this._slideShowInit(); 229 } 230 this.raisePropertyChanged('contextKey'); 231 } 232 }, 233 234 get_useContextKey: function () { 235 /// <value type="Boolean"> 236 /// Whether or not the ContextKey property should be used. This will be 237 /// automatically enabled if the ContextKey property is ever set 238 /// (on either the client or the server). If the context key is used, 239 /// it should have the same signature with an additional parameter 240 /// named contextKey of type string. 241 /// </value> 242 return this._useContextKey; 243 }, 244 set_useContextKey: function (value) { 245 if (this._useContextKey != value) { 246 this._useContextKey = value; 247 this.raisePropertyChanged('useContextKey'); 248 } 249 }, 250 251 get_imageWidth: function () { 252 /// <value type="integer"> 253 /// To fix the size of container to display slides smoothly. 254 /// </value> 255 return this._imageWidth; 256 }, 257 set_imageWidth: function (value) { 258 if (this._imageWidth != value) { 259 this._imageWidth = value; 260 this.raisePropertyChanged('imageWidth'); 261 } 262 }, 263 264 get_imageHeight: function () { 265 /// <value type="integer"> 266 /// To fix the size of container to display slides smoothly. 267 /// </value> 268 return this._imageHeight; 269 }, 270 set_imageHeight: function (value) { 271 if (this._imageHeight != value) { 272 this._imageHeight = value; 273 this.raisePropertyChanged('imageHeight'); 274 } 275 }, 276 277 controlsSetup: function () { 278 /// <summary> 279 /// Get handles to various slide show controls if specified. 280 /// </summary> 281 /// <returns /> 282 if (this._previousButtonID) { 283 this._bPrevious = document.getElementById(this._previousButtonID); 284 } 285 if (this._imageDescriptionLabelID) { 286 this._imageDescriptionLabel = document.getElementById(this._imageDescriptionLabelID); 287 } 288 if (this._imageTitleLabelID) { 289 this._imageTitleLabel = document.getElementById(this._imageTitleLabelID); 290 } 291 if (this._nextButtonID) { 292 this._bNext = document.getElementById(this._nextButtonID); 293 } 294 if (this._playButtonID) { 295 this._bPlay = document.getElementById(this._playButtonID); 296 this._bPlay.value = this._playButtonValue; 297 } 298 }, 299 300 resetButtons: function () { 301 /// <summary> 302 /// Maintain the various buttons states. 303 /// </summary> 304 /// <returns /> 305 306 if (!this._loop) { 307 if (this._slides.length <= this._currentIndex + 1) { 308 if (this._bNext) this._bNext.disabled = true; 309 if (this._bPlay) this._bPlay.disabled = true; 310 if (this._bPrevious) this._bPrevious.disabled = false; 311 this._inPlayMode = false; 312 if (this._timer) { 313 this._timer.set_enabled(false); 314 } 315 if (this._bPlay) this._bPlay.value = this._playButtonValue; 316 317 } else { 318 if (this._bNext) this._bNext.disabled = false; 319 if (this._bPlay) this._bPlay.disabled = false; 320 } 321 if (this._currentIndex <= 0) { 322 if (this._bPrevious) this._bPrevious.disabled = true; 323 } else { 324 if (this._bPrevious) this._bPrevious.disabled = false; 325 } 326 } 327 else { 328 if (this._slides.length == 0) { 329 if (this._bPrevious) this._bPrevious.disabled = true; 330 if (this._bNext) this._bNext.disabled = true; 331 if (this._bPlay) this._bPlay.disabled = true; 332 } 333 } 334 if (this._inPlayMode) { 335 this._timer.set_enabled(false); 336 this._timer.set_enabled(true); 337 } 338 }, 339 340 resetSlideShowButtonState: function () { 341 /// <summary> 342 /// Maintain the play button state to reflect whether the slide show is in play mode. 343 /// </summary> 344 /// <returns /> 345 346 if (this._inPlayMode) { 347 if (this._bPlay) this._bPlay.value = this._stopButtonValue; 348 } 349 else { 350 this.resetButtons(); 351 if (this._bPlay) this._bPlay.value = this._playButtonValue; 352 } 353 }, 354 355 setCurrentImage: function () { 356 /// <summary> 357 /// Retrieve the current image. 358 /// </summary> 359 /// <returns /> 360 if (this._slides[this._currentIndex]) { 361 this._currentImageElement.src = this._slides[this._currentIndex].ImagePath; 362 if (this._slides[this._currentIndex].Url != null) { 363 this._currentImageElement.style.cursor = 'pointer'; 364 this._currentImageElement.onclick = function () { window.open(this._slides[this._currentIndex].Url); }; 365 } 366 else { 367 this._currentImage
367Element.style.cursor = 'auto'; 368 this._currentImageElement.onclick = function () { }; 369 } 370 } else { 371 this._currentImageElement.src = ''; 372 } 373 if (Sys.Browser.agent == Sys.Browser.Opera) { 374 this._onImageLoaded(true); 375 } 376 }, 377 378 updateImage: function (value) { 379 /// <summary> 380 /// Set current image to be the specified Slide. 381 /// </summary> 382 /// <param name="value" type="Object" mayBeNull="false" /> 383 /// <returns /> 384 if (value) { 385 if (this.raiseSlideChanging(this._currentValue, value)) { 386 return; 387 } 388 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.FadeInOut) { 389 this._elementImage.className = "fadeIn"; 390 var me = this; 391 setTimeout(function () { 392 me._elementImage.className = "fadeOut"; 393 me.setImage(value); 394 }, 1000); 395 } 396 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.ScaleX) { 397 this._elementImage.className = "Animation scaleX"; 398 var me = this; 399 setTimeout(function () { 400 me._elementImage.className = "Animation"; 401 me.setImage(value); 402 }, 1000); 403 } 404 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.ScaleY) { 405 this._elementImage.className = "Animation scaleY"; 406 var me = this; 407 setTimeout(function () { 408 me._elementImage.className = "Animation"; 409 me.setImage(value); 410 }, 1000); 411 } 412 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.ZoomInOut) { 413 this._elementImage.className = "Animation zoomOut"; 414 var me = this; 415 setTimeout(function () { 416 me._elementImage.className = "Animation zoomIn"; 417 me.setImage(value); 418 }, 1000); 419 } 420 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.Rotate) { 421 this._elementImage.className = "Animation rotate"; 422 var me = this; 423 setTimeout(function () { 424 me._elementImage.className = "Animation"; 425 me.setImage(value); 426 }, 1000); 427 } 428 else { 429 this.setImage(value); 430 } 431 } 432 }, 433 434 setImage: function (value) { 435 this._currentValue = value; 436 this._elementImage.src = value.ImagePath; 437 this._elementImage.alt = value.Name; 438 439 if (this._imageDescriptionLabel) { 440 this._imageDescriptionLabel.innerHTML = value.Description ? value.Description : ""; 441 } 442 if (this._imageTitleLabel) { 443 this._imageTitleLabel.innerHTML = value.Name ? value.Name : ""; 444 } 445 446 if (value.Url != null) { 447 this._elementImage.style.cursor = 'pointer'; 448 this._elementImage.onclick = function () { window.open(value.Url); } 449 } 450 else { 451 this._elementImage.style.cursor = 'auto'; 452 this._elementImage.onclick = function () { } 453 } 454 455 this.raiseSlideChanged(value); 456 this.resetButtons(); 457 }, 458 459 get_imageDescriptionLabelID: function () { 460 /// <value type="String" mayBeNull="true"> 461 /// ID of the label that describes the current slide. 462 /// </value> 463 return this._imageDescriptionLabelID;
464 }, 465 set_imageDescriptionLabelID: function (value) { 466 if (this._imageDescriptionLabelID != value) { 467 this._imageDescriptionLabelID = value; 468 this.raisePropertyChanged('imageDescriptionLabelID'); 469 } 470 }, 471 472 get_imageTitleLabelID: function () { 473 /// <value type="String" mayBeNull="true"> 474 /// ID of the label that shows the title of the current slide. 475 /// </value> 476 return this._imageTitleLabelID; 477 }, 478 set_imageTitleLabelID: function (value) { 479 if (this._imageTitleLabelID != value) { 480 this._imageTitleLabelID = value; 481 this.raisePropertyChanged('imageTitleLabelID'); 482 } 483 }, 484 485 get_nextButtonID: function () { 486 /// <value type="String" mayBeNull="true"> 487 /// ID on the next button. 488 /// </value> 489 return this._nextButtonID; 490 }, 491 set_nextButtonID: function (value) { 492 if (this._nextButtonID != value) { 493 this._nextButtonID = value; 494 this.raisePropertyChanged('nextButtonID'); 495 } 496 }, 497 498 get_playButtonID: function () { 499 /// <value type="String" mayBeNull="true"> 500 /// ID on the play button. 501 /// </value> 502 return this._playButtonID; 503 }, 504 set_playButtonID: function (value) { 505 if (this._playButtonID != value) { 506 this._playButtonID = value; 507 this.raisePropertyChanged('playButtonID'); 508 } 509 }, 510 511 get_playButtonText: function () { 512 /// <value type="String" mayBeNull="true"> 513 /// Text in play button to play the slide show when it is not playing. 514 /// </value> 515 return this._playButtonValue; 516 }, 517 set_playButtonText: function (value) { 518 if (this._playButtonValue != value) { 519 this._playButtonValue = value; 520 this.raisePropertyChanged('playButtonText'); 521 } 522 }, 523 524 get_stopButtonText: function () { 525 /// <value type="String" mayBeNull="true"> 526 /// Text in play button to stop the slide show when it is playing. 527 /// </value> 528 return this._stopButtonValue; 529 }, 530 set_stopButtonText: function (value) { 531 if (this._stopButtonValue != value) { 532 this._stopButtonValue = value; 533 this.raisePropertyChanged('stopButtonText'); 534 } 535 }, 536 537 get_playInterval: function () { 538 /// <value type="Number" integer="true" mayBeNull="true"> 539 /// Interval in milliseconds between slide switches. 540 /// </value> 541 return this._playInterval; 542 }, 543 set_playInterval: function (value) { 544 if (this._playInterval != value) { 545 this._playInterval = value; 546 this.raisePropertyChanged('playInterval'); 547 } 548 }, 549 550 get_previousButtonID: function () { 551 /// <value type="String" mayBeNull="true"> 552 /// ID of the previous button. 553 /// </value> 554 return this._previousButtonID; 555 }, 556 set_previousButtonID: function (value) { 557 if (this._previousButtonID != value) { 558 this._previousButtonID = value; 559 this.raisePropertyChanged('previousButtonID'); 560 } 561 }, 562 563 get_slideShowServicePath: function () { 564 /// <value type="String" mayBeNull="true"> 565 /// Slide show webservice path to pull the images. 566 /// </value> 567 return this._slideShowServicePath; 568 }, 569 570 set_slideShowServicePath: function (value) { 571 if (this._slideShowServicePath != value) { 572 this._slideShowServicePath = value; 573 this.raisePropertyChanged('slideShowServicePath'); 574 } 575 }, 576 577 get_slideShowServiceMethod: function () { 578 /// <value type="String" mayBeNull="false"> 579 /// Slide show webservice methods that will return the slide images. 580 /// </value> 581 return this._slideShowServiceMethod; 582 }, 583 set_slideShowServiceMethod: function (value) { 584 if (this._slideShowServiceMethod != value) { 585 this._slideShowServiceMethod = value; 586 this.raisePropertyChanged('slideShowServiceMethod'); 587 } 588 }, 589 590 get_loop: function () { 591 /// <value type="Boolean" mayBeNull="true"> 592 /// boolean to detect if slideshow should wrap around on hitting the first/last slides. 593 /// </value> 594 return this._loop; 595 }, 596 set_loop: function (value) { 597 if (this._loop != value) { 598 this._loop = value; 599 this.raisePropertyChanged('loop'); 600 } 601 }, 602 603 get_autoPlay: function () { 604 /// <value type="Boolean" mayBeNull="true"> 605 /// boolean to detect if slide show should start playing on render. 606 /// </value> 607 return this._autoPlay; 608 }, 609 set_autoPlay: function (value) { 610 if (this._autoPlay != value) { 611 this._autoPlay = value; 612 this.raisePropertyChanged('autoPlay'); 613 } 614 }, 615 616 get_slideShowAnimationType: function () { 617 /// <value type="SlideShowAnimationType" mayBeNull="false"> 618 /// animation type that will happen when slide will change. 619 /// </value> 620 return this._slideShowAnimationType; 621 }, 622 set_slideShowAnimationType: function (value) { 623 if (this._slideShowAnimationType != value) { 624 this._slideShowAnimationType = value; 625 this.raisePropertyChanged('slideShowAnimationType'); 626 } 627 }, 628 629 _onClickNext: function (e) { 630 /// <summary> 631 /// Next button click handler. 632 /// </summary> 633 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false" /> 634 /// <returns /> 635 636 e.preventDefault(); 637 e.stopPropagation(); 638 this._clickNext(); 639 }, 640 641 _onImageLoaded: function (e) { 642 /// <summary> 643 /// Image loaded handler. 644 /// </summary> 645 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 646 /// <returns /> 647 this.updateImage(this._slides[this._currentIndex]); 648 this.resetButtons(); 649 this._cacheImages(); 650 }, 651 652 _clickNext: function () { 653 /// <summary> 654 /// Switches slide show to displaying the next slide. 655 /// </summary> 656 /// <returns /> 657 658 if (this._slides) { 659 if ((this._currentIndex + 1) < this._slides.length) { 660 ++this._currentIndex; 661 } else if (this._loop) { 662 this._currentIndex = 0; 663 } else { 664 return false; 665 } 666 667 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 668 this._isNext = true; 669 this.setCurrentSlide(); 670 } 671 else { 672 this.setCurrentImage(); 673 } 674 return true; 675 } 676 return false; 677 }, 678 679 _onClickPrevious: function (e) { 680 /// <summary> 681 /// Previous button click handler. 682 /// </summary> 683 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 684 /// <returns /> 685 686 e.preventDefault(); 687 e.stopPropagation(); 688 this._clickPrevious(); 689 690 }, 691 692 _clickPrevious: function () { 693 /// <summary> 694 /// Switches slide show to displaying the previous slide. 695 /// </summary> 696 /// <returns /> 697 698 if (this._slides) { 699 if ((this._currentIndex - 1) >= 0) { 700 --this._currentIndex; 701 } 702 else if (this._loop) { 703 this._currentIndex = this._slides.length - 1; 704 } else { 705 return false; 706 } 707 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 708 this._isNext = false; 709 this.setCurrentSlide(); 710 } 711 else { 712 this.setCurrentImage(); 713 } 714 return true; 715 } 716 return false; 717 }, 718 719 _onClickPlay: function (e) { 720 /// <summary> 721 /// Play button click handler. 722 /// </summary> 723 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 724 /// <returns /> 725 726 e.preventDefault(); 727 e.stopPropagation(); 728 this._play(); 729 }, 730 731 _play: function () { 732 /// <summary> 733 /// Maintains timer state/slide show buttons state and creates handler to switch images in play mode 734 /// if not already in play mode. 735 /// </summary> 736 /// <returns /> 737 if (this._inPlayMode) { 738 this._inPlayMode = false; 739 this._timer.set_enabled(false); 740 this.resetSlideShowButtonState(); 741 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 742 if (this._bNext) this._bNext.disabled = false; 743 if (this._bPrevious) this._bPrevious.disabled = false; 744 } 745 } else { 746 this._inPlayMode = true; 747 if (!this._timer) { 748 this._timer = new Sys.Timer(); 749 this._timer.set_interval(this._playInterval); 750 this._tickHandler = Function.createDelegate(this, this._onPlay); 751 this._timer.add_tick(this._tickHandler); 752 } 753 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 754 if (this._bNext) this._bNext.disabled = true; 755 if (this._bPrevious) this._bPrevious.disabled = true; 756 } 757 this.resetSlideShowButtonState(); 758 this._timer.set_enabled(true); 759 } 760 }, 761 762 _onPlay: function (e) { 763 /// <summary> 764 /// Sets the slide show to the current image in play mode and maintains button state. 765 /// </summary> 766 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 767 /// <returns type="Boolean" /> 768 if (this._slides) { 769 if ((this._currentIndex + 1) < this._slides.length) { 770 ++this._currentIndex; 771 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 772 this._isNext = true; 773 this.setCurrentSlide(); 774 } 775 else { 776 this.setCurrentImage(); 777 } 778 return true; 779 } else if (this._loop) { 780 this._currentIndex = 0; 781 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight || this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 782 this._isNext = true; 783 this.setCurrentSlide(); 784 } 785 else { 786 this.setCurrentImage(); 787 } 788 return true; 789 } else { 790 this._inPlayMode = false; 791 this.resetSlideShowButtonState(); 792 } 793 } 794 return false; 795 }, 796 797 _slideShowInit: function () { 798 /// <summary> 799 /// Initializes the slide show by invoking the webservice to retrieve the slides 800 /// and sets the first slide. 801 /// </summary> 802 /// <returns /> 803 this._currentIndex = -1; 804 this._cachedImageIndex = -1; 805 this._inPlayMode = false; 806 this._currentValue = null; 807 this._images = null; 808 var params = null; 809 if (this._useContextKey) { 810 params = { contextKey: this._contextKey }; 811 } 812 813 Sys.Net.WebServiceProxy.invoke( 814 this._slideShowServicePath, 815 this._slideShowServiceMethod, 816 false, 817 params, 818 Function.createDelegate(this, this._initSlides), 819 null, 820 null); 821 }, 822 823 _initSlides: function (sender, eventArgs) { 824 /// <summary> 825 /// Initializes the slide show with the first image and configures the specified play settings. 826 /// </summary> 827 /// <param name="sender" type="Object" mayBeNull="true"/> 828 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true" /> 829 /// <returns /> 830 831 this._slides = sender; 832 if (this._slides) { 833 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight) { 834 this._createElementsForSlideRight(); 835 this._setInitialState(); 836 } 837 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 838 this._createElementsForSlideDown(); 839 this._setInitialState(); 840 } 841 else { 842 this._images = new Array(); 843 this._clickNext();
844 } 845 if (this._autoPlay) { 846 this._isNext = true; 847 this._play(); 848 } 849 } 850 }, 851 852 _cacheImages: function () { 853 /// <summary> 854 /// Caches 4 more slides periodically. 855 /// </summary> 856 /// <returns /> 857 858 if ((this._currentIndex) % 3 == 0) { 859 var oldCachedImageIndex = this._cachedImageIndex; 860 for (var i = this._cachedImageIndex + 1; i < this._slides.length; i++) { 861 if (this._slides[i]) { 862 this._images[i] = new Image(); 863 this._images[i].src = this._slides[i].ImagePath; 864 this._cachedImageIndex = i; 865 if ((oldCachedImageIndex + 4) <= i) { 866 break; 867 } 868 } 869 } 870 } 871 }, 872 873 _createElementsForSlideRight: function () { 874 var e = this.get_element(); 875 var _divContainer = document.createElement('DIV'); 876 _divContainer.id = e.id + '_slider'; 877 _divContainer.className = 'container'; 878 _divContainer.style.width = this._imageWidth + 'px'; 879 _divContainer.style.height = this._imageHeight + 'px'; 880 e.parentNode.insertBefore(_divContainer, e); 881 e.parentNode.removeChild(e); 882 _divContainer.appendChild(e); 883 _divContainer.align = 'center'; 884 885 var _divMask = document.createElement('DIV'); 886 _divMask.id = e.id + '_mask'; 887 _divMask.style.width = this._imageWidth + 'px'; 888 _divContainer.appendChild(_divMask); 889 890 this._images = new Array(); 891 for (var i = 0; i < this._slides.length; i++) { 892 var _divImage = document.createElement('DIV'); 893 _divImage.id = e.id + '_imageDiv' + i; 894 _divImage.style.position = 'absolute'; 895 _divImage.style.top = '0px'; 896 _divImage.className = 'slideAnimation'; 897 _divMask.appendChild(_divImage); 898 899 if (this._slides[i].Url != null) { 900 var _imageLink = document.createElement('A'); 901 _imageLink.href = this._slides[i].Url; 902 _imageLink.target = '_blank'; 903 _divImage.appendChild(_imageLink); 904 } 905 906 var _imageElement = document.createElement('IMG'); 907 _imageElement.style.width = this._imageWidth + 'px'; 908 _imageElement.style.height = this._imageHeight + 'px'; 909 _imageElement.src = this._slides[i].ImagePath; 910 if (this._slides[i].Url != null) 911 _imageLink.appendChild(_imageElement); 912 else 913 _divImage.appendChild(_imageElement); 914 this._images[i] = _divImage; 915 } 916 }, 917 918 _createElementsForSlideDown: function () { 919 var e = this.get_element(); 920 921 var _divContainer = document.createElement('DIV'); 922 _divContainer.id = e.id + '_slider'; 923 _divContainer.className = 'container'; 924 _divContainer.style.width = this._imageWidth + 'px'; 925 _divContainer.style.height = this._imageHeight + 'px'; 926 e.parentNode.insertBefore(_divContainer, e); 927 e.parentNode.removeChild(e); 928 _divContainer.appendChild(e); 929 _divContainer.align = 'center'; 930 931 var _divMask = document.createElement('DIV'); 932 _divMask.style.width = this._imageWidth + 'px'; 933 _divContainer.appendChild(_divMask); 934 935 var _ULContainer = document.createElement('UL'); 936 _ULContainer.style.className = 'sliderUL'; 937 _divMask.appendChild(_ULContainer); 938 939 this._images = new Array(); 940 for (var i = 0; i < this._slides.length; i++) { 941 var _LIImage = document.createElement('LI'); 942 _LIImage.id = e.id + '_imageDiv' + i; 943 _LIImage.style.position = 'absolute'; 944 _LIImage.className = 'slideAnimation'; 945 _ULContainer.appendChild(_LIImage); 946 947 if (this._slides[i].Url != null) { 948 var _imageLink = document.createElement('A'); 949 _imageLink.href = this._slides[i].Url; 950 _imageLink.target = '_blank'; 951 _LIImage.appendChild(_imageLink); 952 } 953 954 var _imageElement = document.createElement('IMG'); 955 _imageElement.style.width = this._imageWidth + 'px'; 956 _imageElement.style.height = this._imageHeight + 'px'; 957 _imageElement.src = this._slides[i].ImagePath; 958 if (this._slides[i].Url != null) 959 _imageLink.appendChild(_imageElement); 960 else 961 _LIImage.appendChild(_imageElement); 962 this._images[i] = _LIImage; 963 } 964 }, 965 966 _setInitialState: function () { 967 this._currentIndex++; 968 this._currentImage = this._images[this._currentIndex]; 969 this._nextImage = this._images.length > 1 ? this._images[this._currentIndex + 1] : this._images[this._currentIndex]; 970 971 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight) { 972 this._currentImage.style.left = '0px'; 973 for (var i = 1; i < this._images.length; i++) { 974 this._images[i].style.left = '-' + (this._imageWidth + 5) + 'px'; 975 } 976 } 977 else { 978 this._currentImage.style.top = '0px'; 979 for (var i = 0; i < this._images.length; i++) { 980 this._images[i].style.left = '0px'; 981 } 982 } 983 984 this._previousImage = this._images[this._images.length - 1]; 985 986 this._currentImage.style.width = this._imageWidth + 'px'; 987 this._nextImage.style.width = this._imageWidth + 'px'; 988 this._previousImage.style.width = this._imageWidth + 'px'; 989 990 this._currentImage.style.height = this._imageHeight + 'px'; 991 this._nextImage.style.height = this._imageHeight + 'px'; 992 this._previousImage.style.height = this._imageHeight + 'px'; 993 994 if (this._imageDescriptionLabel) {
995 this._imageDescriptionLabel.innerHTML = this._slides[this._currentIndex].Description ? this._slides[this._currentIndex].Description : ""; 996 } 997 if (this._imageTitleLabel) { 998 this._imageTitleLabel.innerHTML = this._slides[this._currentIndex].Name ? this._slides[this._currentIndex].Name : ""; 999 } 1000 }, 1001 1002 setCurrentSlide: function () { 1003 if (this._isNext) { 1004 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight) { 1005 this._nextImage = this._images[this._currentIndex]; 1006 this._elementImage.alt = this._nextImage.Name; 1007 1008 this._nextImage.className = ''; 1009 this._nextImage.style.left = '-' + (this._imageWidth + 5) + 'px'; 1010 1011 var me = this; 1012 setTimeout(function () { 1013 me._nextImage.className = 'slideAnimation'; 1014 if (me._imageDescriptionLabel) { 1015 me._imageDescriptionLabel.innerHTML = me._slides[me._currentIndex].Description ? me._slides[me._currentIndex].Description : ""; 1016 } 1017 if (me._imageTitleLabel) { 1018 me._imageTitleLabel.innerHTML = me._slides[me._currentIndex].Name ? me._slides[me._currentIndex].Name : ""; 1019 } 1020 me._currentImage.style.left = me._imageWidth + 'px'; 1021 me._nextImage.style.left = '0px'; 1022 }, 200); 1023 1024 setTimeout(function () { 1025 me._previousImage = me._currentImage; 1026 me._currentImage = me._nextImage; 1027 me._previousImage.className = ''; 1028 me._previousImage.style.left = '-' + (me._imageWidth + 5) + 'px'; 1029 setTimeout(function () { 1030 me._previousImage.className = 'slideAnimation'; 1031 this._isNext = false; 1032 }, 1000); 1033 }, 1200); 1034 } 1035 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 1036 this._nextImage = this._images[this._currentIndex]; 1037 this._nextImage.className = ''; 1038 this._nextImage.style.top = '-' + (this._imageHeight + 5) + 'px'; 1039 1040 var me = this; 1041 setTimeout(function () { 1042 me._nextImage.className = 'slideAnimation'; 1043 if (me._imageDescriptionLabel) { 1044 me._imageDescriptionLabel.innerHTML = me._slides[me._currentIndex].Description ? me._slides[me._currentIndex].Description : ""; 1045 } 1046 if (me._imageTitleLabel) { 1047 me._imageTitleLabel.innerHTML = me._slides[me._currentIndex].Name ? me._slides[me._currentIndex].Name : ""; 1048 } 1049 me._currentImage.style.top = me._imageHeight + 'px'; 1050 me._nextImage.style.top = '0px'; 1051 }, 200); 1052 1053 setTimeout(function () { 1054 me._previousImage = me._currentImage; 1055 me._currentImage = me._nextImage; 1056 me._previousImage.className = ''; 1057 me._previousImage.style.top = '-' + (me._imageHeight + 5) + 'px'; 1058 setTimeout(function () { 1059 me._previousImage.className = 'slideAnimation'; 1060 this._isNext = false; 1061 }, 1000); 1062 }, 1200); 1063 } 1064 } 1065 else { 1066 if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideRight) { 1067 this._previousImage = this._images[this._currentIndex]; 1068 this._previousImage.className = ''; 1069 this._previousImage.style.left = (this._imageWidth + 5) + 'px'; 1070 1071 var me = this; 1072 setTimeout(function () { 1073 me._previousImage.className = 'slideAnimation'; 1074 if (me._imageDescriptionLabel) {
1075 me._imageDescriptionLabel.innerHTML = me._slides[me._currentIndex].Description ? me._slides[me._currentIndex].Description : ""; 1076 } 1077 if (me._imageTitleLabel) { 1078 me._imageTitleLabel.innerHTML = me._slides[me._currentIndex].Name ? me._slides[me._currentIndex].Name : ""; 1079 } 1080 me._currentImage.style.left = '-' + (me._imageWidth + 5) + 'px'; 1081 me._previousImage.style.left = '0px'; 1082 }, 200); 1083 1084 setTimeout(function () { 1085 me._nextImage = me._currentImage; 1086 me._currentImage = me._previousImage; 1087 me._nextImage.className = ''; 1088 me._nextImage.style.left = (me._imageWidth + 5) + 'px'; 1089 setTimeout(function () { 1090 me._nextImage.className = 'slideAnimation'; 1091 this._isNext = false; 1092 }, 1000); 1093 }, 1200); 1094 } 1095 else if (this._slideShowAnimationType == Sys.Extended.UI.SlideShowAnimationType.SlideDown) { 1096 this._previousImage = this._images[this._currentIndex]; 1097 this._previousImage.className = ''; 1098 this._previousImage.style.top = (this._imageHeight + 5) + 'px'; 1099 1100 var me = this; 1101 setTimeout(function () { 1102 me._previousImage.className = 'slideAnimation'; 1103 if (me._imageDescriptionLabel) { 1104 me._imageDescriptionLabel.innerHTML = me._slides[me._currentIndex].Description ? me._slides[me._currentIndex].Description : ""; 1105 } 1106 if (me._imageTitleLabel) { 1107 me._imageTitleLabel.innerHTML = me._slides[me._currentIndex].Name ? me._slides[me._currentIndex].Name : ""; 1108 } 1109 me._currentImage.style.top = '-' + (me._imageHeight + 5) + 'px'; 1110 me._previousImage.style.top = '0px'; 1111 }, 200); 1112 1113 setTimeout(function () { 1114 me._nextImage = me._currentImage; 1115 me._currentImage = me._previousImage; 1116 me._nextImage.className = ''; 1117 me._nextImage.style.top = (me._imageHeight + 5) + 'px'; 1118 setTimeout(function () { 1119 me._nextImage.className = 'slideAnimation'; 1120 this._isNext = false; 1121 }, 1000); 1122 }, 1200); 1123 } 1124 } 1125 }, 1126 1127 supportsAnimation: function (animationName) { 1128 var isSupport = false, 1129 domPrefixes = 'Webkit Moz ms O'.split(' '), 1130 elm = document.createElement('div'), 1131 animationNameCapital = null; 1132 1133 animationName = animationName.toLowerCase(); 1134 1135 if (elm.style[animationName]) { isSupport = true; } 1136 1137 if (isSupport === false) { 1138 animationNameCapital = animationName.charAt(0).toUpperCase() + animationName.substr(1); 1139 for (var i = 0; i < domPrefixes.length; i++) { 1140 if (elm.style[domPrefixes[i] + animationNameCapital] !== undefined) { 1141 isSupport = true; 1142 break; 1143 } 1144 } 1145 } 1146 return isSupport; 1147 } 1148 1149 } 1150 Sys.Extended.UI.SlideShowBehavior.registerClass('Sys.Extended.UI.SlideShowBehavior', Sys.Extended.UI.BehaviorBase); 1151 Sys.registerComponent(Sys.Extended.UI.SlideShowBehavior, { name: "slideShow" });
1152 1153 Sys.Extended.UI.SlideShowEventArgs = function (previousSlide, nextSlide, slideIndex) { 1154 /// <summary> 1155 /// Event arguments for the SlideShowBehavior's slideChanging event 1156 /// </summary> 1157 /// <param name="previousSlide" type="Object" mayBeNull="true" /> 1158 /// <param name="nextSlide" type="Object" mayBeNull="true" /> 1159 /// <param name="slideIndex" type="Integer" mayBeNull="true" /> 1160 /// <returns /> 1161 Sys.Extended.UI.SlideShowEventArgs.initializeBase(this); 1162 1163 this._previousSlide = previousSlide; 1164 this._nextSlide = nextSlide; 1165 this._slideIndex = slideIndex; 1166 } 1167 Sys.Extended.UI.SlideShowEventArgs.prototype = { 1168 get_previousSlide: function () { 1169 /// <value type="Object"> 1170 /// PreviousSlide 1171 /// </value> 1172 return this._previousSlide; 1173 }, 1174 1175 get_nextSlide: function () { 1176 /// <value type="Object"> 1177 /// NextSlide 1178 /// </value> 1179 return this._nextSlide; 1180 }, 1181 1182 get_slideIndex: function () { 1183 /// <value type="Number" integer="true"> 1184 /// SlideIndex 1185 /// </value> 1186 return this._slideIndex; 1187 } 1188 } 1189 Sys.Extended.UI.SlideShowEventArgs.registerClass('Sys.Extended.UI.SlideShowEventArgs', Sys.CancelEventArgs); 1190 1191 Sys.Extended.UI.SlideShowAnimationType = function () { 1192 /// <summary> 1193 /// Type of the animation when slide will change 1194 /// </summary> 1195 /// <field name="None" type="Number" integer="true" /> 1196 /// <field name="FadeInOut" type="Number" integer="true" /> 1197 /// <field name="ScaleX" type="Number" integer="true" /> 1198 /// <field name="ScaleY" type="Number" integer="true" /> 1199 /// <field name="ZoomInOut" type="Number" integer="true" /> 1200 /// <field name="Rotate" type="Number" integer="true" /> 1201 /// <field name="LeftRight" type="Number" integer="true" /> 1202 /// <field name="UpDown" type="Number" integer="true" /> 1203 throw Error.invalidOperation(); 1204 } 1205 Sys.Extended.UI.SlideShowAnimationType.prototype = { 1206 None: 0, 1207 FadeInOut: 1, 1208 ScaleX: 2, 1209 ScaleY: 3, 1210 ZoomInOut: 4, 1211 Rotate: 5, 1212 SlideRight: 6, 1213 SlideDown: 7 1214 } 1215 1216 Sys.Extended.UI.SlideShowAnimationType.registerEnum("Sys.Extended.UI.SlideShowAnimationType", false); 1217 1218 } // execute 1219 1220 if (window.Sys && Sys.loader) { 1221 Sys.loader.registerScript(scriptName, ["ExtendedBase", "ExtendedCommon", "ExtendedTimer", "Network"], execute); 1222 } 1223 else { 1224 execute(); 1225 } 1226 1227})();
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.