User:Kidminist/global.js

document.getElementsByClassName('wds-avatar')[0].parentNode.addEventListener('click', function {   location.href = '/wiki/User:Kidminist'; }, false);

let bottomNav = document.getElementsByClassName('notifications')[0];

let talkNav = document.createElement("div"); talkNav.class = "global-navigation__link"; talkNav.innerHTML = 'User Talk '; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(talkNav, bottomNav.nextSibling);

let contribsNav = document.createElement("div"); contribsNav.class = "global-navigation__link"; contribsNav.innerHTML = 'Contribs '; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(contribsNav, bottomNav.nextSibling);

let prefsNav = document.createElement("div"); prefsNav.class = "global-navigation__link"; prefsNav.innerHTML = 'Prefs '; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(prefsNav, bottomNav.nextSibling);

let purgeNav = document.createElement("div"); purgeNav.class = "global-navigation__link"; purgeNav.innerHTML = 'Purge '; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(purgeNav, bottomNav.nextSibling);

let pageInfoNav = document.createElement("div"); pageInfoNav.class = "global-navigation__link"; pageInfoNav.innerHTML = 'Page Info '; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(pageInfoNav, bottomNav.nextSibling);

let wlhNav = document.createElement("div"); wlhNav.class = "global-navigation__link"; wlhNav.innerHTML = '<span class="global-navigation__label">WLH </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(wlhNav, bottomNav.nextSibling);

let randomNav = document.createElement("div"); randomNav.class = "global-navigation__link"; randomNav.innerHTML = '<span class="global-navigation__label">Recent </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(randomNav, bottomNav.nextSibling);

let recentNav = document.createElement("div"); recentNav.class = "global-navigation__link"; recentNav.innerHTML = '<span class="global-navigation__label">Random </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(recentNav, bottomNav.nextSibling);

let pageTalkNav = document.createElement("div"); pageTalkNav.class = "global-navigation__link"; pageTalkNav.innerHTML = '<span class="global-navigation__label">Page talk </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(pageTalkNav, bottomNav.nextSibling);

let historyNav = document.createElement("div"); historyNav.class = "global-navigation__link"; historyNav.innerHTML = '<span class="global-navigation__label">History </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(historyNav, bottomNav.nextSibling);

let editNav = document.createElement("div"); editNav.class = "global-navigation__link"; editNav.innerHTML = '<span class="global-navigation__label">Edit </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(editNav, bottomNav.nextSibling);

let searchNav = document.createElement("div"); searchNav.class = "global-navigation__link"; searchNav.innerHTML = '<span class="global-navigation__label">Search </a>'; document.getElementsByClassName('global-navigation__bottom')[0].insertBefore(searchNav, bottomNav.nextSibling);

//Namespaces: api.php?action=query&meta=siteinfo&siprop=namespaces function randomAllPages(e) { e.preventDefault; var finalPage = ''; var params = { action: 'query', format: 'json', list: 'random', rnlimit: '10', rnnamespace: "-2|-1|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|110|111|420|421|502|503|710|711|828|829|1201|1202|2000|2001|2002", };	api = new mw.Api;

api.get(params).done(function(data) {		var randoms = data.query.random, r;		var randomTitles = '';		for(i = 0; i < randoms.length; i++) {			randomTitles += randoms[i].title + '|';		}		randomTitles = randomTitles.substring(0, randomTitles.length - 1);		var paramsInfo = {			format: 'json',			titles: randomTitles,			prop: 'info',		};		api.get(paramsInfo).done(function(dataset) { var keys = Object.keys(dataset.query.pages); for(var i = 0; i < keys.length; i++) { if(dataset.query.pages[keys[i]].length > 26){ // comparison # is total bytes in from source location.href = window.location.href.slice(0, window.location.href.search("/wiki/") + 6) + dataset.query.pages[keys[i]].title }			}		});	}); }