diff options
author | Brice Maron <brice@bmaron.net> | 2012-05-08 16:22:35 +0000 |
---|---|---|
committer | Brice Maron <brice@bmaron.net> | 2012-05-08 16:22:35 +0000 |
commit | fa4a52260fa59f22edb83f64fb7cbb96504020e0 (patch) | |
tree | f0bbfdc24d37b128feb68ddc6443d37bb1d3f093 /apps/bookmarks | |
parent | 52717d2a1bf5dd4089c76a44076ecf92a22ee82f (diff) | |
download | nextcloud-server-fa4a52260fa59f22edb83f64fb7cbb96504020e0.tar.gz nextcloud-server-fa4a52260fa59f22edb83f64fb7cbb96504020e0.zip |
Try to correct query string url for search in bookmark
Diffstat (limited to 'apps/bookmarks')
-rw-r--r-- | apps/bookmarks/js/bookmarks.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index b1eebaa5515..73986e49186 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -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; |