[-] FO : FixBug #PSCFV-9846 Bookmark title escape problem on special language

This commit is contained in:
jeromenadaud committed 2013-07-31 10:24:14 +02:00
1 parent e1b7470845
commit d68363fdda
1 file changed
+13 -3
+13 -3
View File
@@ -186,7 +186,7 @@ function writeBookmarkLink(url, title, text, img)
{ {
var insert = ''; var insert = '';
if (img) if (img)
insert = writeBookmarkLinkObject(url, title, '<img src="' + img + '" alt="' + escape(text) + '" title="' + escape(text) + '" />') + '&nbsp'; insert = writeBookmarkLinkObject(url, title, '<img src="' + img + '" alt="' + escape(text) + '" title="' + removeQuotes(text) + '" />') + '&nbsp';
insert += writeBookmarkLinkObject(url, title, text); insert += writeBookmarkLinkObject(url, title, text);
if (window.sidebar || window.opera && window.print || (window.external && ('AddFavorite' in window.external))) if (window.sidebar || window.opera && window.print || (window.external && ('AddFavorite' in window.external)))
document.write(insert); document.write(insert);
@@ -195,9 +195,9 @@ function writeBookmarkLink(url, title, text, img)
function writeBookmarkLinkObject(url, title, insert) function writeBookmarkLinkObject(url, title, insert)
{ {
if (window.sidebar || window.external) if (window.sidebar || window.external)
return ('<a href="javascript:addBookmark(\'' + escape(url) + '\', \'' + escape(title) + '\')">' + insert + '</a>'); return ('<a href="javascript:addBookmark(\'' + escape(url) + '\', \'' + removeQuotes(title) + '\')">' + insert + '</a>');
else if (window.opera && window.print) else if (window.opera && window.print)
return ('<a rel="sidebar" href="' + escape(url) + '" title="' + escape(title) + '">' + insert + '</a>'); return ('<a rel="sidebar" href="' + escape(url) + '" title="' + removeQuotes(title) + '">' + insert + '</a>');
return (''); return ('');
} }
@@ -284,6 +284,16 @@ function isArrowKey(k_ev)
return false; return false;
} }
function removeQuotes(value)
{
value = value.replace(/\\"/g, '');
value = value.replace(/"/g, '');
value = value.replace(/\\'/g, '');
value = value.replace(/'/g, '');
return value;
}
//On dom ready //On dom ready
$().ready(function() $().ready(function()
{ {