Skip to content
Snippets Groups Projects
Commit fa4a5226 authored by Brice Maron's avatar Brice Maron
Browse files

Try to correct query string url for search in bookmark

parent 52717d2a
Branches
No related tags found
No related merge requests found
......@@ -120,13 +120,20 @@ function showBookmark(event) {
}, 500);
}
function replaceQueryString(url,param,value) {
var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
if (url.match(re))
return url.replace(re,'$1' + param + "=" + value + '$2');
else
return url + '&' + param + "=" + value;
}
function updateBookmarksList(bookmark) {
var tags = encodeEntities(bookmark.tags).split(' ');
var taglist = '';
for ( var i=0, len=tags.length; i<len; ++i ){
if(tags[i] != '')
taglist = taglist + '<a class="bookmark_tag" href="?tag=' + encodeURIComponent(tags[i]) + '">' + tags[i] + '</a> ';
taglist = taglist + '<a class="bookmark_tag" href="'+replaceQueryString( String(window.location), 'tag', encodeURIComponent(tags[i])) + '">' + tags[i] + '</a> ';
}
if(!hasProtocol(bookmark.url)) {
bookmark.url = 'http://' + bookmark.url;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment