r89055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89054‎ | r89055 | r89056 >
Date:18:42, 28 May 2011
Author:janpaul123
Status:ok
Tags:
Comment:
Some minor things
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.api.php (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.api.php
@@ -123,6 +123,7 @@
124124 'message' => 'Actual message the user has entered, for logging purposes',
125125 'token' => 'Edit token. You can get one of these through prop=info',
126126 'subject' => 'Subject header of the new section',
 127+ 'email' => 'Content of the optional e-mail message to send to the user',
127128 'type' => array( 'Type of WikiLove (for statistics); this corresponds with a type',
128129 'selected in the left menu, and optionally a subtype after that',
129130 '(e.g. "barnstar-normal" or "kitten")',
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
@@ -263,7 +263,7 @@
264264 email: 'Hello $7!\n\nI just awarded you a barnstar.'
265265 }
266266 },
267 - icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png' // icon for left-side menu
 267+ icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png' // icon for left-side menu
268268 },
269269 'beer': {
270270 name: 'Beer',
@@ -275,7 +275,7 @@
276276 width: 145,
277277 number: 3
278278 },
279 - icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-beer.png' // icon for left-side menu
 279+ icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-beer.png' // icon for left-side menu
280280 },
281281 'kitten': {
282282 name: 'Kitten',
@@ -287,14 +287,14 @@
288288 width: 145,
289289 number: 3
290290 },
291 - icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-kitten.png' // icon for left-side menu
 291+ icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-kitten.png' // icon for left-side menu
292292 },
293293 // default type, nice to leave this one in place when adding other types
294294 'makeyourown': {
295295 name: mw.msg( 'wikilove-type-makeyourown' ),
296296 fields: [ 'header', 'title', 'image', 'notify' ],
297297 imageSize: '150px',
298 - icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-create.png' // icon for left-side menu
 298+ icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-create.png' // icon for left-side menu
299299 }
300300 }
301301 }; };
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -281,12 +281,7 @@
282282 $.wikiLove.showError( 'wikilove-err-sig' ); return false;
283283 }
284284
285 - var text = $.wikiLove.prepareMsg(
286 - currentTypeOrSubtype.text || options.defaultText,
287 - currentTypeOrSubtype.imageSize,
288 - currentTypeOrSubtype.backgroundColor,
289 - currentTypeOrSubtype.borderColor
290 - );
 285+ var text = $.wikiLove.prepareMsg( currentTypeOrSubtype.text || options.defaultText );
291286
292287 $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + "==\n" + text );
293288 previewData = {
@@ -316,20 +311,14 @@
317312 * $6: border color
318313 * $7: username of the recipient
319314 */
320 - prepareMsg: function( msg, imageSize, backgroundColor, borderColor ) {
 315+ prepareMsg: function( msg ) {
321316
322317 msg = msg.replace( '$1', $( '#mw-wikilove-message' ).val() ); // replace the raw message
323318 msg = msg.replace( '$2', $( '#mw-wikilove-title' ).val() ); // replace the title
324319 msg = msg.replace( '$3', $( '#mw-wikilove-image' ).val() ); // replace the image
325 -
326 - var myImageSize = imageSize || options.defaultImageSize;
327 - var myBackgroundColor = backgroundColor || options.defaultBackgroundColor;
328 - var myBorderColor = borderColor || options.defaultBorderColor;
329 -
330 - msg = msg.replace( '$4', myImageSize ); // replace the image size
331 - msg = msg.replace( '$5', myBackgroundColor ); // replace the background color
332 - msg = msg.replace( '$6', myBorderColor ); // replace the border color
333 -
 320+ msg = msg.replace( '$4', currentTypeOrSubtype.imageSize || options.defaultImageSize ); // replace the image size
 321+ msg = msg.replace( '$5', currentTypeOrSubtype.backgroundColor || options.defaultBackgroundColor ); // replace the background color
 322+ msg = msg.replace( '$6', currentTypeOrSubtype.borderColor || options.defaultBorderColor ); // replace the border color
334323 msg = msg.replace( '$7', mw.config.get( 'wikilove-recipient' ) ); // replace the username we're sending to
335324
336325 return msg;

Follow-up revisions

RevisionCommit summaryAuthorDate
r89056Small followup to r89055janpaul12318:44, 28 May 2011

Status & tagging log