Langbahn Team – Weltmeisterschaft

User:Ugog Nizdast/displayNumberOfTags.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* [[Category:Wikipedia scripts]]
Originally inspired from User:Numbermaniac/goToTop.js
*/

if (typeof rightDefault === 'undefined') var rightDefault;

function scrollOver (target,x) {
    lengt = target.length;
    if ( x >= lengt ) x = 0;
    $( 'html, body' ).animate( { scrollTop: $(target[x]).offset().top-40 }, 'slow' );
    x++;
    return x;
}
$(function() {
    importStylesheet('User:Ugog Nizdast/displayNumberOfTags.css');
    var pgn = (mw.config.get( 'wgPageName')), isa = (mw.config.get( 'wgIsArticle')), cnp = (mw.config.get( 'wgCanonicalNamespace' )),
    act = (mw.config.get( 'wgAction'));
    if ( (pgn != "Main_Page") && (cnp === "") && ((act == "view") || (act == "edit") || (act == "purge") || (act == "submit")) )  { //check if page content is loaded
        var inline = '<span id="inline">'+$(".Inline-Template").length+" inline,"+'</span>';
        var major = '<span id="major">'+$(".ambox").length+" major"+'</span>';
        $( 'body' ).append( '<span id="msg">Cleanup tags: '+inline+' '+major+'<span>'); //append inline and major to bottom
        if (rightDefault) $("#msg").css('right', "0"); //config variables
        var i = 0, j = 0;
        $('#inline').click( function() {
          i = scrollOver($(".Inline-Template"),i); //as its clicked, scroll over each tag
        } );
        $('#major').click( function() {
          j = scrollOver($(".ambox"),j);
        } );
    }
});


//hooray my first script!