User:Rhadamante/monobook.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:Rhadamante/monobook.css. |
importScript('User:AzaToth/twinkle.js');
/* Boutons de la boîte d'édition */
/* Fonctions d'ajout */
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
mwCustomEditButtons[mwCustomEditButtons.length] =
{"imageId": imageId,
"imageFile": imageFile,
"speedTip": speedTip,
"tagOpen": tagOpen,
"tagClose": tagClose,
"sampleText": sampleText};
}
/***********************************************/
/* édition classique */
/***********************************************/
addCustomButton('',
'- Nowcommons ',
'{{Nowcommons}}',
'',
'',
'mw-editbutton-nowcommons');
/**
* Direct imagelinks to Commons
*
* @source: http://www.mediawiki.org/wiki/Snippets/Direct_imagelinks_to_Commons
* @author: [[commons:User:Krinkle]]
* @rev: 5
*/
if ( mw.config.get( 'wgNamespaceNumber', 0 ) >= 0 ) {
$(document).ready( function() {
// Must be relative without "https://secure.wikimedia.org."
// to avoid triggering 'div#content a[href ^="https://"]' lock-icons
var commonsBase = mw.config.get( 'wgServer' ) === "https://secure.wikimedia.org"
? '/wikipedia/commons/wiki/File:'
: '//commons.wikimedia.org/wiki/File:',
localBase = mw.util.getUrl( mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' ),
uploadBaseRe = new RegExp( '^' + $.escapeRE( '/media/wikipedia/commons/' ) );
$( 'a.image, a.mw-file-description' ).attr( 'href', function( i, currVal ) {
if ( uploadBaseRe.test( $(this).find( 'img' ).attr( 'src' ) ) ) {
return currVal.replace( localBase, commonsBase );
}
});
});
}