]> _ Git - Animations.git/commitdiff
wait #5187 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Apr 2022 16:12:04 +0000 (18:12 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Apr 2022 16:12:04 +0000 (18:12 +0200)
RedbullShopper101/TruthOrMyth/11.mp3 [new file with mode: 0644]
RedbullShopper101/TruthOrMyth/2.mp3 [new file with mode: 0644]
RedbullShopper101/TruthOrMyth/5.mp3 [new file with mode: 0644]
RedbullShopper101/TruthOrMyth/8.mp3 [new file with mode: 0644]
RedbullShopper101/TruthOrMyth/TruthOrMyth.zip [new file with mode: 0644]
RedbullShopper101/TruthOrMyth/index.html
RedbullShopper101/TruthOrMyth/truthormyth.js
RedbullShopper101/_doc/Shopper_constraints.mp3 [deleted file]
RedbullShopper101/_doc/Shoppers_are_rational.mp3 [deleted file]
RedbullShopper101/_doc/Shoppers_need_help.mp3 [deleted file]
RedbullShopper101/_doc/part_1fdac1991e681802ca7b1062be7ec39e.mp3 [deleted file]

diff --git a/RedbullShopper101/TruthOrMyth/11.mp3 b/RedbullShopper101/TruthOrMyth/11.mp3
new file mode 100644 (file)
index 0000000..abdc443
Binary files /dev/null and b/RedbullShopper101/TruthOrMyth/11.mp3 differ
diff --git a/RedbullShopper101/TruthOrMyth/2.mp3 b/RedbullShopper101/TruthOrMyth/2.mp3
new file mode 100644 (file)
index 0000000..fa1147e
Binary files /dev/null and b/RedbullShopper101/TruthOrMyth/2.mp3 differ
diff --git a/RedbullShopper101/TruthOrMyth/5.mp3 b/RedbullShopper101/TruthOrMyth/5.mp3
new file mode 100644 (file)
index 0000000..0a56477
Binary files /dev/null and b/RedbullShopper101/TruthOrMyth/5.mp3 differ
diff --git a/RedbullShopper101/TruthOrMyth/8.mp3 b/RedbullShopper101/TruthOrMyth/8.mp3
new file mode 100644 (file)
index 0000000..2f2c3f0
Binary files /dev/null and b/RedbullShopper101/TruthOrMyth/8.mp3 differ
diff --git a/RedbullShopper101/TruthOrMyth/TruthOrMyth.zip b/RedbullShopper101/TruthOrMyth/TruthOrMyth.zip
new file mode 100644 (file)
index 0000000..4c4182e
Binary files /dev/null and b/RedbullShopper101/TruthOrMyth/TruthOrMyth.zip differ
index d42a05f1b2ef3b3c9ef88c1c9d1a3c8149feef31..c1d41f48f93bfc4ba47808b53cccc26c29fd54bd 100644 (file)
     </style>
 </head>
 <body>
-<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
+<!--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>-->
 <script src="../../../data/jquery.js"></script>
 <script src="truthormyth.js"></script>
 <div id="buttons">
index bb5f45a02b110cafd2d2559b7746c8c73b3b9142..f481d1c314844bdbaa4a8484da4359b45ef13667 100644 (file)
@@ -1,7 +1,9 @@
 $(function () {
     window.activeScreen = 0;
     window.answers = {};
-    window.correctAnswers = {1: 'all', 4: 1, 7: 3, 10: 3};
+    window.correctAnswers = {1: 'all', 4: 0, 7: 0, 10: 1};
+    window.audioPlayer = null;
+
     for (var i = 1; i <= 12; i++) {
         $('#screen_' + i).html('<img src="p' + i + '.svg" />');
     }
@@ -14,27 +16,34 @@ $(function () {
         return false;
     });
     $("#next,#prev").on('click', function () {
-        if($(this).next()){
-           $.each(function(){
-
-           });
+        let i;
+        if ($(this).is('#next')) {
+            for (i = window.activeScreen + 1; i <= 12; i++) {
+                if (window.correctAnswers[i] !== undefined && window.correctAnswers[i] !== null) {
+                    setActiveScreen(i);
+                    break;
+                }
+            }
+        }
+        if ($(this).is('#prev')) {
+            for (i = window.activeScreen - 3; i >= 1; i--) {
+                if (window.correctAnswers[i] !== undefined && window.correctAnswers[i] !== null) {
+                    setActiveScreen(i);
+                    break;
+                }
+            }
         }
-        setActiveScreen(window.activeScreen + 1);
-        return false;
-    });
-    $("#retry").on('click', function () {
-        window.answers = {};
-        setActiveScreen(1);
         return false;
     });
 
+
     $('#read').on('click', function () {
-        setActiveScreen(window.activeScreen+1);
+        setActiveScreen(window.activeScreen + 1);
         return false;
     });
 
     $('#listen').on('click', function () {
-        setActiveScreen(window.activeScreen+1);
+        playAudio(window.activeScreen);
         return false;
     });
 
@@ -43,10 +52,17 @@ $(function () {
         $("#closemore").hide();
         return false;
     });
-    setActiveScreen(5);
+    setActiveScreen(1);
 });
 
+function playAudio(screen) {
+    stopAudio();
+    window.audioPlayer = new Audio(screen + '.mp3');
+    window.audioPlayer.play();
+}
+
 function setActiveScreen(i) {
+    stopAudio();
     window.activeScreen = i;
     $('body').attr('data-screen', i);
     $('[data-screens]').each(function () {
@@ -64,6 +80,14 @@ function setActiveScreen(i) {
     updateScore();
 }
 
+function stopAudio() {
+    try {
+        window.audioPlayer.pause();
+    } catch (e) {
+
+    }
+}
+
 function updateScore() {
     var s = 0;
     $.each(window.answers, function (k, v) {
diff --git a/RedbullShopper101/_doc/Shopper_constraints.mp3 b/RedbullShopper101/_doc/Shopper_constraints.mp3
deleted file mode 100644 (file)
index 0a56477..0000000
Binary files a/RedbullShopper101/_doc/Shopper_constraints.mp3 and /dev/null differ
diff --git a/RedbullShopper101/_doc/Shoppers_are_rational.mp3 b/RedbullShopper101/_doc/Shoppers_are_rational.mp3
deleted file mode 100644 (file)
index 2f2c3f0..0000000
Binary files a/RedbullShopper101/_doc/Shoppers_are_rational.mp3 and /dev/null differ
diff --git a/RedbullShopper101/_doc/Shoppers_need_help.mp3 b/RedbullShopper101/_doc/Shoppers_need_help.mp3
deleted file mode 100644 (file)
index abdc443..0000000
Binary files a/RedbullShopper101/_doc/Shoppers_need_help.mp3 and /dev/null differ
diff --git a/RedbullShopper101/_doc/part_1fdac1991e681802ca7b1062be7ec39e.mp3 b/RedbullShopper101/_doc/part_1fdac1991e681802ca7b1062be7ec39e.mp3
deleted file mode 100644 (file)
index fa1147e..0000000
Binary files a/RedbullShopper101/_doc/part_1fdac1991e681802ca7b1062be7ec39e.mp3 and /dev/null differ