Whitespace, JSHint, removed unused function

This commit is contained in:
Amir E. Aharoni
2013-01-13 23:30:18 +02:00
parent 9147af93d7
commit e40ca2e885

View File

@@ -22,6 +22,7 @@
'use strict';
// Region numbers in id attributes also appear in the langdb.
/*jshint multistr:true */
var template = '\
<div class="grid uls-menu uls-wide"> \
<div class="row"> \
@@ -74,6 +75,7 @@
</div>\
<div class="row uls-language-list"></div>\
</div> ';
/*jshint multistr:false */
/**
* ULS Public class definition
@@ -83,6 +85,7 @@
this.options = $.extend( {}, $.fn.uls.defaults, options );
this.$menu = $( template );
this.languages = this.options.languages;
for ( var code in this.languages ) {
if ( $.uls.data.languages[code] === undefined ) {
if ( window.console && window.console.log ) {
@@ -91,13 +94,16 @@
delete this.languages[code];
}
}
this.left = this.options.left;
this.top = this.options.top;
this.shown = false;
this.initialized = false;
this.$languageFilter = this.$menu.find( '#languagefilter' );
this.$regionFilters = this.$menu.find( '.uls-region' );
this.$resultsView = this.$menu.find( 'div.uls-language-list' );
this.render();
this.listen();
this.ready();
@@ -191,10 +197,9 @@
},
/**
* callback for no results found context.
* @param search string The search term
* Callback for no results found context.
*/
noresults: function( search ) {
noresults: function () {
this.$resultsView.lcd( 'noResults' );
},
@@ -227,6 +232,7 @@
// Handle key press events on the menu
uls.$menu.on( 'keypress', $.proxy( this.keypress, this ) )
.on( 'keyup', $.proxy( this.keyup, this ) );
if ( this.eventSupported( 'keydown' ) ) {
this.$menu.on( 'keydown', $.proxy( this.keypress, this ) );
}
@@ -262,10 +268,12 @@
success: function ( regionfilter ) {
// Deactivate search filtering
uls.$languageFilter.languagefilter( 'deactivate' );
// If it is WW region, show the quicklist
// If it is the WW region, show the quicklist
if ( regionfilter.regionGroup === 1 ) {
lcd.quicklist();
}
// Show 'results view' if we are in no results mode
uls.success();
},
@@ -281,6 +289,7 @@
*/
select: function ( langCode ) {
this.hide();
if ( this.options.onSelect ) {
this.options.onSelect.call( this, langCode );
}
@@ -291,6 +300,7 @@
*/
cancel: function () {
this.hide();
if ( this.options.onCancel ) {
this.options.onCancel.call( this );
}
@@ -300,6 +310,7 @@
if ( !this.shown ) {
return;
}
if ( e.keyCode === 27 ) { // escape
this.cancel();
e.preventDefault();
@@ -311,6 +322,7 @@
if ( !this.shown ) {
return;
}
if ( e.keyCode === 27 ) { // escape
this.cancel();
e.preventDefault();
@@ -321,6 +333,7 @@
click: function ( e ) {
e.stopPropagation();
e.preventDefault();
if ( this.shown ) {
this.hide();
} else {
@@ -335,6 +348,7 @@
this.$element.setAttribute( eventName, 'return;' );
isSupported = typeof this.$element[eventName] === 'function';
}
return isSupported;
},
@@ -355,6 +369,7 @@
if ( !data ) {
$this.data( 'uls', ( data = new ULS( this, options ) ) );
}
if ( typeof option === 'string' ) {
data[option]();
}
@@ -373,22 +388,9 @@
// Define a dummy i18n function, if jquery.i18n not integrated.
if ( !$.fn.i18n ) {
$.fn.i18n = function( option ) {
$.fn.i18n = function () {
};
}
$.fn.uls.Constructor = ULS;
// Private utility functions
function getObjectLength ( obj ) {
var k, count = 0;
for ( k in obj ) {
if ( obj.hasOwnProperty( k ) ) {
count++;
}
}
return count;
}
} ( jQuery ) );