User:Ovinus/WeightedRandom.js

$('#n-randompage').after('Weighted random article') $("#n-weightedrandom-link").click(function (evt) {	evt.preventDefault	fetch("https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=User:Ovinus/WeightedRandom/data.js&rvslots=main")		.then(d => d.json)		.then(json => { var articles = json.query.pages["66296727"].revisions[0].slots.main['*'].split('\n') document.location.href = "https://en.wikipedia.org/wiki/" + articles[Math.round(Math.random * articles.length)] })	return false })