Fixed styling and owner/member texts of regions.

This commit is contained in:
FrozenCow 2011-07-29 17:14:58 +02:00
parent 6259da4e0f
commit 5bf8010bbb
2 changed files with 12 additions and 8 deletions

View File

@ -11,10 +11,6 @@
font-weight: bold;
}
.regioninfo .owners {
margin-left: 20px;
}
.regioninfo .regionflags .regionflag {
display: block;
font-size: 90%;

View File

@ -69,16 +69,24 @@ componentconstructors['regions'] = function(dynmap, configuration) {
}
function createPopupContent(name, region) {
function join(a) {
if (a instanceof Array) {
return a.join(', ');
} else if (typeof a === 'string') {
return a;
}
return null;
}
var members = region.members || {};
return $('<div/>').addClass('regioninfo')
.append($('<span/>').addClass('regionname').text(name))
.append($('<span/>').addClass('owners')
.append(region.owners.players && $('<span/>').addClass('playerowners').text(region.owners.players.concat()))
.append(region.owners.groups && $('<span/>').addClass('groupowners').text(region.owners.groups.concat()))
.append(region.owners.players && $('<span/>').addClass('playerowners').text(join(region.owners.players)))
.append(region.owners.groups && $('<span/>').addClass('groupowners').text(join(region.owners.groups)))
)
.append($('<span/>').addClass('members')
.append(members.players && $('<span/>').addClass('playermembers').text(members.players.concat()))
.append(members.groups && $('<span/>').addClass('groupmembers').text(members.groups.concat()))
.append(members.players && $('<span/>').addClass('playermembers').text(join(members.players)))
.append(members.groups && $('<span/>').addClass('groupmembers').text(join(members.groups)))
)
.append(region.parent && $('<span/>').addClass('regionparent').text(region.parent))
.append(region.flags && function() {