Changeset 2116
- Timestamp:
- 11/23/2015 04:08:42 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js
r1995 r2116 93 93 linkMentions: function() { 94 94 // See https://github.com/regexps/mentions-regex/blob/master/index.js#L21 95 var mentionsRegEx = /( ?:^|[^a-zA-Z0-9_@!@#$%&*])(?:(?:@|@)(?!\/))([a-zA-Z0-9/_.]{1,20})(?:\b(?!@|@)|$)/g;95 var mentionsRegEx = /(^|[^a-zA-Z0-9_@!@#$%&*])(?:(?:@|@)(?!\/))([a-zA-Z0-9/_.]{1,20})(?:\b(?!@|@)|$)/g; 96 96 97 97 $( 'div.change .comment, #ticket .description' ).each( function() { 98 98 $comment = $( this ).html(); 99 99 if ( mentionsRegEx.test( $comment ) ) { 100 $comment = $comment.replace( mentionsRegEx, function( match, username ) {100 $comment = $comment.replace( mentionsRegEx, function( match, pre, username ) { 101 101 if ( -1 !== $.inArray( username, reservedTerms ) ) { 102 102 return match; … … 104 104 105 105 var meClass = ( username === wpTrac.currentUser ) ? ' me' : ''; 106 return '<a class="mention' + meClass + '" href="https://profiles.wordpress.org/' + username + '">@' + username + '</a>';106 return pre + '<a class="mention' + meClass + '" href="https://profiles.wordpress.org/' + username + '">@' + username + '</a>'; 107 107 } ); 108 108 $( this ).html( $comment );
Note: See TracChangeset
for help on using the changeset viewer.