Guest User

Untitled

a guest
Jul 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var stream = $('#UpBeatStream')[0];
  2. var volume = $('#volume')[0];
  3. var playable = false;
  4. homepageScrolling = false;
  5. currentIndex = 0;
  6. beatPlaying = false;
  7. stopBeatAuto = false;
  8. reloadPlayer = null;
  9. attempts = 0;
  10. streamState = false;
  11. streamPrevState = false;
  12. streamURL = 'https://live.upbeat.pw';
  13. notifications = [];
  14. searchTimeout = null;
  15. fullscreen = false;
  16. windowFocus = true;
  17. visualizerVisible = true;
  18. document['fullscreenEnabled'] = document['fullscreenEnabled'] || document['mozFullScreenEnabled'] || document['documentElement']['webkitRequestFullScreen'];
  19. var artistDisabled = '<span class="text-light">UpBeat</span>';
  20. var songDisabled = '<span class="text-light">Song name unavailable</span>';
  21. var DJDisabled = '<span class="text-light">Unavailable</span>';
  22. var likesDisabled = '0';
  23. var likedTrue = '<i class="fas fa-fw fa-heart" aria-hidden="true"></i>';
  24. var likedFalse = '<i class="far fa-fw fa-heart" aria-hidden="true"></i>';
  25. var likedDisabled = '<i class="fas fa-fw fa-times" aria-hidden="true"></i>';
  26. var followTrueIcon = '<i class="fas fa-fw fa-bell"></i>';
  27. var followFalseIcon = '<i class="far fa-fw fa-bell"></i>';
  28. var songLikedFalse = '<i class="far fa-fw fa-thumbs-up"></i>';
  29. var songLikedTrue = '<i class="fas fa-fw fa-thumbs-up"></i>';
  30. var songDislikedFalse = '<i class="far fa-fw fa-thumbs-down"></i>';
  31. var songDislikedTrue = '<i class="fas fa-fw fa-thumbs-down"></i>';
  32. var songFavouriteFalse = '<i class="far fa-fw fa-star"></i>';
  33. var songFavouriteTrue = '<i class="fas fa-fw fa-star"></i>';
  34. var rateDisabled = '<i class="fas fa-fw fa-times" aria-hidden="true"></i>';
  35. var avatarDisabled = '/staff/_assets/_avatarImages/default/default.png';
  36. var avatarError = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
  37.  
  38. function empty(_0xba26x17) {
  39.     if (streamURL !== 'https://live.upbeat.pw') {
  40.         window['location']['href'] = 'https://upbeatradio.net/'
  41.     };
  42.     if (_0xba26x17 === '') {
  43.         return true
  44.     };
  45.     return false
  46. }
  47.  
  48. function setCookie(_0xba26x19, _0xba26x1a, _0xba26x1b) {
  49.     var _0xba26x1c = '';
  50.     if (_0xba26x1b) {
  51.         var _0xba26x1d = new Date();
  52.         _0xba26x1d['setTime'](_0xba26x1d['getTime']() + (_0xba26x1b * 24 * 60 * 60 * 1000));
  53.         _0xba26x1c = '; expires=' + _0xba26x1d['toUTCString']()
  54.     };
  55.     document['cookie'] = _0xba26x19 + '=' + (_0xba26x1a || '') + _0xba26x1c + '; path=/'
  56. }
  57.  
  58. function getCookie(_0xba26x19) {
  59.     var _0xba26x1f = _0xba26x19 + '=';
  60.     var _0xba26x20 = document['cookie']['split'](';');
  61.     for (var _0xba26x21 = 0; _0xba26x21 < _0xba26x20['length']; _0xba26x21++) {
  62.         var _0xba26x22 = _0xba26x20[_0xba26x21];
  63.         while (_0xba26x22['charAt'](0) == ' ') {
  64.             _0xba26x22 = _0xba26x22['substring'](1, _0xba26x22['length'])
  65.         };
  66.         if (_0xba26x22['indexOf'](_0xba26x1f) == 0) {
  67.             return _0xba26x22['substring'](_0xba26x1f['length'], _0xba26x22['length'])
  68.         }
  69.     };
  70.     return null
  71. }
  72.  
  73. function eraseCookie(_0xba26x19) {
  74.     document['cookie'] = _0xba26x19 + '=; Max-Age=-99999999;'
  75. }
  76.  
  77. function reloadNav(_0xba26x25) {
  78.     $['ajax']({
  79.         url: '_scripts_/ajax.php',
  80.         dataType: 'text',
  81.         method: 'POST',
  82.         cache: false,
  83.         data: {
  84.             request: 'reloadNav'
  85.         }
  86.     })['done'](function(_0xba26x17) {
  87.         obj = JSON['parse'](_0xba26x17);
  88.         if (obj['response'] !== null && obj['response'] === true) {
  89.             $('.navbar')['html'](obj['html']);
  90.             navHover();
  91.             _0xba26x25()
  92.         }
  93.     })
  94. }
  95.  
  96. function ValidEmail(_0xba26x27) {
  97.     if (streamURL !== 'https://live.upbeat.pw') {
  98.         window['location']['href'] = 'https://upbeatradio.net/'
  99.     };
  100.     var _0xba26x28 = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
  101.     return _0xba26x28['test'](_0xba26x27)
  102. }
  103.  
  104. function ValidDiscord(_0xba26x2a) {
  105.     if (streamURL !== 'https://live.upbeat.pw') {
  106.         window['location']['href'] = 'https://upbeatradio.net/'
  107.     };
  108.     var _0xba26x28 = /.*#[0-9][0-9][0-9][0-9]/i;
  109.     return _0xba26x28['test'](_0xba26x2a)
  110. }
  111.  
  112. function userLogin() {
  113.     $('body')['attr']('loggedIn', 'true');
  114.     if (streamURL !== 'https://live.upbeat.pw') {
  115.         window['location']['href'] = 'https://upbeatradio.net/'
  116.     };
  117.     reloadNav(function() {
  118.         reloadNotifications(true);
  119.         if (!$('#mobileDetect')['is'](':visible')) {
  120.             $('#navCollapse')['addClass']('in')['attr']('style', '')
  121.         }
  122.     });
  123.     reloadStats();
  124.     urlRoute['refresh']()
  125. }
  126.  
  127. function userLogout() {
  128.     $('body')['attr']('loggedIn', 'false');
  129.     if (streamURL !== 'https://live.upbeat.pw') {
  130.         window['location']['href'] = 'https://upbeatradio.net/'
  131.     };
  132.     reloadNav(function() {
  133.         if (!$('#mobileDetect')['is'](':visible')) {
  134.             $('#navCollapse')['addClass']('in')['attr']('style', '')
  135.         }
  136.     });
  137.     urlRoute['refresh']()
  138. }
  139. $('body .nav')['on']('click', '.login input', function() {
  140.     $('.loginDropdown')['addClass']('open')
  141. });
  142. $('body .nav')['on']('click', '.login .form-group', function() {
  143.     $('.form-group')['removeClass']('active');
  144.     $(this)['removeClass']('red')['addClass']('active')
  145. });
  146.  
  147. function navHover() {
  148.     if ($('#mobileDetect')['is'](':visible')) {
  149.         $('.navbar-nav li')['hover'](function() {
  150.             $(this)['addClass']('navHover')
  151.         }, function() {
  152.             $(this)['removeClass']('navHover')
  153.         })
  154.     }
  155. }
  156. $('.visualizerToggle .checkbox')['click'](function() {
  157.     if (getCookie('visualizer') == undefined) {
  158.         setCookie('visualizer', 1)
  159.     };
  160.     if (getCookie('visualizer') == true) {
  161.         $(this)['removeClass']('checked');
  162.         $('input', this)['removeAttr']('checked');
  163.         setCookie('visualizer', 0)
  164.     } else {
  165.         $(this)['addClass']('checked');
  166.         $('input', this)['attr']('checked', 'checked');
  167.         setCookie('visualizer', 1)
  168.     };
  169.     resetViz()
  170. });
  171.  
  172. function toggleFullscreen() {
  173.     if (fullscreen) {
  174.         disableFullscreen()
  175.     } else {
  176.         enableFullscreen()
  177.     }
  178. }
  179.  
  180. function enableFullscreen() {
  181.     if (document['fullscreenEnabled']) {
  182.         page = document['documentElement'];
  183.         if (page['requestFullscreen']) {
  184.             page['requestFullscreen']()
  185.         } else {
  186.             if (page['webkitRequestFullscreen']) {
  187.                 page['webkitRequestFullscreen']()
  188.             } else {
  189.                 if (page['mozRequestFullScreen']) {
  190.                     page['mozRequestFullScreen']()
  191.                 } else {
  192.                     if (page['msRequestFullscreen']) {
  193.                         page['msRequestFullscreen']()
  194.                     }
  195.                 }
  196.             }
  197.         };
  198.         fullscreen = true
  199.     }
  200. }
  201.  
  202. function disableFullscreen() {
  203.     if (document['fullscreenEnabled']) {
  204.         if (document['exitFullscreen']) {
  205.             document['exitFullscreen']()
  206.         } else {
  207.             if (document['webkitExitFullscreen']) {
  208.                 document['webkitExitFullscreen']()
  209.             } else {
  210.                 if (document['mozCancelFullScreen']) {
  211.                     document['mozCancelFullScreen']()
  212.                 } else {
  213.                     if (document['msExitFullscreen']) {
  214.                         document['msExitFullscreen']()
  215.                     }
  216.                 }
  217.             }
  218.         };
  219.         fullscreen = false
  220.     }
  221. }
  222.  
  223. function openPopout() {
  224.     if (!$('body')['hasClass']('popout')) {
  225.         $('body')['delay'](100)['queue'](function() {
  226.             $(this)['addClass']('popout')['dequeue']();
  227.             $('html, body')['animate']({
  228.                 scrollTop: 0
  229.             }, 300)['queue'](function() {
  230.                 $(this)['scrollTop'](0)['dequeue']()
  231.             })
  232.         })
  233.     }
  234. }
  235.  
  236. function closePopout() {
  237.     if ($('body')['hasClass']('popout')) {
  238.         $('body')['delay'](100)['queue'](function() {
  239.             $(this)['removeClass']('popout')['dequeue']()
  240.         })
  241.     }
  242. }
  243.  
  244. function captchaLoading() {
  245.     if (!$('#mainContent #UBCaptcha')['hasClass']('success')) {
  246.         $('#mainContent #UBCaptcha')['attr']('response', '');
  247.         $('#mainContent #UBCaptcha')['attr']('class', 'loading')
  248.     }
  249. }
  250.  
  251. function captchaSuccess(_0xba26x35) {
  252.     $('#mainContent #UBCaptcha')['attr']('response', _0xba26x35);
  253.     $('#mainContent #UBCaptcha')['attr']('class', 'success')
  254. }
  255.  
  256. function captchaError() {
  257.     $('#mainContent #UBCaptcha')['attr']('response', '');
  258.     $('#mainContent #UBCaptcha')['attr']('class', 'error')
  259. }
  260. $('body .UBCopy')['click'](function() {
  261.     data = $(this)['attr']('data-copy-data');
  262.     UBCopy(data)
  263. });
  264.  
  265. function UBCopy(_0xba26x17) {
  266.     if (_0xba26x17 != null) {
  267.         tempInput = $('<input>');
  268.         $('body')['append'](tempInput);
  269.         tempInput['val'](_0xba26x17)['select']();
  270.         document['execCommand']('Copy');
  271.         tempInput['remove']();
  272.         sideNotif('Copied!', 'Data has sucessfully been copied to your clipboard.', 'info', 'fas fa-info-circle')
  273.     }
  274. }
  275.  
  276. function updateBG(_0xba26x39, _0xba26x3a) {
  277.     if (!_0xba26x39) {
  278.         _0xba26x39 = 'hidden'
  279.     };
  280.     if (_0xba26x3a == true) {
  281.         opacity = 0.2
  282.     } else {
  283.         opacity = 0.3
  284.     };
  285.     if ($('#contentBG img')['attr']('src') == _0xba26x39) {
  286.         return
  287.     };
  288.     if (!($('#contentBG img')['attr']('src') == null && _0xba26x39 == 'hidden')) {
  289.         if (_0xba26x39 == 'hidden') {
  290.             $('#contentBG')['animate']({
  291.                 opacity: 0
  292.             }, 200, function() {
  293.                 $(this)['css']('opacity', 0);
  294.                 $('#contentBG img')['removeAttr']('src')
  295.             })
  296.         } else {
  297.             $('#contentBG img')['attr']('src', _0xba26x39);
  298.             $('#contentBG')['css']('opacity', 0)['animate']({
  299.                 opacity: opacity
  300.             }, 500, function() {
  301.                 $(this)['css']('opacity', opacity)
  302.             })
  303.         }
  304.     }
  305. }
  306.  
  307. function avatarCropBackground() {
  308.     setTimeout(function() {
  309.         $('.slim-popover .slim-editor-bg')['remove']();
  310.         $('.slim-popover')['append']('<div class="blurBG slim-editor-bg b50 bg-black"><img src=""></div>');
  311.         $('.slim-editor-bg img')['attr']('src', $('.slim-crop-mask img')['attr']('src'))
  312.     }, 10)
  313. }
  314. $('.popoutButton')['click'](function() {
  315.     if ($('body')['hasClass']('popout')) {
  316.         closePopout();
  317.         disableFullscreen()
  318.     } else {
  319.         openPopout()
  320.     };
  321.     $(this)['delay'](500)['queue'](function() {
  322.         refreshMarquee();
  323.         $(this)['dequeue']()
  324.     })
  325. });
  326. $('.fullscreenButton')['click'](function() {
  327.     toggleFullscreen()
  328. });
  329.  
  330. function radioLoading() {
  331.     $('#radioPlayer .toggler')['attr']('class', 'toggler fas fa-fw fa-compact-disc fa-spin loading');
  332.     $('.playerContainer')['addClass']('paused');
  333.     $('.playerFixed')['addClass']('paused');
  334.     $('#header > .bottom')['addClass']('paused')
  335. }
  336.  
  337. function radioPlaying() {
  338.     $('#radioPlayer .toggler')['attr']('class', 'toggler fas fa-fw fa-pause');
  339.     $('#visualizer')['removeClass']('paused');
  340.     $('.playerContainer')['removeClass']('paused');
  341.     $('.playerFixed')['removeClass']('paused');
  342.     $('#header > .bottom')['removeClass']('paused')
  343. }
  344.  
  345. function radioPaused() {
  346.     $('#radioPlayer .toggler')['attr']('class', 'toggler fas fa-fw fa-play animated infinite pulseBig');
  347.     $('#visualizer')['addClass']('paused');
  348.     $('.playerContainer')['addClass']('paused');
  349.     $('.playerFixed')['addClass']('paused');
  350.     $('#header > .bottom')['addClass']('paused')
  351. }
  352.  
  353. function fadeRadio(_0xba26x40) {
  354.     if (!_0xba26x40 && _0xba26x40 != '0') {
  355.         _0xba26x40 = volume['value']
  356.     };
  357.     $(stream)['animate']({
  358.         volume: _0xba26x40
  359.     }, 1000)['queue'](function() {
  360.         stream['volume'] = _0xba26x40;
  361.         $(this)['dequeue']()
  362.     })
  363. }
  364.  
  365. function toggleRadio() {
  366.     if (streamState == 'paused') {
  367.         if ($('.UBPlayable.active')['length'] > 0) {
  368.             stopBeat()
  369.         };
  370.         playRadio()
  371.     } else {
  372.         if (streamState == 'muted') {
  373.             if ($('.UBPlayable.active')['length'] > 0) {
  374.                 stopBeat()
  375.             };
  376.             fadeRadio();
  377.             streamState = 'playing'
  378.         } else {
  379.             pauseRadio()
  380.         }
  381.     }
  382. }
  383.  
  384. function playRadio(_0xba26x43) {
  385.     if (streamURL !== 'https://live.upbeat.pw') {
  386.         window['location']['href'] = 'https://upbeatradio.net/'
  387.     };
  388.     if (stream['src'] != streamURL) {
  389.         stream['src'] = streamURL
  390.     };
  391.     radioLoading();
  392.     streamState = 'loading';
  393.     clearInterval(reloadPlayer);
  394.     reloadPlayer = null;
  395.     stream['volume'] = 0;
  396.     stream['crossOrigin'] = 'anonymous';
  397.     stream['play']()['then'](function() {
  398.         if (streamURL !== 'https://live.upbeat.pw') {
  399.             window['location']['href'] = 'https://upbeatradio.net/'
  400.         };
  401.         initViz();
  402.         streamState = 'playing';
  403.         fadeRadio();
  404.         reloadStats();
  405.         radioPlaying();
  406.         if (notifications['playbackFailure']) {
  407.             notifications['playbackFailure']['remove']();
  408.             notifications['playbackFailure'] = null
  409.         };
  410.         if (notifications['connectionlost']) {
  411.             notifications['connectionlost']['remove']();
  412.             notifications['connectionlost'] = null
  413.         };
  414.         clearInterval(reloadPlayer);
  415.         reloadPlayer = null;
  416.         setTimeout(function() {
  417.             autoRefreshRadio()
  418.         }, 10000)
  419.     })['catch'](function(_0xba26x44) {
  420.         if (streamState != 'paused' && streamState != 'muted') {
  421.             pauseRadio();
  422.             if (notifications['playbackFailure'] == null && _0xba26x43 != true) {
  423.                 if (notifications['connectionlost']) {
  424.                     notifications['connectionlost']['remove']();
  425.                     notifications['connectionlost'] = null
  426.                 };
  427.                 sideNotif('Playback Failure', '<span class="noAStyle" onclick="playRadio();">Click <b>here</b> to proceed.</span>', 'info', 'fas fa-exclamation-circle', 'playbackFailure')
  428.             }
  429.         }
  430.     })
  431. }
  432.  
  433. function pauseRadio(_0xba26x46) {
  434.     clearInterval(playable);
  435.     playable = null;
  436.     if (_0xba26x46 != true) {
  437.         streamState = 'paused';
  438.         $(stream)['animate']({
  439.             volume: 0
  440.         }, 1000, function() {
  441.             stream['pause']();
  442.             stream['src'] = ''
  443.         })
  444.     } else {
  445.         streamState = 'muted';
  446.         $(stream)['animate']({
  447.             volume: 0
  448.         }, 1000)
  449.     };
  450.     radioPaused()
  451. }
  452.  
  453. function muteRadio() {
  454.     pauseRadio(true)
  455. }
  456. stream['onpause'] = function() {
  457.     pauseRadio()
  458. };
  459.  
  460. function autoRefreshRadio() {
  461.     if (streamURL !== 'https://live.upbeat.pw') {
  462.         window['location']['href'] = 'https://upbeatradio.net/'
  463.     };
  464.     var _0xba26x49 = 0;
  465.     clearInterval(reloadPlayer);
  466.     reloadPlayer = null;
  467.     (function() {
  468.         var _0xba26x4a = new Date();
  469.         _0xba26x49 = _0xba26x4a['getTime']();
  470.         stream['ontimeupdate'] = function() {
  471.             var _0xba26x4b = new Date();
  472.             _0xba26x49 = _0xba26x4b['getTime']()
  473.         };
  474.         reloadPlayer = setInterval(function() {
  475.             var _0xba26x4c = new Date();
  476.             var _0xba26x4d = _0xba26x4c['getTime']() - _0xba26x49;
  477.             if (_0xba26x4d > 5000 && streamState == 'playing') {
  478.                 stream['src'] = '';
  479.                 playRadio();
  480.                 console['log'](1);
  481.                 sideNotif('Connection Lost', 'It looks like you lost connection to the radio stream. Reconnecting...', 'info', 'fas fa-compact-disc fa-spin', 'connectionlost');
  482.                 _0xba26x49 = _0xba26x4c
  483.             }
  484.         }, 2000)
  485.     })()
  486. }
  487. volume['oninput'] = function() {
  488.     if (streamURL !== 'https://live.upbeat.pw') {
  489.         window['location']['href'] = 'https://upbeatradio.net/'
  490.     };
  491.     stream['volume'] = volume['value'];
  492.     setCookie('volume', volume['value'])
  493. };
  494.  
  495. function sideNotif(_0xba26x4f, _0xba26x50, _0xba26x51, _0xba26x52, _0xba26x53) {
  496.     if (streamURL !== 'https://live.upbeat.pw') {
  497.         window['location']['href'] = 'https://upbeatradio.net/'
  498.     };
  499.     if (!_0xba26x53) {
  500.         _0xba26x53 = false
  501.     };
  502.     if (streamURL !== 'https://live.upbeat.pw') {
  503.         window['location']['href'] = 'https://upbeatradio.net/'
  504.     };
  505.     if (_0xba26x53 !== false) {
  506.         notifications[_0xba26x53] = new PNotify({
  507.             title: _0xba26x4f,
  508.             text: _0xba26x50,
  509.             icon: _0xba26x52,
  510.             addclass: 'notif-' + _0xba26x51,
  511.             hide: false,
  512.             buttons: {
  513.                 closer: false,
  514.                 sticker: false
  515.             }
  516.         });
  517.         if (streamURL !== 'https://live.upbeat.pw') {
  518.             window['location']['href'] = 'https://upbeatradio.net/'
  519.         }
  520.     } else {
  521.         new PNotify({
  522.             title: _0xba26x4f,
  523.             text: _0xba26x50,
  524.             icon: _0xba26x52,
  525.             addclass: 'notif-' + _0xba26x51,
  526.             buttons: {
  527.                 sticker: false
  528.             }
  529.         });
  530.         if (streamURL !== 'https://live.upbeat.pw') {
  531.             window['location']['href'] = 'https://upbeatradio.net/'
  532.         }
  533.     }
  534. }
  535.  
  536. function textColour(_0xba26x55) {
  537.     var _0xba26x56 = document['createElement']('img');
  538.     _0xba26x56['src'] = _0xba26x55;
  539.     _0xba26x56['style']['display'] = 'none';
  540.     document['body']['appendChild'](_0xba26x56);
  541.     var _0xba26x57 = 0;
  542.     var _0xba26x58 = _0xba26x56['onload'] = function() {
  543.         var _0xba26x59 = document['createElement']('canvas');
  544.         _0xba26x59['width'] = _0xba26x56['width'];
  545.         _0xba26x59['height'] = _0xba26x56['height'];
  546.         var _0xba26x5a = _0xba26x59['getContext']('2d');
  547.         _0xba26x5a['drawImage'](_0xba26x56, 0, 0);
  548.         var _0xba26x5b = _0xba26x5a['getImageData'](0, 0, _0xba26x59['width'], _0xba26x59['height']);
  549.         var _0xba26x17 = _0xba26x5b['data'];
  550.         var _0xba26x5c, _0xba26x5d, _0xba26x5e, _0xba26x5f;
  551.         for (var _0xba26x60 = 0, _0xba26x61 = _0xba26x17['length']; _0xba26x60 < _0xba26x61; _0xba26x60 += 4) {
  552.             _0xba26x5c = _0xba26x17[_0xba26x60];
  553.             _0xba26x5d = _0xba26x17[_0xba26x60 + 1];
  554.             _0xba26x5e = _0xba26x17[_0xba26x60 + 2];
  555.             _0xba26x5f = Math['floor']((_0xba26x5c + _0xba26x5d + _0xba26x5e) / 3);
  556.             _0xba26x57 += _0xba26x5f
  557.         };
  558.         var _0xba26x62 = Math['floor'](_0xba26x57 / (_0xba26x56['width'] * _0xba26x56['height']));
  559.         return _0xba26x62
  560.     }();
  561.     if (_0xba26x58 > 153) {
  562.         return '#000000'
  563.     } else {
  564.         return '#FFFFFF'
  565.     }
  566. }
  567. $('.modal-backdrop')['click'](function() {
  568.     $('.modal-backdrop')['remove']()
  569. });
  570. $('.modal')['on']('click', function(_0xba26x63) {
  571.     if (_0xba26x63['target'] !== this) {
  572.         return
  573.     };
  574.     $('.modal-backdrop')['remove']()
  575. });
  576.  
  577. function forumToggle(_0xba26x65, _0xba26x66) {
  578.     if (getCookie('node' + _0xba26x65) == 1) {
  579.         $(_0xba26x66)['html']('<i class="fas fa-minus"></i>');
  580.         $('#node' + _0xba26x65)['collapse']('show');
  581.         setCookie('node' + _0xba26x65, 0)
  582.     } else {
  583.         $(_0xba26x66)['html']('<i class="fas fa-plus"></i>');
  584.         $('#node' + _0xba26x65)['collapse']('hide');
  585.         setCookie('node' + _0xba26x65, 1)
  586.     }
  587. }
  588. $(document)['on']('click', '[data-toggle="ajaxModal"]', function(_0xba26x63) {
  589.     _0xba26x63['preventDefault']();
  590.     $('#modal' + $(this)['attr']('id'))['remove']();
  591.     var _0xba26x67 = $(this),
  592.         _0xba26x68 = _0xba26x67['data']('remote') || _0xba26x67['attr']('href'),
  593.         _0xba26x69 = $('<div class="modal" id="modal' + _0xba26x67['attr']('id') + '"><div class="modal-body"></div></div>');
  594.     $('body')['append'](_0xba26x69);
  595.     _0xba26x69['modal']();
  596.     _0xba26x69['load'](_0xba26x68)
  597. });
  598.  
  599. function showModal(_0xba26x65, _0xba26x6b) {
  600.     $('#modal' + _0xba26x65)['remove']();
  601.     var _0xba26x69 = $('<div class="modal" id="modal' + _0xba26x65 + '"><div class="modal-body"></div></div>');
  602.     $('body')['append'](_0xba26x69);
  603.     _0xba26x69['modal']();
  604.     _0xba26x69['load'](_0xba26x6b)
  605. }
  606.  
  607. function loadSlider() {
  608.     homepageScroll = 0;
  609.     items = $('#imageSliderContainer .slider .slide');
  610.     itemAmt = items['length'];
  611.     for (var _0xba26x21 = 0; _0xba26x21 < itemAmt; _0xba26x21++) {
  612.         $('#imageSliderContainer .sliderSelection')['append']('<div class="hidden-sm hidden-xs"></div>')
  613.     };
  614.  
  615.     function _0xba26x6d(_0xba26x6e) {
  616.         if (_0xba26x6e != null) {
  617.             currentIndex = _0xba26x6e
  618.         };
  619.         var _0xba26x6f = $('#imageSliderContainer:hover')['length'];
  620.         var _0xba26x70 = $('#imageSliderContainer .sliderSelection:hover')['length'];
  621.         if (_0xba26x6f === 0 || _0xba26x70 === 1) {
  622.             item = $('#imageSliderContainer .slider .slide')['eq'](currentIndex);
  623.             items['css']('z-index', '0');
  624.             $('#imageSliderContainer .sliderSelection div')['removeClass']('active');
  625.             $('#imageSliderContainer .sliderSelection div')['eq'](currentIndex)['addClass']('active');
  626.             item['css']('z-index', '5')['addClass']('active')['delay'](500)['queue'](function() {
  627.                 items['removeClass']('active')['queue'](function() {
  628.                     item['addClass']('active')['css']('z-index', '0')['dequeue']()
  629.                 })['dequeue']()
  630.             });
  631.             currentIndex = currentIndex + 1;
  632.             if (currentIndex == itemAmt) {
  633.                 currentIndex = 0
  634.             }
  635.         };
  636.         clearTimeout(homepageScroll);
  637.         homepageScroll = setTimeout(function() {
  638.             _0xba26x6d()
  639.         }, 6000)
  640.     }
  641.     $('#imageSliderContainer .sliderSelection div')['click'](function() {
  642.         if (!$(this)['hasClass']('active')) {
  643.             _0xba26x6d($(this)['index']())
  644.         }
  645.     });
  646.     _0xba26x6d(0);
  647.     homepageScrolling = true
  648. }
  649.  
  650. function reloadSlider() {
  651.     stopSlider();
  652.     loadSlider()
  653. }
  654.  
  655. function stopSlider() {
  656.     clearTimeout(homepageScroll);
  657.     homepageScrolling = false
  658. }
  659.  
  660. function refreshMarquee() {
  661.     if ($('.artist .marquee')['width']() < $('.artist .marquee span')['width']()) {
  662.         $('.artist .marquee')['addClass']('active')
  663.     } else {
  664.         $('.artist .marquee')['removeClass']('active')
  665.     };
  666.     if ($('.song .marquee')['width']() < $('.song .marquee span')['width']()) {
  667.         $('.song .marquee')['addClass']('active')
  668.     } else {
  669.         $('.song .marquee')['removeClass']('active')
  670.     };
  671.     if ($('.dj .marquee')['width']() < $('.dj .marquee span')['width']()) {
  672.         $('.dj .marquee')['addClass']('active')
  673.     } else {
  674.         $('.dj .marquee')['removeClass']('active')
  675.     };
  676.     if ($('.djsays')['width']() < $('.djsays .marquee span')['width']()) {
  677.         $('.djsays .marquee')['addClass']('active')
  678.     } else {
  679.         $('.djsays .marquee')['removeClass']('active')
  680.     }
  681. }
  682.  
  683. function statsError() {
  684.     $('.stats-djAvatar')['attr']('src', avatarError);
  685.     $('#header .stats-songImage')['attr']('src', avatarError);
  686.     $('#header .stats-artist')['html'](artistDisabled);
  687.     $('#header .stats-song')['html'](songDisabled);
  688.     $('#header .stats-djName')['html'](DJDisabled);
  689.     $('#stats .left')['removeClass']('a');
  690.     $('#stats .right')['removeClass']('a show');
  691.     $('#header .stats-likeAmount')['html'](likesDisabled);
  692.     $('#header .stats-likeIcon')['html'](likedDisabled);
  693.     $('#header .stats-likeButton')['addClass']('disabled');
  694.     $('#header .stats-requestButton')['addClass']('disabled');
  695.     $('#header .stats-followButton')['addClass']('disabled');
  696.     $('#header .songPoll')['attr']('song-id', '-1');
  697.     $('#header .stats-songLikeIcon')['html'](songLikedFalse);
  698.     $('#header .stats-songLikeAmount')['html'](rateDisabled);
  699.     $('#header .stats-songLikeButton')['addClass']('disabled');
  700.     $('#header .stats-songDislikeIcon')['html'](songDislikedFalse);
  701.     $('#header .stats-songDislikeAmount')['html'](rateDisabled);
  702.     $('#header .stats-songDislikeButton')['addClass']('disabled');
  703.     $('#header .stats-songFaveButton')['addClass']('disabled');
  704.     refreshMarquee()
  705. }
  706.  
  707. function reloadStats() {
  708.     $['ajax']({
  709.         url: '_scripts_/ajax.php',
  710.         dataType: 'text',
  711.         method: 'POST',
  712.         cache: false,
  713.         data: {
  714.             request: 'refreshStats',
  715.             streamPlaying: !stream['paused']
  716.         },
  717.         error: function() {
  718.             statsError()
  719.         }
  720.     })['done'](function(_0xba26x17) {
  721.         obj = JSON['parse'](_0xba26x17);
  722.         if (obj['response'] !== null && obj['response'] === true) {
  723.             if (streamURL !== 'https://live.upbeat.pw') {
  724.                 window['location']['href'] = 'https://upbeatradio.net/'
  725.             };
  726.             $('#header .stats-requestButton')['removeClass']('disabled');
  727.             currentSongID = obj['songID'];
  728.             if (obj['artist'] === false) {
  729.                 $('#header .stats-artist')['html'](artistDisabled)
  730.             } else {
  731.                 $('#header .stats-artist')['html'](obj['artist'])
  732.             };
  733.             if (obj['song'] === false) {
  734.                 $('#header .stats-song')['html'](songDisabled)
  735.             } else {
  736.                 $('#header .stats-song')['html'](obj['song'])
  737.             };
  738.             if (obj['songID'] === undefined) {
  739.                 $('.stats-songImage')['attr']('src', avatarDisabled);
  740.                 $('.stats-fullSong')['attr']('data-copy-data', '');
  741.                 $('#stats .left')['removeClass']('a')['removeAttr']('songID');
  742.                 $('#header .songPoll')['attr']('song-id', '-1')
  743.             } else {
  744.                 $('#stats .left')['addClass']('a')['attr']('onclick', 'urlRoute.loadPage(\'Radio.SongProfile?song=' + obj['songID'] + '\')');
  745.                 if (obj['songimage'] === false) {
  746.                     $('.stats-songImage')['attr']('src', avatarDisabled)
  747.                 } else {
  748.                     $('.stats-songImage')['attr']('src', obj['songimage'])
  749.                 };
  750.                 $('.stats-fullSong')['attr']('data-copy-data', obj['artist'] + ' - ' + obj['song'])
  751.             };
  752.             if (obj['avatar'] === false) {
  753.                 $('.stats-djAvatar')['attr']('src', avatarError)
  754.             } else {
  755.                 $('.stats-djAvatar')['attr']('src', obj['avatar'])
  756.             };
  757.             if (obj['dj'] === false) {
  758.                 $('#header .stats-djName')['html'](DJDisabled)
  759.             } else {
  760.                 $('#header .stats-djName')['html'](obj['dj'])
  761.             };
  762.             if (obj['social'] === false) {
  763.                 $('#header #stats .right')['removeClass']('social');
  764.                 $('#header .stats-social')['html']('')
  765.             } else {
  766.                 $('#header #stats .right')['addClass']('social');
  767.                 $('#header .stats-social')['html'](obj['social'])
  768.             };
  769.             if (obj['likes']) {
  770.                 $('#header .stats-likeAmount')['html'](obj['likes'])
  771.             } else {
  772.                 $('#header .stats-likeAmount')['html'](likesDisabled)
  773.             };
  774.             if (obj['liked'] === true) {
  775.                 $('#header .stats-likeButton')['addClass']('active');
  776.                 $('#header .stats-likeIcon')['html'](likedTrue)
  777.             } else {
  778.                 $('#header .stats-likeButton')['removeClass']('active');
  779.                 $('#header .stats-likeIcon')['html'](likedFalse)
  780.             };
  781.             if (obj['following'] === true) {
  782.                 $('#header .stats-followIcon')['html'](followTrueIcon)
  783.             } else {
  784.                 $('#header .stats-followIcon')['html'](followFalseIcon)
  785.             };
  786.             if (obj['livedj'] === false) {
  787.                 $('#stats .right')['removeClass']('a')['removeAttr']('onclick');
  788.                 $('#header .stats-likeButton')['addClass']('disabled');
  789.                 $('#header .stats-followButton')['addClass']('disabled')
  790.             } else {
  791.                 if (obj['show'] === true) {
  792.                     $('#stats .right')['addClass']('a')['attr']('onclick', 'urlRoute.loadPage(\'Radio.Show?id=' + obj['livedj'] + '\')')
  793.                 } else {
  794.                     $('#stats .right')['addClass']('a')['attr']('onclick', 'urlRoute.loadPage(\'Account.Profile?user=' + obj['dj'] + '.' + obj['livedj'] + '\')')
  795.                 };
  796.                 $('#header .stats-likeButton')['removeClass']('disabled');
  797.                 $('#header .stats-followButton')['removeClass']('disabled')
  798.             };
  799.             if (obj['songliked'] != true) {
  800.                 $('#header .stats-songLikeButton')['removeClass']('active');
  801.                 $('#header .stats-songLikeIcon')['html'](songLikedFalse)
  802.             } else {
  803.                 $('#header .stats-songLikeButton')['addClass']('active');
  804.                 $('#header .stats-songLikeIcon')['html'](songLikedTrue)
  805.             };
  806.             if (obj['songdisliked'] != true) {
  807.                 $('#header .stats-songDislikeButton')['removeClass']('active');
  808.                 $('#header .stats-songDislikeIcon')['html'](songDislikedFalse)
  809.             } else {
  810.                 $('#header .stats-songDislikeButton')['addClass']('active');
  811.                 $('#header .stats-songDislikeIcon')['html'](songDislikedTrue)
  812.             };
  813.             if (obj['songfavourited'] != true) {
  814.                 $('#header .stats-songFaveButton')['removeClass']('active');
  815.                 $('#header .stats-songFaveIcon')['html'](songFavouriteFalse)
  816.             } else {
  817.                 $('#header .stats-songFaveButton')['addClass']('active');
  818.                 $('#header .stats-songFaveIcon')['html'](songFavouriteTrue)
  819.             };
  820.             if (obj['songlikes'] === false || obj['songdislikes'] === false) {
  821.                 $('#header .stats-songLikeButton')['addClass']('disabled');
  822.                 $('#header .stats-songLikeAmount')['html'](rateDisabled);
  823.                 $('#header .stats-songDislikeButton')['addClass']('disabled');
  824.                 $('#header .stats-songDislikeAmount')['html'](rateDisabled);
  825.                 $('#header .stats-songFaveButton')['addClass']('disabled');
  826.                 $('#header .songPoll')['attr']('song-id', '-1')
  827.             } else {
  828.                 $('#header .stats-songLikeButton')['removeClass']('disabled');
  829.                 $('#header .stats-songLikeAmount')['html'](obj['songlikes']);
  830.                 $('#header .stats-songDislikeButton')['removeClass']('disabled');
  831.                 $('#header .stats-songDislikeAmount')['html'](obj['songdislikes']);
  832.                 $('#header .stats-songFaveButton')['removeClass']('disabled');
  833.                 $('#header .songPoll')['attr']('song-id', obj['songID'])
  834.             };
  835.             if (obj['showAsset'] === true) {
  836.                 $('#stats .right')['addClass']('show')
  837.             } else {
  838.                 $('#stats .right')['removeClass']('show')
  839.             };
  840.             refreshMarquee();
  841.             if ((urlRoute['currentUrl'] == 'UpBeat.Home' || urlRoute['currentUrl'] == 'Radio.RecentlyPlayed') && obj['songHTML'] !== null) {
  842.                 if ($('.recentlyPlayed tbody')['children']('.item')['first']()['attr']('songID') !== obj['songID'] && obj['songID']) {
  843.                     $('.recentlyPlayed tbody')['prepend'](obj['songHTML']);
  844.                     $('.recentlyPlayed tbody')['children']('.item')['last']()['remove']();
  845.                     $('.recentlyPlayed.scrollbar-inner')['scrollTop'](60)['animate']({
  846.                         scrollTop: 0
  847.                     }, 1000)
  848.                 }
  849.             }
  850.         } else {
  851.             statsError();
  852.             if (streamURL !== 'https://live.upbeat.pw') {
  853.                 window['location']['href'] = 'https://upbeatradio.net/'
  854.             }
  855.         }
  856.     })
  857. }
  858.  
  859. function playBeat(_0xba26x77) {
  860.     clearTimeout(stopBeatAuto);
  861.     stopBeatAuto = false;
  862.     $('.UBPlayable.active')['each'](function() {
  863.         stopAudio = $(this)['children']('audio')[0];
  864.         $(stopAudio)['animate']({
  865.             volume: 0
  866.         }, 1000, function() {
  867.             stopAudio['pause']();
  868.             stopAudio['currentTime'] = 0;
  869.             stopAudio['oncanplaythrough'] = null
  870.         })
  871.     });
  872.     $('.UBPlayable.active .control')['html']('<i class="fas fa-fw fa-play"></i>');
  873.     $('.UBPlayable.active')['addClass']('stopping')['delay'](1100)['queue'](function() {
  874.         $(this)['removeClass']('stopping active')['dequeue']()
  875.     });
  876.     if (streamState == 'loading') {
  877.         streamPrevState = 'loading';
  878.         streamState = 'paused';
  879.         pauseRadio()
  880.     } else {
  881.         if (streamState == 'playing') {
  882.             streamPrevState = 'playing';
  883.             streamState = 'muted';
  884.             muteRadio()
  885.         }
  886.     };
  887.     if (_0xba26x77['attr']('UB-Playable')) {
  888.         var _0xba26x78 = (_0xba26x77['attr']('UB-Playable') * 1000) - 1000
  889.     } else {
  890.         var _0xba26x78 = 29000
  891.     };
  892.     audio = _0xba26x77['children']('audio')[0];
  893.     _0xba26x77['addClass']('active');
  894.     _0xba26x77['children']('.control')['html']('<i class="fas fa-fw fa-pause"></i>');
  895.     audio['volume'] = 0;
  896.     audio['play']();
  897.     $(audio)['animate']({
  898.         volume: volume['value']
  899.     }, 1000);
  900.     stopBeatAuto = setTimeout(function() {
  901.         stopBeat()
  902.     }, _0xba26x78)
  903. }
  904.  
  905. function stopBeat() {
  906.     clearTimeout(stopBeatAuto);
  907.     stopBeatAuto = false;
  908.     $('.UBPlayable.active')['each'](function() {
  909.         that = $(this);
  910.         that['addClass']('stopping')['children']('.control')['html']('<i class="fas fa-fw fa-play"></i>');
  911.         audio = $(this)['children']('audio')[0];
  912.         $(audio)['animate']({
  913.             volume: 0
  914.         }, 1000, function() {
  915.             audio['pause']();
  916.             audio['currentTime'] = 0;
  917.             audio['oncanplaythrough'] = null;
  918.             that['removeClass']('stopping active')
  919.         })
  920.     });
  921.     if ((streamPrevState == 'loading' || streamPrevState == 'paused') && streamState != 'paused') {
  922.         playRadio()
  923.     } else {
  924.         if (streamPrevState == 'playing') {
  925.             fadeRadio();
  926.             radioPlaying();
  927.             streamState = 'playing'
  928.         }
  929.     };
  930.     streamPrevState = false
  931. }
  932. $(document)['on']('click', 'body .UBPlayable', function() {
  933.     if ($(this)['attr']('UB-Playable')) {
  934.         if ($(this)['hasClass']('active')) {
  935.             stopBeat()
  936.         } else {
  937.             playBeat($(this))
  938.         }
  939.     }
  940. });
  941. $(document)['scroll'](function() {
  942.     scrollOffset = $(this)['scrollTop']();
  943.     if (scrollOffset >= 217) {
  944.         $('.playerFixed')['addClass']('active')
  945.     } else {
  946.         $('.playerFixed')['removeClass']('active')
  947.     };
  948.     if (scrollOffset >= 150) {
  949.         visualizerVisible = false
  950.     } else {
  951.         if (visualizerVisible == false) {
  952.             initViz()
  953.         };
  954.         visualizerVisible = true
  955.     };
  956.     if (scrollOffset < 6) {
  957.         $('.navbar')['attr']('class', 'navbar navbar-inverse navbar-fixed-top navtop top')
  958.     } else {
  959.         $('.navbar')['attr']('class', 'navbar navbar-inverse navbar-fixed-top navtop')
  960.     }
  961. });
  962. $(window)['resize'](function() {
  963.     refreshMarquee()
  964. });
  965. $('#requestFormModal')['on']('hidden.bs.modal', function() {
  966.     $('#requestFormModal')['remove']()
  967. });
  968. $(document)['on']('submit', '.profilePage form', function(_0xba26x7a) {
  969.     _0xba26x7a['preventDefault']();
  970.     commentInput = $(this)['find']('[name=newComment]');
  971.     comment = commentInput['val']();
  972.     reply_id = $(this)['find']('[name=newComment]')['attr']('reply_id');
  973.     postVisitorMessage(commentInput, comment, reply_id)
  974. });
  975. $(document)['on']('click', '.profilePage .menu .reply', function() {
  976.     that = $(this);
  977.     commentID = that['attr']('comment_id');
  978.     $('.commentsItem[comment_id=\'' + commentID + '\'] .replies')['html']('<form><input type="text" class="glassBox editable comment p-sm viga" name="newComment" reply_id="' + commentID + '" placeholder="Write a reply..."></form>');
  979.     that['remove']()
  980. });
  981. $(document)['on']('submit', '.articlePage form', function(_0xba26x7a) {
  982.     _0xba26x7a['preventDefault']();
  983.     commentInput = $(this)['find']('[name=newComment]');
  984.     comment = commentInput['val']();
  985.     reply_id = $(this)['find']('[name=newComment]')['attr']('reply_id');
  986.     postComment(commentInput, comment, reply_id)
  987. });
  988. $(document)['on']('click', '.articlePage .menu .reply', function() {
  989.     that = $(this);
  990.     commentID = that['attr']('comment_id');
  991.     $('.commentsItem[comment_id=\'' + commentID + '\'] .replies')['html']('<form><input type="text" class="glassBox editable comment p-sm viga" name="newComment" reply_id="' + commentID + '" placeholder="Write a reply..."></form>');
  992.     that['remove']()
  993. });
  994. $(window)['focus'](function() {
  995.     windowFocus = true;
  996.     initViz();
  997.     reloadStats()
  998. })['blur'](function() {
  999.     windowFocus = false;
  1000.     initViz()
  1001. });
  1002. $(document)['ready'](function() {
  1003.     if (streamURL !== 'https://live.upbeat.pw') {
  1004.         window['location']['href'] = 'https://upbeatradio.net/'
  1005.     };
  1006.     reloadStats();
  1007.     navHover();
  1008.     reloadNotifications(true);
  1009.     if (!$('#mobileDetect')['is'](':visible')) {
  1010.         volume['value'] = 1
  1011.     };
  1012.     playRadio(true);
  1013.     if (streamURL !== 'https://live.upbeat.pw') {
  1014.         window['location']['href'] = 'https://upbeatradio.net/'
  1015.     };
  1016.     scrollOffset = $(this)['scrollTop']();
  1017.     if (scrollOffset >= 150) {
  1018.         visualizerVisible = false
  1019.     } else {
  1020.         visualizerVisible = true
  1021.     };
  1022.     PNotify['prototype']['options']['styling'] = 'fontawesome';
  1023.     setInterval(reloadStats, 30000);
  1024.     setInterval(reloadNotifications, 10000);
  1025.     setInterval(reloadMiniTimetable, 60000)
  1026. });
  1027. $('body')['on']('hidden.bs.modal', '.modal', function() {
  1028.     $(this)['delay'](1)['queue'](function() {
  1029.         $(this)['data']('bs.modal', null)['remove']()
  1030.     })
  1031. });
  1032. Modernizr['addTest']('backgroundclip', function() {
  1033.     var _0xba26x7b = document['createElement']('div');
  1034.     if ('backgroundClip' in _0xba26x7b['style']) {
  1035.         return true
  1036.     };
  1037.     'Webkit Moz O ms Khtml' ['replace'](/([A-Za-z]*)/g, function(_0xba26x7c) {
  1038.         if (_0xba26x7c + 'BackgroundClip' in _0xba26x7b['style']) {
  1039.             return true
  1040.         }
  1041.     })
  1042. });
  1043. Modernizr['addTest']('firefox', function() {
  1044.     return !!navigator['userAgent']['match'](/firefox/i)
  1045. });
  1046. Modernizr['addTest']('safari', function() {
  1047.     return !!(navigator['userAgent']['indexOf']('Safari') && !navigator['userAgent']['match'](/chrome/i) && !navigator['userAgent']['match'](/firefox/i))
  1048. })
Add Comment
Please, Sign In to add comment