integration/v2/js/slideshow.js
changeset 206 24607434c13b
parent 203 df9a887eae92
child 219 6667fb5455d0
equal deleted inserted replaced
205:2b050be8ffd7 206:24607434c13b
    69             });
    69             });
    70             
    70             
    71         }
    71         }
    72     }
    72     }
    73     
    73     
    74     function nextSlide() {
    74     var playInterval, playing = false;
       
    75     
       
    76     function toggleSlideShow() {
       
    77         clearInterval(playInterval);
       
    78         playing = !playing;
       
    79         var jqppbtn = $(".play-pause");
       
    80         if (playing) {
       
    81             jqppbtn.addClass("pause");
       
    82             playInterval = setInterval(nextSlide,4000,false);
       
    83         } else {
       
    84             jqppbtn.removeClass("pause");
       
    85         }
       
    86         return false;
       
    87     }
       
    88     
       
    89     function nextSlide(resetInterval) {
       
    90         if (!!resetInterval && playing) {
       
    91             playing = false;
       
    92             toggleSlideShow();
       
    93         }
    75         currentSlide = (currentSlide + 1) % slides.length;
    94         currentSlide = (currentSlide + 1) % slides.length;
    76         showSlide();
    95         showSlide();
    77         return false;
    96         return false;
    78     }
    97     }
    79     
    98     
    80     function prevSlide() {
    99     function prevSlide(resetInterval) {
       
   100         if (!!resetInterval && playing) {
       
   101             playing = false;
       
   102             toggleSlideShow();
       
   103         }
    81         currentSlide = (currentSlide > 0 ? currentSlide - 1 : slides.length - 1);
   104         currentSlide = (currentSlide > 0 ? currentSlide - 1 : slides.length - 1);
    82         showSlide();
   105         showSlide();
    83         return false;
   106         return false;
    84     }
   107     }
    85     
   108     
   124     if ( typeof document.fullScreen === "undefined"
   147     if ( typeof document.fullScreen === "undefined"
   125         && typeof document.mozFullScreen === "undefined"
   148         && typeof document.mozFullScreen === "undefined"
   126         && typeof document.webkitIsFullScreen === "undefined") {
   149         && typeof document.webkitIsFullScreen === "undefined") {
   127         $(".full-screen").remove();
   150         $(".full-screen").remove();
   128     }
   151     }
   129     
   152         
   130     var playInterval, playing = false;
   153     $(".play-pause").click(toggleSlideShow);
   131     
       
   132     $(".play-pause").click(function() {
       
   133         clearInterval(playInterval);
       
   134         playing = !playing;
       
   135         if (playing) {
       
   136             $(this).addClass("pause");
       
   137             playInterval = setInterval(nextSlide,4000);
       
   138         } else {
       
   139             $(this).removeClass("pause");
       
   140         }
       
   141         return false;
       
   142     });
       
   143     
   154     
   144     slides.forEach(function(slide, k) {
   155     slides.forEach(function(slide, k) {
   145         if (!slide.path) {
   156         if (!slide.path) {
   146             slide.path = "M0 0L1 0L1 1L0 1Z"
   157             slide.path = "M0 0L1 0L1 1L0 1Z"
   147         }
   158         }
   156     
   167     
   157     showSlide();
   168     showSlide();
   158     
   169     
   159     jqwin.resize(showSlide);
   170     jqwin.resize(showSlide);
   160     
   171     
       
   172     $(document).keydown(function(e) {
       
   173         if (e.keyCode === 122) { // F11
       
   174             fullScreen();
       
   175             return false;
       
   176         }
       
   177         if (e.keyCode === 32) { // Space
       
   178             jqControls.show();
       
   179             resetTO();
       
   180             toggleSlideShow();
       
   181             return false;
       
   182         }
       
   183         if (e.keyCode === 37) { // Left-Arrow
       
   184             prevSlide(true);
       
   185             return false;
       
   186         }
       
   187         if (e.keyCode === 39) { // Right-Arrow
       
   188             nextSlide(true);
       
   189             return false;
       
   190         }
       
   191     });
       
   192     
   161 });
   193 });