From 9e73f1563d41e4b6877acc4cddfc1b4d63aba1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Jul 2015 15:43:11 +0200 Subject: [PATCH] Strip paragraphs from summaries for announcement notifications --- .../announcements/static/js/announcements.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/announcements/static/js/announcements.js b/src/octoprint/plugins/announcements/static/js/announcements.js index 55e941b3..812d7005 100644 --- a/src/octoprint/plugins/announcements/static/js/announcements.js +++ b/src/octoprint/plugins/announcements/static/js/announcements.js @@ -182,6 +182,17 @@ $(function() { return text; }; + var stripParagraphs = function(text) { + if (_.startsWith(text, "

")) { + text = text.substr("

".length); + } + if (_.endsWith(text, "

")) { + text = text.substr(0, text.length - "

".length); + } + + return text.replace(/<\/p>\s*

/ig, "
"); + }; + _.each(channels, function(value) { var key = value.key; var channel = value.channel; @@ -209,7 +220,7 @@ $(function() { var text = "