Merge branch 'MDL-78676-master' of https://github.com/sarjona/moodle
[moodle.git] / message / module.js
blob13fdecc4574dce5668a5bf9d4b4f251e808fb023
1 M.core_message = M.core_message || {};
3 M.core_message.init_focus = function(Y, eid) {
4     document.getElementById(eid).focus();
5 };
7 M.core_message.init_refresh_page = function(Y, delay, url) {
8     var delay_callback = function() {
9         document.location.replace(url);
10     };
11     setTimeout(delay_callback, delay);
14 M.core_message.combinedsearchgotfocus = function(e) {
15     if (e.target.get('value')==this.defaultsearchterm) {
16         e.target.select();
17     }
20 M.core_message.init_editsettings = function(Y) {
21     var editsettings = {
23         init : function() {
24             var disableall = Y.one(".disableallcheckbox");
25             disableall.on('change', editsettings.changeState);
26             disableall.simulate("change");
27         },
29         changeState : function(e) {
30             Y.all('.notificationpreference').each(function(node) {
31                 var disabled = e.target.get('checked');
33                 node.removeAttribute('disabled');
34                 if (disabled) {
35                     node.setAttribute('disabled', 1)
36                 }
37             }, this);
38         }
39     }
41     editsettings.init();