MediaWiki:Group-bureaucrat.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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
var menuCategories = ['#p-Event_Pok\\.C3\\.A9mon', '#p-Pages', '#p-Pok\\.C3\\.A9mon', '#p-Events', '#p-Help']; $(function shuffle(a) { var j; var i; var x; for (i = a.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); x = a[i]; a[i] = a[j]; a[j] = x; } return a; }); (function ( $) { if(typeof localStorage.menuBar !== "undefined") { var menuBaris = JSON.parse(localStorage.menuBar); menuCategories.forEach(function(elemento, indice, array) { console.log(elemento, indice); shuffle(menuBaris[indice]); //console.log(menuBaris[indice]); for(var i = 1; i < 4; i++) { var thisli = $( elemento+ " .body ul li a" ).eq(i); thisli.text(menuBaris[indice][(i-1)]['title']); thisli.attr("href", menuBaris[indice][(i-1)]['title']); } }) } else { var catNames = ["Event%20Pok%C3%A9mon", "Page", "Pok%C3%A9mon", "Events", "Help"]; var menuBaris = []; catNames.forEach(function(e, i, a) { jQuery.getJSON('https://wiki.pokeheroes.com/api.php?action=query&list=categorymembers&cmtitle=Category:'+e+'&cmdir=desc&cmsort=timestamp&format=json&cmlimit=12', function(data) { console.log(menuBaris); menuBaris[i] = data['query']['categorymembers']; shuffle(menuBaris[i]); for(var ix = 1; ix < 4; ix++) { var thisli = $( menuCategories[i]+ " .body ul li a" ).eq(ix); thisli.text(menuBaris[i][(ix-1)]['title']); thisli.attr("href", menuBaris[i][(ix-1)]['title']); } console.log(menuBaris); console.log(data); localStorage.setItem("menuBar", JSON.stringify(menuBaris)); }); }); } });