Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
async function get_pages(titles,rvprop,startid,rvdir) { // this does something or other to get the pages and shtuss; idk, i don't question it, it works
	var url = "https://en.wikipedia.org/w/api.php";
    titles = titles.replaceAll("&","%26").replaceAll("+","%2B");
	let pages;
	var params = {
		action: "query",
		prop: "revisions",
		titles: titles,
		rvprop: rvprop,
		rvslots: "main",
		rvdir: rvdir,
		formatversion: "2",
		format: "json",
        rvlimit: 200
	};
	if (startid !== null){
		params.rvstartid = startid;
	}
	url = url + "?origin=*";
	Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

	let a = fetch(url)
		.then(function(response){return response.json();})
		.then(function(response) {
			pages = response.query.pages;
			
		})
		.catch(function(error){console.log(error);});
	await a;
	return pages;
}

async function get_section(title,section) { // this does something or other to get the pages and shtuss; idk, i don't question it, it works
	var url = "https://en.wikipedia.org/w/api.php";
    title = title.replaceAll("&","%26").replaceAll("+","%2B");
	let pages;
	var params = {
		action: "parse",
		prop: "wikitext",
		page: title,
		section: section,
		formatversion: "2",
		format: "json"
	};
	url = url + "?origin=*";
	Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

	let a = fetch(url)
		.then(function(response){return response.json();})
		.then(function(response) {
			pages = response.parse;
			
		})
		.catch(function(error){console.log(error,url);});
	await a;
	return pages;
}