Fix advanced search form for multibyte strings
That was mean.
This commit is contained in:
parent
8719f00f37
commit
f41c2875ba
2
js/application.min.js
vendored
2
js/application.min.js
vendored
File diff suppressed because one or more lines are too long
8
js/complete.min.js
vendored
8
js/complete.min.js
vendored
File diff suppressed because one or more lines are too long
@ -90,12 +90,12 @@ if ( $show_advanced ) {
|
||||
$allow_list = [];
|
||||
|
||||
foreach ( $all_terms as $term ) {
|
||||
$allow_list[ rawurlencode( strtolower( $term->name ) ) ] = $term->term_id;
|
||||
$allow_list[ base64_encode( mb_strtolower( $term->name, 'UTF-8' ) ) ] = $term->term_id;
|
||||
}
|
||||
|
||||
if ( ! $skip_author_keywords ) {
|
||||
foreach ( $all_authors as $author ) {
|
||||
$author_key = rawurlencode( strtolower( $author->display_name ) );
|
||||
$author_key = base64_encode( mb_strtolower( $author->display_name, 'UTF-8' ) );
|
||||
|
||||
$allow_list[ $author_key . '_' . $author->ID ] = $author->ID;
|
||||
}
|
||||
|
@ -1683,7 +1683,10 @@ class FCN_KeywordInput {
|
||||
}
|
||||
|
||||
encode(text) {
|
||||
return encodeURIComponent(text.toLowerCase()).replace(/'/g, '%27');
|
||||
const textEncoder = new TextEncoder();
|
||||
const encodedText = textEncoder.encode(text.toLowerCase());
|
||||
|
||||
return btoa(String.fromCharCode.apply(null, encodedText));
|
||||
}
|
||||
|
||||
filterSuggestions() {
|
||||
@ -1703,7 +1706,10 @@ class FCN_KeywordInput {
|
||||
if (suggestion.includes(value) && this.keywords.indexOf(suggestion) < 0) {
|
||||
element.hidden = false; // Show
|
||||
count++; // Count of suggestions
|
||||
if (match == '' && suggestion.startsWith(value)) match = suggestion; // Tab suggestion
|
||||
|
||||
if (match == '' && suggestion.startsWith(value)) {
|
||||
match = suggestion; // Tab suggestion
|
||||
}
|
||||
} else {
|
||||
element.hidden = true; // Hide
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user