Skip to content

Commit bb85358

Browse files
Merge pull request #49 from userabuser/patch-1
Add X-Requested-With header
2 parents 289f7ce + 582d80d commit bb85358

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

dist/autocomplete.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,31 @@ var AutoComplete = (function () {
176176
merge[tmp] = arguments[i][tmp];
177177
}
178178
}
179-
return merge;
180-
};
181-
AutoComplete.defaults = {
182-
Delay: 150,
183-
EmptyMessage: "No result here",
184-
Highlight: {
185-
getRegex: function (value) {
186-
return new RegExp(value, "ig");
179+
},
180+
HttpHeaders: {
181+
"Content-type": "application/x-www-form-urlencoded",
182+
"X-Requested-With": "XMLHttpRequest"
183+
},
184+
Limit: 0,
185+
MinChars: 0,
186+
HttpMethod: "GET",
187+
QueryArg: "q",
188+
Url: null,
189+
KeyboardMappings: {
190+
"Enter": {
191+
Conditions: [{
192+
Is: 13,
193+
Not: false
194+
}],
195+
Callback: function (event) {
196+
if (this.DOMResults.getAttribute("class").indexOf("open") != -1) {
197+
event.preventDefault();
198+
var liActive = this.DOMResults.querySelector("li.active");
199+
if (liActive !== null) {
200+
this._Select(liActive);
201+
this.DOMResults.setAttribute("class", "autocomplete");
202+
}
203+
}
187204
},
188205
transform: function (value) {
189206
return "<strong>" + value + "</strong>";
@@ -523,4 +540,4 @@ var AutoComplete = (function () {
523540
module.exports = AutoComplete;
524541

525542
},{}]},{},[1])(1)
526-
});
543+
});

0 commit comments

Comments
 (0)