Skip to content

Instantly share code, notes, and snippets.

@gmanley
Last active December 20, 2016 17:10
Show Gist options
  • Save gmanley/4657954 to your computer and use it in GitHub Desktop.
Save gmanley/4657954 to your computer and use it in GitHub Desktop.
Random avatar in plug.dj every 5 seconds.
(function randomAvatar() {
var userPoints = parseInt($('#user-points-value').text().replace(',', ''));
var avatars = [];
$.each(AvatarOverlay.avatarSets[0], function(i, value) {
if (value.required <= userPoints) {
avatars = avatars.concat(value.avatars);
};
});
var avatar = avatars[Math.floor(Math.random()*avatars.length)];
new UserChangeAvatarService(avatar);
setTimeout(randomAvatar, 5000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment