Skip to content

Instantly share code, notes, and snippets.

@jgonera
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save jgonera/8925699 to your computer and use it in GitHub Desktop.

Select an option

Save jgonera/8925699 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<h1>EDIT WARZ!!!11!1</h1>
<ul></ul>
<script>
$.ajax({
dataType: 'jsonp',
url: 'https://en.wikipedia.org/w/api.php',
data: {
format: 'json',
action: 'query',
list: 'users',
ususers: 'Moizsyed|Steven_Walling',
usprop: 'editcount'
}
}).done(function(data) {
var users = data.query.users, $ul = $('ul');
users.sort(function(a, b) {
return a.editcount < b.editcount;
});
$ul.append('<li>WINNER: ' + users[0].name + ' (' + users[0].editcount + ')</li>');
$ul.append('<li>LOSER: ' + users[1].name + ' (' + users[1].editcount + ')</li>');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment