User:Planemad/hacks/interwiki.js

// API request to retreive all the langlinks of the current page var pageLanglinks={ format:'json', page:'Chennai', prop:'langlinks', };

// Update opacity of langlinks based on the size of linked page var updateLanglinks = function (data) { //console.log(data.parse.langlinks[2]['*']); //Iterate over langlinks for(var i = 0; i < data.parse.langlinks.length; i++ ){ //Construct a request url var url= 'http://' + data.parse.langlinks[i].lang + '.wikipedia.org/w/api.php?action=query&prop=revisions&format=json&rvprop=size&rvlimit=1&titles=' + data.parse.langlinks[i]['*'] ; //Update the langlink opacity var updateLanglink = function (data) { console.log(data); }           console.log(url); $.get(url,updateLanglink); } };

$.get('/w/api.php?action=parse',pageLanglinks,updateLanglinks);