| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/icd/mscinformatics2022/wp-content/plugins/polylang/js/build/ |
Upload File : |
/**
* Adds one biography textarea field per language in the user profile.
*/
const pllDescription = {
/**
* Init.
*/
init: () => {
if ( ! pllDescriptionData ) {
return;
}
if ( document.readyState !== 'loading' ) {
pllDescription.ready();
} else {
document.addEventListener(
'DOMContentLoaded',
pllDescription.ready
);
}
},
/**
* Called when the DOM is ready.
*/
ready: () => {
const originTextarea = document.getElementById( 'description' );
if ( ! originTextarea ) {
return;
}
const rows = [];
pllDescriptionData.forEach( ( data ) => {
const wrapper = document.createElement( 'div' );
wrapper.setAttribute( 'lang', data.lang );
const label = document.createElement( 'label' );
label.setAttribute( 'for', `description_${ data.slug }` );
label.setAttribute( 'dir', data.direction );
if ( data.flag.src ) {
const img = document.createElement( 'img' );
img.setAttribute( 'alt', '' );
img.setAttribute( 'src', data.flag.src );
if ( data.flag.width ) {
img.setAttribute( 'width', data.flag.width );
}
if ( data.flag.height ) {
img.setAttribute( 'height', data.flag.height );
}
label.textContent = ` ${ data.name }`;
label.prepend( img ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.prepend
} else {
label.textContent = data.name;
}
const textarea = originTextarea.cloneNode( true );
textarea.setAttribute( 'id', `description_${ data.slug }` );
textarea.setAttribute( 'name', `description_${ data.slug }` );
textarea.setAttribute( 'dir', data.direction );
textarea.innerHTML = data.description; // phpcs:ignore WordPressVIPMinimum.JS.InnerHTML.Found
wrapper.append( label, document.createElement( 'br' ), textarea ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.append
rows.push( wrapper );
} );
originTextarea.replaceWith( ...rows ); // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.replaceWith
},
};
pllDescription.init();