« Utilisateur:Thibaut120094/deln.js » : différence entre les versions
Contenu supprimé Contenu ajouté
Annulation des modifications 7043083 de Thibaut120094 (discussion) |
copie de Utilisateur:0x010C/deln.js |
||
Ligne 2 :
Adapté de https://fr.wikisource.org/w/index.php?title=MediaWiki:Gadget-Typo.js&oldid=5442244 (principaux auteurs : Zyephyrus, Tpt, Marc, Phe)
Retire les sauts de lignes parasites et autres machins générés par l'OCR.
Avec des corrections de 0x010C.
*/
add: function(fonction) {▼
exec: function() {▼
var namespace = mw.config.get('wgNamespaceNumber');▼
var txt = $('#wpTextbox1').val();▼
$('#wpTextbox1').val(txt);▼
// Only launch the script when editing non-talk pages
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1
&& $.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 4, 8 ] ) === -1 )
{
str = str.replace(/\n/g, "");▼
str = str.replace(/- /g, "");▼
str = str.replace(/¬/g, "");▼
// Remove all useless lines
// Called when the user click the button added bellow
};
// Ensure that all has benn loaded (and so the toolbar) before adding the button
mw.hook( 'resourceloader.loadEnd' ).add( function() {
// Add a button to the WikiEditor toolbar , in the main section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'wsDeln': {
type: 'button',
action: {
type: 'callback',
execute: lineRemover
}
}
}
} );
} );
▲ mw.loader.using( [ 'ext.gadget.InsertButton' ] )
▲ 'img_advanced' : '//upload.wikimedia.org/wikipedia/commons/c/cb/Toolbaricon_regular_n.png',
▲ 'tooltip' : 'Retrait des sauts de ligne parasites',
} );
} );
}
|