From 02fb59fffa01440dae803998b8e4ef2373de53a3 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 15 May 2015 11:11:22 +0200 Subject: [PATCH] [FIX] website: widget share doesn't always work Depending on the area (in this case a html field), the editor can escape the url which wasn't taken into account by this widget. closes #6726 opw-639852 --- addons/website/static/src/js/website.snippets.animation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js index c72e2c3b84e..f68097c3f69 100644 --- a/addons/website/static/src/js/website.snippets.animation.js +++ b/addons/website/static/src/js/website.snippets.animation.js @@ -137,7 +137,8 @@ var title = encodeURIComponent($("title").text()); this.$target.find("a").each(function () { var $a = $(this); - $a.attr("href", $(this).attr("href").replace("{url}", url).replace("{title}", title)); + var url_regex = /\{url\}|%7Burl%7D/, title_regex = /\{title\}|%7Btitle%7D/; + $a.attr("href", $(this).attr("href").replace(url_regex, url).replace(title_regex, title)); if ($a.attr("target") && $a.attr("target").match(/_blank/i)) { $a.click(function () { window.open(this.href,'','menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=550,width=600');