diff options
author | Andrew Dolgov <[email protected]> | 2018-12-08 09:32:14 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-12-08 09:32:14 +0300 |
commit | bd66a9ef28ddf25e014e852e5ee770868f619aaa (patch) | |
tree | 1e101b88ff13c1aaeaaa743a1c582a828327a90c /js/common.js | |
parent | 41e967136f6391ff6d7a7c20af47dc434d853099 (diff) |
render article on the client using headlines data
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 |