MediaWiki

Lakeus.js: Difference between revisions

From Illustrations in German Translations of Mark Twain's Works

No edit summary
No edit summary
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Lakeus skin */
mw.loader.using('jquery', function() {
mw.loader.using('jquery', function() {
   $(document).ready(function() {
   $(document).ready(function() {
     if (mw.config.get('wgUserName')) { // Nur für eingeloggte Nutzer
     if (mw.config.get('wgUserName')) { // Nur für eingeloggte Nutzer
        var pageName = mw.config.get('wgPageName');
      var pageName = mw.config.get('wgPageName');


        // Klassischer Editor-Button
      // Klassischer Editor-Button
        var editButton = $('<a>', {
      var editButton = $('<a>', {
            href: mw.util.getUrl(pageName, { action: 'edit' }),
        href: mw.util.getUrl(pageName, { action: 'edit' }),
            text: 'Edit (Classic)',
        text: 'Edit (Classic)',
            id: 'custom-edit-button-classic',
        id: 'custom-edit-button-classic',
            css: {
        css: {
                position: 'fixed',
          position: 'fixed',
                top: '10px',
          top: '10px',
                right: '10px',
          right: '10px',
                padding: '8px 12px',
          padding: '8px 12px',
                backgroundColor: '#005ea2',
          backgroundColor: '#005ea2',
                color: '#fff',
          color: '#fff',
                borderRadius: '4px',
          borderRadius: '4px',
                textDecoration: 'none',
          textDecoration: 'none',
                zIndex: 9999,
          zIndex: 9999,
                fontWeight: 'bold',
          fontWeight: 'bold',
                boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
          boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
                display: 'block',
          display: 'block',
                marginBottom: '5px',
          marginBottom: '5px'
            }
        }
        });
      });


        // Visual Editor-Button
      // Visual Editor-Button
        var veEditButton = $('<a>', {
      var veEditButton = $('<a>', {
            href: mw.util.getUrl(pageName, { veaction: 'edit' }),
        href: mw.util.getUrl(pageName, { veaction: 'edit' }),
            text: 'Edit (Visual Editor)',
        text: 'Edit (Visual Editor)',
            id: 'custom-edit-button-ve',
        id: 'custom-edit-button-ve',
            css: {
        css: {
                position: 'fixed',
          position: 'fixed',
                top: '50px',
          top: '50px',
                right: '10px',
          right: '10px',
                padding: '8px 12px',
          padding: '8px 12px',
                backgroundColor: '#2a7f62',
          backgroundColor: '#2a7f62',
                color: '#fff',
          color: '#fff',
                borderRadius: '4px',
          borderRadius: '4px',
                textDecoration: 'none',
          textDecoration: 'none',
                zIndex: 9999,
          zIndex: 9999,
                fontWeight: 'bold',
          fontWeight: 'bold',
                boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
          boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
                display: 'block',
          display: 'block'
            }
        }
        });
      });


        // Buttons zum Body hinzufügen
      // Buttons zum Body hinzufügen
        $('body').append(editButton, veEditButton);
      $('body').append(editButton, veEditButton);
     }
     }
});
  });
});
});

Latest revision as of 13:03, 15 July 2025

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