1// Name: AjaxControlToolkit.SlideShow.SlideShowBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 3.0.30930.28736 4// FileVersion: 3.0.30930.0 5// (c) Copyright Microsoft Corporation. 6// This source is subject to the Microsoft Public License. 7// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL. 8// All other rights reserved. 9 10 11/// <reference name="MicrosoftAjax.debug.js" /> 12/// <reference name="MicrosoftAjaxTimer.debug.js" /> 13/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 14/// <reference path="../ExtenderBase/BaseScripts.js" /> 15/// <reference path="../Common/Common.js" /> 16/// <reference path="../Compat/Timer/Timer.js" /> 17 18 19Type.registerNamespace('AjaxControlToolkit'); 20AjaxControlToolkit.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 AjaxControlToolkit.SlideShowBehavior.initializeBase(this, [element]); 27 // Properties 28 this._nextButtonID = null; 29 this._previousButtonID = null; 30 this._imageDescriptionLabelID = null; 31 this._imageTitleLabelID = null; 32 this._playButtonID = null; 33 this._playButtonValue = '||>'; 34 this._stopButtonValue = '[]'; 35 this._slideShowServicePath = null; 36 this._slideShowServiceMethod = null; 37 this._contextKey = null; 38 this._useContextKey = false; 39 this._playInterval = 3000; 40 this._tickHandler = null; 41 this._loop = false; 42 this._autoPlay = false; 43 44 // Variables 45 this._inPlayMode = false; 46 this._elementImage = null; 47 this._bNext = null; 48 this._bPrevious = null; 49 this._currentIndex = -1; 50 this._currentValue = null; 51 this._imageDescriptionLabel = null; 52 this._imageTitleLabel = null; 53 this._bPlay = null; 54 this._slides = null; 55 this._timer = null; 56 this._currentImageElement = null; 57 this._images = null; 58 this._cachedImageIndex = -1; 59 60 // Delegates 61 this._clickNextHandler = null; 62 this._clickPreviousHandler = null; 63 this._clickPlayHandler = null; 64 this._tickHandler = null; 65 this._imageLoadedHandler = null; 66 67}
68AjaxControlToolkit.SlideShowBehavior.prototype = { 69 initialize : function() { 70 ///<summary> 71 /// Initialize the slide show. 72 /// </summary> 73 /// <returns /> 74 75 AjaxControlToolkit.SlideShowBehavior.callBaseMethod(this, 'initialize'); 76 var e = this.get_element(); 77 this._elementImage = e; 78 79 // create an invisible img element 80 this._currentImageElement = document.createElement('IMG'); 81 this._currentImageElement.style.display = 'none'; 82 document.body.appendChild(this._currentImageElement); 83 84 //Create a new parent for Image 85 var _divContent = document.createElement('DIV'); 86 e.parentNode.insertBefore(_divContent, e); 87 e.parentNode.removeChild(e); 88 _divContent.appendChild(e); 89 _divContent.align = 'center'; 90 91 this.controlsSetup(); 92 // Create handlers for slide show buttons clicks events and for image loaded events. 93 if (this._bNext) { 94 this._clickNextHandler = Function.createDelegate(this, this._onClickNext); 95 $addHandler(this._bNext, 'click', this._clickNextHandler); 96 } 97 if (this._bPrevious) { 98 this._clickPreviousHandler = Function.createDelegate(this, this._onClickPrevious); 99 $addHandler(this._bPrevious, 'click', this._clickPreviousHandler); 100 } 101 if (this._bPlay) { 102 this._clickPlayHandler = Function.createDelegate(this, this._onClickPlay); 103 $addHandler(this._bPlay, 'click', this._clickPlayHandler); 104 } 105 106 this._imageLoadedHandler = Function.createDelegate(this, this._onImageLoaded); 107 $addHandler(this._currentImageElement, 'load', this._imageLoadedHandler); 108 109 // init slide show 110 this._slideShowInit(); 111 }, 112 113 dispose : function() { 114 ///<summary> 115 /// Dispose the handlers and perform other slide show cleanup. 116 /// </summary> 117 /// <returns /> 118 119 if (this._clickNextHandler) { 120 $removeHandler(this._bNext, 'click', this._clickNextHandler); 121 this._clickNextHandler = null; 122 } 123 if (this._clickPreviousHandler) { 124 $removeHandler(this._bPrevious, 'click', this._clickPreviousHandler); 125 this._clickPreviousHandler = null; 126 } 127 if (this._clickPlayHandler) { 128 $removeHandler(this._bPlay, 'click', this._clickPlayHandler); 129 this._clickPlayHandler = null; 130 } 131 if (this._imageLoadedHandler) { 132 $removeHandler(this._currentImageElement, 'load', this._imageLoadedHandler); 133 this._imageLoadedHandler = null; 134 } 135 if (this._timer) { 136 this._timer.dispose(); 137 this._timer = null; 138 } 139 AjaxControlToolkit.SlideShowBehavior.callBaseMethod(this, 'dispose'); 140 }, 141 142 add_slideChanged : function(handler) { 143 ///<summary> 144 /// Add handler for the <code>slideChanged</code> Event. 145 /// </summary> 146 /// <param name="handler" type="Function" mayBeNull="false" /> 147 /// <returns /> 148 this.get_events().addHandler('slideChanged', handler); 149 }, 150 remove_slideChanged : function(handler) { 151 ///<summary> 152 /// Remove handler for the <code>slideChanged</code> Event. 153 /// </summary> 154 /// <param name="handler" type="Function" mayBeNull="false"/> 155 /// <returns /> 156 this.get_events().removeHandler('slideChanged', handler); 157 }, 158 raiseSlideChanged : function(eventArgs) { 159 ///<summary> 160 /// Raise the <code>slideChanged</code> Event. 161 /// </summary> 162 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true"/> 163 /// <returns /> 164 var handler = this.get_events().getHandler('slideChanged'); 165 if (handler) { 166 if (!eventArgs) { 167 eventArgs = Sys.EventArgs.Empty; 168 } 169 handler(this, eventArgs); 170 } 171 }, 172 173 add_slideChanging : function(handler) { 174 ///<summary> 175 /// Add handler for the <code>slideChanging</code> Event. 176 /// </summary> 177 /// <param name="handler" type="Function" mayBeNull="false" /> 178 /// <returns /> 179 this.get_events().addHandler('slideChanging', handler); 180 }, 181 remove_slideChanging : function(handler) { 182 ///<summary> 183 /// Remove handler for the <code>slideChanging</code> Event. 184 /// </summary> 185 /// <param name="handler" type="Function" mayBeNull="false"/> 186 /// <returns /> 187 this.get_events().removeHandler('slideChanging', handler); 188 }, 189 raiseSlideChanging : function(previousSlide, newSlide) { 190 ///<summary> 191 /// Raise the <code>slideChanging</code> Event. 192 /// </summary> 193 /// <param name="previousSlide" type="Object" mayBeNull="true"/> 194 /// <param name="nextSlide" type="Object" mayBeNull="true"/> 195 /// <returns type="Boolean" /> 196 var handler = this.get_events().getHandler('slideChanging'); 197 if (handler) { 198 var eventArgs = new AjaxControlToolkit.SlideShowEventArgs(previousSlide, newSlide, this._currentIndex); 199 handler(this, eventArgs); 200 return eventArgs.get_cancel(); 201 } 202 return false; 203 }, 204 205 get_contextKey : function() { 206 /// <value type="String" mayBeNull="true"> 207 /// User/page specific context provided to an optional overload of the 208 /// web method described by ServiceMethod/ServicePath. If the context 209 /// key is used, it should have the same signature with an additional 210 /// parameter named contextKey of type string. 211 /// </value> 212 return this._contextKey; 213 }, 214 set_contextKey : function(value) { 215 if (this._contextKey != value) { 216 this._contextKey = value; 217 this.set_useContextKey(true); 218 // if initialize has not been called 219 // then do not reset the slideshow. 220 if(this._elementImage) { 221 this._slideShowInit(); 222 } 223 this.raisePropertyChanged('contextKey'); 224 } 225 }, 226 227 get_useContextKey : function() { 228 /// <value type="Boolean"> 229 /// Whether or not the ContextKey property should be used. This will be 230 /// automatically enabled if the ContextKey property is ever set 231 /// (on either the client or the server). If the context key is used, 232 /// it should have the same signature with an additional parameter 233 /// named contextKey of type string. 234 /// </value> 235 return this._useContextKey; 236 }, 237 set_useContextKey : function(value) { 238 if (this._useContextKey != value) { 239 this._useContextKey = value; 240 this.raisePropertyChanged('useContextKey'); 241 } 242 }, 243 244 get_enableCaching: function() { 245 /// <value type="Boolean" maybeNull="true">Get or sets whether suggestions retrieved from the webservice should be cached.
245</value> 246 return this._enableCaching; 247 }, 248 set_enableCaching: function(value) { 249 this._enableCaching = value; 250 }, 251 252 get_completionListElementID: function() { 253 /// <value type="String" maybeNull="true">ID of the completion div element. </value> 254 return this._completionListElementID; 255 }, 256 set_completionListElementID: function(value) { 257 this._completionListElementID = value; 258 }, 259 260 get_completionListCssClass : function() { 261 /// <value type="String" maybeNull="true">Css class name that will be used to style the completion list element. </value> 262 this._completionListCssClass; 263 }, 264 set_completionListCssClass : function(value) { 265 if(this._completionListCssClass != value) { 266 this._completionListCssClass = value; 267 this.raisePropertyChanged('completionListCssClass'); 268 } 269 }, 270 get_completionListItemCssClass : function() { 271 /// <value type="String" maybeNull="true">Css class name that will be used to style an item in the completion list. </value> 272 this._completionListItemCssClass; 273 }, 274 set_completionListItemCssClass : function(value) { 275 if(this._completionListItemCssClass != value) { 276 this._completionListItemCssClass = value; 277 this.raisePropertyChanged('completionListItemCssClass'); 278 } 279 }, 280 get_highlightedItemCssClass : function() { 281 /// <value type="String" maybeNull="true">Css class name that will be used to style a highlighted item in the list. </value> 282 this._highlightedItemCssClass; 283 }, 284 set_highlightedItemCssClass : function(value) { 285 if(this._highlightedItemCssClass != value) { 286 this._highlightedItemCssClass = value; 287 this.raisePropertyChanged('highlightedItemCssClass'); 288 } 289 }, 290 get_delimiterCharacters: function() { 291 /// <value type="String">Gets or sets the character(s) used to seperate words for autocomplete.</value> 292 return this._delimiterCharacters; 293 }, 294 set_delimiterCharacters: function(value) { 295 this._delimiterCharacters = value; 296 }, 297 298 controlsSetup : function() { 299 /// <summary> 300 /// Get handles to various slide show controls if specified. 301 /// </summary> 302 /// <returns /> 303 if (this._previousButtonID) { 304 this._bPrevious = document.getElementById(this._previousButtonID); 305 } 306 if (this._imageDescriptionLabelID) { 307 this._imageDescriptionLabel = document.getElementById(this._imageDescriptionLabelID); 308 } 309 if (this._imageTitleLabelID) { 310 this._imageTitleLabel = document.getElementById(this._imageTitleLabelID); 311 } 312 if (this._nextButtonID) { 313 this._bNext = document.getElementById(this._nextButtonID); 314 } 315 if (this._playButtonID) { 316 this._bPlay = document.getElementById(this._playButtonID); 317 this._bPlay.value = this._playButtonValue; 318 } 319 }, 320 321 resetButtons : function() { 322 /// <summary> 323 /// Maintain the various buttons states. 324 /// </summary> 325 /// <returns /> 326 327 if (!this._loop) { 328 // at the last slide 329 if (this._slides.length <= this._currentIndex + 1 ) { 330 if (this._bNext) this._bNext.disabled = true; 331 if (this._bPlay) this._bPlay.disabled = true; 332 if (this._bPrevious) this._bPrevious.disabled = false; 333 // turn off play mode if on 334 this._inPlayMode = false; 335 if (this._timer) { 336 this._timer.set_enabled(false); 337 } 338 if (this._bPlay) this._bPlay.value = this._playButtonValue; 339 340 } else { 341 if (this._bNext) this._bNext.disabled = false; 342 if (this._bPlay) this._bPlay.disabled = false; 343 } 344 // at the first slide 345 if (this._currentIndex <= 0) { 346 if (this._bPrevious) this._bPrevious.disabled = true; 347 } else { 348 if (this._bPrevious) this._bPrevious.disabled = false; 349 } 350 } 351 else { 352 if (this._slides.length == 0) { 353 if (this._bPrevious) this._bPrevious.disabled = true; 354 if (this._bNext) this._bNext.disabled = true; 355 if (this._bPlay) this._bPlay.disabled = true; 356 } 357 } 358 if (this._inPlayMode) { 359 // restart timer 360 this._timer.set_enabled(false); 361 this._timer.set_enabled(true); 362 } 363 }, 364 365 resetSlideShowButtonState : function() { 366 /// <summary> 367 /// Maintain the play button state to reflect whether the slide show is in play mode. 368 /// </summary> 369 /// <returns /> 370 371 if (this._inPlayMode) { 372 if (this._bPlay) this._bPlay.value = this._stopButtonValue; 373 } 374 else { 375 this.resetButtons(); 376 if (this._bPlay) this._bPlay.value = this._playButtonValue; 377 } 378 }, 379 380 setCurrentImage : function() { 381 /// <summary> 382 /// Retrieve the current image. 383 /// </summary> 384 /// <returns /> 385 if (this._slides[this._currentIndex]) { 386 this._currentImageElement.src = this._slides[this._currentIndex].ImagePath; 387 } else { 388 this._currentImageElement.src = ''; 389 } 390 if(Sys.Browser.agent == Sys.Browser.Opera) { 391 // call the handler explicitly for opera 392 this._onImageLoaded(true); 393 } 394 }, 395 396 updateImage : function(value) { 397 /// <summary> 398 /// Set current image to be the specified Slide. 399 /// </summary> 400 /// <param name="value" type="Object" mayBeNull="false" /> 401 /// <returns /> 402 403 if (value) { 404 if (this.raiseSlideChanging(this._currentValue, value)) { 405 return; 406 } 407 this._currentValue = value; 408 this._elementImage.src = value.ImagePath; 409 this._elementImage.alt = value.Name; 410 411 if (this._imageDescriptionLabel) {
412 this._imageDescriptionLabel.innerHTML = value.Description ? value.Description : ""; 413 } 414 if (this._imageTitleLabel) { 415 this._imageTitleLabel.innerHTML = value.Name ? value.Name : ""; 416 } 417 this.raiseSlideChanged(value); 418 this.resetButtons(); 419 } 420 }, 421 422 get_imageDescriptionLabelID : function() { 423 /// <value type="String" mayBeNull="true"> 424 /// ID of the label that describes the current slide. 425 /// </value> 426 return this._imageDescriptionLabelID; 427 }, 428 set_imageDescriptionLabelID : function(value) { 429 if (this._imageDescriptionLabelID != value) { 430 this._imageDescriptionLabelID = value; 431 this.raisePropertyChanged('imageDescriptionLabelID'); 432 } 433 }, 434 435 get_imageTitleLabelID : function() { 436 /// <value type="String" mayBeNull="true"> 437 /// ID of the label that shows the title of the current slide. 438 /// </value> 439 return this._imageTitleLabelID; 440 }, 441 set_imageTitleLabelID : function(value) { 442 if (this._imageTitleLabelID != value) { 443 this._imageTitleLabelID = value; 444 this.raisePropertyChanged('imageTitleLabelID'); 445 } 446 }, 447 448 get_nextButtonID : function() { 449 /// <value type="String" mayBeNull="true"> 450 /// ID on the next button. 451 /// </value> 452 return this._nextButtonID; 453 }, 454 set_nextButtonID : function(value) { 455 if (this._nextButtonID != value) { 456 this._nextButtonID = value; 457 this.raisePropertyChanged('nextButtonID'); 458 } 459 }, 460 461 get_playButtonID : function() { 462 /// <value type="String" mayBeNull="true"> 463 /// ID on the play button. 464 /// </value> 465 return this._playButtonID; 466 }, 467 set_playButtonID : function(value) { 468 if (this._playButtonID != value) { 469 this._playButtonID = value; 470 this.raisePropertyChanged('playButtonID'); 471 } 472 }, 473 474 get_playButtonText : function() { 475 /// <value type="String" mayBeNull="true"> 476 /// Text in play button to play the slide show when it is not playing. 477 /// </value> 478 return this._playButtonValue; 479 }, 480 set_playButtonText : function(value) { 481 if (this._playButtonValue != value) { 482 this._playButtonValue = value; 483 this.raisePropertyChanged('playButtonText'); 484 } 485 }, 486 487 get_stopButtonText : function() { 488 /// <value type="String" mayBeNull="true"> 489 /// Text in play button to stop the slide show when it is playing. 490 /// </value> 491 return this._stopButtonValue; 492 }, 493 set_stopButtonText : function(value) { 494 if (this._stopButtonValue != value) { 495 this._stopButtonValue = value; 496 this.raisePropertyChanged('stopButtonText'); 497 } 498 }, 499 500 get_playInterval : function() { 501 /// <value type="Number" integer="true" mayBeNull="true"> 502 /// Interval in milliseconds between slide switches. 503 /// </value> 504 return this._playInterval; 505 }, 506 set_playInterval : function(value) { 507 if (this._playInterval != value) { 508 this._playInterval = value; 509 this.raisePropertyChanged('playInterval'); 510 } 511 }, 512 513 get_previousButtonID : function() { 514 /// <value type="String" mayBeNull="true"> 515 /// ID of the previous button. 516 /// </value> 517 return this._previousButtonID; 518 }, 519 set_previousButtonID : function(value) { 520 if (this._previousButtonID != value) { 521 this._previousButtonID = value; 522 this.raisePropertyChanged('previousButtonID'); 523 } 524 }, 525 526 get_slideShowServicePath : function() { 527 /// <value type="String" mayBeNull="true"> 528 /// Slide show webservice path to pull the images. 529 /// </value> 530 return this._slideShowServicePath; 531 }, 532
533 set_slideShowServicePath : function(value) { 534 if (this._slideShowServicePath != value) { 535 this._slideShowServicePath = value; 536 this.raisePropertyChanged('slideShowServicePath'); 537 } 538 }, 539 540 get_slideShowServiceMethod : function() { 541 /// <value type="String" mayBeNull="false"> 542 /// Slide show webservice methods that will return the slide images. 543 /// </value> 544 return this._slideShowServiceMethod; 545 }, 546 set_slideShowServiceMethod : function(value) { 547 if (this._slideShowServiceMethod != value) { 548 this._slideShowServiceMethod = value; 549 this.raisePropertyChanged('slideShowServiceMethod'); 550 } 551 }, 552 553 get_loop : function() { 554 /// <value type="Boolean" mayBeNull="true"> 555 /// boolean to detect if slideshow should wrap around on hitting the first/last slides. 556 /// </value> 557 return this._loop; 558 }, 559 set_loop : function(value) { 560 if (this._loop != value) { 561 this._loop = value; 562 this.raisePropertyChanged('loop'); 563 } 564 }, 565 566 get_autoPlay : function() { 567 /// <value type="Boolean" mayBeNull="true"> 568 /// boolean to detect if slide show should start playing on render. 569 /// </value> 570 return this._autoPlay; 571 }, 572 set_autoPlay : function(value) { 573 if (this._autoPlay != value) { 574 this._autoPlay = value; 575 this.raisePropertyChanged('autoPlay'); 576 } 577 }, 578 579 _onClickNext : function(e) { 580 /// <summary> 581 /// Next button click handler. 582 /// </summary> 583 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false" /> 584 /// <returns /> 585 586 // prevent server post-back for asp.net buttons. 587 e.preventDefault(); 588 e.stopPropagation(); 589 this._clickNext(); 590 }, 591 592 _onImageLoaded : function(e) { 593 /// <summary> 594 /// Image loaded handler. 595 /// </summary> 596 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 597 /// <returns /> 598 this.updateImage(this._slides[this._currentIndex]); 599 this.resetButtons(); 600 this._cacheImages(); 601 }, 602 603 _clickNext : function() { 604 /// <summary> 605 /// Switches slide show to displaying the next slide. 606 /// </summary> 607 /// <returns /> 608 609 if (this._slides) { 610 if ((this._currentIndex + 1) < this._slides.length) { 611 ++this._currentIndex; 612 } else if (this._loop) { 613 this._currentIndex = 0; 614 } else { 615 return false; 616 } 617 this.setCurrentImage(); 618 return true; 619 } 620 return false; 621 }, 622 623 _onClickPrevious : function(e) { 624 /// <summary> 625 /// Previous button click handler. 626 /// </summary> 627 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 628 /// <returns /> 629 630 // prevent server post-back for asp.net buttons. 631 e.preventDefault(); 632 e.stopPropagation(); 633 this._clickPrevious(); 634 635 }, 636 637 _clickPrevious : function() { 638 /// <summary> 639 /// Switches slide show to displaying the previous slide. 640 /// </summary> 641 /// <returns /> 642 643 if (this._slides) { 644 if ((this._currentIndex - 1) >= 0) { 645 --this._currentIndex; 646 } 647 else if (this._loop) { 648 this._currentIndex = this._slides.length - 1; 649 } else { 650 return false; 651 } 652 this.setCurrentImage(); 653 return true; 654 } 655 return false; 656 }, 657 658 _onClickPlay : function(e) { 659 /// <summary> 660 /// Play button click handler. 661 /// </summary> 662 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 663 /// <returns /> 664 665 // prevent server post-back for asp.net buttons. 666 e.preventDefault(); 667 e.stopPropagation(); 668 this._play(); 669 }, 670 671 _play : function() { 672 /// <summary> 673 /// Maintains timer state/slide show buttons state and creates handler to switch images in play mode 674 /// if not already in play mode. 675 /// </summary> 676 /// <returns /> 677 if (this._inPlayMode) { 678 this._inPlayMode = false; 679 this._timer.set_enabled(false); 680 this.resetSlideShowButtonState(); 681 } else { 682 // play the side show 683 this._inPlayMode = true; 684 if (!this._timer) { 685 this._timer = new Sys.Timer(); 686 this._timer.set_interval(this._playInterval); 687 this._tickHandler = Function.createDelegate(this, this._onPlay); 688 this._timer.add_tick(this._tickHandler); 689 } 690 this.resetSlideShowButtonState(); 691 this._timer.set_enabled(true); 692 } 693 }, 694 695 _onPlay : function(e) { 696 /// <summary> 697 /// Sets the slide show to the current image in play mode and maintains button state. 698 /// </summary> 699 /// <param name="e" type="Sys.UI.DomEvent" mayBeNull="false"/> 700 /// <returns type="Boolean" /> 701 if (this._slides) { 702 if ((this._currentIndex + 1) < this._slides.length) { 703 ++this._currentIndex; 704 this.setCurrentImage(); 705 return true; 706 } else if (this._loop) { 707 this._currentIndex = 0; 708 this.setCurrentImage(); 709 return true; 710 } else { 711 this._inPlayMode = false; 712 this.resetSlideShowButtonState(); 713 } 714 } 715 return false; 716 }, 717 718 _slideShowInit : function() { 719 /// <summary> 720 /// Initializes the slide show by invoking the webservice to retrieve the slides 721 /// and sets the first slide. 722 /// </summary> 723 /// <returns /> 724 // clear the state of the slideshow 725 this._currentIndex = -1; 726 this._cachedImageIndex = -1; 727 this._inPlayMode = false; 728 this._currentValue = null; 729 // clear the cache 730 this._images = null; 731 // Create the service parameters and optionally add the context parameter 732 // (thereby determining which method signature we're expecting...) 733 var params = null; 734 if (this._useContextKey) { 735 params = { contextKey : this._contextKey }; 736 } 737 738 Sys.Net.WebServiceProxy.invoke( 739 this._slideShowServicePath, 740 this._slideShowServiceMethod, 741 false, 742 params, 743 Function.createDelegate(this, this._initSlides), 744 null, 745 null); 746 }, 747 748 _initSlides : function(sender, eventArgs) { 749 /// <summary> 750 /// Initializes the slide show with the first image and configures the specified play settings. 751 /// </summary> 752 /// <param name="sender" type="Object" mayBeNull="true"/> 753 /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true" /> 754 /// <returns /> 755 756 this._slides = sender; 757 if (this._slides) { 758 this._images = new Array(); 759 this._clickNext(); 760 if (this._autoPlay) { 761 this._play(); 762 } 763 } 764 }, 765 766 _cacheImages : function() { 767 /// <summary> 768 /// Caches 4 more slides periodically. 769 /// </summary> 770 /// <returns /> 771 772 // cache if current index is divisible by 3 773 if ((this._currentIndex) % 3 == 0) { 774 var oldCachedImageIndex = this._cachedImageIndex; 775 for (var i = this._cachedImageIndex + 1; i < this._slides.length; i++) { 776 if (this._slides[i]) { 777 this._images[i] = new Image(); 778 this._images[i].src = this._slides[i].ImagePath; 779 this._cachedImageIndex = i; 780 if((oldCachedImageIndex + 4) <= i ) { 781 // cached 4 slides 782 break; 783 } 784 } 785 } 786 } 787 } 788 789} 790AjaxControlToolkit.SlideShowBehavior.registerClass('AjaxControlToolkit.SlideShowBehavior', AjaxControlToolkit.BehaviorBase); 791 792 793AjaxControlToolkit.SlideShowEventArgs = function(previousSlide, nextSlide, slideIndex) { 794 /// <summary> 795 /// Event arguments for the SlideShowBehavior's slideChanging event 796 /// </summary> 797 /// <param name="previousSlide" type="Object" mayBeNull="true" /> 798 /// <param name="nextSlide" type="Object" mayBeNull="true" /> 799 /// <param name="slideIndex" type="Integer" mayBeNull="true" /> 800 /// <returns /> 801 AjaxControlToolkit.SlideShowEventArgs.initializeBase(this); 802 803 this._previousSlide = previousSlide; 804 this._nextSlide = nextSlide; 805 this._slideIndex = slideIndex; 806} 807AjaxControlToolkit.SlideShowEventArgs.prototype = { 808 get_previousSlide : function() { 809 /// <value type="Object"> 810 /// PreviousSlide 811 /// </value> 812 return this._previousSlide; 813 }, 814 815 get_nextSlide : function() { 816 /// <value type="Object"> 817 /// NextSlide 818 /// </value> 819 return this._nextSlide; 820 }, 821 822 get_slideIndex : function () { 823 /// <value type="Number" integer="true"> 824 /// SlideIndex 825 /// </value> 826 return this._slideIndex; 827 } 828} 829AjaxControlToolkit.SlideShowEventArgs.registerClass('AjaxControlToolkit.SlideShowEventArgs', Sys.CancelEventArgs);
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.