Skip to content

Instantly share code, notes, and snippets.

@iesta
Created November 21, 2014 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iesta/653fa8d9559ce4067a45 to your computer and use it in GitHub Desktop.
Save iesta/653fa8d9559ce4067a45 to your computer and use it in GitHub Desktop.
Javascript to embed before </body> in Pournosanimaux's homepage
<style>
ul.luckywinners {
list-style-type: none;
padding-left:0px;
margin-top: 27px;
}
ul.luckywinners li {
border: #dddddd 1px solid;
padding: 7px;
font-size: 120%;
margin-bottom: 0px;
margin-top: -27px;
padding-left:0px;
text-align:center;
color: white;
background-color : #517F02;
}
ul.luckywinners li:hover {
background-color : #8FC13E;
}
.luckyname {
font-weight: bold
}
.luckyvalue {
font-weight: bold
}
</style>
<script>
console.log("loading luckycycle board...");
$.getJSON("https://www.luckycycle.com/operations/221f0b972b4ab7bcebc556ae777f8612/board.json?n=6", function (data) {
moment.locale("fr");
var items = [];
$.each(data, function (key, val) {
if (val.firstname) {
//items.push('<li><span class="luckyname">' + val.firstname + " " + val.lastname.charAt(0) + '</span> a gagné <span class="luckyvalue"> ' + val.value + "€" + '</span> <span class="luckydate">' + moment(val.date,"DD/MM/YY hh:mm:ss").fromNow() + '</span></li>');
items.push('<li><span class="luckyname">' + val.firstname + " " + val.lastname.charAt(0) + '</span> a gagné <span class="luckyvalue"> ' + val.value + "€" + '</span></li>');
}
});
$("<ul/>", {
"class": "luckywinners",
html: items.join("")
}).appendTo(".htmlcontent-item-6");
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment