Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -2914,20 +2914,23 @@ |
2915 | 2915 | */ |
2916 | 2916 | $.articleFeedbackv5.buildLink = function ( fulltext, link1, link2, link3 ) { |
2917 | 2917 | var full = mw.html.escape( mw.msg( fulltext ) ); |
2918 | | - for ( var i = 1; i < arguments.length; i++ ) { |
2919 | | - var sub = arguments[i]; |
2920 | | - var re = new RegExp("\\$" + i, 'g'); |
| 2918 | + var args = arguments; |
| 2919 | + return full.replace( /\$(\d+)/g, function( str, number ) { |
| 2920 | + var i = parseInt( number, 10 ); |
| 2921 | + var sub = args[i]; |
| 2922 | + var replacement = ''; |
2921 | 2923 | if ( sub.tag == 'quotes' ) { |
2922 | | - full = full.replace( re, '"' + mw.msg( sub.text ) + '"' ); |
| 2924 | + replacement = '"' + mw.msg( sub.text ) + '"'; |
2923 | 2925 | } else { |
2924 | | - full = full.replace( re, mw.html.element( |
| 2926 | + replacement = mw.html.element( |
2925 | 2927 | 'tag' in sub ? sub.tag : 'a', |
2926 | 2928 | $.articleFeedbackv5.attribs( sub ), |
2927 | 2929 | mw.msg( sub.text ) |
2928 | | - ).toString() ); |
| 2930 | + ).toString(); |
2929 | 2931 | } |
2930 | | - } |
2931 | | - return full; |
| 2932 | + console.log(replacement); |
| 2933 | + return replacement; |
| 2934 | + } ); |
2932 | 2935 | }; |
2933 | 2936 | |
2934 | 2937 | // }}} |