From 9ac1daabf19999334c918ed7cdaff747bd0b863f Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 9 Mar 2016 01:23:30 +0500 Subject: [PATCH] add volume parameter to playSound() --- js/mobile_abstract.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/mobile_abstract.js b/js/mobile_abstract.js index c9de13b..cd7358c 100644 --- a/js/mobile_abstract.js +++ b/js/mobile_abstract.js @@ -513,7 +513,7 @@ var MAL = function() jQuery.MAL = new MAL; -function playSound(player, sound) { +function playSound(player, sound, volume) { if ($.mobile) { } else { var player = $('#'+player); @@ -526,7 +526,7 @@ function playSound(player, sound) { else player.attr({type: 'audio/ogg', src: 'sound/' + sound + '.ogg'}); - player[0].volume = $.Options.playerVol.val; + player[0].volume = (typeof volume === 'number') ? volume : $.Options.playerVol.val; player[0].play(); } else console.warn('cannot find player to play sound, selector: #'+player);