summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/common.js')
-rwxr-xr-xjs/common.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/js/common.js b/js/common.js
index 5b2812be6..788c159fe 100755
--- a/js/common.js
+++ b/js/common.js
@@ -326,6 +326,21 @@ function popupOpenArticle(id) {
"ttrss_article_popup",
"height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no");
- w.opener = null;
- w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + App.getInitParam("csrf_token");
+ if (w) {
+ w.opener = null;
+ 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 = {
+ '&': '&',
+ '<': '&lt;',
+ '>': '&gt;',
+ '"': '&quot;',
+ "'": '&#039;'
+ };
+
+ return text.replace(/[&<>"']/g, function(m) { return map[m]; });
+} \ No newline at end of file