Allow displaying image in POIs (#389)
* Add image to POIs * fix missing quote * Swap <hr> position
This commit is contained in:
parent
89ea214d02
commit
070c7f7bdf
@ -18,6 +18,7 @@ func (this *PoiBlock) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, bloc
|
|||||||
o.Attributes["name"] = md["name"]
|
o.Attributes["name"] = md["name"]
|
||||||
o.Attributes["category"] = md["category"]
|
o.Attributes["category"] = md["category"]
|
||||||
o.Attributes["url"] = md["url"]
|
o.Attributes["url"] = md["url"]
|
||||||
|
o.Attributes["image"] = md["image"]
|
||||||
o.Attributes["owner"] = md["owner"]
|
o.Attributes["owner"] = md["owner"]
|
||||||
o.Attributes["icon"] = md["icon"]
|
o.Attributes["icon"] = md["icon"]
|
||||||
o.Attributes["color"] = this.Color
|
o.Attributes["color"] = this.Color
|
||||||
|
@ -48,3 +48,8 @@ body {
|
|||||||
.player-popup div.info {
|
.player-popup div.info {
|
||||||
grid-area: info;
|
grid-area: info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.poi_image {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
@ -20,18 +20,23 @@ export default AbstractIconOverlay.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
createPopup: function(poi){
|
createPopup: function(poi){
|
||||||
|
var innerHTML = "";
|
||||||
|
|
||||||
if (poi.attributes.url)
|
if (poi.attributes.url) {
|
||||||
{
|
innerHTML += "<a href=\"" + HtmlSanitizer.SanitizeHtml(poi.attributes.url) + "\">" +
|
||||||
return "<a href=\"" + HtmlSanitizer.SanitizeHtml(poi.attributes.url) + "\">" +
|
"<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4></a>";
|
||||||
"<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4></a><hr>" +
|
} else {
|
||||||
"<b>Owner: </b> " + HtmlSanitizer.SanitizeHtml(poi.attributes.owner) + "<br>";
|
innerHTML += "<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4>";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (poi.attributes.image) {
|
||||||
return "<h4>" + HtmlSanitizer.SanitizeHtml(poi.attributes.name) + "</h4><hr>" +
|
innerHTML += "<img class=\"poi_image\" src=\"" + HtmlSanitizer.SanitizeHtml(poi.attributes.image) +
|
||||||
"<b>Owner: </b> " + HtmlSanitizer.SanitizeHtml(poi.attributes.owner) + "<br>";
|
"\" crossorigin=\"anonymous\" referrerpolicy=\"origin-when-cross-origin\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
innerHTML += "<hr><b>Owner: </b> " + HtmlSanitizer.SanitizeHtml(poi.attributes.owner) + "<br>";
|
||||||
|
|
||||||
|
return innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user