Utilisateur:0x010C/deln.js
Apparence
Note : après avoir enregistré vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : Maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ou Ctrl-R (⌘-R sur un Mac) ;
- Google Chrome : Appuyez sur Ctrl-Maj-R (⌘-Shift-R sur un Mac) ;
- Internet Explorer : Maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ;
- Opera : Allez dans Menu → Settings (Opera → Préférences sur un Mac) et ensuite à Confidentialité & sécurité → Effacer les données d'exploration → Images et fichiers en cache.
/*
Retire les sauts de lignes parasites et autres machins générés par l'OCR
Version proprisé de [[User:Thibaut120094/deln.js]]
*/
// Only launch the script when editing non-talk pages
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1
&& mw.config.get( 'wgNamespaceNumber' ) % 2 !== 1
&& $.inArray( mw.config.get( 'wgNamespaceNumber' ), [ 4, 8 ] ) === -1 )
{
$( function() {
mw.loader.using( [ 'ext.wikiEditor' ], function() {
// Remove all useless lines
// Called when the user click the button added bellow
var lineRemover = function() {
var str = $( '#wpTextbox1' ).val();
str = str.replace(/\n/g, "");
str = str.replace(/- /g, "");
str = str.replace(/¬/g, "");
$( '#wpTextbox1' ).val( str.trim() );
};
// Ensure that all has benn loaded (and so the toolbar) before adding the button
$( function() {
// Add a button to the WikiEditor toolbar , in the main section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'wsDeln': {
label: 'Retrait des sauts de ligne parasites',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Toolbaricon_regular_n.png',
action: {
type: 'callback',
execute: lineRemover
}
}
}
} );
} );
} );
} );
}