diff --git a/web/js/regions.js b/web/js/regions.js index aa3639a8..6cac8ce0 100644 --- a/web/js/regions.js +++ b/web/js/regions.js @@ -106,30 +106,24 @@ componentconstructors['regions'] = function(dynmap, configuration) { return a.join(', '); } else if (typeof a === 'string') { return a; + } else { + return ""; } - return null; } var members = region.members || {}; + var popup = this.infowindow || '
%regionname%
Owner %playerowners%
Flags
%flags%
'; + popup = popup.replace('%regionname%', name); + popup = popup.replace('%playerowners%', join(region.owners.players)); + popup = popup.replace('%groupowners%', join(region.owners.groups)); + popup = popup.replace('%playermembers%', join(members.players)); + popup = popup.replace('%groupmembers%', join(members.groups)); + var regionflags = ""; + $.each(region.flags, function(name, value) { + regionflags = regionflags + "" + name + ": " + value + "
"; + }); + popup = popup.replace('%flags%', regionflags); return $('
').addClass('regioninfo') - .append($('').addClass('regionname').text(name)) - .append($('').addClass('owners') - .append(region.owners.players && $('').addClass('playerowners').text(join(region.owners.players))) - .append(region.owners.groups && $('').addClass('groupowners').text(join(region.owners.groups))) - ) - .append($('').addClass('members') - .append(members.players && $('').addClass('playermembers').text(join(members.players))) - .append(members.groups && $('').addClass('groupmembers').text(join(members.groups))) - ) - .append(region.parent && $('').addClass('regionparent').text(region.parent)) - .append(region.flags && function() { - var regionflags = $('').addClass('regionflags'); - $.each(region.flags, function(name, value) { - regionflags.append($('').addClass('regionflag').text(name + ': ' + value)); - }); - return regionflags; - }()) - .append($('').addClass('regionpriority').text(region.priority)) - [0]; + .append(popup)[0]; } var self = this; diff --git a/web/js/regions_Residence.js b/web/js/regions_Residence.js index a8b5c0cd..7a8db228 100644 --- a/web/js/regions_Residence.js +++ b/web/js/regions_Residence.js @@ -8,7 +8,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) { var boxLayers = []; $.each(data, function(name, residence) { if(configuration.worldName == residence.Permissions.World) { - $.each(residence.Areas, function(name, area) { + $.each(residence.Areas, function(aname, area) { var boxLayer = configuration.createBoxLayer(area.X1, area.X2, area.Y1, area.Y2, area.Z1, area.Z2); boxLayer.bindPopup(configuration.createPopupContent(name, $.extend(residence, { @@ -21,7 +21,7 @@ regionConstructors['Residence'] = function(dynmap, configuration) { $.each(residence.Subzones, function(szname, subzone) { $.each(subzone.Areas, function(name2, area2) { var subzoneLayer = configuration.createBoxLayer(area2.X1, area2.X2, area2.Y1, area2.Y2, area2.Z1, area2.Z2); - subzoneLayer.bindPopup(configuration.createPopupContent(name2, $.extend(subzone, { + subzoneLayer.bindPopup(configuration.createPopupContent(name + '.' + szname, $.extend(subzone, { owners: { players: [subzone.Permissions.Owner] }, flags: subzone.Permissions.AreaFlags })));