User:Ugog Nizdast/displayNumberOfTags.js
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 = ''+$(".Inline-Template").length+" inline,"+'';
var major = ''+$(".ambox").length+" major"+'';
$( 'body' ).append( 'Cleanup tags: '+inline+' '+major+''); //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!