diff options
Diffstat (limited to 'js/common.js')
-rwxr-xr-x | js/common.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/common.js b/js/common.js index 00bac636b..788c159fe 100755 --- a/js/common.js +++ b/js/common.js @@ -331,3 +331,16 @@ function popupOpenArticle(id) { w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + App.getInitParam("csrf_token"); } } + +// htmlspecialchars()-alike for headlines data-content attribute +function escapeHtml(text) { + const map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); +}
\ No newline at end of file |