diff options
| author | Jules Laplace <jules@okfoc.us> | 2012-07-18 00:02:21 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2012-07-18 00:02:21 -0400 |
| commit | c4338d2ae878a167c409e91dea6d1783fc7e30ba (patch) | |
| tree | 1e54fac722ac3153f9180a5a8332f2b19e11c00c /static/js/src/userlist.js | |
| parent | d891a7ae1b205716c086363fba17a3249a665deb (diff) | |
put away back
Diffstat (limited to 'static/js/src/userlist.js')
| -rw-r--r-- | static/js/src/userlist.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/static/js/src/userlist.js b/static/js/src/userlist.js new file mode 100644 index 0000000..4af21c1 --- /dev/null +++ b/static/js/src/userlist.js @@ -0,0 +1,38 @@ +var MUTES = {}; +$(".mute").live("click", function(){ + $(this).removeClass("mute"); + $(this).addClass("unmute"); + $(this).html("o"); + var nick = $(this).parent().children("a").html().replace(/<img[^>]+>/,""); + $(".nick_" + nick).hide(); + MUTES[nick] = true; +}); +$(".unmute").live("click", function(){ + $(this).removeClass("unmute"); + $(this).addClass("mute"); + $(this).html("x"); + var nick = $(this).parent().children("a").html().replace(/<img[^>]+>/,""); + $(".nick_" + nick).show(); + delete MUTES[nick]; +}); + +function buildUserDiv(user) { + var muted = MUTES[user.nick] ? '<span class="unmute">o</span>' : '<span class="mute">x</span>'; + if (user.avatar) { + return '<div class="username">' + + muted + + '<a href="' + RootDomain + escapeHtml(user.nick) + '" target="_blank">' + + '<img src="' + user.avatar + '" width="50" height="50">' + + escapeHtml(user.nick) + + '</a>' + + '</div>'; + } else { + return '<div class="username">' + + muted + + '<a href="' + RootDomain + escapeHtml(user.nick) + '" target="_blank">' + + '<img src="' + RootDomain + 'static/img/noinfo.png" width="50" height="50">' + + escapeHtml(user.nick) + + '</a>' + + '</div>'; + } +} |
