From bd66a9ef28ddf25e014e852e5ee770868f619aaa Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 8 Dec 2018 09:32:14 +0300 Subject: render article on the client using headlines data --- js/common.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'js/common.js') 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 -- cgit v1.2.3