MediaWiki:Lakeus.js
From Illustrations in German Translations of Mark Twain's Works
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('jquery', function() {
$(document).ready(function() {
if (mw.config.get('wgUserName')) { // Nur für eingeloggte Nutzer
var pageName = mw.config.get('wgPageName');
// Klassischer Editor-Button
var editButton = $('<a>', {
href: mw.util.getUrl(pageName, { action: 'edit' }),
text: 'Edit (Classic)',
id: 'custom-edit-button-classic',
css: {
position: 'fixed',
top: '10px',
right: '10px',
padding: '8px 12px',
backgroundColor: '#005ea2',
color: '#fff',
borderRadius: '4px',
textDecoration: 'none',
zIndex: 9999,
fontWeight: 'bold',
boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
display: 'block',
marginBottom: '5px'
}
});
// Visual Editor-Button
var veEditButton = $('<a>', {
href: mw.util.getUrl(pageName, { veaction: 'edit' }),
text: 'Edit (Visual Editor)',
id: 'custom-edit-button-ve',
css: {
position: 'fixed',
top: '50px',
right: '10px',
padding: '8px 12px',
backgroundColor: '#2a7f62',
color: '#fff',
borderRadius: '4px',
textDecoration: 'none',
zIndex: 9999,
fontWeight: 'bold',
boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
display: 'block'
}
});
// Buttons zum Body hinzufügen
$('body').append(editButton, veEditButton);
}
});
});