Last active
December 20, 2016 17:10
-
-
Save gmanley/4657954 to your computer and use it in GitHub Desktop.
Random avatar in plug.dj every 5 seconds.
This file contains hidden or 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
(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