Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add jshintrc, Fix jshint errors

  • Loading branch information...
commit bea91095ee587854435d4ba704994c57c0f50edc 1 parent f793a66
@santhoshtr santhoshtr authored
View
4 .jshintrc
@@ -5,7 +5,6 @@
"_"
],
- "camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
@@ -20,9 +19,8 @@
"unused": true,
"strict": true,
"trailing": true,
-
+ "laxbreak": true,
"browser": true,
-
"nomen": true,
"onevar": true,
"white": false
View
22 rules/am/am-transliteration.js
@@ -2,14 +2,14 @@
'use strict';
var amTransliteration = {
- id: "am-transliteration",
- name: "Amharic Transliteration",
- description: "Amharic Transliteration",
- date: "2012-09-09",
- URL: "http://am.wikipedia.org/wiki/%E1%8A%A5%E1%88%AD%E1%8B%B3%E1%89%B3:%E1%8A%A2%E1%89%B5%E1%8B%AE%E1%8D%92%E1%8A%AD_%E1%88%B4%E1%88%AB",
- author: "Elfalem [[User:Elfalem]])",
- license: "GPLv3",
- version: "1.0",
+ id: 'am-transliteration',
+ name: 'Amharic Transliteration',
+ description: 'Amharic Transliteration',
+ date: '2012-09-09',
+ URL: 'http://am.wikipedia.org/wiki/%E1%8A%A5%E1%88%AD%E1%8B%B3%E1%89%B3:%E1%8A%A2%E1%89%B5%E1%8B%AE%E1%8D%92%E1%8A%AD_%E1%88%B4%E1%88%AB',
+ author: 'Elfalem [[User:Elfalem]])',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 2,
patterns: [
@@ -198,7 +198,7 @@
[ 'ክW', '' ],
[ 'ኳe', '' ],
- [ "(ኳu|ኳ')", '' ],
+ [ '(ኳu|ኳ\')', '' ],
[ 'ኳi', '' ],
[ '(ኰe|ኳE)', '' ],
@@ -211,7 +211,7 @@
[ 'ኽW', '' ],
[ 'ዃe', '' ],
- [ "(ዃu|ዃ')", '' ],
+ [ '(ዃu|ዃ\')', '' ],
[ 'ዃi', '' ],
[ 'ዃE', '' ],
@@ -277,7 +277,7 @@
[ 'ግo', '' ],
[ 'ጓe', '' ],
- [ "(ጓu|ጓ')", '' ],
+ [ '(ጓu|ጓ\')', '' ],
[ 'ጓi', '' ],
[ '(ጐe|ጓE)', '' ],
View
16 rules/de/de.js
@@ -2,14 +2,14 @@
'use strict';
var de = {
- id: "de",
- name: "Deutsch",
- description: "German input method",
- date: "2012-11-20",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Erik Moeller",
- license: "Public domain",
- version: "1.0",
+ id: 'de',
+ name: 'Deutsch',
+ description: 'German input method',
+ date: '2012-11-20',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Erik Moeller',
+ license: 'Public domain',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 1,
patterns: [
View
16 rules/en/capitalize.js
@@ -2,14 +2,14 @@
'use strict';
var capitalize = {
- id: "en-capitalize",
- name: "English Capitalize",
- description: "Capitalize all the letters",
- date: "2012-10-03",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Santhosh Thottingal",
- license: "CC-BY-SA",
- version: "1.0",
+ id: 'en-capitalize',
+ name: 'English Capitalize',
+ description: 'Capitalize all the letters',
+ date: '2012-10-03',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Santhosh Thottingal',
+ license: 'CC-BY-SA',
+ version: '1.0',
patterns: [ [ '[a-z]', function ( $1 ) {
return $1.toUpperCase();
} ] ]
View
16 rules/he/he-standard-2011.js
@@ -2,14 +2,14 @@
'use strict';
var heStandard = {
- id: "he-standard-2011",
- name: "Hebrew standard keyboard",
- description: "Hebrew keyboard according to Israeli Standard 1452",
- date: "2011-12-06",
- URL: "http://www.lingnu.com/he/howto/78-si1452.html",
- author: "Amir E. Aharoni (אָמִיר אֱלִישָׁע אַהֲרוֹנִי, [[User:Amire80]])",
- license: "GPLv3",
- version: "1.0",
+ id: 'he-standard-2011',
+ name: 'Hebrew standard keyboard',
+ description: 'Hebrew keyboard according to Israeli Standard 1452',
+ date: '2011-12-06',
+ URL: 'http://www.lingnu.com/he/howto/78-si1452.html',
+ author: 'Amir E. Aharoni (אָמִיר אֱלִישָׁע אַהֲרוֹנִי, [[User:Amire80]])',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 0,
maxKeyLength: 0,
patterns: [
View
16 rules/hi/hi-bolnagri.js
@@ -2,14 +2,14 @@
'use strict';
var hiBolnagari = {
- id: "hi-bolnagari",
- name: "Bolnagari",
- description: "Bolnagari phonetic keymap for Devanagari script",
- date: "2012-03-28",
- URL: "http://www.indlinux.org/wiki/index.php/BolNagri",
- author: "G Karunakar",
- license: "GPLv3",
- version: "1.0",
+ id: 'hi-bolnagari',
+ name: 'Bolnagari',
+ description: 'Bolnagari phonetic keymap for Devanagari script',
+ date: '2012-03-28',
+ URL: 'http://www.indlinux.org/wiki/index.php/BolNagri',
+ author: 'G Karunakar',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 0,
maxKeyLength: 1,
patterns: [
View
18 rules/hi/hi-inscript.js
@@ -2,13 +2,13 @@
'use strict';
var hiInscript = {
- id: "hi-inscript",
- name: "Devanagari Inscript",
- description: "Inscript keyboard for Devanagari script",
- date: "2011-02-26",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'hi-inscript',
+ name: 'Devanagari Inscript',
+ description: 'Inscript keyboard for Devanagari script',
+ date: '2011-02-26',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 0,
maxKeyLength: 1,
patterns: [
@@ -38,8 +38,8 @@
[ 'p', '\u091C' ],
[ 'P', '\u091D' ],
[ '\\}', '\u091E' ],
- [ "'", '\u091F' ],
- [ '"', '\u0920' ],
+ [ '\'', '\u091F' ],
+ [ '\'', '\u0920' ],
[ '\\[', '\u0921' ],
[ '\\{', '\u0922' ],
[ 'C', '\u0923' ],
View
14 rules/hi/hi-transliteration.js
@@ -2,13 +2,13 @@
'use strict';
var hiTransliteration = {
- id: "hi-transliteration",
- name: "Devanagari Transliteration",
- description: "Transliteration keyboard for Devanagari script",
- date: "2011-11-20",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'hi-transliteration',
+ name: 'Devanagari Transliteration',
+ description: 'Transliteration keyboard for Devanagari script',
+ date: '2011-11-20',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 3,
patterns: [
View
18 rules/ml/ml-inscript.js
@@ -1,14 +1,14 @@
( function ( $ ) {
'use strict';
var inscript = {
- id: "ml-inscript",
- name: "Malayalam Inscript",
- description: "Malayalam Inscript",
- date: "2012-10-03",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ml-inscript',
+ name: 'Malayalam Inscript',
+ description: 'Malayalam Inscript',
+ date: '2012-10-03',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 0,
maxKeyLength: 2,
patterns: [
@@ -68,7 +68,7 @@
[ ';', '' ],
[ ':', '' ],
[ '\'', '' ],
- [ '"', '' ],
+ [ '\'', '' ],
[ 'z', '' ],
[ 'Z', '' ],
[ 'x', '' ],
View
16 rules/ml/ml-transliteration.js
@@ -1,14 +1,14 @@
( function ( $ ) {
'use strict';
var mltransliteration = {
- id: "ml-transliteration",
- name: "Malayalam Transliteration",
- description: "Malayalam Transliteration based input method",
- date: "2012-10-03",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ml-transliteration',
+ name: 'Malayalam Transliteration',
+ description: 'Malayalam Transliteration based input method',
+ date: '2012-10-03',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 2,
maxKeyLength: 2,
patterns: [
View
28 rules/ta/ta-99.js
@@ -2,14 +2,14 @@
'use strict';
var ta99 = {
- id: "ta-99",
- name: "Tamil 99",
- description: "Tamil 99 Keyboard",
- date: "2012-11-20",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ta-99',
+ name: 'Tamil 99',
+ description: 'Tamil 99 Keyboard',
+ date: '2012-11-20',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 4,
patterns: [
@@ -25,7 +25,7 @@
[ '([க-ஹ])i', 'a', '$1ன' ],
[ '([க-ஹ])j', 'a', '$1ப' ],
[ '([க-ஹ])k', 'a', '$1ம' ],
- [ "([க-ஹ])'", 'a', '$1ய' ],
+ [ '([க-ஹ])\'', 'a', '$1ய' ],
[ '([க-ஹ])m', 'a', '$1ர' ],
[ '([க-ஹ])u', 'a', '$1ற' ],
[ '([க-ஹ])n', 'a', '$1ல' ],
@@ -49,7 +49,7 @@
[ 'ன்னi', 'ன்னன' ],
[ 'ப்பj', 'ப்பப' ],
[ 'ம்மk', 'ம்மம' ],
- [ "ய்ய'", 'ய்யய' ],
+ [ 'ய்ய\'', 'ய்யய' ],
[ 'ர்ரm', 'ர்ரர' ],
[ 'ற்றu', 'ற்றற' ],
[ 'ல்லn', 'ல்லல' ],
@@ -87,7 +87,7 @@
[ 'னi', 'ன்ன' ],
[ 'பj', 'ப்ப' ],
[ 'மk', 'ம்ம' ],
- [ "ய'", 'ய்ய' ],
+ [ '\'', 'ய்ய' ],
[ 'ரm', 'ர்ர' ],
[ 'றu', 'ற்ற' ],
[ 'லn', 'ல்ல' ],
@@ -129,7 +129,7 @@
[ 'k', '' ],
[ 'l', '' ],
[ ';', '' ],
- [ "'", '' ],
+ [ '\'', '' ],
[ 'z', '' ],
[ 'x', '' ],
@@ -164,10 +164,10 @@
[ 'G', '' ],
[ 'H', '' ],
[ 'J', '' ],
- [ 'K', '"' ],
+ [ 'K', '\'' ],
[ 'L', ':' ],
[ '\\:', ';' ],
- [ '"', "'" ],
+ [ '\'', '\'' ],
[ 'Z', '' ],
[ 'X', '' ],
View
18 rules/ta/ta-bamini.js
@@ -2,14 +2,14 @@
'use strict';
var taBamini = {
- id: "ta-bamini",
- name: "Tamil Bamini",
- description: "Tamil Bamini input method",
- date: "2012-10-03",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ta-bamini',
+ name: 'Tamil Bamini',
+ description: 'Tamil Bamini input method',
+ date: '2012-10-03',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 0,
maxKeyLength: 2,
patterns: [
@@ -65,7 +65,7 @@
[ 'I', '' ],
[ 'O', 'ழு' ],
[ 'P', '' ],
- [ '\\|', "'" ],
+ [ '\\|', '\'' ],
[ 'A', 'யு' ],
[ 'S', 'ளு' ],
[ 'D', 'னு' ],
View
16 rules/ta/ta-inscript.js
@@ -2,14 +2,14 @@
'use strict';
var taInscript = {
- id: "ta-inscript",
- name: "Tamil Inscript",
- description: "Tamil Inscript Keyboard",
- date: "2012-11-20",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ta-inscript',
+ name: 'Tamil Inscript',
+ description: 'Tamil Inscript Keyboard',
+ date: '2012-11-20',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 4,
patterns: [
View
18 rules/ta/ta-transliteration.js
@@ -2,14 +2,14 @@
'use strict';
var taTransliteration = {
- id: "ta-transliteration",
- name: "Tamil Transliteration",
- description: "Tamil Transliteration based input method",
- date: "2012-10-03",
- URL: "http://github.com/wikimedia/jquery.ime",
- author: "Junaid P V",
- license: "GPLv3",
- version: "1.0",
+ id: 'ta-transliteration',
+ name: 'Tamil Transliteration',
+ description: 'Tamil Transliteration based input method',
+ date: '2012-10-03',
+ URL: 'http://github.com/wikimedia/jquery.ime',
+ author: 'Junaid P V',
+ license: 'GPLv3',
+ version: '1.0',
contextLength: 1,
maxKeyLength: 4,
patterns: [
@@ -19,7 +19,7 @@
// '(ஸ்ரிi|ஸ்ர்I)',
[ 'ஸ்ர்i', 'ஸ்ரீ' ],
- [ 'க்(ச்|ஸ்)h', 'க்‌ஷ்' ], // with ZWNJ
+ [ 'க்(ச்|ஸ்)h', 'க்\u200Cஷ்' ], // with ZWNJ
[ 'க்(ச்|ஸ்)H', 'க்ஷ்' ],
[ '([க-ஹ])்a', '$1' ],
View
44 src/jquery.ime.inputmethods.js
@@ -3,95 +3,95 @@
$.extend( $.ime.sources, {
'en-capitalize': {
- name: "Capitalize", // XXX This can be the name written in its own script?
+ name: 'Capitalize', // XXX This can be the name written in its own script?
source: 'rules/en/capitalize.js'
},
'am-transliteration': {
- name: "Transliteration",
+ name: 'Transliteration',
source: 'rules/am/am-transliteration.js'
},
'hi-transliteration': {
- name: "Transliteration",
+ name: 'Transliteration',
source: 'rules/hi/hi-transliteration.js'
},
'hi-inscript': {
- name: "Inscript",
+ name: 'Inscript',
source: 'rules/hi/hi-inscript.js'
},
'hi-bolnagari': {
- name: "Bolnagari",
+ name: 'Bolnagari',
source: 'rules/hi/hi-bolnagari.js'
},
'ml-transliteration': {
- name: "Transliteration",
+ name: 'Transliteration',
source: 'rules/ml/ml-transliteration.js'
},
'ml-inscript': {
- name: "Inscript",
+ name: 'Inscript',
source: 'rules/ml/ml-inscript.js'
},
'ta-inscript': {
- name: "Inscript",
+ name: 'Inscript',
source: 'rules/ta/ta-inscript.js'
},
'ta-transliteration': {
- name: "Transliteration",
+ name: 'Transliteration',
source: 'rules/ta/ta-transliteration.js'
},
'ta-99': {
- name: "Tamil 99",
+ name: 'Tamil 99',
source: 'rules/ta/ta-99.js'
},
'ta-bamini': {
- name: "Bamini",
+ name: 'Bamini',
source: 'rules/ta/ta-bamini.js'
},
'de': {
- name: "Deutsch",
+ name: 'Deutsch',
source: 'rules/de/de.js'
},
'he-standard-2011': {
- name: "Hebrew Standard 2011",
+ name: 'Hebrew Standard 2011',
source: 'rules/he/he-standard-2011.js'
}
} );
$.extend( $.ime.languages, {
'am': {
- autonym: "አማርኛ",
+ autonym: 'አማርኛ',
inputmethods: [ 'am-transliteration' ]
},
'en': {
- autonym: "English",
+ autonym: 'English',
inputmethods: [ 'en-capitalize' ]
},
'de': {
- autonym: "Deutsch",
+ autonym: 'Deutsch',
inputmethods: [ 'de' ]
},
'he': {
- autonym: "עִבְרִית",
+ autonym: 'עִבְרִית',
inputmethods: [ 'he-standard-2011' ]
},
'hi': {
- autonym: "हिन्दी",
+ autonym: 'हिन्दी',
inputmethods: [ 'hi-transliteration', 'hi-inscript', 'hi-bolnagari' ]
},
'ml': {
- autonym: "മലയാളം",
+ autonym: 'മലയാളം',
inputmethods: [ 'ml-transliteration', 'ml-inscript' ]
},
'mr': {
- autonym: "मराठी",
+ autonym: 'मराठी',
inputmethods: [ 'hi-transliteration', 'hi-inscript', 'hi-bolnagari' ]
},
'sa': {
- autonym: "संस्कृत",
+ autonym: 'संस्कृत',
inputmethods: [ 'hi-transliteration', 'hi-inscript', 'hi-bolnagari' ]
},
'ta': {
- autonym: "தமிழ்",
+ autonym: 'தமிழ்',
inputmethods: [ 'ta-transliteration', 'ta-inscript', 'ta-99', 'ta-bamini' ]
}
} );
View
68 src/jquery.ime.js
@@ -28,7 +28,7 @@
* @returns String transliterated string
*/
transliterate: function ( input, context, altGr ) {
- var patterns, regex, rule, replacement;
+ var patterns, regex, rule, replacement,i ;
@Nikerabbit Owner

Missing space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
if ( altGr ) {
patterns = this.inputmethod.patterns_x || [];
@@ -40,7 +40,7 @@
return patterns.call( this, input, context );
}
- for ( var i = 0; i < patterns.length; i++) {
+ for ( i = 0; i < patterns.length; i++) {
rule = patterns[i];
regex = new RegExp( rule[0] + '$' );
@@ -172,23 +172,25 @@
$.ajax( {
url: ime.options.imePath + $.ime.sources[name].source,
- dataType: "script"
+ dataType: 'script'
} ).done( function () {
- debug( name + " loaded" );
+ debug( name + ' loaded' );
if ( callback ) {
callback.call( ime );
}
} ).fail( function ( jqxhr, settings, exception ) {
- debug( "Error in loading inputmethod " + name + " Exception: " + exception );
+ debug( 'Error in loading inputmethod ' + name + ' Exception: ' + exception );
} );
}
};
$.fn.ime = function ( option ) {
return this.each( function () {
- var $this = $( this );
- var data = $this.data( 'ime' );
- var options = typeof option === 'object' && option;
+ var $this, data, options;
+
+ $this = $( this );
+ data = $this.data( 'ime' );
+ options = typeof option === 'object' && option;
if ( !data ) {
$this.data( 'ime', ( data = new IME( this, options ) ) );
@@ -218,7 +220,7 @@
// default options
IME.defaults = {
- imePath: "../" // Relative/Absolute path for the rules folder of jquery.ime
+ imePath: '../' // Relative/Absolute path for the rules folder of jquery.ime
};
// private function for debugging
@@ -231,11 +233,12 @@
/**
*
*/
- var getCaretPosition = function ( $element ) {
- var el = $element.get( 0 );
- var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange;
+ function getCaretPosition( $element ) {
+ var el, start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange;
+
+ el = $element.get( 0 );
- if ( typeof el.selectionStart === "number" && typeof el.selectionEnd === "number" ) {
+ if ( typeof el.selectionStart === 'number' && typeof el.selectionEnd === 'number' ) {
start = el.selectionStart;
end = el.selectionEnd;
} else {
@@ -243,7 +246,7 @@
range = document.selection.createRange();
if ( range && range.parentElement() === el ) {
len = el.value.length;
- normalizedValue = el.value.replace( /\r\n/g, "\n" );
+ normalizedValue = el.value.replace( /\r\n/g, '\n' );
// Create a working TextRange that lives only in the input
textInputRange = el.createTextRange();
@@ -255,24 +258,24 @@
endRange = el.createTextRange();
endRange.collapse( false );
- if ( textInputRange.compareEndPoints( "StartToEnd", endRange ) > -1 ) {
+ if ( textInputRange.compareEndPoints( 'StartToEnd', endRange ) > -1 ) {
start = end = len;
} else {
- start = -textInputRange.moveStart( "character", -len );
- start += normalizedValue.slice( 0, start ).split( "\n" ).length - 1;
+ start = -textInputRange.moveStart( 'character', -len );
+ start += normalizedValue.slice( 0, start ).split( '\n' ).length - 1;
- if ( textInputRange.compareEndPoints( "EndToEnd", endRange ) > -1 ) {
+ if ( textInputRange.compareEndPoints( 'EndToEnd', endRange ) > -1 ) {
end = len;
} else {
- end = -textInputRange.moveEnd( "character", -len );
- end += normalizedValue.slice( 0, end ).split( "\n" ).length - 1;
+ end = -textInputRange.moveEnd( 'character', -len );
+ end += normalizedValue.slice( 0, end ).split( '\n' ).length - 1;
}
}
}
}
return [ start, end ];
- };
+ }
/**
* Helper function to get an IE TextRange object for an element
@@ -292,12 +295,11 @@
*
*/
function replaceText ( $element, replacement, start, end ) {
- var element = $element.get( 0 );
+ var element = $element.get( 0 ), selection, length, newLines, scrollTop ;
if ( document.body.createTextRange ) {
// IE
- var selection = rangeForElementIE(element);
-
+ selection = rangeForElementIE(element);
length = element.value.length;
// IE doesn't count \n when computing the offset, so we won't either
newLines = element.value.match( /\n/g );
@@ -314,7 +316,7 @@
selection.select();
} else {
// All other browsers
- var scrollTop = element.scrollTop;
+ scrollTop = element.scrollTop;
// This could be made better if range selection worked on browsers.
// But for complex scripts, browsers place cursor in unexpected places
@@ -337,26 +339,28 @@
* @param b String
* @return Position at which a and b diverge, or -1 if a === b
*/
- var firstDivergence = function ( a, b ) {
- var minLength = a.length < b.length ? a.length : b.length;
- for ( var i = 0; i < minLength; i++) {
+ function firstDivergence ( a, b ) {
+ var minLength, i;
+
+ minLength = a.length < b.length ? a.length : b.length;
+ for ( i = 0; i < minLength; i++) {
if ( a.charCodeAt( i ) !== b.charCodeAt( i ) ) {
return i;
}
}
return -1;
- };
+ }
/**
* Get the n characters in str that immediately precede pos
- * Example: lastNChars( "foobarbaz", 5, 2 ) === "ba"
+ * Example: lastNChars( 'foobarbaz', 5, 2 ) === 'ba'
*
* @param str String to search in
* @param pos Position in str
* @param n Number of characters to go back from pos
* @return Substring of str, at most n characters long, immediately preceding pos
*/
- var lastNChars = function ( str, pos, n ) {
+ function lastNChars ( str, pos, n ) {
if ( n === 0 ) {
return '';
} else if ( pos <= n ) {
@@ -364,6 +368,6 @@
} else {
return str.substr( pos - n, n );
}
- };
+ }
}( jQuery ) );
View
59 src/jquery.ime.selector.js
@@ -89,8 +89,10 @@
* @param {jQuery.Event} e
*/
keydown: function ( e ) {
- var imeselector = this;
- var ime = $( e.target ).data( 'ime' );
+ var imeselector, ime;
+
+ imeselector = this;
+ ime = $( e.target ).data( 'ime' );
if ( isShortcutKey( e ) ) {
ime.toggle();
if ( !ime.isActive() ) {
@@ -123,6 +125,7 @@
*/
selectLanguage: function ( languageCode ) {
var imeselector = this, language;
+
this.$menu.find( 'li.ime-lang.checked' ).removeClass( 'checked' );
imeselector.$menu.find( 'li.ime-im' ).remove();
this.prepareInputMethods( languageCode );
@@ -166,8 +169,9 @@
* Disable the inputmethods( Use system input method )
*/
disableIM: function () {
- var imeselector = this;
- var ime = imeselector.$element.data( 'ime' );
+ var imeselector = this, ime;
+
+ ime = imeselector.$element.data( 'ime' );
this.$menu.find( 'li.ime-im.checked' ).removeClass( 'checked' );
this.$menu.find( 'li.ime-disable-link' ).addClass( 'checked' );
ime.disable();
@@ -180,14 +184,16 @@
* Prepare language list
*/
prepareLanguageList: function () {
- var imeselector = this;
+ var imeselector = this, $languageList;
// Language list can be very long. So we use a container with
// overflow auto.
- var $languageList = $( '<div class="ime-language-list">' );
+ $languageList = $( '<div class="ime-language-list">' );
$.each( $.ime.languages, function ( languageCode, language ) {
- var $languageItem = $( '<a>' ).attr( 'href', '#' ).text( language.autonym );
- var $language = $( '<li class="ime-lang">' ).attr( 'lang', languageCode );
+ var $languageItem, $language;
+
+ $languageItem = $( '<a>' ).attr( 'href', '#' ).text( language.autonym );
+ $language = $( '<li class="ime-lang">' ).attr( 'lang', languageCode );
$language.append( $languageItem );
$languageList.append( $language );
} );
@@ -201,13 +207,14 @@
* @param languageCode
*/
prepareInputMethods: function ( languageCode ) {
- var imeselector = this;
- var language = $.ime.languages[languageCode];
+ var imeselector = this,language = $.ime.languages[languageCode];
@Nikerabbit Owner

There should be newline after comma. Or at least space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
$.each( language.inputmethods, function ( index, inputmethod ) {
- var name = $.ime.sources[inputmethod].name;
- var $imeItem = $( '<a>' ).attr( 'href', '#' ).text( name );
- var $inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
+ var name, $imeItem, $inputMethod;
+
+ name = $.ime.sources[inputmethod].name;
+ $imeItem = $( '<a>' ).attr( 'href', '#' ).text( name );
+ $inputMethod = $( '<li data-ime-inputmethod=' + inputmethod + '>' );
$inputMethod.append( '<span class="ime-im-check">' ).append( $imeItem );
$inputMethod.addClass( 'ime-im' );
imeselector.$menu.prepend( $inputMethod );
@@ -240,20 +247,24 @@
$.fn.imeselector.Constructor = IMESelector;
// Private functions
- var helpLink = function () {
- return $( "<li>" ).append( $( '<a>' ).attr( 'href', '#' ).text( "Help" ) );
- };
- var languageListTitle = function () {
- return $( '<li class="ime-lang-title">' ).text( "Change input language" );
- };
- var divider = function () {
+ function helpLink () {
+ return $( '<li>' ).append( $( '<a>' ).attr( 'href', '#' ).text( 'Help' ) );
+ }
+
+ function languageListTitle () {
+ return $( '<li class="ime-lang-title">' ).text( 'Change input language' );
+ }
+
+ function divider () {
return $( '<li class="divider">' );
- };
- var toggleMenuItem = function () {
+ }
+
+ function toggleMenuItem () {
return $( '<li class="ime-disable-link">' ).append(
- $( '<a>' ).attr( 'href', '#' ).text( "System input method" ).append(
+ $( '<a>' ).attr( 'href', '#' ).text( 'System input method' ).append(
'<span>CTRL+M</span>' ) );
- };
+ }
+
var selectorTemplate = '<div class="imeselector">'
+ '<a class="ime-name imeselector-toggle" href="#"></a>'
+ '<b class="caret"></b></div>';
Please sign in to comment.
Something went wrong with that request. Please try again.