https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112692

Revision: 112692
Author:   nikerabbit
Date:     2012-02-29 14:59:42 +0000 (Wed, 29 Feb 2012)
Log Message:
-----------
Consistently indent, even though it leads to huge indentation, because I had 
problems understanding the code.
Not many non-whitespace changes.

Modified Paths:
--------------
    
trunk/extensions/Translate/resources/ext.translate.special.pagetranslation.js

Modified: 
trunk/extensions/Translate/resources/ext.translate.special.pagetranslation.js
===================================================================
--- 
trunk/extensions/Translate/resources/ext.translate.special.pagetranslation.js   
    2012-02-29 14:44:30 UTC (rev 112691)
+++ 
trunk/extensions/Translate/resources/ext.translate.special.pagetranslation.js   
    2012-02-29 14:59:42 UTC (rev 112692)
@@ -7,71 +7,74 @@
  * Credits: http://jqueryui.com/demos/autocomplete/#multiple
  */
 jQuery( function( $ ) {
+       "use strict"
+       
        $.widget( "ui.combobox", {
-       _create: function() {
-               var self = this,
-                       select = this.element.hide(),
-                       selected = select.children( ":selected" );
-               function split( val ) {
-                       return val.split( /,\s*/ );
-               }
-               var input = this.input = $( '#tpt-prioritylangs' )
-                       .autocomplete( {
-                       delay: 0,
-                       minLength: 0,
-                       source: function( request, response ) {
-                               var term = split( request.term ).pop();
-                               var matcher = new RegExp( 
$.ui.autocomplete.escapeRegex( term ), "i" );
-                               response( select.children( "option" 
).map(function() {
-                               var text = $( this ).text();
-                               var value = $( this ).val();
-                               var term = split( request.term ).pop();
-                               if ( this.value && ( !request.term || 
matcher.test(text) ) )
-                                       return {
-                                       label: text.replace(
-                                               new RegExp(
-                                               "(?![^&;]+;)(?!<[^<>]*)(" +
-                                               
$.ui.autocomplete.escapeRegex(term) +
-                                               ")(?![^<>]*>)(?![^&;]+;)", "gi"
-                                               ), "<strong>$1</strong>" ),
-                                       value: value,
-                                       option: this
-                                       };
-                               }) );
-                       },
-                       select: function( event, ui ) {
-                               ui.item.option.selected = true;
-                               self._trigger( "selected", event, {
-                                       item: ui.item.option
-                               });
-                               var terms = split( $(this).val() );
-                               // remove the current input
-                               terms.pop();
-                               // add the selected item
-                               terms.push( ui.item.value );
-                               // add placeholder to get the comma-and-space 
at the end
-                               terms.push( "" );
-                               $( this ).val( terms.join( ", " ) );
-                               return false;
+               _create: function() {
+                       var self = this,
+                               select = this.element.hide(),
+                               selected = select.children( ":selected" );
+                               
+                       function split( val ) {
+                               return val.split( /,\s*/ );
                        }
                        
-                       });
+                       var input = this.input = $( '#tpt-prioritylangs' )
+                               .autocomplete( {
+                                       delay: 0,
+                                       minLength: 0,
+                                       source: function( request, response ) {
+                                               var term = split( request.term 
).pop();
+                                               var matcher = new RegExp( 
$.ui.autocomplete.escapeRegex( term ), "i" );
+                                               response( select.children( 
"option" ).map( function() {
+                                                       var text = $( this 
).text();
+                                                       var value = $( this 
).val();
+                                                       var term = split( 
request.term ).pop();
+                                                       if ( this.value && ( 
!request.term || matcher.test(text) ) ) {
+                                                               return {
+                                                                       label: 
text.replace(
+                                                                               
new RegExp(
+                                                                               
"(?![^&;]+;)(?!<[^<>]*)(" +
+                                                                               
$.ui.autocomplete.escapeRegex( term ) +
+                                                                               
")(?![^<>]*>)(?![^&;]+;)", "gi"
+                                                                               
), "<strong>$1</strong>" ),
+                                                                       value: 
value,
+                                                                       option: 
this
+                                                               };
+                                                       }
+                                               } ) );
+                                       },
+                                       select: function( event, ui ) {
+                                               ui.item.option.selected = true;
+                                               self._trigger( "selected", 
event, {
+                                                       item: ui.item.option
+                                               });
+                                               var terms = split( 
$(this).val() );
+                                               // remove the current input
+                                               terms.pop();
+                                               // add the selected item
+                                               terms.push( ui.item.value );
+                                               // add placeholder to get the 
comma-and-space at the end
+                                               terms.push( "" );
+                                               $( this ).val( terms.join( ", " 
) );
+                                               return false;
+                                       }
+                               } );
 
-               input.data( "autocomplete" )._renderItem = function( ul, item ) 
{
-                       return $( "<li></li>" )
-                       .data( "item.autocomplete", item )
-                       .append( "<a>" + item.label + "</a>" )
-                       .appendTo( ul );
-               };
+                               input.data( "autocomplete" )._renderItem = 
function( ul, item ) {
+                                       return $( "<li>" )
+                                               .data( "item.autocomplete", 
item )
+                                               .append( "<a>" + item.label + 
"</a>" )
+                                               .appendTo( ul );
+                               };
+                       }, // End of _create
 
-               },
+                       destroy: function() {
+                               this.input.remove();
+                               this.element.show();
+                               $.Widget.prototype.destroy.call( this );
+                       }
+               } );
 
-               destroy: function() {
-                       this.input.remove();
-                       this.element.show();
-                       $.Widget.prototype.destroy.call( this );
-               }
-       });
-
        $( "#wpUserLanguage" ).combobox();
 } );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to