Index: trunk/extensions/WebFonts/resources/ext.webfonts.js |
— | — | @@ -246,10 +246,10 @@ |
247 | 247 | }, |
248 | 248 | |
249 | 249 | /** |
250 | | - * Prepare the menu for the webfonts. |
| 250 | + * Prepare the div containing menu items. |
251 | 251 | * @param config The webfont configuration. |
252 | 252 | */ |
253 | | - buildMenu: function(config) { |
| 253 | + buildMenuItems: function ( config ){ |
254 | 254 | var haveSchemes = false; |
255 | 255 | // Build font dropdown |
256 | 256 | var $fontsMenu = $( '<ul>' ).attr( 'id', 'webfonts-fontsmenu' ); |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | if ( !haveSchemes && !$( '.webfonts-lang-attr' ).length ) { |
282 | 282 | // No schemes available, and no tags with lang attr |
283 | 283 | // with fonts loaded. Don't show the menu. |
284 | | - return; |
| 284 | + return null; |
285 | 285 | } |
286 | 286 | |
287 | 287 | var $resetLink = $( '<input type="radio" />' ) |
— | — | @@ -307,12 +307,22 @@ |
308 | 308 | .addClass( 'menu' ) |
309 | 309 | .append( $fontsMenu ) |
310 | 310 | .append(); |
311 | | - |
| 311 | + return $menuDiv; |
| 312 | + }, |
| 313 | + /** |
| 314 | + * Prepare the menu for the webfonts. |
| 315 | + * @param config The webfont configuration. |
| 316 | + */ |
| 317 | + buildMenu: function(config) { |
| 318 | + var $menuItemsDiv = mw.webfonts.buildMenuItems( config ); |
| 319 | + if( $menuItemsDiv == null ) { |
| 320 | + return; |
| 321 | + } |
312 | 322 | var $div = $( '<div>' ) |
313 | 323 | .attr( 'id', 'webfonts-menu' ) |
314 | 324 | .addClass( 'webfontMenu' ) |
315 | 325 | .append( $( '<a>' ).prop( 'href', '#' ).text( mw.message( 'webfonts-load' ).escaped() ) ) |
316 | | - .append( $menuDiv ); |
| 326 | + .append( $menuItemsDiv ); |
317 | 327 | |
318 | 328 | // This is the fonts link |
319 | 329 | var $li = $( '<li>' ) |