Guest User

Untitled

a guest
Feb 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. (function() {
  2. var initialized = false;
  3.  
  4. function BuckleDown(msg) {
  5. var d = JSON.parse(msg);
  6. var uid = null;
  7. if ((
  8. d.command === "registered" ||
  9. d.command === "rem_dj" ||
  10. d.command === "add_dj"
  11. ) &&
  12. d.user[0].avatarid !== 37)
  13. {
  14. uid = d.user[0].userid;
  15. } else if (
  16. d.command === "update_user" &&
  17. d.userid !== turntable.user.id &&
  18. d.avatarid !== 37)
  19. {
  20. uid = d.userid;
  21. }
  22.  
  23. if (uid !== null) GingerUp(uid);
  24. if (initialized) Profit();
  25. }
  26.  
  27. function GingerUp(uid) {
  28. turntable.socket.emit('message', [JSON.stringify({
  29. command: "update_user",
  30. userid: uid,
  31. avatarid: 37
  32. })]);
  33. }
  34.  
  35. function Profit() {
  36. $("img[src$='headback.png']").each(function() {
  37. this.src = this.src.replace('headback.png', 'headfront.png');
  38. });
  39. }
  40.  
  41. $('.ttpUser').each(function() {
  42. var uid = (this.id + '').substring(4);
  43. if (uid !== turntable.user.id) GingerUp(uid);
  44. });
  45. turntable.socket.on('message',BuckleDown);
  46.  
  47. Profit();
  48.  
  49. initialized = true;
  50. })();
Add Comment
Please, Sign In to add comment