Index: trunk/extensions/Narayam/Narayam.hooks.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | } |
41 | 41 | |
42 | 42 | public static function addVariables( &$vars ) { |
43 | | - global $wgUser; |
| 43 | + global $wgUser, $wgNarayamSchemes; |
44 | 44 | |
45 | 45 | if ( $wgUser->getOption( 'narayamDisable' ) ) { |
46 | 46 | // User disabled Narayam |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | $vars['wgNarayamAvailableSchemes'] = self::getSchemes(); // Note: scheme names must be keys, not values |
51 | | - |
| 51 | + $vars['wgNarayamAllSchemes'] = $wgNarayamSchemes; |
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | |
Index: trunk/extensions/Narayam/images/open.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Narayam/images/open.png |
___________________________________________________________________ |
Added: svn:mime-type |
55 | 55 | + image/png |
Index: trunk/extensions/Narayam/images/closed-ltr.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Narayam/images/closed-ltr.png |
___________________________________________________________________ |
Added: svn:mime-type |
56 | 56 | + image/png |
Index: trunk/extensions/Narayam/images/closed-rtl.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/Narayam/images/closed-rtl.png |
___________________________________________________________________ |
Added: svn:mime-type |
57 | 57 | + image/png |
Index: trunk/extensions/Narayam/css/ext.narayam.core.css |
— | — | @@ -139,3 +139,16 @@ |
140 | 140 | /* @embed */ |
141 | 141 | background: url('../images/narayam-inactive.png') no-repeat scroll left top transparent; |
142 | 142 | } |
| 143 | + |
| 144 | +li.narayam-more-imes-link{ |
| 145 | + /* @embed */ |
| 146 | + background: url('../images/closed-ltr.png') no-repeat scroll left center transparent; |
| 147 | +} |
| 148 | + |
| 149 | +li.narayam-more-imes-link.open{ |
| 150 | + /* @embed */ |
| 151 | + background: url('../images/open.png') no-repeat scroll left center transparent; |
| 152 | +} |
| 153 | +li.narayam-more-imes-link a{ |
| 154 | + padding-left:10px; |
| 155 | +} |
Index: trunk/extensions/Narayam/Narayam.i18n.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | 'narayam-help-page' => 'Help:Typing', |
24 | 24 | 'narayam-checkbox-tooltip' => 'To toggle input method on and off', // FIXME: better message |
25 | 25 | 'narayam-disable-preference' => 'Disable Narayam Input Method Editor (IME)', |
| 26 | + 'narayam-more-imes' => 'More input methods', |
26 | 27 | 'narayam-am' => 'Amharic Transliteration', |
27 | 28 | 'narayam-as' => 'Assamese Transliteration', |
28 | 29 | 'narayam-as-avro' => 'Assamese Avro', |
Index: trunk/extensions/Narayam/js/ext.narayam.core.js |
— | — | @@ -30,6 +30,9 @@ |
31 | 31 | // This object is formatted as { 'schemename': '', 'schemename2': '', ... } |
32 | 32 | // for easy searching |
33 | 33 | var availableSchemes = mw.config.get( 'wgNarayamAvailableSchemes' ) || {}; |
| 34 | + // All input methods. This will be used for selecting input methods from languages |
| 35 | + // other than uselang- optionally |
| 36 | + var allImes = mw.config.get( 'wgNarayamAllSchemes' ) || {}; |
34 | 37 | // Currently selected scheme |
35 | 38 | var currentScheme = null; |
36 | 39 | // Shortcut key for turning Narayam on and off |
— | — | @@ -389,12 +392,9 @@ |
390 | 393 | * @return True if added, false if not |
391 | 394 | */ |
392 | 395 | this.addScheme = function( name, data ) { |
393 | | - if ( name in availableSchemes ) { |
394 | | - schemes[name] = data; |
395 | | - return true; |
396 | | - } else { |
397 | | - return false; |
398 | | - } |
| 396 | + schemes[name] = data; |
| 397 | + return true; |
| 398 | + |
399 | 399 | }; |
400 | 400 | |
401 | 401 | /** |
— | — | @@ -402,10 +402,14 @@ |
403 | 403 | * @param name String |
404 | 404 | */ |
405 | 405 | this.setScheme = function( name ) { |
406 | | - if ( name in schemes ) { |
407 | | - currentScheme = schemes[name]; |
| 406 | + currentScheme = schemes[name]; |
| 407 | + if ( currentScheme ){ |
408 | 408 | $.cookie( 'narayam-scheme', name, { 'path': '/', 'expires': 30 } ); |
| 409 | + return true; |
409 | 410 | } |
| 411 | + else { |
| 412 | + return false; |
| 413 | + } |
410 | 414 | }; |
411 | 415 | |
412 | 416 | /** |
— | — | @@ -500,6 +504,52 @@ |
501 | 505 | .text( mw.msg( 'narayam-toggle-ime', shortcutText() ) ) |
502 | 506 | .prepend( $checkbox ) |
503 | 507 | .attr( 'title', mw.msg( 'narayam-checkbox-tooltip' ) ); |
| 508 | + |
| 509 | + $narayamMenuItems.append( $( '<li class="narayam-more-imes-link" />') |
| 510 | + .append( |
| 511 | + $( '<a/>' ) |
| 512 | + .text( mw.msg( 'narayam-more-imes' ) ) |
| 513 | + .click( function() { |
| 514 | + $('.narayam-scheme-dynamic-item').toggle('fast'); |
| 515 | + if( $('li.narayam-more-imes-link').hasClass( 'open' )){ |
| 516 | + $('li.narayam-more-imes-link').removeClass('open'); |
| 517 | + }else{ |
| 518 | + $('li.narayam-more-imes-link').addClass('open'); |
| 519 | + } |
| 520 | + }) |
| 521 | + ) |
| 522 | + ); |
| 523 | + |
| 524 | + for ( var lang in allImes ) { |
| 525 | + var langschemes = allImes[lang]; |
| 526 | + for ( var langscheme in langschemes ) { |
| 527 | + |
| 528 | + var $input = $( '<input type="radio" name="narayam-input-method" class="narayam-scheme-dynamic" />' ); |
| 529 | + $input |
| 530 | + .attr( 'id', 'narayam-' + langscheme ) |
| 531 | + .val( langscheme ); |
| 532 | + |
| 533 | + var $narayamMenuItemLabel = $( '<label />' ) |
| 534 | + .attr( 'for' ,'narayam-' + langscheme ) |
| 535 | + .append( $input ) |
| 536 | + .append( mw.html.escape( mw.msg( "narayam-"+ langscheme ) ) ); |
| 537 | + |
| 538 | + var $narayamMenuItem = $( '<li class="narayam-scheme-dynamic-item" />' ) |
| 539 | + .append( $input ) |
| 540 | + .append( $narayamMenuItemLabel ); |
| 541 | + |
| 542 | + $narayamMenuItems.append( $narayamMenuItem ); |
| 543 | + |
| 544 | + } |
| 545 | + } |
| 546 | + |
| 547 | + // Event listener for scheme selection - dynamic loading of rules. |
| 548 | + $( '.narayam-scheme-dynamic', $( '#narayam-menu-items > ul')[0] ).live( 'click', function() { |
| 549 | + var curVal = $(this).val(); |
| 550 | + mw.loader.using( "ext.narayam.rules." + $(this).val() , function() { |
| 551 | + that.setScheme( curVal ) |
| 552 | + }); |
| 553 | + } ); |
504 | 554 | |
505 | 555 | var helppage = mw.msg( 'narayam-help-page' ); |
506 | 556 | if ( helppage ) { |
— | — | @@ -546,7 +596,7 @@ |
547 | 597 | $( '#searchform' ).css( 'visibility', 'visible' ); |
548 | 598 | }); |
549 | 599 | } |
550 | | - |
| 600 | + $('.narayam-scheme-dynamic-item').hide(); |
551 | 601 | // Narayam controls setup complete, returns true |
552 | 602 | return true; |
553 | 603 | }; |
Index: trunk/extensions/Narayam/Narayam.php |
— | — | @@ -147,136 +147,137 @@ |
148 | 148 | 'narayam-help', |
149 | 149 | 'narayam-help-page', |
150 | 150 | 'narayam-toggle-ime', |
| 151 | + 'narayam-more-imes', |
| 152 | + 'narayam-am', |
| 153 | + 'narayam-as', |
| 154 | + 'narayam-as-avro', |
| 155 | + 'narayam-as-bornona', |
| 156 | + 'narayam-as-inscript', |
| 157 | + 'narayam-eo', |
| 158 | + 'narayam-hi-inscript', |
| 159 | + 'narayam-kn', |
| 160 | + 'narayam-kn-inscript', |
| 161 | + 'narayam-ml', |
| 162 | + 'narayam-ml-inscript' , |
| 163 | + 'narayam-ne', |
| 164 | + 'narayam-ne-inscript', |
| 165 | + 'narayam-or', |
| 166 | + 'narayam-or-inscript', |
| 167 | + 'narayam-sa', |
| 168 | + 'narayam-sa-inscript', |
| 169 | + 'narayam-si-singlish', |
| 170 | + 'narayam-si-wijesekara', |
| 171 | + 'narayam-ta99', |
| 172 | + 'narayam-ta', |
| 173 | + 'narayam-ta-bamini', |
| 174 | + 'narayam-te-inscript', |
| 175 | + 'narayam-bn-avro', |
| 176 | + 'narayam-bn-inscript', |
| 177 | + 'narayam-bn-nkb', |
151 | 178 | ), |
152 | 179 | 'dependencies' => array( 'mediawiki.util', 'jquery.textSelection' ), |
153 | 180 | ); |
154 | 181 | $wgResourceModules['ext.narayam.rules.am'] = $narayamTpl + array( |
155 | 182 | 'scripts' => 'js/ext.narayam.rules.am.js', |
156 | | - 'messages' => array( 'narayam-am' ), |
157 | 183 | 'dependencies' => 'ext.narayam.core', |
158 | 184 | ); |
159 | 185 | $wgResourceModules['ext.narayam.rules.as'] = $narayamTpl + array( |
160 | 186 | 'scripts' => 'js/ext.narayam.rules.as.js', |
161 | | - 'messages' => array( 'narayam-as' ), |
162 | 187 | 'dependencies' => 'ext.narayam.core', |
163 | 188 | ); |
164 | 189 | $wgResourceModules['ext.narayam.rules.as-avro'] = $narayamTpl + array( |
165 | 190 | 'scripts' => 'js/ext.narayam.rules.as-avro.js', |
166 | | - 'messages' => array( 'narayam-as-avro' ), |
167 | 191 | 'dependencies' => 'ext.narayam.core', |
168 | 192 | ); |
169 | 193 | $wgResourceModules['ext.narayam.rules.as-bornona'] = $narayamTpl + array( |
170 | 194 | 'scripts' => 'js/ext.narayam.rules.as-bornona.js', |
171 | | - 'messages' => array( 'narayam-as-bornona' ), |
172 | 195 | 'dependencies' => 'ext.narayam.core', |
173 | 196 | ); |
174 | 197 | $wgResourceModules['ext.narayam.rules.as-inscript'] = $narayamTpl + array( |
175 | 198 | 'scripts' => 'js/ext.narayam.rules.as-inscript.js', |
176 | | - 'messages' => array( 'narayam-as-inscript' ), |
177 | 199 | 'dependencies' => 'ext.narayam.core', |
178 | 200 | ); |
179 | 201 | $wgResourceModules['ext.narayam.rules.bn-avro'] = $narayamTpl + array( |
180 | 202 | 'scripts' => 'js/ext.narayam.rules.bn-avro.js', |
181 | | - 'messages' => array( 'narayam-bn-avro' ), |
182 | 203 | 'dependencies' => 'ext.narayam.core', |
183 | 204 | ); |
184 | 205 | $wgResourceModules['ext.narayam.rules.bn-inscript'] = $narayamTpl + array( |
185 | 206 | 'scripts' => 'js/ext.narayam.rules.bn-inscript.js', |
186 | | - 'messages' => array( 'narayam-bn-inscript' ), |
187 | 207 | 'dependencies' => 'ext.narayam.core', |
188 | 208 | ); |
189 | 209 | $wgResourceModules['ext.narayam.rules.bn-nkb'] = $narayamTpl + array( |
190 | 210 | 'scripts' => 'js/ext.narayam.rules.bn-nkb.js', |
191 | | - 'messages' => array( 'narayam-bn-nkb' ), |
192 | 211 | 'dependencies' => 'ext.narayam.core', |
193 | 212 | ); |
194 | 213 | $wgResourceModules['ext.narayam.rules.eo'] = $narayamTpl + array( |
195 | 214 | 'scripts' => 'js/ext.narayam.rules.eo.js', |
196 | | - 'messages' => array( 'narayam-eo' ), |
197 | 215 | 'dependencies' => 'ext.narayam.core', |
198 | 216 | ); |
199 | 217 | $wgResourceModules['ext.narayam.rules.hi-inscript'] = $narayamTpl + array( |
200 | 218 | 'scripts' => 'js/ext.narayam.rules.hi-inscript.js', |
201 | | - 'messages' => array( 'narayam-hi-inscript' ), |
202 | 219 | 'dependencies' => 'ext.narayam.core', |
203 | 220 | ); |
204 | 221 | $wgResourceModules['ext.narayam.rules.kn'] = $narayamTpl + array( |
205 | 222 | 'scripts' => 'js/ext.narayam.rules.kn.js', |
206 | | - 'messages' => array( 'narayam-kn' ), |
207 | 223 | 'dependencies' => 'ext.narayam.core', |
208 | 224 | ); |
209 | 225 | $wgResourceModules['ext.narayam.rules.kn-inscript'] = $narayamTpl + array( |
210 | 226 | 'scripts' => 'js/ext.narayam.rules.kn-inscript.js', |
211 | | - 'messages' => array( 'narayam-kn-inscript' ), |
212 | 227 | 'dependencies' => 'ext.narayam.core', |
213 | 228 | ); |
214 | 229 | $wgResourceModules['ext.narayam.rules.ml'] = $narayamTpl + array( |
215 | 230 | 'scripts' => 'js/ext.narayam.rules.ml.js', |
216 | | - 'messages' => array( 'narayam-ml' ), |
217 | 231 | 'dependencies' => 'ext.narayam.core', |
218 | 232 | ); |
219 | 233 | $wgResourceModules['ext.narayam.rules.ml-inscript'] = $narayamTpl + array( |
220 | 234 | 'scripts' => 'js/ext.narayam.rules.ml-inscript.js', |
221 | | - 'messages' => array( 'narayam-ml-inscript' ), |
222 | 235 | 'dependencies' => 'ext.narayam.core', |
223 | 236 | ); |
224 | 237 | $wgResourceModules['ext.narayam.rules.ne'] = $narayamTpl + array( |
225 | 238 | 'scripts' => 'js/ext.narayam.rules.ne.js', |
226 | | - 'messages' => array( 'narayam-ne' ), |
227 | 239 | 'dependencies' => 'ext.narayam.core', |
228 | 240 | ); |
229 | 241 | $wgResourceModules['ext.narayam.rules.ne-inscript'] = $narayamTpl + array( |
230 | 242 | 'scripts' => 'js/ext.narayam.rules.ne-inscript.js', |
231 | | - 'messages' => array( 'narayam-ne-inscript' ), |
232 | 243 | 'dependencies' => 'ext.narayam.core', |
233 | 244 | ); |
234 | 245 | $wgResourceModules['ext.narayam.rules.or'] = $narayamTpl + array( |
235 | 246 | 'scripts' => 'js/ext.narayam.rules.or.js', |
236 | | - 'messages' => array( 'narayam-or' ), |
237 | 247 | 'dependencies' => 'ext.narayam.core', |
238 | 248 | ); |
239 | 249 | $wgResourceModules['ext.narayam.rules.or-inscript'] = $narayamTpl + array( |
240 | 250 | 'scripts' => 'js/ext.narayam.rules.or-inscript.js', |
241 | | - 'messages' => array( 'narayam-or-inscript' ), |
242 | 251 | 'dependencies' => 'ext.narayam.core', |
243 | 252 | ); |
244 | 253 | $wgResourceModules['ext.narayam.rules.sa'] = $narayamTpl + array( |
245 | 254 | 'scripts' => 'js/ext.narayam.rules.sa.js', |
246 | | - 'messages' => array( 'narayam-sa' ), |
247 | 255 | 'dependencies' => 'ext.narayam.core', |
248 | 256 | ); |
249 | 257 | $wgResourceModules['ext.narayam.rules.sa-inscript'] = $narayamTpl + array( |
250 | 258 | 'scripts' => 'js/ext.narayam.rules.sa-inscript.js', |
251 | | - 'messages' => array( 'narayam-sa-inscript' ), |
252 | 259 | 'dependencies' => 'ext.narayam.core', |
253 | 260 | ); |
254 | 261 | $wgResourceModules['ext.narayam.rules.si-singlish'] = $narayamTpl + array( |
255 | 262 | 'scripts' => 'js/ext.narayam.rules.si-singlish.js', |
256 | | - 'messages' => array( 'narayam-si-singlish' ), |
257 | 263 | 'dependencies' => 'ext.narayam.core', |
258 | 264 | ); |
259 | 265 | $wgResourceModules['ext.narayam.rules.si-wijesekara'] = $narayamTpl + array( |
260 | 266 | 'scripts' => 'js/ext.narayam.rules.si-wijesekara.js', |
261 | | - 'messages' => array( 'narayam-si-wijesekara' ), |
262 | 267 | 'dependencies' => 'ext.narayam.core', |
263 | 268 | ); |
264 | 269 | $wgResourceModules['ext.narayam.rules.ta'] = $narayamTpl + array( |
265 | 270 | 'scripts' => 'js/ext.narayam.rules.ta.js', |
266 | | - 'messages' => array( 'narayam-ta' ), |
267 | 271 | 'dependencies' => 'ext.narayam.core', |
268 | 272 | ); |
269 | 273 | $wgResourceModules['ext.narayam.rules.ta99'] = $narayamTpl + array( |
270 | 274 | 'scripts' => 'js/ext.narayam.rules.ta99.js', |
271 | | - 'messages' => array( 'narayam-ta99' ), |
272 | 275 | 'dependencies' => 'ext.narayam.rules.ta', // make sure ta99 loads after ta |
273 | 276 | ); |
274 | 277 | $wgResourceModules['ext.narayam.rules.ta-bamini'] = $narayamTpl + array( |
275 | 278 | 'scripts' => 'js/ext.narayam.rules.ta-bamini.js', |
276 | | - 'messages' => array( 'narayam-ta-bamini' ), |
277 | 279 | 'dependencies' => 'ext.narayam.rules.ta', // make sure ta99 loads after ta |
278 | 280 | ); |
279 | 281 | $wgResourceModules['ext.narayam.rules.te-inscript'] = $narayamTpl + array( |
280 | 282 | 'scripts' => 'js/ext.narayam.rules.te-inscript.js', |
281 | | - 'messages' => array( 'narayam-te-inscript' ), |
282 | 283 | 'dependencies' => 'ext.narayam.core', |
283 | 284 | ); |