Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -56,9 +56,10 @@ |
57 | 57 | * |
58 | 58 | * @param {boolean} global whether to get/set/exists values on the window object or a private object |
59 | 59 | * @param {function} parser function to perform extra processing; in the form of function( value, options ) |
| 60 | + * @param {function} fallback function to format default fallback; in the form of function( key ) |
60 | 61 | * where value is the data to be parsed and options is additional data passed through to the parser |
61 | 62 | */ |
62 | | - 'configuration': function( global, parser ) { |
| 63 | + 'map': function( global, parser, fallback ) { |
63 | 64 | |
64 | 65 | /* Private Members */ |
65 | 66 | |
— | — | @@ -98,8 +99,13 @@ |
99 | 100 | return results; |
100 | 101 | } else if ( typeof selection === 'string' ) { |
101 | 102 | if ( typeof values[selection] === 'undefined' ) { |
102 | | - return typeof options === 'object' && 'fallback' in options ? |
103 | | - options.fallback : '<' + selection + '>'; |
| 103 | + if ( typeof options === 'object' && 'fallback' in options ) { |
| 104 | + return options.fallback; |
| 105 | + } else if ( typeof fallback === 'function' ) { |
| 106 | + return fallback( selection ); |
| 107 | + } else { |
| 108 | + return null; |
| 109 | + } |
104 | 110 | } else { |
105 | 111 | if ( typeof parser === 'function' ) { |
106 | 112 | return parser( values[selection], options ); |
— | — | @@ -158,7 +164,7 @@ |
159 | 165 | * |
160 | 166 | * In legacy mode the values this object wraps will be in the global space |
161 | 167 | */ |
162 | | - this.config = new this.prototypes.configuration( LEGACY_GLOBALS ); |
| 168 | + this.config = new this.prototypes.map( LEGACY_GLOBALS ); |
163 | 169 | |
164 | 170 | /* |
165 | 171 | * Information about the current user |
— | — | @@ -167,7 +173,7 @@ |
168 | 174 | |
169 | 175 | /* Public Members */ |
170 | 176 | |
171 | | - this.options = new that.prototypes.configuration(); |
| 177 | + this.options = new that.prototypes.map(); |
172 | 178 | } )(); |
173 | 179 | |
174 | 180 | /* |
— | — | @@ -186,7 +192,7 @@ |
187 | 193 | /* |
188 | 194 | * Localization system |
189 | 195 | */ |
190 | | - this.msg = new that.prototypes.configuration( false, this.parser ); |
| 196 | + this.msg = new that.prototypes.map( false, this.parser, function( key ) { return '<' + key + '>'; } ); |
191 | 197 | |
192 | 198 | /* |
193 | 199 | * Client-side module loader which integrates with the MediaWiki ResourceLoader |