Advertisement
Guest User

fff.js

a guest
Sep 15th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (API.enabled && $("#radiantscript-css").length <= 0) {
  2.  
  3.     var radiantScript = {
  4.  
  5.         version     : "0.9.999 alpha",
  6.         autoWoot    : false,
  7.         cAutoWoot   : '',
  8.         autoJoin    : false,
  9.         cAutoJoin   : '',
  10.         fullScreen  : false,
  11.         cfullScreen : '',
  12.         mehShow     : false,
  13.         cmehShow    : '',
  14.  
  15.         setCookie: function (key, value) {          
  16.             var expires = new Date();
  17.             expires.setTime(expires.getTime() + (365 * 24 * 60 * 60 * 1000));
  18.             document.cookie = key + '=' + value + ';path=/;expires=' + expires.toUTCString();  
  19.         },
  20.  
  21.         getCookie: function (key) {
  22.             var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
  23.             return keyValue ? keyValue[2] : null;
  24.         },  
  25.  
  26.         toggleAutoWoot: function() {
  27.             this.autoWoot = !this.autoWoot;    
  28.             this.cAutoWoot = this.autoWoot ? 'checked' : '';
  29.  
  30.             if (this.autoWoot) {
  31.                 $('#woot').click();
  32.             }
  33.             if (!this.autoWoot) {
  34.             }
  35.             this.setCookie("COOKIE_AUTO_WOOT", this.autoWoot);
  36.         },
  37.  
  38.         toggleMehShow: function() {
  39.             this.mehShow = !this.mehShow;    
  40.             this.cmehShow = this.mehShow ? 'checked' : '';
  41.  
  42.             if (this.mehShow) {
  43.             }
  44.             if (!this.mehShow) {
  45.             }
  46.             this.setCookie("COOKIE_MEH_SHOW", this.mehShow);
  47.         },  
  48.  
  49.         toggleAutoJoin: function() {
  50.             this.autoJoin = !this.autoJoin;    
  51.             this.cAutoJoin = this.autoJoin ? 'checked' : '';
  52.             if (this.autoJoin) {
  53.                 API.djJoin();
  54.             }
  55.             if (!this.autoJoin) {
  56.             }
  57.             this.setCookie("COOKIE_AUTO_JOIN", this.autoJoin);
  58.         },
  59.  
  60.         toggleFullScreen: function(obj) {
  61.             this.fullScreen = !this.fullScreen;    
  62.             this.cfullScreen = this.fullScreen ? 'checked' : '';
  63.             if (this.fullScreen) {
  64.                 radiantScript.fullscreenTrigger();
  65.             }
  66.             if (!this.fullScreen) {
  67.                 radiantScript.fullscreenTrigger();
  68.             }
  69.         },
  70.  
  71.         addChatLog: function(message, cssClass) {
  72.             $('#chat-messages').append('<div class="update ' + cssClass + '">' + message + '</div>');
  73.             $('#chat-messages').scrollTop($('#chat-messages').prop("scrollHeight"));
  74.         },
  75.  
  76.         playChatSound: function() {
  77.             document.getElementById('chat-sound').playChatSound();
  78.         },
  79.  
  80.         playMentionSound: function() {
  81.             document.getElementById('chat-sound').playMentionSound();
  82.         },
  83.  
  84.         updateQueueStatus: function() {            
  85.             if(API.getWaitListPosition() == '0') {
  86.                 radiantScript.addChatLog('Get ready ' + this.userInfo.username + ', you\'re about to play!', 'aqua');
  87.                 $('#waitlist-button').addClass('blue-bg');    
  88.                 radiantScript.playChatSound();  
  89.                 radiantScript.playMentionSound();          
  90.             }
  91.             else {                      
  92.                 $('#waitlist-button').removeClass('blue-bg');                                  
  93.             }
  94.         },
  95.  
  96.         f_votelggr: function (obj){
  97.             if (radiantScript.mehShow) {
  98.                 if (obj.vote != 1){
  99.                     API.chatLog(obj.user.username + " meh'd this track", true);
  100.                 }
  101.             }
  102.         },
  103.  
  104.         djAdvanced: function(obj) {
  105.             if (radiantScript.autoWoot) { setTimeout(function() { $('#woot').click(); }, 2000); }
  106.             radiantScript.updateQueueStatus();
  107.             radiantScript.hyperSpace();
  108.         },
  109.  
  110.         queueUpdate: function(obj) {
  111.             if (radiantScript.autoJoin) {
  112.                     !radiantScript.isInQueue() && radiantScript.joinQueue();
  113.             }
  114.         },
  115.  
  116.         isInQueue: function(obj) {
  117.             if (radiantScript.autoJoin) {
  118.                     return -1 !== API.getWaitListPosition();
  119.             }
  120.         },
  121.  
  122.  
  123.         hyperSpace: function() {
  124.             var FIREFOX = /Firefox/i.test(navigator.userAgent);
  125.             if (FIREFOX) return;
  126.             $('#yt-frame').each(function(i){
  127.                 var ytSrc = this.src;
  128.                 if(ytSrc.indexOf('/_/balls') >= 0){
  129.                     $(this).attr('src', 'https://code.radiant.dj/hyperspace');
  130.                 }
  131.                     else if(ytSrc.indexOf('/_/abstract') >= 0){
  132.                     $(this).attr('src', 'https://code.radiant.dj/hyperspace_1');
  133.                 }
  134.             });
  135.         },
  136.  
  137.         joinQueue: function(obj) {
  138.             if (radiantScript.autoJoin) {
  139.                     "is-wait" === $("#dj-button").attr("class") ? $("#dj-button").click() : API.getWaitList().length < 50 && API.djJoin();
  140.             }
  141.         },
  142.  
  143.         join: function(obj) {
  144.             if (radiantScript.autoJoin) {
  145.                     radiantScript.joinQueue();
  146.             }
  147.         },
  148.  
  149.         fullscreenTrigger: function() {
  150.             if (radiantScript.fullScreen) {
  151.                 radiantScript.fullscreen();
  152.                 $('#vote').addClass('disabled1');
  153.                 $('#radiantscriptBottom').addClass('disabled1');
  154.                 $('#playback').addClass('fsenabled3');
  155.                 $('#playback-controls').addClass('fsenabled4');
  156.                 $('#playback .background').addClass('fsenabled5');
  157.                 $('#playback .background img').addClass('fsenabled6');
  158.                 $('#DisableFullScreen').removeClass('disabled1');
  159.                 $('#radiantscriptRight').addClass('disabled1');
  160.             }
  161.             if (!radiantScript.fullScreen) {
  162.                 $('#vote').removeClass('disabled1');
  163.                 $('#radiantscriptBottom').removeClass('disabled1');
  164.                 $('#playback').removeClass('fsenabled3');
  165.                 $('#playback-controls').removeClass('fsenabled4');
  166.                 $('#playback .background').removeClass('fsenabled5');
  167.                 $('#playback .background img').removeClass('fsenabled6');
  168.                 $('#DisableFullScreen').addClass('disabled1');
  169.                 $('#radiantscriptRight').removeClass('disabled1');
  170.                 $('#vote').removeClass('disabled1');
  171.                 $('#vote').removeClass('fsenabled');
  172.                 $(window).trigger('resize');
  173.             }
  174.         },
  175.  
  176.         fullscreen: function() {
  177.             if (radiantScript.fullScreen) {
  178.                 var a = document.getElementById("playback");
  179.                 var b = document.getElementById("playback-container").style.height = document.getElementById("app").style.height;
  180.                 var c = document.getElementById("playback-container").style.width = document.getElementById("app").style.width;
  181.                 var d = document.getElementById("no-dj");
  182.                 var g;
  183.  
  184.                 a.style.height = "", a.style.overflow = "visible";
  185.                 document.getElementById("playback-container").style.left = 0, a.style.left = 0;
  186.                 d && (d.style.height = b, d.style.width = c, d.style.left = 0);
  187.  
  188.                 window.onresize = function(event) {
  189.                     radiantScript.fullscreen();
  190.                 }
  191.                 window.dispatchEvent = function(event) {
  192.                     radiantScript.fullscreen();
  193.                 }
  194.                 window.onclick = function(event) {
  195.                     radiantScript.fullscreen();
  196.                 }
  197.  
  198.                 $('#app').on('mouseover', function() {
  199.                     if (radiantScript.fullScreen) { $('#fullscreenDisable').removeClass('disabled1');
  200.                     $('#vote').addClass('fsenabled');
  201.                     $('#vote').removeClass('disabled1'); };
  202.                 });
  203.                 $('#app').on('mouseout', function() {  
  204.                     if (radiantScript.fullScreen) { $('#fullscreenDisable').addClass('disabled1');
  205.                     $('#vote').removeClass('fsenabled');
  206.                     $('#vote').addClass('disabled1'); }
  207.                 });
  208.             }
  209.            
  210.         },
  211.  
  212.         init: function() {
  213.  
  214.             this.autoWoot    = this.getCookie('COOKIE_AUTO_WOOT') == 'true' ?  true : false;  
  215.             this.autoJoin    = this.getCookie('COOKIE_AUTO_JOIN') == 'true' ?  true : false;    
  216.             this.fullScreen  = this.getCookie('COOKIE_FULL_SCREEN') == 'true' ?  true : false;
  217.             this.mehShow     = this.getCookie('COOKIE_MEH_SHOW') == 'true' ?  true : false;          
  218.             this.cAutoWoot   = this.autoWoot   ? 'checked' : '';
  219.             this.cAutoJoin   = this.autoJoin   ? 'checked' : '';  
  220.             this.cfullScreen = this.fullScreen ? 'checked' : '';
  221.             this.cmehShow    = this.mehShow ? 'checked' : '';  
  222.             this.userInfo    = API.getUser();
  223.  
  224.             if(this.autoWoot) { $('#woot').click(); }      
  225.             this.updateQueueStatus();
  226.  
  227.             API.on(API.ADVANCE, this.djAdvanced);
  228.             API.on(API.WAIT_LIST_UPDATE, this.queueUpdate);
  229.             API.on(API.UPDATE, this.queueUpdate);
  230.             API.on(API.VOTE_UPDATE, this.f_votelggr);
  231.  
  232.             this.queueUpdate();
  233.             this.fullscreenTrigger();
  234.  
  235.             $('#now-playing-media').hover(function(){
  236.                 $('body').append('<div id="tooltip" style="top:0px;left:550px;"><span>' + API.getMedia().author + ' - ' + API.getMedia().title + '</span><div class="corner"></div></div>');
  237.                 },function(){
  238.                 $('#tooltip').remove();
  239.             });
  240.  
  241.             cleanASCII = function(a) {
  242.               var b = a.split("&#");
  243.                   for (var c = 1;c < b.length;c++) {
  244.                   var d = b[c].split(";")[0];
  245.                       a = a.replace("&#" + d + ";",String.fromCharCode(d));
  246.                   }
  247.                   a = a.split('&lt;').join('<').split('&gt;').join('>').split('&amp;').join('&').split('&quot;').join('"').replace(/<(?:.|\n)*?>/gm, '');
  248.                   return a;
  249.                 };
  250.             function f_chtlggr (data){
  251.                 var str = data.un;
  252.                 var ns = str.length;
  253.                 var msg = cleanASCII(data.message);
  254.                 var log = function () {
  255.                     return console.log.apply(
  256.                         console,
  257.                         ['['+new Date().toISOString().slice(11,-5)+']'].concat(
  258.                             Array.prototype.slice.call(arguments)
  259.                         )
  260.                     );
  261.                 };
  262.                 switch(data.type){
  263.                      case("message"):
  264.                             log("(" + data.cid + ") (" + data.uid + ")  " + Array(25 - ns).join(" ") + "" + data.un + " : " + msg );
  265.                             break;
  266.                      case("emote"):
  267.                             log("(" + data.cid + ") (" + data.uid + ") " + Array(25 - ns).join(" ") + "" + data.un + " : /me: " + msg );
  268.                             break;
  269.                      case("mention"):
  270.                          log("(" + data.cid + ") (" + data.uid + ") " + Array(25 - ns).join(" ") + "" + data.un + " : " + msg );
  271.                      break;
  272.                 }
  273.             }
  274.             API.on(API.CHAT, f_chtlggr);
  275.             // End of chat logger
  276.             API.on(API.CHAT_COMMAND, customCommands);
  277.             function customCommands(value) {
  278.                 if (value == '/users') {
  279.                     radiantScript.addChatLog("Right now there are " + API.getUsers().length + " users in the room.", "aqua");
  280.                 }
  281.             }
  282.         },
  283.  
  284.     }          
  285.  
  286.     console.log('Loaded Exécito da zoeira v' + radiantScript.version);      
  287.     radiantScript.addChatLog('Exécito da zoeira Script v' + radiantScript.version, 'aqua');
  288.     radiantScript.addChatLog(' Atualizado apenas editado e modificado por !Cret?n?)', 'orange');
  289.     API.chatLog('plugCubed não incluído!',true);  
  290.     radiantScript.init();  
  291.     var plugCubed;
  292.     var content1 = '<section id="radiantscript">\
  293.       <h3>Radiant Script</h3>\
  294.       <p class="version">bookmarklet for plug.dj</p>\
  295.       <div><p>Auto Woot?</p>\
  296.       <div class="onoffswitch">\
  297.           <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="checkbox-autowoot" ' + radiantScript.cAutoWoot + '>\
  298.           <label class="onoffswitch-label" for="checkbox-autowoot">\
  299.               <div class="onoffswitch-inner"></div>\
  300.               <div class="onoffswitch-switch"></div>\
  301.           </label>\
  302.       </div></div>\
  303.       <div><p>AutoJoin?</p>\
  304.       <div class="onoffswitch">\
  305.           <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="checkbox-autojoin" ' + radiantScript.cAutoJoin + '>\
  306.           <label class="onoffswitch-label" for="checkbox-autojoin">\
  307.               <div class="onoffswitch-inner"></div>\
  308.               <div class="onoffswitch-switch"></div>\
  309.           </label>\
  310.       </div></div>\
  311.       <div><p>Show Mehs?</p>\
  312.       <div class="onoffswitch">\
  313.           <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="checkbox-showmehs" ' + radiantScript.cmehShow + '>\
  314.           <label class="onoffswitch-label" for="checkbox-showmehs">\
  315.               <div class="onoffswitch-inner"></div>\
  316.               <div class="onoffswitch-switch"></div>\
  317.           </label>\
  318.       </div></div>\
  319.       <div><p>Fullscreen?</p>\
  320.       <div class="onoffswitch">\
  321.           <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="checkbox-fullscreen" ' + radiantScript.cfullScreen + '>\
  322.           <label class="onoffswitch-label" for="checkbox-fullscreen">\
  323.               <div class="onoffswitch-inner"></div>\
  324.               <div class="onoffswitch-switch"></div>\
  325.           </label>\
  326.       </div></div>\
  327.       <p class="version">version ' + radiantScript.version + '</p>\
  328.   </section>';
  329.     var content2 = '<section id="radiantscriptOther">\
  330.   <div><p id="rmFacebook" class="rmLinks">Facebook</p></div>\
  331.   <div><p id="rmTwitter" class="rmLinks">Twitter</p></div>\
  332.   <div><p id="rmSite" class="rmLinks">Website</p></div>\
  333.   <div><p id="rmRules" class="rmLinks">Our Rules</p></div>\
  334.   <div><p id="rmCmd" class="rmLinks">LiteBot Commands</p></div>\
  335.   <div><p id="rmBlacklist" class="rmLinks">Blacklists</p></div>\
  336.   </section>';
  337.  
  338.     var content3 = '<div id="playlist-export-button" class="button"><i class="icon icon-export-white"></i></div>';
  339.  
  340.     var content4 = '<section id="DisableFullScreen" class="disabled1"><div id="fullscreenDisable">Disable Fullscreen</div></section>';
  341.  
  342.  
  343.     $('body').prepend('<link rel="stylesheet" type="text/css" id="radiantscript-css" href="https://code.radiant.dj/roomscript.css" />');  
  344.     $('#room').append(content1);
  345.     $('#room').append(content2);
  346.     $('#room').append(content3);
  347.     $('#room').append(content4);
  348.  
  349.     radiantScript.fullscreen();
  350.     radiantScript.hyperSpace();
  351.  
  352.     $('#checkbox-autowoot').on('click', function() { radiantScript.toggleAutoWoot();  });    
  353.     $('#checkbox-autojoin').on('click', function() { radiantScript.toggleAutoJoin();  });
  354.     $('#checkbox-pointwhore').on('click', function() { radiantScript.togglePointWhore();  });
  355.     $('#checkbox-fullscreen').on('click', function() { radiantScript.toggleFullScreen();  });
  356.     $('#checkbox-showmehs').on('click', function() { radiantScript.toggleMehShow();  });
  357.  
  358.     $('#rmFacebook').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  359.     $('#rmTwitter').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  360.     $('#rmSite').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  361.     $('#rmCmd').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  362.     $('#rmBlacklist').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  363.     $('#rmRules').on('click', function() { window.open('https://www.facebook.com/groups/843768588974745/');  });
  364.    
  365.     $('#fullscreenDisable').on('click', function() { $('#checkbox-fullscreen').click(); });
  366.     $('#fullscreenDisable').on('mouseover', function() { $('#fullscreenDisable').addClass('highlight'); });
  367.     $('#fullscreenDisable').on('mouseout', function() { $('#fullscreenDisable').removeClass('highlight'); });  
  368.     $(document).on('click', '#chat-messages .from, #user-lists .user', function(e){
  369.         var name = $(this).text().replace(/^\s*|\s*$/g, ''),
  370.             users = API.getUsers(),
  371.             user;
  372.  
  373.         for(var i = users.length; !user && i--; )
  374.             if(users[i].username == name)
  375.                 user = users[i];
  376.  
  377.         setTimeout(function(){
  378.             if(!$('#user-panel .showID').length){
  379.                 $('#user-panel .name').after(
  380.                     $('\
  381.                       <span class="showID"></span>\
  382.                   ').css({
  383.                         'font-size': '11px',
  384.                         position: 'absolute',
  385.                         top: '31px',
  386.                         left: '64px'
  387.                     })
  388.                 );
  389.                 $('#user-panel .status').css({
  390.                     top: '45px',
  391.                     'font-size': '11px'
  392.                 });
  393.             }
  394.             if(user) $('#user-panel .showID').text(user.id || '');
  395.         }, 0);
  396.     });
  397.     $('#audience-canvas').on('mouseover', function(e){
  398.         $('#user-panel .showID').remove();
  399.     });
  400.     $('.slideout-menu-toggle').on('click', function(event){
  401.         event.preventDefault();
  402.         // create menu variables
  403.         var slideoutMenu = $('.slideout-menu');
  404.         var slideoutMenuWidth = $('.slideout-menu').width();
  405.        
  406.         // toggle open class
  407.         slideoutMenu.toggleClass("open");
  408.        
  409.         // slide menu
  410.         if (slideoutMenu.hasClass("open")) {
  411.             slideoutMenu.animate({
  412.                 left: "0px"
  413.             });
  414.         } else {
  415.             slideoutMenu.animate({
  416.                 left: -slideoutMenuWidth
  417.             }, 250);    
  418.         }
  419.     });
  420.    
  421. }
  422. else {
  423.     $('#radiantscript').fadeIn();
  424.     console.log('Radiant Script v' + radiantScript.version + ' already loaded');
  425.     API.chatLog('Radiant Script v' + radiantScript.version + ' already loaded', true);    
  426. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement