r88062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88061‎ | r88062 | r88063 >
Date:12:49, 14 May 2011
Author:kaldari
Status:ok
Tags:
Comment:
detect for signature already in message
Modified paths:
  • /trunk/extensions/WikiLove/wikiLove.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/wikiLove.js
@@ -10,14 +10,14 @@
1111 'original': {
1212 title: 'An Original Barnstar for you!', // subject title for the message
1313 descr: 'Original barnstar', // description in the menu
14 - text: '{{subst:The Original Barnstar|$1 ~~~~}}', // message text, $1 is replaced by the user message
 14+ text: '{{subst:The Original Barnstar|$1}}', // message text, $1 is replaced by the user message
1515 template: 'The Original Barnstar', // template that is used, for statistics
1616 message: 'Hello '+wgTitle+'!\n\nI just awarded you a barnstar.' // message to use in email notification
1717 },
1818 'special': {
1919 title: null, // no predefined title, allows the user to enter a title
2020 descr: 'Special barnstar',
21 - text: '{{subst:The Special Barnstarl|$1 ~~~~}}',
 21+ text: '{{subst:The Special Barnstarl|$1}}',
2222 template: 'The Special Barnstar',
2323 message: 'Hello '+wgTitle+'!\n\nI just awarded you the special barnstar.'
2424 }
@@ -29,7 +29,7 @@
3030 'makeyourown': {
3131 title: null,
3232 descr: mw.msg( 'wikilove-type-makeyourown' ),
33 - text: "$1\n\n~~~~",
 33+ text: "$1",
3434 template: ''
3535 }
3636 },
@@ -287,7 +287,11 @@
288288 submitPreview: function( e ) {
289289 e.preventDefault();
290290 var title = '==' + $( '#wlTitle' ).val() + "==\n";
291 - var msg = $.wikiLove.currentTypeOrSubtype.text.replace( '$1', $( '#wlMessage' ).val() );
 291+ var rawMessage = $( '#wlMessage' ).val();
 292+ if ( rawMessage.indexOf( '~~~' ) == -1 ) {
 293+ rawMessage += ' ~~~~';
 294+ }
 295+ var msg = $.wikiLove.currentTypeOrSubtype.text.replace( '$1', rawMessage );
292296 $.wikiLove.doPreview( title + msg );
293297 $.wikiLove.previewData = {
294298 'title': title,

Status & tagging log