add button to turn volume on and off

This commit is contained in:
jorsi
2020-05-30 22:20:29 -04:00
parent 1d84e5f85c
commit 8db47cecf9
2 changed files with 63 additions and 21 deletions
+24 -2
View File
@@ -133,6 +133,12 @@
});
}
$('<span>')
.addClass('volume menuBtn')
.text(_('sound off.'))
.click(Engine.toggleVolume)
.appendTo(menu);
$('<span>')
.addClass('appStore menuBtn')
.text(_('get the app.'))
@@ -215,12 +221,16 @@
Ship.init();
}
if(!$SM.get('config.soundOn')){
Engine.toggleVolume();
}
if($SM.get('config.lightsOff', true)){
Engine.turnLightsOff();
Engine.turnLightsOff();
}
if($SM.get('config.hyperMode', true)){
Engine.triggerHyperMode();
Engine.triggerHyperMode();
}
Engine.saveLanguage();
@@ -782,6 +792,18 @@
}
},
toggleVolume: function() {
if ($SM.get('config.soundOn')) {
$('.volume').text(_('sound on.'));
$SM.set('config.soundOn', false);
AudioEngine.mute();
} else {
$('.volume').text(_('sound off.'));
$SM.set('config.soundOn', true);
AudioEngine.setVolume(1.0);
}
},
setInterval: function(callback, interval, skipDouble){
if( Engine.options.doubleTime && !skipDouble ){
Engine.log('Double time, cutting interval in half');