User talk:Pcj/Templates sorted by age

templates = []; function comp(a,b) { if (a.timestamp < b.timestamp) return -1; if (a.timestamp > b.timestamp) return 1; return 0; } function tmpl(c) { url = "https://wow.gamepedia.com/api.php?action=query&generator=allpages&prop=revisions&gapnamespace=10&gapfilterredir=nonredirects&gaplimit=500&format=json&gapcontinue="+c+"&callback=?" $.getJSON(url, function(data) {		for (page in data.query.pages) {			if (data.query.pages[page].revisions == undefined) continue;			templates.push({"title":data.query.pages[page].title,"timestamp":data.query.pages[page].revisions[0].timestamp});		}		if (data.continue != undefined) tmpl(data.continue.gapcontinue);		else {			templates.sort(comp);			s = "";			for (template in templates) s+= "*"+templates[template].title+"\n";			$("#wpTextbox1").html(s);			console.log("Done");		}	}); } tmpl("");