Advertisement
gustavonzr

ChatStats

May 5th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. API.on(API.CURATE_UPDATE, grabs);
  2. API.on(API.VOTE_UPDATE, chatu);
  3. API.on(API.USER_FAN, userfan);
  4. API.on(API.MOD_SKIP, modskip);
  5. API.on(API.DJ_ADVANCE, djadvancee);
  6. API.on(API.WAIT_LIST_UPDATE, autojj);
  7. API.on(API.DJ_ADVANCE, DJ_ADVANCE_LISTENER);
  8. API.off(API.CHAT, log);
  9.  
  10. var a = $('#chat-messages'), b = a.scrollTop() > a[0].scrollHeight - a.height() - 20;
  11.  
  12. function grabs(obj)
  13. {
  14. var song3 = API.getMedia().author + ' - ' + API.getMedia().title;
  15. $("#chat-messages").append("<div class='BlueViolet system'><i class='icon icon-curate'></i><span class='text'> " + obj.user.username + " adicionou o video: "+song3+". </span></div>");
  16. b && a.scrollTop(a[0].scrollHeight);
  17. }
  18.  
  19. function chatu(obj) {
  20. var song2 = API.getMedia().author + ' - ' + API.getMedia().title;
  21. var vote = obj.vote == 1 ? "woot" : "meh";
  22. if (vote == "meh"){
  23. $("#chat-messages").append("<div class='system'><i class='icon icon-meh'></i><span class='text'> " + obj.user.username + " votou Chato em: "+song2+" </span></div>");
  24. b && a.scrollTop(a[0].scrollHeight);
  25. }
  26. };
  27.  
  28. function userfan(user) {
  29. $("#chat-messages").append("<div class='LGreen system'><i class='icon icon-fan'></i><span class='text'> " + user.username + " virou seu fã! </span></div>");
  30. b && a.scrollTop(a[0].scrollHeight);
  31. };
  32.  
  33. function modskip(username) {
  34. $("#chat-messages").append("<div class='Orange system'><i class='icon icon-skip'></i><span class='text'> " + username + " pulou o DJ! </span></div>");
  35. b && a.scrollTop(a[0].scrollHeight);
  36. };
  37.  
  38. function log(data) {
  39. console.log(data);
  40. var a = data.message.toLowerCase();
  41. if (a.indexOf('!') > -1)
  42. {
  43. }
  44. else if (a.indexOf(' ') > -1)
  45. {
  46. }
  47. }
  48.  
  49.  
  50. function djadvancee(obj) {
  51. if (obj == null) return;
  52. var str = "";
  53. var currentDJ = obj.dj;
  54. str += currentDJ.username;
  55. var total = currentDJ.djPoints + currentDJ.listenerPoints + currentDJ.curatorPoints;
  56. str += " pontos: " + total;
  57. str += ", fãs: " + currentDJ.fans;
  58. str += " ||Tocando Agora: " + obj.media.author + " - " + obj.media.title;
  59. $("#chat-messages").append("<div class='Yellow system'><i class='icon icon-volume-half'></i><span class='text'> " +str+ " </span></div>");
  60. b && a.scrollTop(a[0].scrollHeight);
  61. };
  62.  
  63. Grab = {};
  64. Grab.check=function(e){
  65. if(e===null){
  66. API.chatLog("Autoadd: Não há DJ",true);
  67. Grab.djname=null
  68. }
  69. else if(API.getDJ().username!=API.getUser().username){
  70. Grab.grab();
  71. Grab.djname=API.getDJ().username
  72. }
  73. else{
  74. if(Grab.djname!=API.getUser().username){
  75. API.chatLog("Autoadd: Você é o DJ Agora",false);
  76. Grab.djname=API.getDJ().username
  77. }
  78. }
  79. };
  80.  
  81. Grab.grab=function(){
  82. $(".icon-curate").click();$($(".curate").children(".menu").children().children()[0]).mousedown()
  83. };
  84.  
  85.  
  86. function autojj(){
  87. var waitingCount = API.getWaitList().length;
  88. if (waitingCount<50){
  89. API.djJoin();
  90. }
  91. }
  92.  
  93. var wooting = true;
  94. wootSong();
  95. function DJ_ADVANCE_LISTENER(obj) {
  96. wootSong();
  97. }
  98.  
  99. function wootSong() {
  100. if(wooting) {
  101. $("#woot").click();
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement