]> source.dussan.org Git - nextcloud-server.git/commitdiff
Revert "Edited combobox to adhere to coding standards and added a dblclick handler."
authorThomas Tanghus <thomas@tanghus.net>
Sat, 12 May 2012 17:54:16 +0000 (19:54 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Sun, 13 May 2012 04:22:15 +0000 (06:22 +0200)
This reverts commit 19b55d3fcef54d610a8256e861d0bc894b514c5c.

apps/contacts/js/jquery.combobox.js

index d9959eb6cdee7bb1133cac828dbcd0f61626013d..f12d1d7dd20ef3934bd054950f79e7dee94f8615 100644 (file)
                                        minLength: 0,
                                        source: function( request, response ) {
                                                var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
-                                               response( select.children('option').map(function() {
+                                               response( select.children( "option" ).map(function() {
                                                        var text = $( this ).text();
                                                        if ( this.value && ( !request.term || matcher.test(text) ) )
                                                                return {
                                                                        label: text.replace(
                                                                                new RegExp(
-                                                                                       '(?![^&;]+;)(?!<[^<>]*)(' +
+                                                                                       "(?![^&;]+;)(?!<[^<>]*)(" +
                                                                                        $.ui.autocomplete.escapeRegex(request.term) +
-                                                                                       ')(?![^<>]*>)(?![^&;]+;)', 'gi'
-                                                                               ), '<strong>$1</strong>'),
+                                                                                       ")(?![^<>]*>)(?![^&;]+;)", "gi"
+                                                                               ), "<strong>$1</strong>" ),
                                                                        value: text,
                                                                        option: this
                                                                };
                                                self.input.val($(ui.item.option).text());
                                                self.input.trigger('change');
                                                ui.item.option.selected = true;
-                                               self._trigger('selected', event, {
+                                               self._trigger( "selected", event, {
                                                        item: ui.item.option
                                                });
                                        },
                                        change: function( event, ui ) {
                                                if ( !ui.item ) {
-                                                       var matcher = new RegExp( '^' + $.ui.autocomplete.escapeRegex( $(this).val() ) + '$', 'i' ),
+                                                       var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
                                                                valid = false;
                                                        self.input.val($(this).val());
                                                        //self.input.trigger('change');
-                                                       select.children('option').each(function() {
+                                                       select.children( "option" ).each(function() {
                                                                if ( $( this ).text().match( matcher ) ) {
                                                                        this.selected = valid = true;
                                                                        return false;
                                                                // remove invalid value, as it didn't match anything
                                                                $( this ).val( "" );
                                                                select.val( "" );
-                                                               input.data('autocomplete').term = '';
+                                                               input.data( "autocomplete" ).term = "";
                                                                return false;
                                                        }
                                                }
                                        }
                                })
-                               .addClass('ui-widget ui-widget-content ui-corner-left');
+                               .addClass( "ui-widget ui-widget-content ui-corner-left" );
 
-                       input.data('autocomplete')._renderItem = function( ul, item ) {
-                               return $('<li></li>')
-                                       .data('item.autocomplete', item )
-                                       .append('<a>' + item.label + '</a>')
+                       input.data( "autocomplete" )._renderItem = function( ul, item ) {
+                               return $( "<li></li>" )
+                                       .data( "item.autocomplete", item )
+                                       .append( "<a>" + item.label + "</a>" )
                                        .appendTo( ul );
                        };
                        $.each(this.options, function(key, value) {
                                self._setOption(key, value);
                        });
 
-                       input.dblclick(function() {
-                               // pass empty string as value to search for, displaying all results
-                               input.autocomplete('search', '');
-                       });
-                       
                        if(this.options['showButton']) {
-                               this.button = $('<button type="button">&nbsp;</button>')
-                                       .attr('tabIndex', -1 )
-                                       .attr('title', 'Show All Items')
+                               this.button = $( "<button type='button'>&nbsp;</button>" )
+                                       .attr( "tabIndex", -1 )
+                                       .attr( "title", "Show All Items" )
                                        .insertAfter( input )
                                        .addClass('svg')
                                        .addClass('action')
                                        .addClass('combo-button')
                                        .click(function() {
                                                // close if already visible
-                                               if ( input.autocomplete('widget').is(':visible') ) {
-                                                       input.autocomplete('close');
+                                               if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
+                                                       input.autocomplete( "close" );
                                                        return;
                                                }
 
                                                $( this ).blur();
 
                                                // pass empty string as value to search for, displaying all results
-                                               input.autocomplete('search', '');
+                                               input.autocomplete( "search", "" );
                                                input.focus();
                                        });
                        }