integration/v2/js/slideshow.js
changeset 203 df9a887eae92
parent 190 ebb8b58fc2b8
child 206 24607434c13b
--- a/integration/v2/js/slideshow.js	Fri Jun 28 12:12:57 2013 +0200
+++ b/integration/v2/js/slideshow.js	Fri Jun 28 12:46:42 2013 +0200
@@ -83,21 +83,21 @@
         return false;
     }
     
-    var hideTO, isInArrow = false, jqArrows = $(".arrow-wrap");
+    var hideTO, isInArrow = false, jqControls = $(".arrow-wrap,.top-controls");
     function resetTO() {
         clearTimeout(hideTO);
         if (!isInArrow) {
             hideTO = setTimeout(function() {
-                jqArrows.hide();
+                jqControls.hide();
             }, 1000);
         }
     }
     $("body").mousemove(function() {
-        jqArrows.show();
+        jqControls.show();
         resetTO();
         return false;
     });
-    jqArrows.hover(function() {
+    jqControls.hover(function() {
         isInArrow = true;
         resetTO();
     }, function() {
@@ -108,6 +108,39 @@
     $(".left-arrow").click(prevSlide);
     $(".right-arrow").click(nextSlide);
     
+    function fullScreen() {
+        var isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || false;
+        if (isFull) {
+            (document.cancelFullScreen || document.mozCancelFullScreen || document.webkitCancelFullScreen || function(){}).call(document);
+        } else {
+            (document.body.requestFullScreen || document.body.mozRequestFullScreen || document.body.webkitRequestFullScreen || function(){}).call(document.body);
+        }
+        showSlide();
+        return false;
+    }
+    
+    $(".full-screen").click(fullScreen);
+           
+    if ( typeof document.fullScreen === "undefined"
+        && typeof document.mozFullScreen === "undefined"
+        && typeof document.webkitIsFullScreen === "undefined") {
+        $(".full-screen").remove();
+    }
+    
+    var playInterval, playing = false;
+    
+    $(".play-pause").click(function() {
+        clearInterval(playInterval);
+        playing = !playing;
+        if (playing) {
+            $(this).addClass("pause");
+            playInterval = setInterval(nextSlide,4000);
+        } else {
+            $(this).removeClass("pause");
+        }
+        return false;
+    });
+    
     slides.forEach(function(slide, k) {
         if (!slide.path) {
             slide.path = "M0 0L1 0L1 1L0 1Z"