Revision | 7c4201befb0a5e78793159a7994183ea3912d917 (tree) |
---|---|
Zeit | 2017-09-30 10:44:00 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
Fix encode_hint logic
@@ -166,7 +166,7 @@ function plugin_search2_do_search($query_text, $base, $start_index) | ||
166 | 166 | mb_convert_variables('UTF-8', SOURCE_ENCODING, $obj); |
167 | 167 | } |
168 | 168 | } |
169 | - print(json_encode(obj, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
169 | + print(json_encode($obj, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); | |
170 | 170 | } |
171 | 171 | |
172 | 172 | function plugin_search2_search_form($s_word = '', $type = '', $bases = array()) |
@@ -28,7 +28,7 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
28 | 28 | function doSearch(searchText, session, startIndex) { |
29 | 29 | var url = './?cmd=search2&action=query'; |
30 | 30 | var props = getSiteProps(); |
31 | - url += '&encode_hint=\u3077'; | |
31 | + url += '&encode_hint=' + encodeURIComponent('\u3077'); | |
32 | 32 | if (searchText) { |
33 | 33 | url += '&q=' + encodeURIComponent(searchText); |
34 | 34 | } |
@@ -451,7 +451,8 @@ window.addEventListener && window.addEventListener('DOMContentLoaded', function( | ||
451 | 451 | baseUri = props.base_uri_pathname; |
452 | 452 | } |
453 | 453 | var url = baseUri + '?' + |
454 | - (props.is_utf8 ? '' : 'encode_hint=\u3077' + '&') + | |
454 | + (props.is_utf8 ? '' : 'encode_hint=' + | |
455 | + encodeURIComponent('\u3077') + '&') + | |
455 | 456 | 'cmd=search2' + |
456 | 457 | '&q=' + encodeSearchText(q) + |
457 | 458 | (base ? '&base=' + encodeURIComponent(base) : ''); |