From f1a7e040fbe7671c6be85d6590ed82195fcc1285 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 16 Feb 2013 17:32:50 -0500 Subject: [PATCH] fixed & error on synapse desc display --- app/assets/javascripts/Jit/graphsettings.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/assets/javascripts/Jit/graphsettings.js b/app/assets/javascripts/Jit/graphsettings.js index 8b3b4165..5d092906 100644 --- a/app/assets/javascripts/Jit/graphsettings.js +++ b/app/assets/javascripts/Jit/graphsettings.js @@ -300,6 +300,9 @@ var nodeSettings = { var desc = adj.getData("desc"); var showDesc = adj.getData("showDesc"); if( desc != "" && showDesc ) { + // '&' to '&' + desc = decodeEntities(desc); + //now adjust the label placement var ctx = canvas.getCtx(); var radius = canvas.getSize(); @@ -449,3 +452,14 @@ function onPlaceLabelHandler(domElement, node) { style = label.style; style.left = (-(w / 2 + 106)) + 'px'; } + +// thanks to http://stackoverflow.com/questions/4338963/ +// convert-html-character-entities-back-to-regular-text-using-javascript +function decodeEntities(desc) { + var str, temp = document.createElement('p'); + temp.innerHTML = desc; //browser handles the entities + str = temp.textContent || temp.innerText; + temp = null; //delete the element; + return str; +}//decodeEntities +