From 70900a249b1d4078ac403f15c62851d52d0a86f8 Mon Sep 17 00:00:00 2001 From: jomo Date: Thu, 15 Oct 2015 01:46:14 +0200 Subject: [PATCH] shuffle avatars in website header --- lib/public/javascript/{mojang.js => crafatar.js} | 7 +++++++ lib/public/stylesheets/style.css | 2 +- lib/views/index.html.ejs | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) rename lib/public/javascript/{mojang.js => crafatar.js} (81%) diff --git a/lib/public/javascript/mojang.js b/lib/public/javascript/crafatar.js similarity index 81% rename from lib/public/javascript/mojang.js rename to lib/public/javascript/crafatar.js index e1aa4cf..bea9429 100644 --- a/lib/public/javascript/mojang.js +++ b/lib/public/javascript/crafatar.js @@ -31,6 +31,13 @@ xhr.onload = function() { }; document.addEventListener("DOMContentLoaded", function(event) { + var avatars = document.querySelector("#avatar-wrapper"); + for (var i = 0; i < avatars.children.length; i++) { + // shake 'em on down! + // https://stackoverflow.com/a/11972692/2517068 + avatars.appendChild(avatars.children[Math.random() * i | 0]); + } + xhr.open("GET", "https://status.mojang.com/check", true); xhr.send(); }); \ No newline at end of file diff --git a/lib/public/stylesheets/style.css b/lib/public/stylesheets/style.css index f9172e0..bb3200f 100644 --- a/lib/public/stylesheets/style.css +++ b/lib/public/stylesheets/style.css @@ -207,7 +207,7 @@ img.preload { margin: 5px; } -.avatar-wrapper { +#avatar-wrapper { height: 64px; overflow: hidden; } diff --git a/lib/views/index.html.ejs b/lib/views/index.html.ejs index 2cc9cf5..534570c 100644 --- a/lib/views/index.html.ejs +++ b/lib/views/index.html.ejs @@ -17,7 +17,7 @@ - + @@ -29,7 +29,7 @@

Crafatar

A blazing fast API for Minecraft faces!

-
+