r88963 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88962‎ | r88963 | r88964 >
Date:10:38, 27 May 2011
Author:janpaul123
Status:ok
Tags:
Comment:
Added a default image that is used when no image is specified
Modified paths:
  • /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/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
@@ -1,7 +1,7 @@
22 ( function( $ ) {
33 $.wikiLove.optionsHook = function() { return {
44 defaultText: '{| style="background-color: $5; border: 1px solid $6;"\n\
5 -|rowspan="2" style="vertical-align: middle; padding: 5px;" | [[Image:$3|$4]]\n\
 5+|rowspan="2" style="vertical-align: middle; padding: 5px;" | [[File:$3|$4]]\n\
66 |style="font-size: x-large; padding: 3px; height: 1.5em;" | \'\'\'$2\'\'\'\n\
77 |-\n\
88 |style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
@@ -9,6 +9,7 @@
1010 defaultBackgroundColor: '#fdffe7',
1111 defaultBorderColor: '#fceb92',
1212 defaultImageSize: '100px',
 13+ defaultImage: 'Emblem-fun.svg',
1314
1415 types: {
1516 // example type, could be removed later (also no i18n)
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -266,10 +266,14 @@
267267 $( '#mw-wikilove-preview' ).hide();
268268 $( '#mw-wikilove-dialog' ).find( '.mw-wikilove-error' ).remove();
269269
270 - if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 'object' ) {
271 - if ( $( '#mw-wikilove-image' ).val().length <= 0 ) {
 270+
 271+ if ( $( '#mw-wikilove-image' ).val().length <= 0 ) {
 272+ if( typeof $.wikiLove.currentTypeOrSubtype.gallery == 'object' ) {
272273 $.wikiLove.showError( 'wikilove-err-image' ); return false;
273274 }
 275+ else {
 276+ $( '#mw-wikilove-image' ).val( $.wikiLove.options.defaultImage );
 277+ }
274278 }
275279 if( $( '#mw-wikilove-header' ).val().length <= 0 ) {
276280 $.wikiLove.showError( 'wikilove-err-header' ); return false;

Status & tagging log