You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
2.2 KiB

YUI.add("moodle-message_airnotifier-toolboxes",function(e,t){var n={AIRNOTIFIERCONTENT:'div[data-processor-name="airnotifier"]',HIDEDEVICE:"a.hidedevice",DEVICELI:"li.airnotifierdevice",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",DEVICEIDPREFIX:"deviceid-"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{replace_button:function(t,n,r,i){i||(i="pointer");var s=e.one(t).all(n).setStyle("cursor",i);return s.on("click",r,this),s},toggle_hide_device_ui:function(e){var t=e.ancestor(n.DEVICELI),r=e.one("img"),i=n.DIMMEDTEXT,s="";t.hasClass(i)?s="hide":s="show",t.toggleClass(i);var o=M.util.get_string(s,"moodle");r.setAttrs({alt:o,title:o,src:M.util.image_url("t/"+s)}),e.set("title",o),e.set("className","editing_"+s)},send_request:function(t,n,r){t||(t={});var i=this.get("config").pageparams,s;for(s in i)t[s]=i[s];n&&n.show(),t.sesskey=M.cfg.sesskey;var o=M.cfg.wwwroot+this.get("ajaxurl"),u=[],a={method:"POST",data:t,on:{success:function(t,i){try{u=e.JSON.parse(i.responseText),u.error?e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(u)).show()}):u.success&&r()}catch(s){}n&&n.hide()},failure:function(t,r){n&&n.hide(),e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()})}},context:this,sync:!1};return e.io(o,a),u},get_element_id:function(e){return e.get("id").replace(n.DEVICEIDPREFIX,"")}},{NAME:"device-toolbox",ATTRS:{ajaxurl:{value:0},config:{value:0}}});var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,r,{initializer:function(){this.setup_for_device()},setup_for_device:function(t){t||(t=n.AIRNOTIFIERCONTENT),e.all(t).each(this._setup_for_device,this)},_setup_for_device:function(e){this.replace_button(e,n.HIDEDEVICE,this.toggle_hide_device)},toggle_hide_device:function(t){t.preventDefault();var r=t.target.ancestor(n.DEVICELI),i=t.target.ancestor("a",!0),s;r.hasClass(n.DIMMEDTEXT)?s=1:s=0;var o={field:"enable",enable:s,id:this.get_element_id(r)},u=M.util.add_spinner(e,r),a=this,f=function(){a.toggle_hide_device_ui(i)};this.send_request(o,u,f)}},{NAME:"message-device-toolbox",ATTRS:{}}),M.message=M.message||{},M.message.init_device_toolbox=function(e){return new i(e)}},"@VERSION@",{requires:["base","node","io"]});