forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.js
42 lines (34 loc) · 1.1 KB
/
module.js
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
M.core_message = M.core_message || {};
M.core_message.init_focus = function(Y, eid) {
document.getElementById(eid).focus();
};
M.core_message.init_refresh_page = function(Y, delay, url) {
var delay_callback = function() {
document.location.replace(url);
};
setTimeout(delay_callback, delay);
};
M.core_message.combinedsearchgotfocus = function(e) {
if (e.target.get('value')==this.defaultsearchterm) {
e.target.select();
}
};
M.core_message.init_editsettings = function(Y) {
var editsettings = {
init : function() {
var disableall = Y.one(".disableallcheckbox");
disableall.on('change', editsettings.changeState);
disableall.simulate("change");
},
changeState : function(e) {
Y.all('.notificationpreference').each(function(node) {
var disabled = e.target.get('checked');
node.removeAttribute('disabled');
if (disabled) {
node.setAttribute('disabled', 1)
}
}, this);
}
}
editsettings.init();
}