[Jifty-commit] jifty branch, autocomplete-refactor, updated. 0a86fceec5a166a70f52ee78f0bf578960a39fc0
Jifty commits
jifty-commit at lists.jifty.org
Mon Mar 22 17:42:47 EDT 2010
The branch, autocomplete-refactor has been updated
via 0a86fceec5a166a70f52ee78f0bf578960a39fc0 (commit)
from 48076bdfca7d444bb1fbba7d58b170f887b78a26 (commit)
Summary of changes:
share/web/static/js/jquery.autocomplete.js | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit 0a86fceec5a166a70f52ee78f0bf578960a39fc0
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Mar 22 17:42:39 2010 -0400
Patch jquery.autocomplete to let extraParams itself be a function
diff --git a/share/web/static/js/jquery.autocomplete.js b/share/web/static/js/jquery.autocomplete.js
index 9d12a29..4a2fb25 100644
--- a/share/web/static/js/jquery.autocomplete.js
+++ b/share/web/static/js/jquery.autocomplete.js
@@ -8,6 +8,8 @@
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
+ *
+ * 2010-03-22 Shawn M Moore: let extraParams itself be a function
*/
;(function($) {
@@ -350,14 +352,18 @@ $.Autocompleter = function(input, options) {
success(term, data);
// if an AJAX url has been supplied, try loading the data now
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
-
- var extraParams = {
- timestamp: +new Date()
- };
- $.each(options.extraParams, function(key, param) {
- extraParams[key] = typeof param == "function" ? param() : param;
- });
-
+ var extraParams = {
+ timestamp: +new Date()
+ };
+ if (typeof options.extraParams == "function") {
+ extraParams = options.extraParams();
+ }
+ else {
+ $.each(options.extraParams, function(key, param) {
+ extraParams[key] = typeof param == "function" ? param() : param;
+ });
+ }
+
$.ajax({
// try to leverage ajaxQueue plugin to abort previous requests
mode: "abort",
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list