Created
November 19, 2014 17:10
-
-
Save iesta/6a752a5f471a01689b39 to your computer and use it in GitHub Desktop.
Winner board pournosanimaux.fr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment-with-locales.min.js"></script> | |
<h3>Last winners</h3> | |
<p> | |
<div id="luckyleaderboard"></div> | |
<script> | |
$.getJSON("https://www.luckycycle.com/operations/221f0b972b4ab7bcebc556ae777f8612/board.json?n=10", function (data) { | |
var items = []; | |
$.each(data, function (key, val) { | |
if (val.firstname) { | |
items.push('<li><span class="luckyname">' + val.firstname + " " + val.lastname.charAt(0) + '</span> has won <span class="luckyvalue"> ' + val.value + "€" + '</span> <span class="luckydate">' + moment(val.date).fromNow() + '</span></li>'); | |
} | |
}); | |
$("<ul/>", { | |
"class": "luckywinners", | |
html: items.join("") | |
}).appendTo("#luckyleaderboard"); | |
}); | |
</script> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment