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
1.1 KiB
1 lines
1.1 KiB
define(["jquery","core/ajax","core/str","core/notification"],function(a,b,c,d){var e={CHANGE_VISIBILITY_LINK:"#change-user-visibility",CHANGE_VISIBILITY_ICON:"#change-user-visibility .icon"},f=function(a,c){var e="show"==a?1:0,f=[{name:"block_online_users_uservisibility",value:e,userid:c}],j={methodname:"core_user_set_user_preferences",args:{preferences:f}};b.call([j])[0].then(function(b){if(b.saved){var c=g(a);h(c),i(c)}})["catch"](d.exception)},g=function(a){return"show"==a?"hide":"show"},h=function(b){k(b).then(function(c){a(e.CHANGE_VISIBILITY_LINK).attr({"data-action":b,title:c})})["catch"](d.exception)},i=function(b){var c=a(e.CHANGE_VISIBILITY_ICON);k(b).then(function(d){a(c).attr({title:d,"aria-label":d}),c.is("img")?a(c).attr({src:M.util.image_url("t/"+b),alt:d}):(a(c).addClass(j(b)),a(c).removeClass(j(g(b))))})["catch"](d.exception)},j=function(a){return"show"==a?"fa-eye-slash":"fa-eye"},k=function(a){return c.get_string("online_status:"+a,"block_online_users")};return{init:function(){a(e.CHANGE_VISIBILITY_LINK).on("click",function(b){b.preventDefault();var c=a(this).attr("data-action"),d=a(this).attr("data-userid");f(c,d)})}}});
|