radio.min.js 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. (function(){
  2. var debug = false;
  3. // ***************************************************************************
  4. // Socket.io events
  5. // ***************************************************************************
  6. var socket = io.connect(window.location.host);
  7. // Connection established
  8. socket.on('connected', function (data) {
  9. console.log(data);
  10. // Get users connected to mainroom
  11. socket.emit('getUsersInRoom', {'room':'Lobby'});
  12. if (debug) {
  13. // Subscription to rooms
  14. socket.emit('subscribe', {'username':'sergio', 'rooms':['sampleroom']});
  15. // Send sample message to room
  16. socket.emit('newMessage', {'room':'sampleroom', 'msg':'Hellooooooo!'});
  17. // Auto-disconnect after 10 minutes
  18. setInterval(function() {
  19. socket.emit('unsubscribe', {'rooms':['sampleroom']});
  20. socket.disconnect();
  21. }, 600000);
  22. }
  23. });
  24. // Disconnected from server
  25. socket.on('disconnect', function (data) {
  26. var info = {'room':'Lobby', 'username':'Radio-bot', 'msg':'---- Lost connection ----'};
  27. addMessage(info);
  28. });
  29. // Reconnected to server
  30. socket.on('reconnect', function (data) {
  31. var info = {'room':'Lobby', 'username':'Radio-bot', 'msg':'---- Reconnected ----'};
  32. addMessage(info);
  33. });
  34. // Subscription to room confirmed
  35. socket.on('subscriptionConfirmed', function(data) {
  36. // Create room space in interface
  37. if (!roomExists(data.room)) {
  38. addRoomTab(data.room);
  39. addRoom(data.room);
  40. }
  41. // Close modal if opened
  42. $('#modal_joinroom').modal('hide');
  43. });
  44. // Unsubscription to room confirmed
  45. socket.on('unsubscriptionConfirmed', function(data) {
  46. // Remove room space in interface
  47. if (roomExists(data.room)) {
  48. removeRoomTab(data.room);
  49. removeRoom(data.room);
  50. }
  51. });
  52. // User joins room
  53. socket.on('userJoinsRoom', function(data) {
  54. console.log("userJoinsRoom: %s", JSON.stringify(data));
  55. // Log join in conversation
  56. addMessage(data);
  57. // Add user to connected users list
  58. addUser(data);
  59. });
  60. // User leaves room
  61. socket.on('userLeavesRoom', function(data) {
  62. console.log("userLeavesRoom: %s", JSON.stringify(data));
  63. // Log leave in conversation
  64. addMessage(data);
  65. // Remove user from connected users list
  66. removeUser(data);
  67. });
  68. // Message received
  69. socket.on('newMessage', function (data) {
  70. console.log("newMessage: %s", JSON.stringify(data));
  71. addMessage(data);
  72. // Scroll down room messages
  73. var room_messages = '#'+data.room+' #room_messages';
  74. $(room_messages).animate({
  75. scrollTop: $(room_messages).height()
  76. }, 300);
  77. });
  78. // Users in room received
  79. socket.on('usersInRoom', function(data) {
  80. console.log('usersInRoom: %s', JSON.stringify(data));
  81. _.each(data.users, function(user) {
  82. addUser(user);
  83. });
  84. });
  85. // User nickname updated
  86. socket.on('userNicknameUpdated', function(data) {
  87. console.log("userNicknameUpdated: %s", JSON.stringify(data));
  88. updateNickname(data);
  89. msg = '----- ' + data.oldUsername + ' is now ' + data.newUsername + ' -----';
  90. var info = {'room':data.room, 'username':'Radio-bot', 'msg':msg};
  91. addMessage(info);
  92. });
  93. // ***************************************************************************
  94. // Templates and helpers
  95. // ***************************************************************************
  96. var templates = {};
  97. var getTemplate = function(path, callback) {
  98. var source;
  99. var template;
  100. // Check first if we've the template cached
  101. if (_.has(templates, path)) {
  102. if (callback) callback(templates[path]);
  103. // If not we get and compile it
  104. } else {
  105. $.ajax({
  106. url: path,
  107. success: function(data) {
  108. source = data;
  109. template = Handlebars.compile(source);
  110. // Store compiled template in cache
  111. templates[path] = template;
  112. if (callback) callback(template);
  113. }
  114. });
  115. }
  116. }
  117. // Add room tab
  118. var addRoomTab = function(room) {
  119. getTemplate('js/templates/room_tab.handlebars', function(template) {
  120. $('#rooms_tabs').append(template({'room':room}));
  121. });
  122. };
  123. // Remove room tab
  124. var removeRoomTab = function(room) {
  125. var tab_id = "#"+room+"_tab";
  126. $(tab_id).remove();
  127. };
  128. // Add room
  129. var addRoom = function(room) {
  130. getTemplate('js/templates/room.handlebars', function(template) {
  131. $('#rooms').append(template({'room':room}));
  132. // Toogle to created room
  133. var newroomtab = '[href="#'+room+'"]';
  134. $(newroomtab).click();
  135. // Get users connected to room
  136. socket.emit('getUsersInRoom', {'room':room});
  137. });
  138. };
  139. // Remove room
  140. var removeRoom = function(room) {
  141. var room_id = "#"+room;
  142. $(room_id).remove();
  143. };
  144. // Add message to room
  145. var addMessage = function(msg) {
  146. getTemplate('js/templates/message.handlebars', function(template) {
  147. var room_messages = '#'+msg.room+' #room_messages';
  148. $(room_messages).append(template(msg));
  149. });
  150. };
  151. // Add user to connected users list
  152. var addUser = function(user) {
  153. getTemplate('js/templates/user.handlebars', function(template) {
  154. var room_users = '#'+user.room+' #room_users';
  155. // Add only if it doesn't exist in the room
  156. var user_badge = '#'+user.room+' #'+user.id;
  157. if (!($(user_badge).length)) {
  158. $(room_users).append(template(user));
  159. }
  160. });
  161. }
  162. // Remove user from connected users list
  163. var removeUser = function(user) {
  164. var user_badge = '#'+user.room+' #'+user.id;
  165. $(user_badge).remove();
  166. };
  167. // Check if room exists
  168. var roomExists = function(room) {
  169. var room_selector = '#'+room;
  170. if ($(room_selector).length) {
  171. return true;
  172. } elseĀ {
  173. return false;
  174. }
  175. };
  176. // Get current room
  177. var getCurrentRoom = function() {
  178. return $('li[id$="_tab"][class="active"]').text();
  179. };
  180. // Get message text from input field
  181. var getMessageText = function() {
  182. var text = $('#message_text').val();
  183. $('#message_text').val("");
  184. return text;
  185. };
  186. // Get room name from input field
  187. var getRoomName = function() {
  188. var name = $('#room_name').val().trim();
  189. $('#room_name').val("");
  190. return name;
  191. };
  192. // Get nickname from input field
  193. var getNickname = function() {
  194. var nickname = $('#nickname').val();
  195. $('#nickname').val("");
  196. return nickname;
  197. };
  198. // Update nickname in badges
  199. var updateNickname = function(data) {
  200. var badges = '#'+data.room+' #'+data.id;
  201. $(badges).text(data.newUsername);
  202. };
  203. // ***************************************************************************
  204. // Events
  205. // ***************************************************************************
  206. // Send new message
  207. $('#b_send_message').click(function(eventObject) {
  208. eventObject.preventDefault();
  209. if ($('#message_text').val() != "") {
  210. socket.emit('newMessage', {'room':getCurrentRoom(), 'msg':getMessageText()});
  211. }
  212. });
  213. // Join new room
  214. $('#b_join_room').click(function(eventObject) {
  215. var roomName = getRoomName();
  216. if (roomName) {
  217. eventObject.preventDefault();
  218. socket.emit('subscribe', {'rooms':[roomName]});
  219. // Added error class if empty room name
  220. } else {
  221. $('#room_name').addClass('error');
  222. }
  223. });
  224. // Leave current room
  225. $('#b_leave_room').click(function(eventObject) {
  226. eventObject.preventDefault();
  227. var currentRoom = getCurrentRoom();
  228. if (currentRoom != 'Lobby') {
  229. socket.emit('unsubscribe', {'rooms':[getCurrentRoom()]});
  230. // Toogle to MainRoom
  231. $('[href="#Lobby"]').click();
  232. } else {
  233. console.log('Cannot leave Lobby, sorry');
  234. }
  235. });
  236. // Remove error style to hide modal
  237. $('#modal_joinroom').on('hidden.bs.modal', function (e) {
  238. if ($('#room_name').hasClass('error')) {
  239. $('#room_name').removeClass('error');
  240. }
  241. });
  242. // Set nickname
  243. $('#b_set_nickname').click(function(eventObject) {
  244. eventObject.preventDefault();
  245. socket.emit('setNickname', {'username':getNickname()});
  246. // Close modal if opened
  247. $('#modal_setnick').modal('hide');
  248. });
  249. })();
  250. /*!
  251. * jQuery Color Animations v@VERSION
  252. * https://github.com/jquery/jquery-color
  253. *
  254. * Copyright jQuery Foundation and other contributors
  255. * Released under the MIT license.
  256. * http://jquery.org/license
  257. *
  258. * Date: @DATE
  259. */
  260. (function( jQuery, undefined ) {
  261. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  262. // plusequals test for += 100 -= 100
  263. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  264. // a set of RE's that can match strings and generate color tuples.
  265. stringParsers = [{
  266. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  267. parse: function( execResult ) {
  268. return [
  269. execResult[ 1 ],
  270. execResult[ 2 ],
  271. execResult[ 3 ],
  272. execResult[ 4 ]
  273. ];
  274. }
  275. }, {
  276. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  277. parse: function( execResult ) {
  278. return [
  279. execResult[ 1 ] * 2.55,
  280. execResult[ 2 ] * 2.55,
  281. execResult[ 3 ] * 2.55,
  282. execResult[ 4 ]
  283. ];
  284. }
  285. }, {
  286. // this regex ignores A-F because it's compared against an already lowercased string
  287. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  288. parse: function( execResult ) {
  289. return [
  290. parseInt( execResult[ 1 ], 16 ),
  291. parseInt( execResult[ 2 ], 16 ),
  292. parseInt( execResult[ 3 ], 16 )
  293. ];
  294. }
  295. }, {
  296. // this regex ignores A-F because it's compared against an already lowercased string
  297. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  298. parse: function( execResult ) {
  299. return [
  300. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  301. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  302. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  303. ];
  304. }
  305. }, {
  306. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  307. space: "hsla",
  308. parse: function( execResult ) {
  309. return [
  310. execResult[ 1 ],
  311. execResult[ 2 ] / 100,
  312. execResult[ 3 ] / 100,
  313. execResult[ 4 ]
  314. ];
  315. }
  316. }],
  317. // jQuery.Color( )
  318. color = jQuery.Color = function( color, green, blue, alpha ) {
  319. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  320. },
  321. spaces = {
  322. rgba: {
  323. props: {
  324. red: {
  325. idx: 0,
  326. type: "byte"
  327. },
  328. green: {
  329. idx: 1,
  330. type: "byte"
  331. },
  332. blue: {
  333. idx: 2,
  334. type: "byte"
  335. }
  336. }
  337. },
  338. hsla: {
  339. props: {
  340. hue: {
  341. idx: 0,
  342. type: "degrees"
  343. },
  344. saturation: {
  345. idx: 1,
  346. type: "percent"
  347. },
  348. lightness: {
  349. idx: 2,
  350. type: "percent"
  351. }
  352. }
  353. }
  354. },
  355. propTypes = {
  356. "byte": {
  357. floor: true,
  358. max: 255
  359. },
  360. "percent": {
  361. max: 1
  362. },
  363. "degrees": {
  364. mod: 360,
  365. floor: true
  366. }
  367. },
  368. support = color.support = {},
  369. // element for support tests
  370. supportElem = jQuery( "<p>" )[ 0 ],
  371. // colors = jQuery.Color.names
  372. colors,
  373. // local aliases of functions called often
  374. each = jQuery.each;
  375. // determine rgba support immediately
  376. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  377. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  378. // define cache name and alpha properties
  379. // for rgba and hsla spaces
  380. each( spaces, function( spaceName, space ) {
  381. space.cache = "_" + spaceName;
  382. space.props.alpha = {
  383. idx: 3,
  384. type: "percent",
  385. def: 1
  386. };
  387. });
  388. function clamp( value, prop, allowEmpty ) {
  389. var type = propTypes[ prop.type ] || {};
  390. if ( value == null ) {
  391. return (allowEmpty || !prop.def) ? null : prop.def;
  392. }
  393. // ~~ is an short way of doing floor for positive numbers
  394. value = type.floor ? ~~value : parseFloat( value );
  395. // IE will pass in empty strings as value for alpha,
  396. // which will hit this case
  397. if ( isNaN( value ) ) {
  398. return prop.def;
  399. }
  400. if ( type.mod ) {
  401. // we add mod before modding to make sure that negatives values
  402. // get converted properly: -10 -> 350
  403. return (value + type.mod) % type.mod;
  404. }
  405. // for now all property types without mod have min and max
  406. return 0 > value ? 0 : type.max < value ? type.max : value;
  407. }
  408. function stringParse( string ) {
  409. var inst = color(),
  410. rgba = inst._rgba = [];
  411. string = string.toLowerCase();
  412. each( stringParsers, function( i, parser ) {
  413. var parsed,
  414. match = parser.re.exec( string ),
  415. values = match && parser.parse( match ),
  416. spaceName = parser.space || "rgba";
  417. if ( values ) {
  418. parsed = inst[ spaceName ]( values );
  419. // if this was an rgba parse the assignment might happen twice
  420. // oh well....
  421. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  422. rgba = inst._rgba = parsed._rgba;
  423. // exit each( stringParsers ) here because we matched
  424. return false;
  425. }
  426. });
  427. // Found a stringParser that handled it
  428. if ( rgba.length ) {
  429. // if this came from a parsed string, force "transparent" when alpha is 0
  430. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  431. if ( rgba.join() === "0,0,0,0" ) {
  432. jQuery.extend( rgba, colors.transparent );
  433. }
  434. return inst;
  435. }
  436. // named colors
  437. return colors[ string ];
  438. }
  439. color.fn = jQuery.extend( color.prototype, {
  440. parse: function( red, green, blue, alpha ) {
  441. if ( red === undefined ) {
  442. this._rgba = [ null, null, null, null ];
  443. return this;
  444. }
  445. if ( red.jquery || red.nodeType ) {
  446. red = jQuery( red ).css( green );
  447. green = undefined;
  448. }
  449. var inst = this,
  450. type = jQuery.type( red ),
  451. rgba = this._rgba = [];
  452. // more than 1 argument specified - assume ( red, green, blue, alpha )
  453. if ( green !== undefined ) {
  454. red = [ red, green, blue, alpha ];
  455. type = "array";
  456. }
  457. if ( type === "string" ) {
  458. return this.parse( stringParse( red ) || colors._default );
  459. }
  460. if ( type === "array" ) {
  461. each( spaces.rgba.props, function( key, prop ) {
  462. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  463. });
  464. return this;
  465. }
  466. if ( type === "object" ) {
  467. if ( red instanceof color ) {
  468. each( spaces, function( spaceName, space ) {
  469. if ( red[ space.cache ] ) {
  470. inst[ space.cache ] = red[ space.cache ].slice();
  471. }
  472. });
  473. } else {
  474. each( spaces, function( spaceName, space ) {
  475. var cache = space.cache;
  476. each( space.props, function( key, prop ) {
  477. // if the cache doesn't exist, and we know how to convert
  478. if ( !inst[ cache ] && space.to ) {
  479. // if the value was null, we don't need to copy it
  480. // if the key was alpha, we don't need to copy it either
  481. if ( key === "alpha" || red[ key ] == null ) {
  482. return;
  483. }
  484. inst[ cache ] = space.to( inst._rgba );
  485. }
  486. // this is the only case where we allow nulls for ALL properties.
  487. // call clamp with alwaysAllowEmpty
  488. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  489. });
  490. // everything defined but alpha?
  491. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  492. // use the default of 1
  493. inst[ cache ][ 3 ] = 1;
  494. if ( space.from ) {
  495. inst._rgba = space.from( inst[ cache ] );
  496. }
  497. }
  498. });
  499. }
  500. return this;
  501. }
  502. },
  503. is: function( compare ) {
  504. var is = color( compare ),
  505. same = true,
  506. inst = this;
  507. each( spaces, function( _, space ) {
  508. var localCache,
  509. isCache = is[ space.cache ];
  510. if (isCache) {
  511. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  512. each( space.props, function( _, prop ) {
  513. if ( isCache[ prop.idx ] != null ) {
  514. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  515. return same;
  516. }
  517. });
  518. }
  519. return same;
  520. });
  521. return same;
  522. },
  523. _space: function() {
  524. var used = [],
  525. inst = this;
  526. each( spaces, function( spaceName, space ) {
  527. if ( inst[ space.cache ] ) {
  528. used.push( spaceName );
  529. }
  530. });
  531. return used.pop();
  532. },
  533. transition: function( other, distance ) {
  534. var end = color( other ),
  535. spaceName = end._space(),
  536. space = spaces[ spaceName ],
  537. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  538. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  539. result = start.slice();
  540. end = end[ space.cache ];
  541. each( space.props, function( key, prop ) {
  542. var index = prop.idx,
  543. startValue = start[ index ],
  544. endValue = end[ index ],
  545. type = propTypes[ prop.type ] || {};
  546. // if null, don't override start value
  547. if ( endValue === null ) {
  548. return;
  549. }
  550. // if null - use end
  551. if ( startValue === null ) {
  552. result[ index ] = endValue;
  553. } else {
  554. if ( type.mod ) {
  555. if ( endValue - startValue > type.mod / 2 ) {
  556. startValue += type.mod;
  557. } else if ( startValue - endValue > type.mod / 2 ) {
  558. startValue -= type.mod;
  559. }
  560. }
  561. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  562. }
  563. });
  564. return this[ spaceName ]( result );
  565. },
  566. blend: function( opaque ) {
  567. // if we are already opaque - return ourself
  568. if ( this._rgba[ 3 ] === 1 ) {
  569. return this;
  570. }
  571. var rgb = this._rgba.slice(),
  572. a = rgb.pop(),
  573. blend = color( opaque )._rgba;
  574. return color( jQuery.map( rgb, function( v, i ) {
  575. return ( 1 - a ) * blend[ i ] + a * v;
  576. }));
  577. },
  578. toRgbaString: function() {
  579. var prefix = "rgba(",
  580. rgba = jQuery.map( this._rgba, function( v, i ) {
  581. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  582. });
  583. if ( rgba[ 3 ] === 1 ) {
  584. rgba.pop();
  585. prefix = "rgb(";
  586. }
  587. return prefix + rgba.join() + ")";
  588. },
  589. toHslaString: function() {
  590. var prefix = "hsla(",
  591. hsla = jQuery.map( this.hsla(), function( v, i ) {
  592. if ( v == null ) {
  593. v = i > 2 ? 1 : 0;
  594. }
  595. // catch 1 and 2
  596. if ( i && i < 3 ) {
  597. v = Math.round( v * 100 ) + "%";
  598. }
  599. return v;
  600. });
  601. if ( hsla[ 3 ] === 1 ) {
  602. hsla.pop();
  603. prefix = "hsl(";
  604. }
  605. return prefix + hsla.join() + ")";
  606. },
  607. toHexString: function( includeAlpha ) {
  608. var rgba = this._rgba.slice(),
  609. alpha = rgba.pop();
  610. if ( includeAlpha ) {
  611. rgba.push( ~~( alpha * 255 ) );
  612. }
  613. return "#" + jQuery.map( rgba, function( v ) {
  614. // default to 0 when nulls exist
  615. v = ( v || 0 ).toString( 16 );
  616. return v.length === 1 ? "0" + v : v;
  617. }).join("");
  618. },
  619. toString: function() {
  620. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  621. }
  622. });
  623. color.fn.parse.prototype = color.fn;
  624. // hsla conversions adapted from:
  625. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  626. function hue2rgb( p, q, h ) {
  627. h = ( h + 1 ) % 1;
  628. if ( h * 6 < 1 ) {
  629. return p + (q - p) * h * 6;
  630. }
  631. if ( h * 2 < 1) {
  632. return q;
  633. }
  634. if ( h * 3 < 2 ) {
  635. return p + (q - p) * ((2/3) - h) * 6;
  636. }
  637. return p;
  638. }
  639. spaces.hsla.to = function ( rgba ) {
  640. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  641. return [ null, null, null, rgba[ 3 ] ];
  642. }
  643. var r = rgba[ 0 ] / 255,
  644. g = rgba[ 1 ] / 255,
  645. b = rgba[ 2 ] / 255,
  646. a = rgba[ 3 ],
  647. max = Math.max( r, g, b ),
  648. min = Math.min( r, g, b ),
  649. diff = max - min,
  650. add = max + min,
  651. l = add * 0.5,
  652. h, s;
  653. if ( min === max ) {
  654. h = 0;
  655. } else if ( r === max ) {
  656. h = ( 60 * ( g - b ) / diff ) + 360;
  657. } else if ( g === max ) {
  658. h = ( 60 * ( b - r ) / diff ) + 120;
  659. } else {
  660. h = ( 60 * ( r - g ) / diff ) + 240;
  661. }
  662. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  663. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  664. if ( diff === 0 ) {
  665. s = 0;
  666. } else if ( l <= 0.5 ) {
  667. s = diff / add;
  668. } else {
  669. s = diff / ( 2 - add );
  670. }
  671. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  672. };
  673. spaces.hsla.from = function ( hsla ) {
  674. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  675. return [ null, null, null, hsla[ 3 ] ];
  676. }
  677. var h = hsla[ 0 ] / 360,
  678. s = hsla[ 1 ],
  679. l = hsla[ 2 ],
  680. a = hsla[ 3 ],
  681. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  682. p = 2 * l - q;
  683. return [
  684. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  685. Math.round( hue2rgb( p, q, h ) * 255 ),
  686. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  687. a
  688. ];
  689. };
  690. each( spaces, function( spaceName, space ) {
  691. var props = space.props,
  692. cache = space.cache,
  693. to = space.to,
  694. from = space.from;
  695. // makes rgba() and hsla()
  696. color.fn[ spaceName ] = function( value ) {
  697. // generate a cache for this space if it doesn't exist
  698. if ( to && !this[ cache ] ) {
  699. this[ cache ] = to( this._rgba );
  700. }
  701. if ( value === undefined ) {
  702. return this[ cache ].slice();
  703. }
  704. var ret,
  705. type = jQuery.type( value ),
  706. arr = ( type === "array" || type === "object" ) ? value : arguments,
  707. local = this[ cache ].slice();
  708. each( props, function( key, prop ) {
  709. var val = arr[ type === "object" ? key : prop.idx ];
  710. if ( val == null ) {
  711. val = local[ prop.idx ];
  712. }
  713. local[ prop.idx ] = clamp( val, prop );
  714. });
  715. if ( from ) {
  716. ret = color( from( local ) );
  717. ret[ cache ] = local;
  718. return ret;
  719. } else {
  720. return color( local );
  721. }
  722. };
  723. // makes red() green() blue() alpha() hue() saturation() lightness()
  724. each( props, function( key, prop ) {
  725. // alpha is included in more than one space
  726. if ( color.fn[ key ] ) {
  727. return;
  728. }
  729. color.fn[ key ] = function( value ) {
  730. var vtype = jQuery.type( value ),
  731. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  732. local = this[ fn ](),
  733. cur = local[ prop.idx ],
  734. match;
  735. if ( vtype === "undefined" ) {
  736. return cur;
  737. }
  738. if ( vtype === "function" ) {
  739. value = value.call( this, cur );
  740. vtype = jQuery.type( value );
  741. }
  742. if ( value == null && prop.empty ) {
  743. return this;
  744. }
  745. if ( vtype === "string" ) {
  746. match = rplusequals.exec( value );
  747. if ( match ) {
  748. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  749. }
  750. }
  751. local[ prop.idx ] = value;
  752. return this[ fn ]( local );
  753. };
  754. });
  755. });
  756. // add cssHook and .fx.step function for each named hook.
  757. // accept a space separated string of properties
  758. color.hook = function( hook ) {
  759. var hooks = hook.split( " " );
  760. each( hooks, function( i, hook ) {
  761. jQuery.cssHooks[ hook ] = {
  762. set: function( elem, value ) {
  763. var parsed, curElem,
  764. backgroundColor = "";
  765. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  766. value = color( parsed || value );
  767. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  768. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  769. while (
  770. (backgroundColor === "" || backgroundColor === "transparent") &&
  771. curElem && curElem.style
  772. ) {
  773. try {
  774. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  775. curElem = curElem.parentNode;
  776. } catch ( e ) {
  777. }
  778. }
  779. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  780. backgroundColor :
  781. "_default" );
  782. }
  783. value = value.toRgbaString();
  784. }
  785. try {
  786. elem.style[ hook ] = value;
  787. } catch( e ) {
  788. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  789. }
  790. }
  791. };
  792. jQuery.fx.step[ hook ] = function( fx ) {
  793. if ( !fx.colorInit ) {
  794. fx.start = color( fx.elem, hook );
  795. fx.end = color( fx.end );
  796. fx.colorInit = true;
  797. }
  798. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  799. };
  800. });
  801. };
  802. color.hook( stepHooks );
  803. jQuery.cssHooks.borderColor = {
  804. expand: function( value ) {
  805. var expanded = {};
  806. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  807. expanded[ "border" + part + "Color" ] = value;
  808. });
  809. return expanded;
  810. }
  811. };
  812. // Basic color names only.
  813. // Usage of any of the other color names requires adding yourself or including
  814. // jquery.color.svg-names.js.
  815. colors = jQuery.Color.names = {
  816. // 4.1. Basic color keywords
  817. aqua: "#00ffff",
  818. black: "#000000",
  819. blue: "#0000ff",
  820. fuchsia: "#ff00ff",
  821. gray: "#808080",
  822. green: "#008000",
  823. lime: "#00ff00",
  824. maroon: "#800000",
  825. navy: "#000080",
  826. olive: "#808000",
  827. purple: "#800080",
  828. red: "#ff0000",
  829. silver: "#c0c0c0",
  830. teal: "#008080",
  831. white: "#ffffff",
  832. yellow: "#ffff00",
  833. // 4.2.3. "transparent" color keyword
  834. transparent: [ null, null, null, 0 ],
  835. _default: "#ffffff"
  836. };
  837. }( jQuery ));
  838. /* Radio Funtions */
  839. /*
  840. Version: 1.1
  841. Author: Dan Pastori
  842. Company: 521 Dimensions
  843. */
  844. function hook_amplitude_functions(e){var a=window.onload;window.onload="function"!=typeof window.onload?e:function(){a&&a(),e()}}function amplitude_configure_variables(){amplitude_active_config.amplitude_active_song=new Audio,amplitude_bind_time_update(),void 0!=amplitude_config.amplitude_songs&&(amplitude_active_config.amplitude_songs=amplitude_config.amplitude_songs),void 0!=amplitude_config.amplitude_volume&&(amplitude_active_config.amplitude_volume=amplitude_config.amplitude_volume/100,amplitude_active_config.amplitude_pre_mute_volume=amplitude_config.amplitude_volume/100,document.getElementById("amplitude-volume-slider")&&(document.getElementById("amplitude-volume-slider").value=100*amplitude_active_config.amplitude_volume),amplitude_active_config.amplitude_active_song.volume=amplitude_active_config.amplitude_volume),void 0!=amplitude_config.amplitude_pre_mute_volume&&(amplitude_active_config.amplitude_pre_mute_volume=amplitude_config.amplitude_pre_mute_volume),void 0!=amplitude_config.amplitude_auto_play&&(amplitude_active_config.amplitude_auto_play=amplitude_config.amplitude_auto_play),void 0!=amplitude_config.amplitude_start_song&&(amplitude_active_config.amplitude_start_song=amplitude_config.amplitude_start_song),void 0!=amplitude_config.amplitude_before_play_callback&&(amplitude_active_config.amplitude_before_play_callback=amplitude_config.amplitude_before_play_callback),void 0!=amplitude_config.amplitude_after_play_callback&&(amplitude_active_config.amplitude_after_play_callback=amplitude_config.amplitude_after_play_callback),void 0!=amplitude_config.amplitude_before_stop_callback&&(amplitude_active_config.amplitude_before_stop_callback=amplitude_config.amplitude_before_stop_callback),void 0!=amplitude_config.amplitude_after_stop_callback&&(amplitude_active_config.amplitude_after_stop_callback=amplitude_config.amplitude_after_stop_callback),void 0!=amplitude_config.amplitude_before_next_callback&&(amplitude_active_config.amplitude_before_next_callback=amplitude_config.amplitude_before_next_callback),void 0!=amplitude_config.amplitude_after_next_callback&&(amplitude_active_config.amplitude_after_next_callback=amplitude_config.amplitude_after_next_callback),void 0!=amplitude_config.amplitude_before_prev_callback&&(amplitude_active_config.amplitude_before_prev_callback=amplitude_config.amplitude_before_prev_callback),void 0!=amplitude_config.amplitude_after_prev_callback&&(amplitude_active_config.amplitude_after_prev_callback=amplitude_config.amplitude_after_prev_callback),void 0!=amplitude_config.amplitude_after_pause_callback&&(amplitude_active_config.amplitude_after_pause_callback=amplitude_config.amplitude_after_pause_callback),void 0!=amplitude_config.amplitude_before_pause_callback&&(amplitude_active_config.amplitude_before_pause_callback=amplitude_config.amplitude_before_pause_callback),void 0!=amplitude_config.amplitude_after_shuffle_callback&&(amplitude_active_config.amplitude_after_shuffle_callback=amplitude_config.amplitude_after_shuffle_callback),void 0!=amplitude_config.amplitude_before_shuffle_callback&&(amplitude_active_config.amplitude_before_shuffle_callback=amplitude_config.amplitude_before_shuffle_callback),void 0!=amplitude_config.amplitude_before_volume_change_callback&&(amplitude_active_config.amplitude_before_volume_change_callback=amplitude_config.amplitude_before_volume_change_callback),void 0!=amplitude_config.amplitude_after_volume_change_callback&&(amplitude_active_config.amplitude_after_volume_change_callback=amplitude_config.amplitude_after_volume_change_callback),void 0!=amplitude_config.amplitude_before_mute_callback&&(amplitude_active_config.amplitude_before_mute_callback=amplitude_config.amplitude_before_mute_callback),void 0!=amplitude_config.amplitude_after_mute_callback&&(amplitude_active_config.amplitude_after_mute_callback=amplitude_config.amplitude_after_mute_callback),void 0!=amplitude_config.amplitude_before_time_update_callback&&(amplitude_active_config.amplitude_before_time_update_callback=amplitude_config.amplitude_before_time_update_callback),void 0!=amplitude_config.amplitude_after_time_update_callback&&(amplitude_active_config.amplitude_after_time_update_callback=amplitude_config.amplitude_after_time_update_callback),void 0!=amplitude_config.amplitude_before_song_information_set_callback&&(amplitude_active_config.amplitude_before_song_information_set_callback=amplitude_config.amplitude_before_song_information_set_callback),void 0!=amplitude_config.amplitude_after_song_information_set_callback&&(amplitude_active_config.amplitude_after_song_information_set_callback=amplitude_config.amplitude_after_song_information_set_callback),void 0!=amplitude_config.amplitude_before_song_added_callback&&(amplitude_active_config.amplitude_before_song_added_callback=amplitude_config.amplitude_before_song_added_callback),void 0!=amplitude_config.amplitude_after_song_added_callback&&(amplitude_active_config.amplitude_after_song_added_callback=amplitude_config.amplitude_after_song_added_callback),void 0!=amplitude_config.amplitude_volume_up_amount&&(amplitude_active_config.amplitude_volume_up_amount=amplitude_config.amplitude_volume_up_amount),void 0!=amplitude_config.amplitude_volume_down_amount&&(amplitude_active_config.amplitude_volume_down_amount=amplitude_config.amplitude_volume_down_amount),void 0!=amplitude_config.amplitude_continue_next&&(amplitude_active_config.amplitude_continue_next=amplitude_config.amplitude_continue_next),null!=amplitude_active_config.amplitude_start_song?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[amplitude_active_config.amplitude_start_song].url,amplitude_set_active_song_information(amplitude_active_config.amplitude_songs[amplitude_active_config.amplitude_start_song]),amplitude_active_config.amplitude_list_playing_index=amplitude_active_config.amplitude_start_song,"undefined"==amplitude_active_config.amplitude_start_song.live&&(amplitude_active_config.amplitude_start_song.live=!1)):0!=amplitude_active_config.amplitude_songs.length?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[0].url,amplitude_set_active_song_information(amplitude_active_config.amplitude_songs[0]),amplitude_active_config.amplitude_list_playing_index=0):console.log("Please define a an array of songs!"),amplitude_bind_song_additions()}function amplitude_web_desktop(){document.getElementById("amplitude-play")&&document.getElementById("amplitude-play").addEventListener("click",function(){amplitude_play_song()}),document.getElementById("amplitude-stop")&&document.getElementById("amplitude-stop").addEventListener("click",function(){amplitude_stop_song()}),document.getElementById("amplitude-pause")&&document.getElementById("amplitude-pause").addEventListener("click",function(){amplitude_pause_song()}),document.getElementById("amplitude-play-pause")&&document.getElementById("amplitude-play-pause").addEventListener("click",function(){if(amplitude_active_config.amplitude_active_song.paused){var e=" amplitude-playing";this.className=this.className.replace("amplitude-paused",""),this.className=this.className.replace(e,""),this.className=this.className+e}else{var e=" amplitude-paused";this.className=this.className.replace("amplitude-playing",""),this.className=this.className.replace(e,""),this.className=this.className+e}amplitude_play_pause()}),document.getElementById("amplitude-mute")&&document.getElementById("amplitude-mute").addEventListener("click",function(){amplitude_mute()}),document.getElementById("amplitude-shuffle")&&(document.getElementById("amplitude-shuffle").classList.add("amplitude-shuffle-off"),document.getElementById("amplitude-shuffle").addEventListener("click",function(){amplitude_active_config.amplitude_shuffle?(this.classList.add("amplitude-shuffle-off"),this.classList.remove("amplitude-shuffle-on")):(this.classList.add("amplitude-shuffle-on"),this.classList.remove("amplitude-shuffle-off")),amplitude_shuffle_playlist()})),document.getElementById("amplitude-next")&&document.getElementById("amplitude-next").addEventListener("click",function(){amplitude_next_song()}),document.getElementById("amplitude-previous")&&document.getElementById("amplitude-previous").addEventListener("click",function(){amplitude_previous_song()}),document.getElementById("amplitude-song-slider")&&document.getElementById("amplitude-song-slider").addEventListener("input",amplitude_handle_song_sliders),document.getElementById("amplitude-volume-slider")&&document.getElementById("amplitude-volume-slider").addEventListener("input",function(){amplitude_volume_update(this.value)}),document.getElementById("amplitude-volume-up")&&document.getElementById("amplitude-volume-up").addEventListener("click",function(){amplitude_change_volume("up")}),document.getElementById("amplitude-volume-down")&&document.getElementById("amplitude-volume-down").addEventListener("click",function(){amplitude_change_volume("down")}),amplitude_active_config.amplitude_continue_next&&amplitude_active_config.amplitude_active_song.addEventListener("ended",function(){amplitude_next_song()});for(var e=document.getElementsByClassName("amplitude-play-pause"),a=0;a<e.length;a++)e[a].addEventListener("click",amplitude_handle_play_pause_classes);for(var i=document.getElementsByClassName("amplitude-song-slider"),a=0;a<i.length;a++)i[a].addEventListener("input",amplitude_handle_song_sliders)}function amplitude_web_mobile(){document.getElementById("amplitude-play")&&document.getElementById("amplitude-play").addEventListener("touchstart",function(){amplitude_play_song()}),document.getElementById("amplitude-stop")&&document.getElementById("amplitude-stop").addEventListener("touchstart",function(){amplitude_stop_song()}),document.getElementById("amplitude-pause")&&document.getElementById("amplitude-pause").addEventListener("touchstart",function(){amplitude_pause_song()}),document.getElementById("amplitude-play-pause")&&document.getElementById("amplitude-play-pause").addEventListener("touchstart",function(){if(amplitude_active_config.amplitude_active_song.paused){var e=" amplitude-playing";this.className=this.className.replace("amplitude-paused",""),this.className=this.className.replace(e,""),this.className=this.className+e}else{var e=" amplitude-paused";this.className=this.className.replace("amplitude-playing",""),this.className=this.className.replace(e,""),this.className=this.className+e}amplitude_play_pause()}),document.getElementById("amplitude-mute")&&(/iPhone|iPad|iPod/i.test(navigator.userAgent)?console.log("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4"):document.getElementById("amplitude-mute").addEventListener("touchstart",function(){amplitude_mute()})),document.getElementById("amplitude-shuffle")&&(document.getElementById("amplitude-shuffle").classList.add("amplitude-shuffle-off"),document.getElementById("amplitude-shuffle").addEventListener("touchstart",function(){amplitude_active_config.amplitude_shuffle?(this.classList.add("amplitude-shuffle-off"),this.classList.remove("amplitude-shuffle-on")):(this.classList.add("amplitude-shuffle-on"),this.classList.remove("amplitude-shuffle-off")),amplitude_shuffle_playlist()})),document.getElementById("amplitude-next")&&document.getElementById("amplitude-next").addEventListener("touchstart",function(){amplitude_next_song()}),document.getElementById("amplitude-previous")&&document.getElementById("amplitude-previous").addEventListener("touchstart",function(){amplitude_previous_song()}),document.getElementById("amplitude-song-slider")&&document.getElementById("amplitude-song-slider").addEventListener("input",amplitude_handle_song_sliders),document.getElementById("amplitude-volume-slider")&&(/iPhone|iPad|iPod/i.test(navigator.userAgent)?console.log("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4"):document.getElementById("amplitude-volume-slider").addEventListener("input",function(){amplitude_volume_update(this.value)})),document.getElementById("amplitude-volume-up")&&(/iPhone|iPad|iPod/i.test(navigator.userAgent)?console.log("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4"):document.getElementById("amplitude-volume-up").addEventListener("touchstart",function(){amplitude_change_volume("up")})),document.getElementById("amplitude-volume-down")&&(/iPhone|iPad|iPod/i.test(navigator.userAgent)?console.log("iOS does NOT allow volume to be set through javascript: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW4"):document.getElementById("amplitude-volume-down").addEventListener("touchstart",function(){amplitude_change_volume("down")})),amplitude_active_config.amplitude_continue_next&&amplitude_active_config.amplitude_active_song.addEventListener("ended",function(){amplitude_next_song()});for(var e=document.getElementsByClassName("amplitude-play-pause"),a=0;a<e.length;a++)e[a].addEventListener("touchstart",amplitude_handle_play_pause_classes);for(var i=document.getElementsByClassName("amplitude-song-slider"),a=0;a<i.length;a++)i[a].addEventListener("input",amplitude_handle_song_sliders)}function amplitude_start(){document.getElementById("amplitude-song-time-visualization")&&(document.getElementById("amplitude-song-time-visualization").innerHTML='<div id="amplitude-song-time-visualization-status"></div>',document.getElementById("amplitude-song-time-visualization-status").setAttribute("style","width:0px")),amplitude_active_config.amplitude_auto_play&&amplitude_play_pause()}function amplitude_play_song(){if(amplitude_active_config.amplitude_before_play_callback){var e=window[amplitude_active_config.amplitude_before_play_callback];e()}"undefined"!=amplitude_active_config.amplitude_active_song_information.live&&amplitude_active_config.amplitude_active_song_information.live&&amplitude_reconnect_stream();for(var a=document.getElementsByClassName("amplitude-song-slider"),i=0;i<a.length;i++)a[i].getAttribute("amplitude-song-slider-index")!=amplitude_active_config.amplitude_list_playing_index&&(a[i].value=0);if(amplitude_active_config.amplitude_active_song.play(),amplitude_set_song_info(),amplitude_active_config.amplitude_after_play_callback){var t=window[amplitude_active_config.amplitude_after_play_callback];t()}}function amplitude_stop_song(){if(amplitude_active_config.amplitude_before_stop_callback){var e=window[amplitude_active_config.amplitude_before_stop_callback];e()}if(amplitude_active_config.amplitude_active_song.currentTime=0,amplitude_active_config.amplitude_active_song.pause(),"undefined"!=typeof amplitude_active_config.amplitude_active_song.live&&amplitude_active_config.amplitude_active_song.live&&amplitude_disconnect_stream(),amplitude_active_config.amplitude_after_stop_callback){var a=window[amplitude_active_config.amplitude_after_stop_callback];a()}}function amplitude_pause_song(){if(amplitude_active_config.amplitude_before_pause_callback){var e=window[amplitude_active_config.amplitude_before_pause_callback];e()}if(amplitude_active_config.amplitude_active_song.pause(),amplitude_active_config.amplitude_active_song_information.live&&amplitude_disconnect_stream(),amplitude_active_config.amplitude_after_pause_callback){var a=window[amplitude_active_config.amplitude_active_pause_callback];a()}}function amplitude_play_pause(){if(amplitude_active_config.amplitude_active_song.paused){amplitude_play_song();var e=document.querySelector('[amplitude-song-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=e&&(e.classList.add("amplitude-list-playing"),e.classList.remove("amplitude-list-paused"))}else{amplitude_pause_song();var e=document.querySelector('[amplitude-song-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=e&&(e.classList.add("amplitude-list-paused"),e.classList.remove("amplitude-list-playing"))}}function amplitude_update_time(){if(amplitude_active_config.amplitude_before_time_update_callback){var e=window[amplitude_active_config.amplitude_before_time_update_callback];e()}var a=(Math.floor(amplitude_active_config.amplitude_active_song.currentTime%60)<10?"0":"")+Math.floor(amplitude_active_config.amplitude_active_song.currentTime%60),i=Math.floor(amplitude_active_config.amplitude_active_song.currentTime/60),t=Math.floor(amplitude_active_config.amplitude_active_song.duration/60),l=(Math.floor(amplitude_active_config.amplitude_active_song.duration%60)<10?"0":"")+Math.floor(amplitude_active_config.amplitude_active_song.duration%60);if(document.getElementById("amplitude-current-time")&&(document.getElementById("amplitude-current-time").innerHTML=i+":"+a),document.getElementById("amplitude-audio-duration")&&(isNaN(t)||(document.getElementById("amplitude-audio-duration").innerHTML=t+":"+l)),document.getElementById("amplitude-song-slider")&&(document.getElementById("amplitude-song-slider").value=amplitude_active_config.amplitude_active_song.currentTime/amplitude_active_config.amplitude_active_song.duration*100),document.getElementById("amplitude-song-time-visualization")){var _=document.getElementById("amplitude-song-time-visualization").offsetWidth;document.getElementById("amplitude-song-time-visualization-status").setAttribute("style","width:"+_*(amplitude_active_config.amplitude_active_song.currentTime/amplitude_active_config.amplitude_active_song.duration)+"px")}if(amplitude_active_config.amplitude_songs.length>1){var u=document.querySelector('[amplitude-song-slider-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=u&&(u.value=amplitude_active_config.amplitude_active_song.currentTime/amplitude_active_config.amplitude_active_song.duration*100);var d=document.querySelector('[amplitude-current-time-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=d&&(d.innerHTML=i+":"+a);var n=document.querySelector('[amplitude-audio-duration-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=n&&(isNaN(t)||(n.innerHTML=t+":"+l))}if(amplitude_active_config.amplitude_after_time_update_callback){var m=window[amplitude_active_config.amplitude_after_time_update_callback];m()}}function amplitude_volume_update(e){if(amplitude_active_config.amplitude_before_volume_change_callback){var a=window[amplitude_active_config.amplitude_before_volume_change_callback];a()}if(amplitude_active_config.amplitude_active_song.volume=e/100,amplitude_active_config.amplitude_volume=e/100,amplitude_active_config.amplitude_after_volume_change_callback){var i=window[amplitude_active_config.amplitude_after_volume_change_callback];i()}}function amplitude_change_volume(e){amplitude_active_config.amplitude_volume>=0&&"down"==e&&amplitude_volume_update(100*amplitude_active_config.amplitude_volume-amplitude_active_config.amplitude_volume_down_amount>0?100*amplitude_active_config.amplitude_volume-amplitude_active_config.amplitude_volume_down_amount:0),amplitude_active_config.amplitude_volume<=1&&"up"==e&&amplitude_volume_update(100*amplitude_active_config.amplitude_volume+amplitude_active_config.amplitude_volume_up_amount<100?100*amplitude_active_config.amplitude_volume+amplitude_active_config.amplitude_volume_up_amount:100),document.getElementById("amplitude-volume-slider")&&(document.getElementById("amplitude-volume-slider").value=100*amplitude_active_config.amplitude_volume)}function amplitude_set_active_song_information(e){if(amplitude_active_config.amplitude_before_song_information_set_callback){var a=window[amplitude_active_config.amplitude_before_song_information_set_callback];a()}if(amplitude_active_config.amplitude_active_song_information.song_title="undefined"!=e.name?e.name:"",amplitude_active_config.amplitude_active_song_information.artist="undefined"!=e.aritst?e.artist:"",amplitude_active_config.amplitude_active_song_information.cover_art_url="undefined"!=e.cover_art_url?e.cover_art_url:"",amplitude_active_config.amplitude_active_song_information.album="undefined"!=e.album?e.album:"",amplitude_active_config.amplitude_active_song_information.live="undefined"!=e.live?e.live:!1,amplitude_active_config.amplitude_active_song_information.url="undefined"!=e.url?e.url:"",amplitude_active_config.amplitude_active_song_information.visual_id="undefined"!=e.visual_id?e.visual_id:"",amplitude_active_song_information=amplitude_active_config.amplitude_active_song_information,amplitude_active_config.amplitude_after_song_information_set_callback){var i=window[amplitude_active_config.amplitude_after_song_information_set_callback];i()}}function amplitude_set_song_position(e){amplitude_active_config.amplitude_active_song.currentTime=amplitude_active_config.amplitude_active_song.duration*(e/100)}function amplitude_mute(){if(amplitude_active_config.amplitude_before_mute_callback){var e=window[amplitude_active_config.amplitude_before_mute_callback];e()}if(0==amplitude_active_config.amplitude_volume?amplitude_active_config.amplitude_volume=amplitude_active_config.amplitude_pre_mute_volume:(amplitude_active_config.amplitude_pre_mute_volume=amplitude_active_config.amplitude_volume,amplitude_active_config.amplitude_volume=0),amplitude_volume_update(100*amplitude_active_config.amplitude_volume),document.getElementById("amplitude-volume-slider")&&(document.getElementById("amplitude-volume-slider").value=100*amplitude_active_config.amplitude_volume),amplitude_active_config.amplitude_after_mute_callback){var a=window[amplitude_active_config.amplitude_after_mute_callback];a()}}function amplitude_set_song_info(){document.getElementById("amplitude-now-playing-artist")&&(document.getElementById("amplitude-now-playing-artist").innerHTML=amplitude_active_config.amplitude_active_song_information.artist),document.getElementById("amplitude-now-playing-title")&&(document.getElementById("amplitude-now-playing-title").innerHTML=amplitude_active_config.amplitude_active_song_information.song_title),document.getElementById("amplitude-now-playing-album")&&(document.getElementById("amplitude-now-playing-album").innerHTML=amplitude_active_config.amplitude_active_song_information.album),document.getElementById("amplitude-album-art")&&null!=amplitude_active_config.amplitude_active_song_information.cover_art_url&&(document.getElementById("amplitude-album-art").innerHTML='<img src="'+amplitude_active_config.amplitude_active_song_information.cover_art_url+'" class="amplitude-album-art-image"/>');var e=document.getElementsByClassName("amplitude-now-playing");e.length>0&&e[0].classList.remove("amplitude-now-playing"),void 0!=amplitude_active_config.amplitude_active_song_information.visual_id&&document.getElementById(amplitude_active_config.amplitude_active_song_information.visual_id)&&document.getElementById(amplitude_active_config.amplitude_active_song_information.visual_id).classList.add("amplitude-now-playing")}function amplitude_next_song(){if(amplitude_active_config.amplitude_before_next_callback){var e=window[amplitude_active_config.amplitude_before_next_callback];e()}if(amplitude_active_config.amplitude_shuffle?("undefined"!=typeof amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)+1]?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)+1].url,amplitude_active_config.amplitude_list_playing_index=amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)+1].original,amplitude_active_config.amplitude_playlist_index=parseInt(amplitude_active_config.amplitude_playlist_index)+1):(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_shuffle_list[0].url,amplitude_active_config.amplitude_playlist_index=0,amplitude_active_config.amplitude_list_playing_index=amplitude_active_config.amplitude_shuffle_list[0].original),amplitude_set_active_song_information(amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)]),amplitude_play_song()):("undefined"!=typeof amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)+1]?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)+1].url,amplitude_active_config.amplitude_playlist_index=parseInt(amplitude_active_config.amplitude_playlist_index)+1):(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[0].url,amplitude_active_config.amplitude_playlist_index=0),amplitude_set_active_song_information(amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)]),amplitude_play_song(),amplitude_active_config.amplitude_list_playing_index=parseInt(amplitude_active_config.amplitude_playlist_index)),amplitude_set_play_pause(),amplitude_set_playlist_play_pause(),amplitude_active_config.amplitude_after_next_callback){var a=window[amplitude_active_config.amplitude_after_next_callback];a()}}function amplitude_previous_song(){if(amplitude_active_config.amplitude_before_prev_callback){var e=window[amplitude_active_config.amplitude_before_prev_callback];e()}if(amplitude_active_config.amplitude_shuffle?("undefined"!=typeof amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)-1]?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)-1].url,amplitude_active_config.amplitude_list_playing_index=amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)-1].original,amplitude_active_config.amplitude_playlist_index=parseInt(amplitude_active_config.amplitude_playlist_index)-1):(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_shuffle_list[amplitude_active_config.amplitude_shuffle_list.length-1].url,amplitude_active_config.amplitude_playlist_index=amplitude_active_config.amplitude_shuffle_list.length-1,amplitude_active_config.amplitude_list_playing_index=amplitude_active_config.amplitude_shuffle_list[amplitude_active_config.amplitude_shuffle_list.length-1].original),amplitude_set_active_song_information(amplitude_active_config.amplitude_shuffle_list[parseInt(amplitude_active_config.amplitude_playlist_index)]),amplitude_play_song()):("undefined"!=typeof amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)-1]?(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)-1].url,amplitude_active_config.amplitude_playlist_index=parseInt(amplitude_active_config.amplitude_playlist_index)-1):(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[amplitude_active_config.amplitude_songs.length-1].url,amplitude_active_config.amplitude_playlist_index=amplitude_active_config.amplitude_songs.length-1),amplitude_set_active_song_information(amplitude_active_config.amplitude_songs[parseInt(amplitude_active_config.amplitude_playlist_index)]),amplitude_play_song(),amplitude_active_config.amplitude_list_playing_index=parseInt(amplitude_active_config.amplitude_playlist_index)),amplitude_set_play_pause(),amplitude_set_playlist_play_pause(),amplitude_active_config.amplitude_after_prev_callback){var a=window[amplitude_active_config.amplitude_after_prev_callback];a()}}function amplitude_set_playlist_play_pause(){for(var e=document.getElementsByClassName("amplitude-play-pause"),a=0;a<e.length;a++){var i=" amplitude-list-paused";e[a].className=e[a].className.replace("amplitude-list-playing",""),e[a].className=e[a].className.replace(i,""),e[a].className=e[a].className+i}var t=document.querySelector('[amplitude-song-index="'+amplitude_active_config.amplitude_list_playing_index+'"]');null!=t&&(t.classList.add("amplitude-list-playing"),t.classList.remove("amplitude-list-paused"))}function amplitude_set_play_pause(){var e=document.getElementById("amplitude-play-pause");if(void 0!=e)if(amplitude_active_config.amplitude_active_song.paused){var a=" amplitude-paused";e.className=e.className.replace("amplitude-playing",""),e.className=e.className.replace(a,""),e.className=e.className+a}else{var a=" amplitude-playing";e.className=e.className.replace("amplitude-paused",""),e.className=e.className.replace(a,""),e.className=e.className+a}}function amplitude_shuffle_playlist(){amplitude_active_config.amplitude_shuffle?(amplitude_active_config.amplitude_shuffle=!1,amplitude_active_config.amplitude_shuffle_list={}):(amplitude_active_config.amplitude_shuffle=!0,amplitude_shuffle_songs())}function amplitude_shuffle_songs(){if(amplitude_active_config.amplitude_before_shuffle_callback){var e=window[amplitude_active_config.amplitude_before_shuffle_callback];e()}var a=new Array(amplitude_active_config.amplitude_songs.length);for(i=0;i<amplitude_active_config.amplitude_songs.length;i++)a[i]=amplitude_active_config.amplitude_songs[i],a[i].original=i;for(i=amplitude_active_config.amplitude_songs.length-1;i>0;i--){var t=Math.floor(Math.random()*amplitude_active_config.amplitude_songs.length+1);amplitude_shuffle_swap(a,i,t-1)}if(amplitude_active_config.amplitude_shuffle_list=a,amplitude_active_config.amplitude_after_shuffle_callback){var l=window[amplitude_active_config.amplitude_after_shuffle_callback];l()}}function amplitude_shuffle_swap(e,a,i){var t=e[a];e[a]=e[i],e[i]=t}function amplitude_bind_time_update(){amplitude_active_config.amplitude_active_song.addEventListener("timeupdate",function(){amplitude_update_time()})}function amplitude_prepare_list_play_pause(e){if(e!=amplitude_active_config.amplitude_list_playing_index&&(amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_songs[e].url,amplitude_set_active_song_information(amplitude_active_config.amplitude_songs[e])),amplitude_active_config.amplitude_list_playing_index=e,amplitude_active_config.amplitude_active_song.paused){if(amplitude_play_song(),document.getElementById("amplitude-play-pause")){var a="amplitude-playing";document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className.replace("amplitude-paused",""),document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className.replace(a,""),document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className+a}}else if(amplitude_pause_song(),document.getElementById("amplitude-play-pause")){var a="amplitude-paused";document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className.replace("amplitude-playing",""),document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className.replace(a,""),document.getElementById("amplitude-play-pause").className=document.getElementById("amplitude-play-pause").className+a}}function amplitude_add_song(e){return amplitude_active_config.amplitude_songs.push(e),amplitude_active_config.amplitude_songs.length-1}function amplitude_bind_song_additions(){document.addEventListener("DOMNodeInserted",function(e){if(void 0!=e.target.classList&&"amplitude-album-art-image"!=e.target.classList[0]){for(var a=document.getElementsByClassName("amplitude-play-pause"),i=0;i<a.length;i++)/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?(a[i].removeEventListener("touchstart",amplitude_handle_play_pause_classes),a[i].addEventListener("touchstart",amplitude_handle_play_pause_classes)):(a[i].removeEventListener("click",amplitude_handle_play_pause_classes),a[i].addEventListener("click",amplitude_handle_play_pause_classes));
  845. for(var t=document.getElementsByClassName("amplitude-song-slider"),i=0;i<t.length;i++)t[i].removeEventListener("input",amplitude_handle_song_sliders),t[i].addEventListener("input",amplitude_handle_song_sliders)}})}function amplitude_handle_play_pause_classes(){var e=document.getElementsByClassName("amplitude-play-pause");if(this.getAttribute("amplitude-song-index")!=amplitude_active_config.amplitude_list_playing_index){for(var a=0;a<e.length;a++){var i=" amplitude-list-paused";e[a].className=e[a].className.replace(" amplitude-list-playing",""),e[a].className=e[a].className.replace(i,""),e[a].className=e[a].className+i}var i=" amplitude-list-playing";this.className=this.className.replace(" amplitude-list-paused",""),this.className=this.className.replace(i,""),this.className=this.className+i}else if(amplitude_active_config.amplitude_active_song.paused){var i=" amplitude-list-playing";this.className=this.className.replace(" amplitude-list-paused",""),this.className=this.className.replace(i,""),this.className=this.className+i}else{var i=" amplitude-list-paused";this.className=this.className.replace(" amplitude-list-playing",""),this.className=this.className.replace(i,""),this.className=this.className+i}amplitude_prepare_list_play_pause(this.getAttribute("amplitude-song-index"))}function amplitude_handle_song_sliders(){amplitude_set_song_position(this.value)}function amplitude_disconnect_stream(){amplitude_active_config.amplitude_active_song.pause(),amplitude_active_config.amplitude_active_song.src="",amplitude_active_config.amplitude_active_song.load()}function amplitude_reconnect_stream(){amplitude_active_config.amplitude_active_song.src=amplitude_active_config.amplitude_active_song_information.url,amplitude_active_config.amplitude_active_song.load()}var amplitude_active_config={amplitude_active_song:null,amplitude_volume:.5,amplitude_pre_mute_volume:.5,amplitude_list_playing_index:null,amplitude_auto_play:!1,amplitude_songs:{},amplitude_shuffle:!1,amplitude_shuffle_list:{},amplitude_start_song:null,amplitude_volume_up_amount:10,amplitude_volume_down_amount:10,amplitude_continue_next:!1,amplitude_active_song_information:{},amplitude_before_play_callback:null,amplitude_after_play_callback:null,amplitude_before_stop_callback:null,amplitude_after_stop_callback:null,amplitude_before_next_callback:null,amplitude_after_next_callback:null,amplitude_before_prev_callback:null,amplitude_after_prev_callback:null,amplitude_before_pause_callback:null,amplitude_after_pause_callback:null,amplitude_before_shuffle_callback:null,amplitude_after_shuffle_callback:null,amplitude_before_volume_change_callback:null,amplitude_after_volume_change_callback:null,amplitude_before_mute_callback:null,amplitude_after_mute_callback:null,amplitude_before_time_update_callback:null,amplitude_after_time_update_callback:null,amplitude_before_song_information_set_callback:null,amplitude_after_song_information_set_callback:null,amplitude_before_song_added_callback:null,amplitude_after_song_added_callback:null},amplitude_active_song_information={};hook_amplitude_functions(amplitude_configure_variables),hook_amplitude_functions(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?amplitude_web_mobile:amplitude_web_desktop),hook_amplitude_functions(amplitude_start);
  846. (function( $ ) {
  847. $.fn.lfmr = function(options){
  848. var urla = "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&format=json&limit=100";
  849. var tracks = [];
  850. function isLoadedr (recentElement) {
  851. for (var i = 0; i < tracks.length; i++){
  852. var markup = $("<li class='list-group-item'>" + tracks[i].artist + " - <span class='artist'>" + tracks[i].title + " : " + tracks[i].album + "</li>");
  853. recentElement.append(markup);
  854. }
  855. }
  856. return this.each(function(){
  857. var $this = $(this);
  858. $.getJSON( urla, function(data){
  859. $(data.recenttracks.track).each(function(){
  860. tracks.push ({
  861. artist: this.artist["#text"],
  862. title: this.name,
  863. album: this.album["#text"]
  864. });
  865. });
  866. isLoadedr($this);
  867. });
  868. });
  869. };
  870. $('.recent').lfmr();
  871. })( jQuery );
  872. /* ======= SAVE FOR LATER Icecast 2.4 upgrade to fix CORs headers @ http://64.207.154.37:8008/status2.xsl ========
  873. (function($){
  874. $.fn.icecast = function(options){
  875. $.ajaxSetup({
  876. cache:true,
  877. scriptCharset:"utf-8",
  878. contentType:"text/json;charset=utf-8"
  879. });
  880. var defaults = {
  881. server:"http://stream.davidawindham.com:8008/stream",
  882. stationlogo:""
  883. };
  884. var options = $.extend(defaults,options);
  885. return this.each(function(){var icecast = $(this);
  886. $.getJSON('http://'+options.server+'/status2.xsl',
  887. function(data){$.each(data.mounts,function(i,mount){
  888. $(icecast).append('<li class="mount"><div class="track">'+mount.title+'</div><div class="listeners">Listeners: '+mount.listeners+' at '+mount.bitrate+'kbps</div></li>');
  889. });
  890. });
  891. });
  892. };})(jQuery);
  893. $(function(){
  894. $('.mounts').icecast({server:"64.207.154.37:8008"});
  895. });
  896. */
  897. amplitude_config = {
  898. amplitude_songs: []
  899. // "amplitude_songs": [{
  900. // "url": "http://code.davidawindham.com:8008/stream",
  901. // "live": true
  902. // }],
  903. // "amplitude_volume": 90
  904. }
  905. function get_radio_tower() {return 'img/radio.gif';}
  906. function get_radio_none() {return 'img/none.svg';}
  907. function get_radio_eq() {return 'img/eq.gif';}
  908. function get_radio_eq_none() {return 'img/1.png';}
  909. function radioTitle() {
  910. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  911. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  912. // var url = 'http://code.davidawindham.com:8008/status2.xsl';
  913. /* var mountpoint = '/stream';
  914. $.ajax({ type: 'GET',
  915. url: url,
  916. async: true,
  917. jsonpCallback: 'parseMusic',
  918. contentType: "application/json",
  919. dataType: 'jsonp',
  920. success: function (json) {
  921. $('#track').text(json[mountpoint].title);
  922. $('#listeners').text(json[mountpoint].listeners);
  923. $('#peak-listeners').text(json[mountpoint].peak_listeners);
  924. $('#bitrate').text(json[mountpoint].bitrate);
  925. $('#radio').attr('src', get_radio_tower()).fadeIn(300);
  926. $('#eq').attr('src', get_radio_eq()).fadeIn(300);
  927. },
  928. error: function (e) { console.log(e.message);
  929. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  930. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  931. }
  932. });
  933. */
  934. }
  935. $(function() {
  936. var el, newPoint, newPlace, offset;
  937. $("input[type='range']").change(function() {
  938. el = $(this);
  939. width = el.width();
  940. newPoint = (el.val() - el.attr("min")) / (el.attr("max") - el.attr("min"));
  941. offset = -1.3;
  942. if (newPoint < 0) { newPlace = 0; }
  943. else if (newPoint > 1) { newPlace = width; }
  944. else { newPlace = width * newPoint + offset; offset -= newPoint;}
  945. el
  946. .next("output")
  947. .css({
  948. left: newPlace,
  949. marginLeft: offset + "%"
  950. })
  951. .text(el.val());
  952. })
  953. .trigger('change');
  954. });
  955. $(document).ready(function () {
  956. //setTimeout(function () {radioTitle();}, 2000);
  957. //setInterval(function () {radioTitle();}, 30000); // update every 30 seconds
  958. spectrum();
  959. function spectrum() {
  960. var randomColor = Math.floor(Math.random()*16777215).toString(16);
  961. $("span#user-label").css({ backgroundColor: '#' + randomColor });
  962. //$("body").animate({ backgroundColor: '#' + randomColor });
  963. //$("body").animate({ backgroundColor: '#' + randomColor }, 1000);
  964. //spectrum();
  965. }
  966. });