[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
This commit is contained in:
Nicolas Lempereur 2015-05-15 11:11:22 +02:00
parent cab5e3668f
commit 02fb59fffa
1 changed files with 2 additions and 1 deletions

View File

@ -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');