« MediaWiki:Gadget-Edittools.js » : différence entre les versions

m
Test
Kharmitch (discussion | contributions)
Page créée avec « /** * EditTools support: add a selector, change <a> into buttons. * The special characters to insert are defined at MediaWiki:Edittools. * * @author Arnomane, 2006... »
 
Kharmitch (discussion | contributions)
m Test
 
Ligne 117 : Ligne 117 :
$links = $section.find('a');
$links = $section.find('a');
$links.each(function (i, a) {
$links.each(function (i, a) {
var $a, button;
var $a, $button, start, end;
$a = $(a);
$a = $(a);
button = document.createElement('input');
$button = $( '<input>' ).attr( 'type', 'button' );
button.type = 'button';
start = $a.data( 'mw-charinsert-start' );
button.onclick = a.onclick;
end = $a.data( 'mw-charinsert-end' );
button.value = $a.text();
if ( start !== undefined && end !== undefined ) {
$a.replaceWith(button);
$button.click( function( e ) {
e.preventDefault();
$('#wpTextbox1').textSelection('encapsulateSelection', {pre: start, post: end});
} );
} else {
$button[0].onclick = a.onclick;
                                }
$button[0].value = $a.text();
$a.replaceWith($button);
});
});
}
}
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications