1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// Copy elements value to another element on change
// Used for title choosers
$(document).on('change', '[data-target]', function() {
var target = $(this).data().target;
$(target).val(this.value);
});
STUDIP.domReady(() => {
$('#edit_userdata').on('change', 'input[name^=email]', function() {
var changed = false;
$('#edit_userdata input[name^=email]').each(function() {
changed = changed || this.value !== this.defaultValue;
});
$('#edit_userdata .email-change-confirm').toggle(changed);
});
$('#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(() => {
navigator.mediaDevices.getUserMedia({video: false, audio: true});
});
}
});
});
//
$(document).on('change', '#settings-notifications :checkbox', function() {
var name = $(this).attr('name');
if (name === 'all[all]') {
$(this)
.closest('table')
.find(':checkbox')
.prop('checked', this.checked);
return;
}
if (/all\[columns\]/.test(name)) {
var index =
$(this)
.closest('td')
.index() + 2;
$(this)
.closest('table')
.find('tbody td:nth-child(' + index + ') :checkbox')
.prop('checked', this.checked);
} else if (/all\[rows\]/.test(name)) {
$(this)
.closest('td')
.siblings()
.find(':checkbox')
.prop('checked', this.checked);
}
$('.notification.settings tbody :checkbox[name^=all]').each(function() {
var other = $(this)
.closest('td')
.siblings()
.find(':checkbox');
this.checked = other.filter(':not(:checked)').length === 0;
});
$('.notification.settings thead :checkbox').each(function() {
var index =
$(this)
.closest('td')
.index() + 2,
other = $(this)
.closest('table')
.find('tbody td:nth-child(' + index + ') :checkbox');
this.checked = other.filter(':not(:checked)').length === 0;
});
});
$(document).on('input', '#new_password', function() {
var message = $(this).data().message;
if (this.validity.patternMismatch) {
this.setCustomValidity(message);
} else {
this.setCustomValidity('');
}
});
|