From: Thomas Tanghus Date: Sat, 12 May 2012 17:54:16 +0000 (+0200) Subject: Revert "Edited combobox to adhere to coding standards and added a dblclick handler." X-Git-Tag: v4.0.0RC2~103 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=56bd3f12209cfd64cc0dc333bf643f077ef011fc;p=nextcloud-server.git Revert "Edited combobox to adhere to coding standards and added a dblclick handler." This reverts commit 19b55d3fcef54d610a8256e861d0bc894b514c5c. --- diff --git a/apps/contacts/js/jquery.combobox.js b/apps/contacts/js/jquery.combobox.js index d9959eb6cde..f12d1d7dd20 100644 --- a/apps/contacts/js/jquery.combobox.js +++ b/apps/contacts/js/jquery.combobox.js @@ -23,16 +23,16 @@ 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' - ), '$1'), + ")(?![^<>]*>)(?![^&;]+;)", "gi" + ), "$1" ), value: text, option: this }; @@ -42,17 +42,17 @@ 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; @@ -62,41 +62,36 @@ // 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 $('
  • ') - .data('item.autocomplete', item ) - .append('' + item.label + '') + input.data( "autocomplete" )._renderItem = function( ul, item ) { + return $( "
  • " ) + .data( "item.autocomplete", item ) + .append( "" + item.label + "" ) .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 = $('') - .attr('tabIndex', -1 ) - .attr('title', 'Show All Items') + this.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; } @@ -104,7 +99,7 @@ $( this ).blur(); // pass empty string as value to search for, displaying all results - input.autocomplete('search', ''); + input.autocomplete( "search", "" ); input.focus(); }); }