|
@@ -68,6 +68,43 @@
|
|
}, "#" + qinput_id);
|
|
}, "#" + qinput_id);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ Monkey patch autocomplete.js to fix a bug
|
|
|
|
+ With the POST method, the values are not URL encoded: query like "1 + 1" are sent as "1 1" since space are URL encoded as plus.
|
|
|
|
+ See HTML specifications:
|
|
|
|
+ * HTML5: https:
|
|
|
|
+ * HTML4: https:
|
|
|
|
+
|
|
|
|
+ autocomplete.js does not URL encode the name and values:
|
|
|
|
+ https:
|
|
|
|
+
|
|
|
|
+ The monkey patch overrides the compiled version of the ajax function.
|
|
|
|
+ See https:
|
|
|
|
+ The patch changes only the line 156 from
|
|
|
|
+ params.Request.send(params._QueryArg() + "=" + params._Pre());
|
|
|
|
+ to
|
|
|
|
+ params.Request.send(encodeURIComponent(params._QueryArg()) + "=" + encodeURIComponent(params._Pre()));
|
|
|
|
+
|
|
|
|
+ Related to:
|
|
|
|
+ * https:
|
|
|
|
+ * https:
|
|
|
|
+ */
|
|
|
|
+ AutoComplete.prototype.ajax = function (params, request, timeout) {
|
|
|
|
+ if (timeout === void 0) { timeout = true; }
|
|
|
|
+ if (params.$AjaxTimer) {
|
|
|
|
+ window.clearTimeout(params.$AjaxTimer);
|
|
|
|
+ }
|
|
|
|
+ if (timeout === true) {
|
|
|
|
+ params.$AjaxTimer = window.setTimeout(AutoComplete.prototype.ajax.bind(null, params, request, false), params.Delay);
|
|
|
|
+ } else {
|
|
|
|
+ if (params.Request) {
|
|
|
|
+ params.Request.abort();
|
|
|
|
+ }
|
|
|
|
+ params.Request = request;
|
|
|
|
+ params.Request.send(encodeURIComponent(params._QueryArg()) + "=" + encodeURIComponent(params._Pre()));
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
if (!isMobile && document.querySelector('.index_endpoint')) {
|
|
if (!isMobile && document.querySelector('.index_endpoint')) {
|
|
qinput.focus();
|
|
qinput.focus();
|
|
}
|
|
}
|