add util function to escape strings for manual building of HTML, and use this for the portal title
fix #319
This commit is contained in:
parent
e609c64775
commit
bfd9f39067
@ -54,7 +54,7 @@ window.renderPortalDetails = function(guid) {
|
|||||||
$('#portaldetails')
|
$('#portaldetails')
|
||||||
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
.attr('class', TEAM_TO_CSS[getTeam(d)])
|
||||||
.html(''
|
.html(''
|
||||||
+ '<h3 class="title">'+d.portalV2.descriptiveText.TITLE+'</h3>'
|
+ '<h3 class="title">'+escapeHtmlSpecialChars(d.portalV2.descriptiveText.TITLE)+'</h3>'
|
||||||
+ '<span class="close" onclick="unselectOldPortal();" title="Close">X</span>'
|
+ '<span class="close" onclick="unselectOldPortal();" title="Close">X</span>'
|
||||||
// help cursor via ".imgpreview img"
|
// help cursor via ".imgpreview img"
|
||||||
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
|
||||||
|
@ -365,6 +365,14 @@ window.escapeJavascriptString = function(str) {
|
|||||||
return (str+'').replace(/[\\"']/g,'\\$&');
|
return (str+'').replace(/[\\"']/g,'\\$&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//escape special characters, such as tags
|
||||||
|
window.escapeHtmlSpecialChars = function(str) {
|
||||||
|
var div = document.createElement(div);
|
||||||
|
var text = document.createTextNode(str);
|
||||||
|
div.appendChild(text);
|
||||||
|
return div.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
window.prettyEnergy = function(nrg) {
|
window.prettyEnergy = function(nrg) {
|
||||||
return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg;
|
return nrg> 1000 ? Math.round(nrg/1000) + ' k': nrg;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user