MediaWiki:Common.js: Difference between revisions

m
no edit summary
m (This part is old for collapsible & collapsed. It is in the built-in mw code. Use mw-collapsible & mw-collapsed instead.)
mNo edit summary
Line 5: Line 5:
     };
     };
})();
})();
/*
addOnloadHook(function(){
    $('div.tabdiv > ul > li').click(function(){
        $(this).parent().parent().children('div').hide();
        $((this).children('a:first').attr('href')).show();
        $(this).parent().children('li').removeClass('active').addClass('inactive');
        $(this).removeClass('inactive').addClass('active');
    });
    $('div.tabdiv > ul > li > a:first').each(function(){
        $(this).attr('href', '');
    });
});
*/
addOnloadHook(function($) {
    return function() {
        $('.tabdiv > div').hide();
        $('.tabdiv').each(function() {
            $(this).find('> ul li').addClass('inactive');
            $(this).find('> ul li:first').removeClass('inactive');
            $(this).find('> ul li:first').addClass('active');
            $(this).find('> div:first').show();
        });
        $('.tabdiv > ul li').each(function() {
            var a = $(this).find('a:first');
            var target = a.attr('href');
            $(a).attr('href', ''); // Opera hates real hrefs
            $(this).click(function() {
                $(this).parent().find('> li').removeClass('active');
                $(this).parent().find('> li').addClass('inactive');
                $(this).addClass('active');
                $(this).removeClass('inactive');
                $(this).parent().parent().find('> div').hide();
                $(target).show();
                return false;
            });
        });
    }
}(jQuery));


/* JavaScript for rounding borders
/* JavaScript for rounding borders