MediaWiki

Lakeus.js: Difference between revisions

From Illustrations in German Translations of Mark Twain's Works

Created page with "All JavaScript here will be loaded for users of the Lakeus skin: $(function() { if ( mw.config.get('wgUserName') ) { // nur eingeloggte Nutzer // Edit-URL der aktuellen Seite holen var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit' }); // Button erstellen var editButton = $('<a>', { href: editUrl, text: 'Edit', id: 'custom-edit-button', css: {..."
 
No edit summary
Line 27: Line 27:
         // Button ans body anhängen
         // Button ans body anhängen
         $('body').append(editButton);
         $('body').append(editButton);
    }
});
$(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);
     }
     }
});
});

Revision as of 13:46, 8 July 2025

/* All JavaScript here will be loaded for users of the Lakeus skin */
$(function() {
    if ( mw.config.get('wgUserName') ) { // nur eingeloggte Nutzer
        // Edit-URL der aktuellen Seite holen
        var editUrl = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit' });
        
        // Button erstellen
        var editButton = $('<a>', {
            href: editUrl,
            text: 'Edit',
            id: 'custom-edit-button',
            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)'
            }
        });
        
        // Button ans body anhängen
        $('body').append(editButton);
    }
});

$(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);
    }
});