diff options
Diffstat (limited to 'js/common.js')
| -rwxr-xr-x | js/common.js | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/js/common.js b/js/common.js index 427e3034c..788c159fe 100755 --- a/js/common.js +++ b/js/common.js @@ -56,7 +56,23 @@ const Lists = { if (row) checked ? row.addClassName("Selected") : row.removeClassName("Selected"); - } + }, + select: function(elemId, selected) { + $(elemId).select("li").each((row) => { + const checkNode = row.select(".dijitCheckBox,input[type=checkbox]")[0]; + if (checkNode) { + const widget = dijit.getEnclosingWidget(checkNode); + + if (widget) { + widget.attr("checked", selected); + } else { + checkNode.checked = selected; + } + + this.onRowChecked(widget); + } + }); + }, }; // noinspection JSUnusedGlobalSymbols @@ -154,8 +170,7 @@ const Notify = { } let msgfmt = "<span class=\"msg\">%s</span>".replace("%s", __(msg)); - let icon = false; - + let icon = ""; notify.className = "notify"; @@ -164,23 +179,28 @@ const Notify = { switch (kind) { case this.KIND_INFO: notify.addClassName("notify_info") - icon = App.getInitParam("icon_information"); + icon = "notifications"; break; case this.KIND_ERROR: notify.addClassName("notify_error"); - icon = App.getInitParam("icon_alert"); + icon = "error"; break; case this.KIND_PROGRESS: notify.addClassName("notify_progress"); icon = App.getInitParam("icon_indicator_white") break; + default: + icon = "notifications"; } - if (icon) msgfmt = "<span><img src=\"%s\"></span>".replace("%s", icon) + msgfmt; + if (icon) + if (icon.indexOf("data:image") != -1) + msgfmt = "<img src=\"%s\">".replace("%s", icon) + msgfmt; + else + msgfmt = "<i class='material-icons icon-notify'>%s</i>".replace("%s", icon) + msgfmt; - msgfmt += (" <span><img src=\"%s\" class='close' title=\"" + - __("Click to close") + "\" onclick=\"Notify.close()\"></span>") - .replace("%s", App.getInitParam("icon_cross")); + msgfmt += "<i class='material-icons icon-close' title=\"" + + __("Click to close") + "\" onclick=\"Notify.close()\">close</i>"; notify.innerHTML = msgfmt; notify.addClassName("visible"); @@ -306,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 = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); +}
\ No newline at end of file |