MediaWiki:Common.js

From Hauck LabWiki
Jump to navigation Jump to search

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.
/* Any JavaScript here will be loaded for all users on every page load. */

// Real Example Tab für Protokoll-Seiten
$(document).ready(function() {
    var pageName = mw.config.get('wgPageName');
    
    // Real Example Tab nur auf Protokoll-Seiten hinzufügen
    // Anpassen Sie die Bedingung nach Ihren Protokoll-Seitennamen
    if (pageName.includes('Protocol') || 
        pageName.includes('Method') || 
        pageName.startsWith('PCR_') ||
        pageName.startsWith('Western_') ||
        // Fügen Sie hier weitere Pattern Ihrer Protokolle hinzu
        pageName === 'DNA_Extraction' ||
        pageName === 'LIC_Cloning') {
        
        // Real Example Seite = Protokollname + "_Real_Example"
        var realExamplePage = pageName + '_Real_Example';
        var realExampleTab = $('<li id="ca-realexample"><a href="/wiki/' + realExamplePage + '" title="Real Example from Lab Notebook">Real Example</a></li>');
        
        $('#p-views ul').append(realExampleTab);
    }
});