aboutsummaryrefslogtreecommitdiff
path: root/vendors
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-10-17 19:37:30 -0700
committerCash Costello <cash.costello@gmail.com>2011-10-17 19:37:30 -0700
commit63ebe7b121105beb7e4c8b9b82e3c649f6a9a489 (patch)
tree79f51f8b6e94203297cbbc899f3daa400475de34 /vendors
parent9a3ec606cfe2cbbe08949a56198bf9d4bb2e1e64 (diff)
parent34c968355231216624c2beae59ea9ad17f7ef2c0 (diff)
downloadelgg-63ebe7b121105beb7e4c8b9b82e3c649f6a9a489.tar.gz
elgg-63ebe7b121105beb7e4c8b9b82e3c649f6a9a489.tar.bz2
Merge pull request #74 from cash/autocomplete
Fixes #2102, #2712, #3450 Finishes autocomplete and userpicker for 1.8.1
Diffstat (limited to 'vendors')
-rw-r--r--vendors/jquery/jquery.ui.autocomplete.html.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/vendors/jquery/jquery.ui.autocomplete.html.js b/vendors/jquery/jquery.ui.autocomplete.html.js
new file mode 100644
index 000000000..a3ed2ee4b
--- /dev/null
+++ b/vendors/jquery/jquery.ui.autocomplete.html.js
@@ -0,0 +1,40 @@
+/*
+ * jQuery UI Autocomplete HTML Extension
+ *
+ * Copyright 2010, Scott González (http://scottgonzalez.com)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * http://github.com/scottgonzalez/jquery-ui-extensions
+ */
+(function( $ ) {
+
+var proto = $.ui.autocomplete.prototype,
+ initSource = proto._initSource;
+
+function filter( array, term ) {
+ var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+ return $.grep( array, function(value) {
+ return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() );
+ });
+}
+
+$.extend( proto, {
+ _initSource: function() {
+ if ( this.options.html && $.isArray(this.options.source) ) {
+ this.source = function( request, response ) {
+ response( filter( this.options.source, request.term ) );
+ };
+ } else {
+ initSource.call( this );
+ }
+ },
+
+ _renderItem: function( ul, item) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) )
+ .appendTo( ul );
+ }
+});
+
+})( jQuery ); \ No newline at end of file