Skip to content

Commit

Permalink
Triggers for setim events
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikerabbit committed Aug 19, 2013
1 parent fa434ce commit 204f777
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/jquery.ime.selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@

imeselector.$menu.on( 'click.ime', 'li.ime-im', function () {
imeselector.selectIM( $( this ).data( 'ime-inputmethod' ) );
imeselector.$element.trigger( 'setim.ime', $( this ).data( 'ime-inputmethod' ) );

return false;
} );

imeselector.$menu.on( 'click.ime', 'li.ime-lang', function () {
imeselector.selectLanguage( $( this ).attr( 'lang' ) );
var im = imeselector.selectLanguage( $( this ).attr( 'lang' ) );
imeselector.$element.trigger( 'setim.ime', im );

return false;
} );
Expand Down Expand Up @@ -217,9 +219,11 @@
if ( isShortcutKey( e ) ) {
if ( ime.isActive() ) {
this.disableIM();
this.$element.trigget( 'setim.ime', 'system' );
} else {
if ( this.inputmethod !== null ) {
this.selectIM( this.inputmethod.id );
this.$element.trigget( 'setim.ime', this.inputmethod.id );
} else {
languageCode = this.decideLanguage();
this.selectLanguage( languageCode );
Expand Down Expand Up @@ -317,7 +321,8 @@
/**
* Select a language
*
* @param languageCode
* @param {string} languageCode
* @return {string|bool} Selected input method id or false
*/
selectLanguage: function ( languageCode ) {
var ime,
Expand All @@ -337,7 +342,7 @@
this.selectIM( $.ime.preferences.getIM( languageCode ) );
}

return false;
return $.ime.preferences.getIM( languageCode );
}

this.$menu.find( 'li.ime-lang' ).show();
Expand All @@ -350,6 +355,7 @@
ime.setLanguage( languageCode );
this.inputmethod = null;
this.selectIM( $.ime.preferences.getIM( languageCode ) );
return $.ime.preferences.getIM( languageCode );
},

/**
Expand Down

0 comments on commit 204f777

Please sign in to comment.