aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'resources/assets/javascripts/bootstrap')
-rw-r--r--resources/assets/javascripts/bootstrap/settings.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/resources/assets/javascripts/bootstrap/settings.js b/resources/assets/javascripts/bootstrap/settings.js
index a8c7ccd..4338763 100644
--- a/resources/assets/javascripts/bootstrap/settings.js
+++ b/resources/assets/javascripts/bootstrap/settings.js
@@ -15,6 +15,21 @@ STUDIP.domReady(() => {
});
$('#edit_userdata .email-change-confirm').hide();
+
+ const audioActive = $('input[name="personal_notifications_audio_activated"]');
+ audioActive.on('change', function() {
+ if (audioActive.is(':checked')) {
+ navigator.permissions.query({name: 'autoplay'})
+ .then(result => {
+ if (result.state !== 'granted') {
+ navigator.mediaDevices.getUserMedia({video: false, audio: true});
+ }
+ })
+ .catch(error => {
+ navigator.mediaDevices.getUserMedia({video: false, audio: true});
+ });
+ }
+ });
});
//