Changeset 11539
- Timestamp:
- 02/10/2022 02:36:15 AM (4 years ago)
- Location:
- sites/trunk
- Files:
-
- 2 edited
-
trac.wordpress.org/templates/site.html (modified) (1 diff)
-
wordpress.org/public_html/style/trac/wp-trac.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/trac.wordpress.org/templates/site.html
r11538 r11539 5 5 6 6 <?python 7 scripts_version = '1 59'7 scripts_version = '160' 8 8 project_slug = req.environ['HTTP_HOST'].split(':')[0].split('.')[0] 9 9 wporg_endpoint = 'https://make.wordpress.org/' + project_slug + '/' -
sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js
r11538 r11539 551 551 var $summary = $( '#field-summary' ), 552 552 $description = $( '#field-description' ), 553 $comment = $( '#comment' ); 553 $comment = $( '#comment' ), 554 isNewTicket = wpTrac.isNewTicket(); 554 555 555 556 // Simple replacement for ticket summary. 556 $summary.val( $summary.val().replace( 'Wordpress', 'WordPress' ) ); 557 if ( isNewTicket ) { 558 $summary.val( $summary.val().replaceAll( 'Wordpress', 'WordPress' ) ); 559 } 557 560 558 561 // Use the more judicious replacement for ticket description and comments. 559 562 $.each( [ ' Wordpress', '‘Wordpress', '“Wordpress', '>Wordpress', '(Wordpress' ], function( index, value ) { 560 var replacement = value.replace ( 'Wordpress', 'WordPress' );561 562 if ( $description.length ) {563 $description.val( $description.val().replace ( value, replacement ) );563 var replacement = value.replaceAll( 'Wordpress', 'WordPress' ); 564 565 if ( $description.length && isNewTicket ) { 566 $description.val( $description.val().replaceAll( value, replacement ) ); 564 567 } 565 568 if ( $comment.length ) { 566 $comment.val( $comment.val().replace ( value, replacement ) );569 $comment.val( $comment.val().replaceAll( value, replacement ) ); 567 570 } 568 571 } ); … … 2059 2062 2060 2063 })(jQuery); 2064 2065 /** 2066 * String.prototype.replaceAll() polyfill. For Internet Explorer. 2067 * 2068 * https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/ 2069 * https://vanillajstoolkit.com/polyfills/stringreplaceall/ 2070 * 2071 * @author Chris Ferdinandi 2072 * @license MIT 2073 */ 2074 if ( ! String.prototype.replaceAll ) { 2075 String.prototype.replaceAll = function(str, newStr) { 2076 2077 // If a regex pattern 2078 if ( Object.prototype.toString.call(str).toLowerCase() === '[object regexp]' ) { 2079 return this.replace(str, newStr); 2080 } 2081 2082 // If a string 2083 return this.replace(new RegExp(str, 'g'), newStr); 2084 2085 }; 2086 }
Note: See TracChangeset
for help on using the changeset viewer.