Index: trunk/extensions/WebFonts/resources/ext.webfonts.js |
— | — | @@ -1,6 +1,6 @@ |
2 | | -(function($){ |
| 2 | +( function( $ ) { |
3 | 3 | |
4 | | - function fontID(font) { |
| 4 | + function fontID( font ) { |
5 | 5 | if ( typeof font !== 'string' ) { |
6 | 6 | return font; |
7 | 7 | } |
— | — | @@ -20,31 +20,31 @@ |
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | | - if ( !(font in $.webfonts.config.fonts) ) { |
| 24 | + if ( !( font in $.webfonts.config.fonts ) ) { |
25 | 25 | mw.log( "Requested unknown font", font ); |
26 | 26 | return; |
27 | 27 | } |
28 | 28 | var config = $.webfonts.config.fonts[font]; |
29 | 29 | |
30 | 30 | //load the style sheet for the font |
31 | | - $.webfonts.addFont(font); |
| 31 | + $.webfonts.addFont( font ); |
32 | 32 | |
33 | 33 | //save the current font and its size. Used for reset. |
34 | 34 | if ( !$.webfonts.oldconfig ) { |
35 | | - var $body = $("body"); |
| 35 | + var $body = $( 'body' ); |
36 | 36 | $.webfonts.oldconfig = { |
37 | | - "font-family": $body.css('font-family'), |
38 | | - "font-size": $body.css('font-size') |
| 37 | + "font-family": $body.css( 'font-family' ), |
| 38 | + "font-size": $body.css( 'font-size' ) |
39 | 39 | }; |
40 | 40 | } |
41 | 41 | |
42 | 42 | //Set the font, fallback fonts.Need to change the fonts of Input Select and Textarea explicitly. |
43 | | - $("body, input, select, textarea").css('font-family', "'"+ font +"', Helvetica, Arial, sans-serif"); |
| 43 | + $( 'body, input, select, textarea' ).css( 'font-family', "'"+ font +"', Helvetica, Arial, sans-serif" ); |
44 | 44 | |
45 | 45 | if ( 'normalization' in config ) { |
46 | | - $(document).ready(function() { |
47 | | - $.webfonts.normalize(config.normalization); |
48 | | - }); |
| 46 | + $( document ).ready( function() { |
| 47 | + $.webfonts.normalize( config.normalization ); |
| 48 | + } ); |
49 | 49 | } |
50 | 50 | //set the font option in cookie |
51 | 51 | $.cookie( 'webfonts-font', font, { 'path': '/', 'expires': 30 } ); |
— | — | @@ -57,16 +57,16 @@ |
58 | 58 | * Reset the font with old configuration |
59 | 59 | */ |
60 | 60 | reset: function() { |
61 | | - $("body").css({ |
| 61 | + $( 'body' ).css( { |
62 | 62 | 'font-family': $.webfonts.oldconfig["font-family"], |
63 | 63 | //reset the font size from old configuration |
64 | | - 'font-size': $.webfonts.oldconfig["font-size"] |
| 64 | + 'font-size': $.webfonts.oldconfig[ "font-size" ] |
65 | 65 | }); |
66 | 66 | //we need to reset the fonts of Input and Select explicitly. |
67 | | - $("input, select").css('font-family', $.webfonts.oldconfig["font-family"]); |
| 67 | + $( 'input, select' ).css( 'font-family', $.webfonts.oldconfig["font-family"] ); |
68 | 68 | |
69 | 69 | // Reset the fonts applied for tags with lang attribute. |
70 | | - $(".webfonts-lang-attr").css( 'font-family', 'none' ).removeClass( 'webfonts-lang-attr' ); |
| 70 | + $( '.webfonts-lang-attr' ).css( 'font-family', 'none' ).removeClass( 'webfonts-lang-attr' ); |
71 | 71 | |
72 | 72 | //remove the cookie |
73 | 73 | $.cookie( 'webfonts-font', 'none', { 'path': '/', 'expires': 30 } ); |
— | — | @@ -76,25 +76,25 @@ |
77 | 77 | * Does a find replace of string on the page. |
78 | 78 | * @param normalization_rules hashmap of replacement rules. |
79 | 79 | */ |
80 | | - normalize: function(normalization_rules) { |
81 | | - $.each(normalization_rules, function(search, replace) { |
82 | | - var search_pattern = new RegExp(search,"g"); |
83 | | - return $("*").each(function() { |
| 80 | + normalize: function( normalizationRules ) { |
| 81 | + $.each( normalizationRules, function( search, replace ) { |
| 82 | + var searchPattern = new RegExp( search,"g" ); |
| 83 | + return $( '*' ).each(function() { |
84 | 84 | var node = this.firstChild, |
85 | | - val, new_val; |
| 85 | + val, newVal; |
86 | 86 | if ( node ) { |
87 | 87 | do { |
88 | 88 | if ( node.nodeType === 3 ) { |
89 | 89 | val = node.nodeValue; |
90 | | - new_val = val.replace(search_pattern, replace); |
91 | | - if ( new_val !== val ) { |
92 | | - node.nodeValue = new_val; |
| 90 | + newVal = val.replace( searchPattern, replace ); |
| 91 | + if ( newVal !== val ) { |
| 92 | + node.nodeValue = newVal; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | } while ( node = node.nextSibling ); |
96 | 96 | } |
97 | | - }); |
98 | | - }); |
| 97 | + } ); |
| 98 | + } ); |
99 | 99 | }, |
100 | 100 | |
101 | 101 | /* |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | * so that it gets loaded. |
104 | 104 | * @param fontfamily The fontfamily name |
105 | 105 | */ |
106 | | - loadcss: function(fontfamily) { |
| 106 | + loadcss: function( fontfamily ) { |
107 | 107 | var fontconfig = $.webfonts.config.fonts[fontfamily]; |
108 | 108 | var base = mw.config.get( "wgExtensionAssetsPath" ) + "/WebFonts/fonts/"; |
109 | 109 | var styleString = |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | styleString += "\tfont-weight: normal;\n}\n</style>\n"; |
135 | 135 | |
136 | 136 | //inject the css to the head of the page. |
137 | | - $(styleString).appendTo("head"); |
| 137 | + $( styleString ).appendTo( 'head' ); |
138 | 138 | |
139 | 139 | }, |
140 | 140 | |
— | — | @@ -163,24 +163,24 @@ |
164 | 164 | var languages = $.webfonts.config.languages; |
165 | 165 | var requested = [mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), mw.config.get( 'wgUserLanguage' )]; |
166 | 166 | |
167 | | - for (var i = 0; i < requested.length; i++) { |
168 | | - if (requested[i] in languages) { |
| 167 | + for ( var i = 0; i < requested.length; i++ ) { |
| 168 | + if ( requested[i] in languages ) { |
169 | 169 | var fonts = languages[requested[i]]; |
170 | | - for (var j = 0; j < fonts.length; j++) { |
| 170 | + for ( var j = 0; j < fonts.length; j++) { |
171 | 171 | if ( $.inArray(fonts[j], config) === -1 ) { |
172 | | - config.push(fonts[j]); |
| 172 | + config.push( fonts[j] ); |
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | 178 | // Build font dropdown |
179 | | - $.webfonts.buildMenu(config); |
| 179 | + $.webfonts.buildMenu( config ); |
180 | 180 | // See if there is a font in cookie if not first font is default font. |
181 | 181 | var cookieFont = $.cookie( 'webfonts-font' ); |
182 | 182 | var selectedFont = null; |
183 | 183 | // check whether this font is for the current userlang/contentlang |
184 | | - if ( $.inArray(cookieFont, config) !== -1){ |
| 184 | + if ( $.inArray( cookieFont, config ) !== -1){ |
185 | 185 | selectedFont = cookieFont; |
186 | 186 | } |
187 | 187 | else{ |
— | — | @@ -196,10 +196,10 @@ |
197 | 197 | |
198 | 198 | $.webfonts.loadFontsForFontFamilyStyle(); |
199 | 199 | $.webfonts.loadFontsForLangAttr(); |
200 | | - if ( $(".webfonts-lang-attr").length && !$( '#webfonts-fontsmenu' ).length ){ |
| 200 | + if ( $('.webfonts-lang-attr').length && !$( '#webfonts-fontsmenu' ).length ) { |
201 | 201 | // We need to show the reset option even if there is no font to show |
202 | 202 | // for the language, if there is lang attr based font embedding. |
203 | | - $.webfonts.buildMenu(config); |
| 203 | + $.webfonts.buildMenu( config ); |
204 | 204 | } |
205 | 205 | }, |
206 | 206 | |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | loadFontsForLangAttr: function() { |
212 | 212 | var languages = $.webfonts.config.languages; |
213 | 213 | //if there are tags with lang attribute, |
214 | | - $('body').find('*[lang]').each(function(index) { |
| 214 | + $( 'body' ).find( '*[lang]' ).each( function( index ) { |
215 | 215 | //check the availability of font. |
216 | 216 | //add a font-family style if it does not have any |
217 | 217 | if( languages[this.lang] && ( !this.style.fontFamily || this.style.fontFamily == "none" ) ) { |
— | — | @@ -229,10 +229,10 @@ |
230 | 230 | loadFontsForFontFamilyStyle: function() { |
231 | 231 | var languages = $.webfonts.config.languages; |
232 | 232 | //if there are tags with font-family style definition, get a list of fonts to be loaded |
233 | | - $('body').find('*[style]').each(function(index) { |
| 233 | + $( 'body' ).find( '*[style]' ).each(function( index ) { |
234 | 234 | if( this.style.fontFamily ) { |
235 | | - var fontFamilyItems = this.style.fontFamily.split(","); |
236 | | - $.each( fontFamilyItems, function(index, fontFamily) { |
| 235 | + var fontFamilyItems = this.style.fontFamily.split( "," ); |
| 236 | + $.each( fontFamilyItems, function( index, fontFamily ) { |
237 | 237 | //remove the ' characters if any. |
238 | 238 | fontFamily = fontFamily.replace(/'/g, ''); |
239 | 239 | $.webfonts.addFont( fontFamily ); |
— | — | @@ -250,9 +250,9 @@ |
251 | 251 | var haveSchemes = false; |
252 | 252 | // Build font dropdown |
253 | 253 | var $fontsMenu = $( '<ul>' ).attr('id','webfonts-fontsmenu'); |
254 | | - $fontsMenu.delegate('input:radio', 'change', function( event ) { |
| 254 | + $fontsMenu.delegate( 'input:radio', 'change', function( event ) { |
255 | 255 | $.webfonts.set( $(this).val() ); |
256 | | - }); |
| 256 | + } ); |
257 | 257 | for ( var scheme in config ) { |
258 | 258 | var $fontLink = $( '<input type="radio" />' ) |
259 | 259 | .attr( "name", "font" ) |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | .val( config[scheme] ); |
262 | 262 | |
263 | 263 | var $fontLabel = $( '<label>' ) |
264 | | - .attr("for",fontID(config[scheme])) |
| 264 | + .attr( "for",fontID(config[scheme] ) ) |
265 | 265 | .append( $fontLink ) |
266 | 266 | .append( config[scheme] ); |
267 | 267 | |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | |
272 | 272 | haveSchemes = true; |
273 | 273 | |
274 | | - $fontsMenu.append($fontMenuItem); |
| 274 | + $fontsMenu.append( $fontMenuItem ); |
275 | 275 | |
276 | 276 | } |
277 | 277 | |
— | — | @@ -281,49 +281,49 @@ |
282 | 282 | } |
283 | 283 | |
284 | 284 | var $resetLink = $( '<input type="radio" />' ) |
285 | | - .attr("name","font") |
286 | | - .attr("value","webfont-none") |
287 | | - .attr("id","webfont-none") |
| 285 | + .attr( "name","font" ) |
| 286 | + .attr( "value","webfont-none" ) |
| 287 | + .attr( "id","webfont-none" ) |
288 | 288 | .click( function( event ) { |
289 | | - $.webfonts.set( 'none'); |
| 289 | + $.webfonts.set( 'none' ); |
290 | 290 | }); |
291 | 291 | |
292 | 292 | var $resetLabel = $( '<label>' ) |
293 | | - .attr("for","webfont-none") |
| 293 | + .attr( "for","webfont-none" ) |
294 | 294 | .append( $resetLink ) |
295 | | - .append( mw.msg("webfonts-reset")); |
| 295 | + .append( mw.msg("webfonts-reset") ); |
296 | 296 | |
297 | 297 | var $resetLinkItem = $( '<li>' ) |
298 | 298 | .val( 'none' ) |
299 | 299 | .append( $resetLabel ); |
300 | 300 | |
301 | | - $fontsMenu.append($resetLinkItem); |
| 301 | + $fontsMenu.append( $resetLinkItem ); |
302 | 302 | |
303 | 303 | var $menuDiv = $( '<div>' ).attr('id','webfonts-fonts') |
304 | 304 | .addClass( 'menu' ) |
305 | 305 | .append( $fontsMenu ) |
306 | 306 | .append(); |
307 | 307 | |
308 | | - var $div = $( '<div>' ).attr('id','webfonts-menu') |
| 308 | + var $div = $( '<div>' ).attr( 'id','webfonts-menu' ) |
309 | 309 | .addClass( 'webfontMenu' ) |
310 | | - .append( $('<a>').prop( 'href', '#' ).append( mw.msg( "webfonts-load" ) ) ) |
| 310 | + .append( $( '<a>' ).prop( 'href', '#' ).append( mw.msg( "webfonts-load" ) ) ) |
311 | 311 | .append( $menuDiv ); |
312 | 312 | |
313 | 313 | //this is the fonts link |
314 | | - var $li = $( '<li>' ).attr('id','pt-webfont') |
| 314 | + var $li = $( '<li>' ).attr( 'id','pt-webfont' ) |
315 | 315 | .append( $div ); |
316 | 316 | |
317 | 317 | //if rtl, add to the right of top personal links. Else, to the left |
318 | | - var fn = $('body').hasClass( 'rtl' ) ? "append" : "prepend"; |
319 | | - $('#p-personal ul:first')[fn]( $li ); |
| 318 | + var fn = $( 'body' ).hasClass( 'rtl' ) ? "append" : "prepend"; |
| 319 | + $( '#p-personal ul:first' )[fn]( $li ); |
320 | 320 | //workaround for IE bug - activex components like input fields coming on top of everything. |
321 | 321 | //TODO: is there a better solution other than hiding it on hover? |
322 | 322 | if ( $.browser.msie ) { |
323 | | - $("#webfonts-menu").hover(function(){ |
324 | | - $("#searchform").css({ visibility: "hidden" }); |
325 | | - },function(){ |
326 | | - $("#searchform").css({ visibility: "visible" }); |
327 | | - }); |
| 323 | + $( '#webfonts-menu' ).hover( function( ) { |
| 324 | + $( '#searchform' ).css({ visibility: "hidden" } ); |
| 325 | + }, function( ) { |
| 326 | + $( '#searchform' ).css( { visibility: "visible" } ); |
| 327 | + } ); |
328 | 328 | } |
329 | 329 | } |
330 | 330 | }; |
— | — | @@ -332,4 +332,4 @@ |
333 | 333 | $.webfonts.setup(); |
334 | 334 | } ); |
335 | 335 | |
336 | | -})(jQuery); |
| 336 | +} ) ( jQuery ); |
Index: trunk/extensions/WebFonts/resources/ext.webfonts.fontlist.js |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | * First font is the default font for the language |
5 | 5 | */ |
6 | 6 | |
7 | | -(function ($) { |
| 7 | +( function ( $ ) { |
8 | 8 | $.webfonts = {}; |
9 | 9 | |
10 | 10 | $.webfonts.config = { |
— | — | @@ -37,7 +37,6 @@ |
38 | 38 | eot: "Mlym/Meera.eot", |
39 | 39 | ttf: "Mlym/Meera.ttf", |
40 | 40 | woff: "Mlym/Meera.woff", |
41 | | - scale: 1.5, |
42 | 41 | normalization: { |
43 | 42 | "ൾ": "ള്", |
44 | 43 | "ൻ": "ന്", |
— | — | @@ -317,4 +316,4 @@ |
318 | 317 | cdo: [ "Charis SIL" ] |
319 | 318 | } |
320 | 319 | }; |
321 | | -})(jQuery); |
| 320 | +} ) ( jQuery ); |
Index: trunk/extensions/WebFonts/resources/ext.webfonts.css |
— | — | @@ -1,28 +1,28 @@ |
2 | | -li#pt-webfont{ |
| 2 | +li#pt-webfont { |
3 | 3 | /* @embed */ |
4 | 4 | background: url(images/font-icon.png) no-repeat scroll left top transparent; |
5 | 5 | padding-left: 15px !important; |
6 | 6 | } |
7 | 7 | |
8 | | -div#webfonts-menu{ |
| 8 | +div#webfonts-menu { |
9 | 9 | font-size: 100%; |
10 | 10 | z-index: 99999; |
11 | 11 | } |
12 | 12 | |
13 | | -div#webfonts-fonts{ |
| 13 | +div#webfonts-fonts { |
14 | 14 | font-size: 100%; |
15 | 15 | z-index: 99999; |
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | | -div#webfonts-menu .menu ul{ |
20 | | - padding-left:5px!important; |
| 19 | +div#webfonts-menu .menu ul { |
| 20 | + padding-left: 5px!important; |
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | | -div#webfonts-fonts li{ |
| 24 | +div#webfonts-fonts li { |
25 | 25 | margin: 0; |
26 | | - padding:5px; |
| 26 | + padding: 5px; |
27 | 27 | font-size: 100%; |
28 | 28 | float: none; |
29 | 29 | } |
— | — | @@ -68,7 +68,8 @@ |
69 | 69 | margin-left: 23px; |
70 | 70 | } |
71 | 71 | /* Enable forcing showing of the menu for accessibility */ |
72 | | -div.webfontMenu:hover div.menu, div.webfontMenu div.menuForceShow { |
| 72 | +div.webfontMenu:hover div.menu, |
| 73 | +div.webfontMenu div.menuForceShow { |
73 | 74 | display: block; |
74 | 75 | } |
75 | 76 | div.webfontMenu ul { |
— | — | @@ -121,6 +122,6 @@ |
122 | 123 | } |
123 | 124 | div.webfontMenu a { |
124 | 125 | display: block; |
125 | | - padding-left:5px; |
126 | | - padding-right:5px; |
| 126 | + padding-left: 5px; |
| 127 | + padding-right: 5px; |
127 | 128 | } |