Index: trunk/extensions/WebFonts/WebFonts.config.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | "ൾ" => "ള്", |
36 | 36 | "ൻ" => "ന്", |
37 | 37 | "ർ" => "ര്", |
38 | | - "ൺ "=> "ണ്", |
| 38 | + "ൺ " => "ണ്", |
39 | 39 | "ൽ" => "ല്", |
40 | 40 | "ൿ" => "ക് ", |
41 | 41 | "ൻറ" => "ന്റ", |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | "ൾ" => "ള്", |
53 | 53 | "ൻ" => "ന്", |
54 | 54 | "ർ" => "ര്", |
55 | | - "ൺ "=> "ണ്", |
| 55 | + "ൺ " => "ണ്", |
56 | 56 | "ൽ" => "ല്", |
57 | 57 | "ൿ" => "ക് ", |
58 | 58 | "ൻറ" => "ന്റ", |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | "ൾ" => "ള്", |
69 | 69 | "ൻ" => "ന്", |
70 | 70 | "ർ" => "ര്", |
71 | | - "ൺ "=> "ണ്", |
| 71 | + "ൺ " => "ണ്", |
72 | 72 | "ൽ" => "ല്", |
73 | 73 | "ൿ" => "ക് ", |
74 | 74 | "ൻറ" => "ന്റ", |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | "ൾ" => "ള്", |
84 | 84 | "ൻ" => "ന്", |
85 | 85 | "ർ" => "ര്", |
86 | | - "ൺ "=> "ണ്", |
| 86 | + "ൺ " => "ണ്", |
87 | 87 | "ൽ" => "ല്", |
88 | 88 | "ൿ" => "ക് ", |
89 | 89 | "ൻറ" => "ന്റ", |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | 'ttf' => "$fontsPath/he/TaameyFrankCLM.ttf", |
146 | 146 | 'woff' => "$fontsPath/he/TaameyFrankCLM.woff", |
147 | 147 | 'svg' => "$fontsPath/he/TaameyFrankCLM.svg", |
148 | | - ), |
| 148 | + ), |
149 | 149 | 'Kedage' => array( |
150 | 150 | 'eot' => "$fontsPath/kn/Kedage.eot", |
151 | 151 | 'ttf' => "$fontsPath/kn/Kedage.ttf", |
— | — | @@ -179,13 +179,13 @@ |
180 | 180 | 'woff' => "$fontsPath/my/Yunghkio.woff", |
181 | 181 | 'svg' => "$fontsPath/my/Yunghkio.svg", |
182 | 182 | ), |
183 | | - 'KhmerOSbattambang'=> array( |
| 183 | + 'KhmerOSbattambang' => array( |
184 | 184 | 'eot' => "$fontsPath/km/KhmerOSbattambang.eot", |
185 | 185 | 'ttf' => "$fontsPath/km/KhmerOSbattambang.ttf", |
186 | 186 | 'woff' => "$fontsPath/km/KhmerOSbattambang.woff", |
187 | 187 | 'svg' => "$fontsPath/km/KhmerOSbattambang.svg", |
188 | 188 | ), |
189 | | - 'KhmerOSbokor'=> array( |
| 189 | + 'KhmerOSbokor' => array( |
190 | 190 | 'eot' => "$fontsPath/km/KhmerOSbokor.eot", |
191 | 191 | 'ttf' => "$fontsPath/km/KhmerOSbokor.ttf", |
192 | 192 | 'woff' => "$fontsPath/km/KhmerOSbokor.woff", |
— | — | @@ -241,21 +241,21 @@ |
242 | 242 | ), |
243 | 243 | |
244 | 244 | 'languages' => array( |
245 | | - //'en' => array( 'RufScript', 'Perizia', 'Ubuntu' ), |
246 | | - 'ml' => array( 'Meera', 'Rachana' , 'Dyuthi', 'RaghuMalayalam'), |
247 | | - 'or' => array( 'Lohit Oriya'), |
248 | | - 'ta' => array( 'Lohit Tamil'), |
249 | | - 'te' => array( 'Lohit Telugu'), |
250 | | - 'bn' => array( 'Lohit Bengali'), |
251 | | - 'as' => array( 'Lohit Bengali'), |
252 | | - 'gu' => array( 'Samyak Gujarati'), |
253 | | - 'hi' => array( 'Samyak Devanagari', 'Lohit Hindi'), |
254 | | - 'mr' => array( 'Samyak Devanagari', 'Lohit Hindi'), |
255 | | - 'ks' => array( 'Samyak Devanagari', 'Lohit Hindi'), |
256 | | - 'he' => array( 'Ezra SIL', 'David CLM','Hadasim CLM', 'Taamey Frank CLM'), |
257 | | - 'kn' => array( 'Kedage', 'Lohit Kannada'), |
258 | | - 'my' => array( 'Masterpiece Uni Sans','Padauk-Regular','Myanmar3','Yunghkio'), |
259 | | - 'km' => array('KhmerOSbattambang', 'KhmerOSsiemreap', 'KhmerOS', 'KhmerOSbokor', 'KhmerOSmuollight', 'KhmerOSmuol','KhmerOSmuolpali', 'KhmerOSfreehand', 'KhmerOSfasthand'), |
260 | | - 'saz' => array('Pagul'), |
| 245 | + // 'en' => array( 'RufScript', 'Perizia', 'Ubuntu' ), |
| 246 | + 'ml' => array( 'Meera', 'Rachana' , 'Dyuthi', 'RaghuMalayalam' ), |
| 247 | + 'or' => array( 'Lohit Oriya' ), |
| 248 | + 'ta' => array( 'Lohit Tamil' ), |
| 249 | + 'te' => array( 'Lohit Telugu' ), |
| 250 | + 'bn' => array( 'Lohit Bengali' ), |
| 251 | + 'as' => array( 'Lohit Bengali' ), |
| 252 | + 'gu' => array( 'Samyak Gujarati' ), |
| 253 | + 'hi' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
| 254 | + 'mr' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
| 255 | + 'ks' => array( 'Samyak Devanagari', 'Lohit Hindi' ), |
| 256 | + 'he' => array( 'Ezra SIL', 'David CLM', 'Hadasim CLM', 'Taamey Frank CLM' ), |
| 257 | + 'kn' => array( 'Kedage', 'Lohit Kannada' ), |
| 258 | + 'my' => array( 'Masterpiece Uni Sans', 'Padauk-Regular', 'Myanmar3', 'Yunghkio' ), |
| 259 | + 'km' => array( 'KhmerOSbattambang', 'KhmerOSsiemreap', 'KhmerOS', 'KhmerOSbokor', 'KhmerOSmuollight', 'KhmerOSmuol', 'KhmerOSmuolpali', 'KhmerOSfreehand', 'KhmerOSfasthand' ), |
| 260 | + 'saz' => array( 'Pagul' ), |
261 | 261 | ), |
262 | 262 | ); |
Index: trunk/extensions/WebFonts/js/webfonts.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $.webfonts.reset(); |
12 | 12 | return; |
13 | 13 | } |
14 | | - |
| 14 | + |
15 | 15 | var config = mw.config.get( "wgWebFonts" ); |
16 | 16 | if ( !font in config.fonts ) { |
17 | 17 | console.log( "Requested unknown font", font ); |
— | — | @@ -18,8 +18,8 @@ |
19 | 19 | } else { |
20 | 20 | config = config.fonts[font]; |
21 | 21 | } |
22 | | - |
23 | | - var styleString = |
| 22 | + |
| 23 | + var styleString = |
24 | 24 | "<style type='text/css'>\n@font-face {\n" |
25 | 25 | + "\tfont-family: '"+font+"';\n"; |
26 | 26 | if ( 'eot' in config ) { |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | } |
29 | 29 | //If the font is present locally, use it. |
30 | 30 | styleString += "\tsrc: local('"+ font +"'),"; |
31 | | - |
| 31 | + |
32 | 32 | if ( 'woff' in config ) { |
33 | 33 | styleString += "\t\turl('"+config.woff+"') format('woff'),"; |
34 | 34 | } |
— | — | @@ -37,10 +37,10 @@ |
38 | 38 | if ( 'ttf' in config ) { |
39 | 39 | styleString += "\t\turl('"+config.ttf+"') format('truetype');\n"; |
40 | 40 | } |
41 | | - |
| 41 | + |
42 | 42 | styleString += "\tfont-weight: normal;\n}\n</style>\n"; |
43 | 43 | $(styleString).appendTo("head" ); |
44 | | - |
| 44 | + |
45 | 45 | //save the current font and its size. Used for reset. |
46 | 46 | if ( !$.webfonts.oldconfig ) { |
47 | 47 | $.webfonts.oldconfig = { |
— | — | @@ -48,19 +48,19 @@ |
49 | 49 | "font-size": $("body").css('font-size') |
50 | 50 | } |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | //Set the font, fallback fonts |
54 | 54 | $("body").css('font-family', font +", Helvetica, Arial, sans-serif"); |
55 | 55 | //we need to change the fonts of Input and Select explicitly. |
56 | 56 | $("input").css('font-family', font +", Helvetica, Arial, sans-serif"); |
57 | 57 | $("select").css('font-family', font +", Helvetica, Arial, sans-serif"); |
58 | | - |
| 58 | + |
59 | 59 | //scale the font of the page. Scale is in percentage. |
60 | 60 | // For example scale = 1.2 means scale the font by 120 percentage |
61 | 61 | if ( 'scale' in config ) { |
62 | 62 | $.webfonts.scale("body", config.scale); |
63 | 63 | } |
64 | | - |
| 64 | + |
65 | 65 | if ( 'normalization' in config ) { |
66 | 66 | $(document).ready(function() { |
67 | 67 | $.webfonts.normalize(config.normalization); |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | //set the font option in cookie |
71 | 71 | $.cookie( 'webfonts-font', font, { 'path': '/', 'expires': 30 } ); |
72 | 72 | }, |
73 | | - |
| 73 | + |
74 | 74 | /** |
75 | 75 | * Reset the font with old configuration |
76 | 76 | */ |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | //remove the cookie |
85 | 85 | $.cookie( 'webfonts-font', 'none' ); |
86 | 86 | }, |
87 | | - |
| 87 | + |
88 | 88 | /** |
89 | 89 | * Scale the font of the page by given percentage |
90 | 90 | * @param selecter CSS selector |
— | — | @@ -95,35 +95,35 @@ |
96 | 96 | $(this).css("font-size", Math.round( currentSize * percentage)); |
97 | 97 | }); |
98 | 98 | }, |
99 | | - |
| 99 | + |
100 | 100 | /** |
101 | 101 | * Does a find replace of string on the page. |
102 | 102 | * @param normalization_rules hashmap of replacement rules. |
103 | 103 | */ |
104 | 104 | normalize: function(normalization_rules){ |
105 | | - $.each(normalization_rules, function(search, replace) { |
| 105 | + $.each(normalization_rules, function(search, replace) { |
106 | 106 | var search_pattern = new RegExp(search,"g"); |
107 | | - return $("*").each(function(){ |
108 | | - var node = this.firstChild, |
109 | | - val, |
| 107 | + return $("*").each(function(){ |
| 108 | + var node = this.firstChild, |
| 109 | + val, |
110 | 110 | new_val; |
111 | | - if ( node ) { |
112 | | - do { |
113 | | - if ( node.nodeType === 3 ) { |
114 | | - val = node.nodeValue; |
115 | | - new_val = val.replace(search_pattern, replace ); |
116 | | - if ( new_val !== val ) { |
117 | | - node.nodeValue = new_val; |
118 | | - } |
119 | | - } |
120 | | - } while ( node = node.nextSibling ); |
121 | | - } |
122 | | - }); |
| 111 | + if ( node ) { |
| 112 | + do { |
| 113 | + if ( node.nodeType === 3 ) { |
| 114 | + val = node.nodeValue; |
| 115 | + new_val = val.replace(search_pattern, replace ); |
| 116 | + if ( new_val !== val ) { |
| 117 | + node.nodeValue = new_val; |
| 118 | + } |
| 119 | + } |
| 120 | + } while ( node = node.nextSibling ); |
| 121 | + } |
| 122 | + }); |
123 | 123 | }); |
124 | 124 | }, |
125 | | - |
| 125 | + |
126 | 126 | setup: function() { |
127 | | - |
| 127 | + |
128 | 128 | var config = mw.config.get( "wgWebFontsAvailable" ); |
129 | 129 | // Build font dropdown |
130 | 130 | $fontsmenu = $( '<ul />' ).attr('id','webfonts-fontsmenu'); |
— | — | @@ -133,12 +133,12 @@ |
134 | 134 | .attr("name","font") |
135 | 135 | .attr("id","webfont-"+config[scheme]) |
136 | 136 | .attr("value",config[scheme] ); |
137 | | - |
| 137 | + |
138 | 138 | $fontmenuitem = $( '<li />' ) |
139 | 139 | .val( config[scheme] ) |
140 | 140 | .append( $fontlink ) |
141 | 141 | .append( config[scheme] ); |
142 | | - |
| 142 | + |
143 | 143 | haveSchemes = true; |
144 | 144 | //some closure trick :) |
145 | 145 | (function (font) { |
— | — | @@ -155,36 +155,36 @@ |
156 | 156 | .attr("value","webfont-none") |
157 | 157 | .click( function( event ) { |
158 | 158 | $.webfonts.set( 'none'); |
159 | | - }); |
| 159 | + }); |
160 | 160 | $resetlinkitem = $( '<li />' ) |
161 | 161 | .val( 'none') |
162 | | - .append( $resetlink ) |
| 162 | + .append( $resetlink ) |
163 | 163 | .append( mw.msg("webfonts-reset")); |
164 | | - |
| 164 | + |
165 | 165 | $fontsmenu.append($resetlinkitem); |
166 | 166 | |
167 | 167 | if ( !haveSchemes ) { |
168 | 168 | // No schemes available, don't show the tool |
169 | 169 | return; |
170 | 170 | } |
171 | | - |
| 171 | + |
172 | 172 | var $menudiv = $( '<div />' ).attr('id','webfonts-fonts') |
173 | 173 | .addClass( 'menu' ) |
174 | 174 | .append( $fontsmenu ) |
175 | 175 | .append(); |
176 | | - |
| 176 | + |
177 | 177 | var $div = $( '<div />' ).attr('id','webfonts-menu') |
178 | 178 | .addClass( 'webfontMenu' ) |
179 | 179 | .append( "<a href='#'>"+ mw.msg("webfonts-load")+"</a>") |
180 | 180 | .append( $menudiv ); |
181 | | - |
| 181 | + |
182 | 182 | //this is the fonts link |
183 | 183 | var $li = $( '<li />' ) |
184 | 184 | .append( $div ); |
185 | | - |
| 185 | + |
186 | 186 | //add to the left of top personal links |
187 | 187 | $($( '#p-personal ul' )[0]).prepend( $li ); |
188 | | - |
| 188 | + |
189 | 189 | //see if there is a font in cookie |
190 | 190 | cookie_font = $.cookie('webfonts-font'); |
191 | 191 | if(cookie_font == null){ |
— | — | @@ -202,7 +202,7 @@ |
203 | 203 | } |
204 | 204 | |
205 | 205 | } |
206 | | - |
| 206 | + |
207 | 207 | $( document ).ready( function() { |
208 | 208 | $.webfonts.setup(); |
209 | 209 | } ); |
Index: trunk/extensions/WebFonts/WebFonts.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * @licence GNU General Public Licence 3.0 or later |
15 | 15 | */ |
16 | 16 | |
17 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 17 | +if ( !defined( 'MEDIAWIKI' ) ) { |
18 | 18 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
19 | 19 | die( -1 ); |
20 | 20 | } |
— | — | @@ -21,12 +21,12 @@ |
22 | 22 | $wgExtensionCredits['parserhook'][] = array( |
23 | 23 | 'path' => __FILE__, |
24 | 24 | 'name' => 'WebFonts', |
25 | | - 'author' => array( 'Santhosh Thottingal', 'Niklas Laxström'), |
| 25 | + 'author' => array( 'Santhosh Thottingal', 'Niklas Laxström' ), |
26 | 26 | 'url' => 'http://www.mediawiki.org/wiki/Extension:WebFonts', |
27 | 27 | 'descriptionmsg' => 'webfonts-desc', |
28 | 28 | ); |
29 | 29 | |
30 | | -$dir = dirname(__FILE__); |
| 30 | +$dir = dirname( __FILE__ ); |
31 | 31 | // Internationalization |
32 | 32 | $wgExtensionMessagesFiles['WebFonts'] = "$dir/WebFonts.i18n.php"; |
33 | 33 | |
— | — | @@ -46,5 +46,5 @@ |
47 | 47 | 'styles' => 'css/webfonts.css', |
48 | 48 | 'localBasePath' => dirname( __FILE__ ), |
49 | 49 | 'remoteExtPath' => 'WebFonts', |
50 | | - 'messages' => array( 'webfonts-load', 'webfonts-reset'), |
| 50 | + 'messages' => array( 'webfonts-load', 'webfonts-reset' ), |
51 | 51 | ); |