User popups: visually indicate if the user is in the room/battle

This commit is contained in:
Ivo Julca 2015-10-16 01:46:52 -05:00
parent e5220f7cb1
commit 4bcc23dd50
2 changed files with 8 additions and 3 deletions

View File

@ -2413,9 +2413,10 @@
};
var group = (groupDetails[name.substr(0, 1)] || '');
if (group || name.charAt(0) === ' ') name = name.substr(1);
var ownUserid = app.user.get('userid');
var buf = '<div class="userdetails">';
if (avatar) buf += '<img class="trainersprite' + (userid === app.user.get('userid') ? ' yours' : '') + '" src="' + Tools.resolveAvatar(avatar) + '" />';
if (avatar) buf += '<img class="trainersprite' + (userid === ownUserid ? ' yours' : '') + '" src="' + Tools.resolveAvatar(avatar) + '" />';
buf += '<strong><a href="//pokemonshowdown.com/users/' + userid + '" target="_blank">' + Tools.escapeHTML(name) + '</a></strong><br />';
buf += '<small>' + (group || '&nbsp;') + '</small>';
if (data.rooms) {
@ -2429,11 +2430,12 @@
var p2 = data.rooms[i].p2.substr(1);
if (!battlebuf) battlebuf = '<br /><em>Battles:</em> ';
else battlebuf += ', ';
battlebuf += '<span title="' + (Tools.escapeHTML(p1) || '?') + ' v. ' + (Tools.escapeHTML(p2) || '?') + '"><a href="' + app.root + roomid + '" class="ilink">' + roomid.substr(7) + '</a></span>';
var ownBattle = (ownUserid === toUserid(p1) || ownUserid === toUserid(p2));
battlebuf += '<span title="' + (Tools.escapeHTML(p1) || '?') + ' v. ' + (Tools.escapeHTML(p2) || '?') + '"><a href="' + app.root + roomid + '" class="ilink' + ((ownBattle || app.rooms[i]) ? ' yours' : '') + '">' + roomid.substr(7) + '</a></span>';
} else {
if (!chatbuf) chatbuf = '<br /><em>Chatrooms:</em> ';
else chatbuf += ', ';
chatbuf += '<a href="' + app.root + roomid + '" class="ilink">' + roomid + '</a>';
chatbuf += '<a href="' + app.root + roomid + '" class="ilink' + (app.rooms[i] ? ' yours' : '') + '">' + roomid + '</a>';
}
}
buf += '<small class="rooms">' + battlebuf + chatbuf + '</small>';

View File

@ -1103,6 +1103,9 @@ a.ilink:hover {
text-decoration: underline;
color: #6688CC;
}
a.ilink.yours {
color: #55388B;
}
.chatbox {
margin: 0 10px 0 80px;