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