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 spezifische Protokoll-Seiten
$(document).ready(function() {
    var pageName = mw.config.get('wgPageName');
    
    // Liste der Protokolle mit Real Examples
    var protocolsWithExamples = [
        'In_vitro_Tyrosine_Kinase_Activity_Assay',
        'Gentamicin_Protection_Assay', 
        'LIC_Cloning_(Ligation_independent_cloning)',
        'Immunoprecipitation',
        'Protein_expression_and_purification',
        'Production_of_lentiviral_particles',
        'Bacterial_growth_curve'
    ];
    
    // Prüfen ob aktuelle Seite ein Protokoll mit Real Example ist
    if (protocolsWithExamples.includes(pageName)) {
        // Real Example Seite = Protokollname + "_Real_Example"
        var realExamplePage = pageName + '_Real_Example';
        var realExampleTab = $('<li id="ca-realexample"><a href="/wiki/' + realExamplePage + '" title="Real Lab Notebook Example">Real Example</a></li>');
        
        $('#p-views ul').append(realExampleTab);
    }
});