]> _ Git - fluidbook-html5.git/commitdiff
wait #4042 @0.15
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Nov 2020 11:42:57 +0000 (12:42 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Nov 2020 11:42:57 +0000 (12:42 +0100)
js/libs/fluidbook/fluidbook.sound.js

index 47ab87d5e0b54dd61082ec2a79267c7c81fff56c..f84e1d20ccc20d855715a43f87dc97cec5f8243d 100644 (file)
@@ -11,6 +11,7 @@ function FluidbookSound(fluidbook) {
     this.on = !!this.fluidbook.settings.soundOn;
     this.audios = {};
     this.playing = null;
+    this.simpleTheme = this.fluidbook.settings.simpleSoundTheme;
 
     this.preloadSounds();
     this.initEvents();
@@ -42,7 +43,12 @@ FluidbookSound.prototype = {
     },
 
     preloadSounds: function () {
-        var sounds = ['empty', 'cover-flip', 'page-flip-1', 'page-flip-2'];
+        var sounds;
+        if (this.simpleTheme) {
+            sounds = ['empty', 'flip'];
+        } else {
+            sounds = ['empty', 'cover-flip', 'page-flip-1', 'page-flip-2'];
+        }
         var $this = this;
         $.each(sounds, function (k, v) {
             var src;
@@ -102,10 +108,14 @@ FluidbookSound.prototype = {
         }
 
         var sound = '';
-        if (data.turningPages.indexOf(1) >= 0 || data.turningPages.indexOf(last) >= 0) {
-            sound = 'cover-flip';
+        if (this.simpleTheme) {
+            sound = 'flip';
         } else {
-            sound = 'page-flip-' + (Math.round(Math.random() + 1));
+            if (data.turningPages.indexOf(1) >= 0 || data.turningPages.indexOf(last) >= 0) {
+                sound = 'cover-flip';
+            } else {
+                sound = 'page-flip-' + (Math.round(Math.random() + 1));
+            }
         }
 
         var transitionDuration = this.fluidbook.pagetransitions.getTransitionDuration(page);