Clean up code formatting, add .jsbeautifyrc

Change-Id: Iafcc8084d87d8f2323d97bb4446e031951820d41
This commit is contained in:
Santhosh Thottingal
2016-05-09 16:40:55 +05:30
parent 35cd1b5736
commit 29f28a1f50
2 changed files with 101 additions and 80 deletions

17
.jsbeautifyrc Normal file
View File

@@ -0,0 +1,17 @@
{
"preserve_newlines": true,
"jslint_happy": true,
"keep_array_indentation": true,
"space_before_conditional": true,
"max_preserve_newlines": 10,
"brace_style": "collapse",
"keep_function_indentation": false,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"space_in_paren": true,
"space_in_square_bracket": true,
"git_happy": true,
"indent_with_tabs": true
}

View File

@@ -196,7 +196,9 @@
searchAPI: function ( query ) { searchAPI: function ( query ) {
var languageFilter = this; var languageFilter = this;
$.get( languageFilter.options.searchAPI, { search: query }, function( result ) { $.get( languageFilter.options.searchAPI, {
search: query
}, function ( result ) {
$.each( result.languagesearch, function ( code, name ) { $.each( result.languagesearch, function ( code, name ) {
if ( languageFilter.resultCount === 0 ) { if ( languageFilter.resultCount === 0 ) {
// Autofill the first result. // Autofill the first result.
@@ -229,6 +231,8 @@
}, },
autofill: function ( langCode, languageName ) { autofill: function ( langCode, languageName ) {
var autonym, userInput, suggestion;
if ( !this.$suggestion.length ) { if ( !this.$suggestion.length ) {
return; return;
} }
@@ -245,8 +249,7 @@
return; return;
} }
var autonym, userInput = this.$element.val();
userInput = this.$element.val(),
suggestion = userInput + languageName.substring( userInput.length, languageName.length ); suggestion = userInput + languageName.substring( userInput.length, languageName.length );
if ( suggestion.toLowerCase() !== languageName.toLowerCase() ) { if ( suggestion.toLowerCase() !== languageName.toLowerCase() ) {
@@ -340,8 +343,9 @@
/** /**
* Check if a prefix is visually prefix of a string * Check if a prefix is visually prefix of a string
* @param prefix string *
* @param string string * @param {string} prefix
* @param {string} string
*/ */
function isVisualPrefix( prefix, string ) { function isVisualPrefix( prefix, string ) {
// Pre-base vowel signs of Indic languages. A vowel sign is called pre-base if // Pre-base vowel signs of Indic languages. A vowel sign is called pre-base if