| @@ -1,27 +1,20 @@ | ||
| 1 | -jQuery( document ).ready( | |
| 2 | - function( $ ) { | |
| 3 | - // biography | |
| 4 | - // FIXME there is probably a more efficient way to do this | |
| 5 | - var td = $( '#description' ).parent(); | |
| 6 | - var d = $( '#description' ).clone(); | |
| 7 | - var span = td.children( '.description' ).clone(); | |
| 8 | - td.children().remove(); | |
| 1 | +jQuery( document ).ready(function( $ ) { | |
| 2 | + // biography | |
| 3 | + // FIXME there is probably a more efficient way to do this | |
| 4 | + var td = $( '#description' ).parent(); | |
| 5 | + var d = $( '#description' ).clone(); | |
| 6 | + var span = td.children( '.description' ).clone(); | |
| 7 | + td.children().remove(); | |
| 9 | 8 | |
| 10 | - $( '.biography' ).each( | |
| 11 | - function(){ | |
| 12 | - lang = $( this ).attr( 'name' ).split( '___' ); | |
| 13 | - desc = d.clone(); | |
| 14 | - desc.attr( 'name', 'description_' + lang[0] ); | |
| 15 | - desc.attr( 'id', 'description_' + lang[0] ); | |
| 16 | - // Whitelist because description and lang value is already escaped by the side of PHP | |
| 17 | - desc.html( $( this ).val() ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html | |
| 18 | - td.append( $( '<div></div>' ).text( lang[1] ) ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append | |
| 19 | - td.append( desc ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append | |
| 20 | - } | |
| 21 | - ); | |
| 9 | + $( '.biography' ).each(function(){ | |
| 10 | + lang = $( this ).attr( 'name' ).split( '___' ); | |
| 11 | + desc = d.clone(); | |
| 12 | + desc.attr( 'name', 'description_' + lang[0] ); | |
| 13 | + desc.html( $( this ).val() ); | |
| 14 | + td.append( '<div>' + lang[1] + '</div' ); | |
| 15 | + td.append( desc ); | |
| 16 | + }); | |
| 22 | 17 | |
| 23 | - td.append( '<br />' ); | |
| 24 | - // Whitelist because description come from html code generated by WordPress | |
| 25 | - td.append( span ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append | |
| 26 | - } | |
| 27 | -); | |
| 18 | + td.append( '<br />' ); | |
| 19 | + td.append( span ); | |
| 20 | +}); | |