Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | ( function( $ ) { |
3 | 3 | $.wikiLove.optionsHook = function() { return { |
4 | 4 | defaultText: '{| style="background-color: $5; border: 1px solid $6;"\n\ |
5 | | -|rowspan="2" style="vertical-align: middle; padding: 5px;" | [[File:$3|$4]]\n\ |
| 5 | +|rowspan="2" style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\ |
6 | 6 | |style="font-size: x-large; padding: 3px; height: 1.5em;" | \'\'\'$2\'\'\'\n\ |
7 | 7 | |-\n\ |
8 | 8 | |style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\ |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | header: 'A barnstar for you!', // header that appears at the top of the talk page post (optional) |
28 | 28 | title: 'The Original Barnstar', // title that appears inside the award box (optional) |
29 | 29 | image: 'Original Barnstar Hires.png', // image for the award |
30 | | - email: 'Hello $7!\n\nI just awarded you a barnstar.' // message to use in eemail notification; $7 is replaced by the recipient's username |
| 30 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' // message to use in email notification; $7 is replaced by the recipient's username |
31 | 31 | }, |
32 | 32 | 'admins': { |
33 | 33 | fields: [ 'notify' ], |
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js |
— | — | @@ -261,8 +261,7 @@ |
262 | 262 | if ( $( '#mw-wikilove-image' ).val().length <= 0 ) { |
263 | 263 | if( typeof currentTypeOrSubtype.gallery == 'object' ) { |
264 | 264 | $.wikiLove.showError( 'wikilove-err-image' ); return false; |
265 | | - } |
266 | | - else { |
| 265 | + } else { |
267 | 266 | $( '#mw-wikilove-image' ).val( options.defaultImage ); |
268 | 267 | } |
269 | 268 | } |
— | — | @@ -319,7 +318,12 @@ |
320 | 319 | |
321 | 320 | msg = msg.replace( '$1', $( '#mw-wikilove-message' ).val() ); // replace the raw message |
322 | 321 | msg = msg.replace( '$2', $( '#mw-wikilove-title' ).val() ); // replace the title |
323 | | - msg = msg.replace( '$3', $( '#mw-wikilove-image' ).val() ); // replace the image |
| 322 | + var imageName = $( '#mw-wikilove-image' ).val(); |
| 323 | + // if the image name doesn't start with a prefix, add one |
| 324 | + if ( imageName.indexOf( 'File:' ) !== 0 && imageName.indexOf( 'Image:' ) !== 0 ) { |
| 325 | + imageName = 'File:' + imageName; |
| 326 | + } |
| 327 | + msg = msg.replace( '$3', imageName ); // replace the image |
324 | 328 | msg = msg.replace( '$4', currentTypeOrSubtype.imageSize || options.defaultImageSize ); // replace the image size |
325 | 329 | msg = msg.replace( '$5', currentTypeOrSubtype.backgroundColor || options.defaultBackgroundColor ); // replace the background color |
326 | 330 | msg = msg.replace( '$6', currentTypeOrSubtype.borderColor || options.defaultBorderColor ); // replace the border color |
— | — | @@ -439,11 +443,16 @@ |
440 | 444 | var titles = ''; |
441 | 445 | var imageList = currentTypeOrSubtype.gallery.imageList.slice( 0 ); |
442 | 446 | for( var i=0; i<currentTypeOrSubtype.gallery.number; i++ ) { |
443 | | - // get a randomimage |
| 447 | + // get a random image from imageList and add it to the list of titles to be retrieved |
444 | 448 | var id = Math.floor( Math.random() * imageList.length ); |
445 | | - titles = titles + 'File:' + imageList[id] + '|'; |
| 449 | + // make sure the image name has a prefix |
| 450 | + if ( imageList[id].indexOf( 'File:' ) === 0 || imageList[id].indexOf( 'Image:' ) === 0 ) { |
| 451 | + titles = titles + imageList[id] + '|'; |
| 452 | + } else { |
| 453 | + titles = titles + 'File:' + imageList[id] + '|'; |
| 454 | + } |
446 | 455 | |
447 | | - // remove the random page from the keys array |
| 456 | + // remove the randomly selected image from imageList so that it can't be added twice |
448 | 457 | imageList.splice(id, 1); |
449 | 458 | } |
450 | 459 | |