mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
Merged revision(s) 23229 from trunk:
bug:2921 Can't create tags with special chars like ( + [ https://github.com/MartinKoerner/jquery-tokeninput/commit/cc8eab541ad1371c6f0c6730c0154908eb105f5d git-svn-id: http://piwigo.org/svn/branches/2.5@23230 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -576,7 +576,12 @@ $.TokenList = function (input, url_or_data, settings) {
|
||||
|
||||
// Highlight the query part of the search term
|
||||
function highlight_term(value, term) {
|
||||
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
|
||||
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + escape_regexp_chars(term) + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
|
||||
}
|
||||
|
||||
function escape_regexp_chars(string) {
|
||||
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
|
||||
return string.replace(specials, "\\$&");
|
||||
}
|
||||
|
||||
// Populate the results dropdown with some results
|
||||
|
||||
Reference in New Issue
Block a user