MediaWiki:Common.js
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.
mw.loader.load( 'https://pro.fontawesome.com/releases/v5.1.0/css/all.css', 'text/css' );
$(document).ready(function(){
$('.gendergraph:first-child').addClass("show");
$('.ShowGender').click(function(){
$('.gendergraph').removeClass("show");
var genderindex = $(this).index() + 1;
$('.gendergraph:nth-child(' + genderindex + ')').addClass("show");
});
$('.agegraph:first-child').addClass("show");
$('.ShowAge').click(function(){
$('.agegraph').removeClass("show");
var ageindex = $(this).index() + 1;
$('.agegraph:nth-child(' + ageindex + ')').addClass("show");
});
$('.nationgraph:first-child').addClass("show");
$('.ShowNation').click(function(){
$('.nationgraph').removeClass("show");
var nationindex = $(this).index() + 1;
$('.nationgraph:nth-child(' + nationindex + ')').addClass("show");
});
$('.centergraph:first-child').addClass("show");
$('.ShowCenter').click(function(){
$('.centergraph').removeClass("show");
var centerindex = $(this).index() + 1;
$('.centergraph:nth-child(' + centerindex + ')').addClass("show");
});
$('.ShowAll').click(function(){
$(".gendergraph, .agegraph, .nationgraph, .centergraph").removeClass("show");
var yearindex = $(this).index() + 1;
$('.gendergraph:nth-child(' + yearindex + ')').addClass("show");
$('.agegraph:nth-child(' + yearindex + ')').addClass("show");
$('.nationgraph:nth-child(' + yearindex + ')').addClass("show");
$('.centergraph:nth-child(' + yearindex + ')').addClass("show");
});
});
// Loading jQuery seems to only work here ¯\_(ツ)_/¯
mw.loader.load( 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js' );