Diferencia entre revisiones de «MediaWiki:Common.js»
Ir a la navegación
Ir a la búsqueda
Sin resumen de edición |
Move language switcher to server hook |
||
| (No se muestran 4 ediciones intermedias de 2 usuarios) | |||
| Línea 1: | Línea 1: | ||
$ | $( function () { | ||
$( '.copiar-portapapeles' ).on( 'click', function () { | |||
var textoACopiar = $( this ).data( 'texto-a-copiar' ); | |||
var $temp = $( '<textarea>' ); | |||
$( 'body' ).append( $temp ); | |||
$temp.val( textoACopiar ).select(); | |||
try { | |||
document.execCommand( 'copy' ); | |||
mw.notify( '¡Texto copiado al portapapeles!', { type: 'success' } ); | |||
} catch ( e ) { | |||
mw.notify( 'Error al copiar el texto.', { type: 'error' } ); | |||
} | |||
$temp.remove(); | |||
} ); | |||
} ); | |||
}); | |||
Revisión actual - 15:33 19 may 2026
$( function () {
$( '.copiar-portapapeles' ).on( 'click', function () {
var textoACopiar = $( this ).data( 'texto-a-copiar' );
var $temp = $( '<textarea>' );
$( 'body' ).append( $temp );
$temp.val( textoACopiar ).select();
try {
document.execCommand( 'copy' );
mw.notify( '¡Texto copiado al portapapeles!', { type: 'success' } );
} catch ( e ) {
mw.notify( 'Error al copiar el texto.', { type: 'error' } );
}
$temp.remove();
} );
} );