radio.min.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  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. addBotMessage(info);
  28. });
  29. // Reconnected to server
  30. socket.on('reconnect', function (data) {
  31. var info = {'room':'Lobby', 'username':'Radio-bot', 'msg':'---- Reconnected ----'};
  32. addBotMessage(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. addBotMessage(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. // Robot Add message to room
  152. var addBotMessage = function(msg) {
  153. getTemplate('js/templates/message-bot.handlebars', function(template) {
  154. var room_messages = '#'+msg.room+' #room_messages';
  155. $(room_messages).append(template(msg));
  156. });
  157. };
  158. // Add user to connected users list
  159. var addUser = function(user) {
  160. getTemplate('js/templates/user.handlebars', function(template) {
  161. var room_users = '#'+user.room+' #room_users';
  162. // Add only if it doesn't exist in the room
  163. var user_badge = '#'+user.room+' #'+user.id;
  164. if (!($(user_badge).length)) {
  165. $(room_users).append(template(user));
  166. }
  167. });
  168. }
  169. // Remove user from connected users list
  170. var removeUser = function(user) {
  171. var user_badge = '#'+user.room+' #'+user.id;
  172. $(user_badge).remove();
  173. };
  174. // Check if room exists
  175. var roomExists = function(room) {
  176. var room_selector = '#'+room;
  177. if ($(room_selector).length) {
  178. return true;
  179. } elseĀ {
  180. return false;
  181. }
  182. };
  183. // Get current room
  184. var getCurrentRoom = function() {
  185. return $('li[id$="_tab"][class="active"]').text();
  186. };
  187. // Get message text from input field
  188. var getMessageText = function() {
  189. var text = $('#message_text').val();
  190. $('#message_text').val("");
  191. return text;
  192. };
  193. // Get room name from input field
  194. var getRoomName = function() {
  195. var name = $('#room_name').val().trim();
  196. $('#room_name').val("");
  197. return name;
  198. };
  199. // Get nickname from input field
  200. var getNickname = function() {
  201. var nickname = $('#nickname').val();
  202. $('#nickname').val("");
  203. return nickname;
  204. };
  205. // Update nickname in badges
  206. var updateNickname = function(data) {
  207. var badges = '#'+data.room+' #'+data.id;
  208. $(badges).text(data.newUsername);
  209. };
  210. // ***************************************************************************
  211. // Events
  212. // ***************************************************************************
  213. // Send new message
  214. $('#b_send_message').click(function(eventObject) {
  215. eventObject.preventDefault();
  216. if ($('#message_text').val() != "") {
  217. socket.emit('newMessage', {'room':getCurrentRoom(), 'msg':getMessageText()});
  218. }
  219. });
  220. // Join new room
  221. $('#b_join_room').click(function(eventObject) {
  222. var roomName = getRoomName();
  223. if (roomName) {
  224. eventObject.preventDefault();
  225. socket.emit('subscribe', {'rooms':[roomName]});
  226. // Added error class if empty room name
  227. } else {
  228. $('#room_name').addClass('error');
  229. }
  230. });
  231. // Leave current room
  232. $('#b_leave_room').click(function(eventObject) {
  233. eventObject.preventDefault();
  234. var currentRoom = getCurrentRoom();
  235. if (currentRoom != 'Lobby') {
  236. socket.emit('unsubscribe', {'rooms':[getCurrentRoom()]});
  237. // Toogle to MainRoom
  238. $('[href="#Lobby"]').click();
  239. } else {
  240. console.log('Cannot leave Lobby, sorry');
  241. }
  242. });
  243. // Remove error style to hide modal
  244. $('#modal_joinroom').on('hidden.bs.modal', function (e) {
  245. if ($('#room_name').hasClass('error')) {
  246. $('#room_name').removeClass('error');
  247. }
  248. });
  249. // Set nickname
  250. $('#b_set_nickname').click(function(eventObject) {
  251. eventObject.preventDefault();
  252. socket.emit('setNickname', {'username':getNickname()});
  253. // Close modal if opened
  254. $('#modal_setnick').modal('hide');
  255. });
  256. })();
  257. /*!
  258. * jQuery Color Animations v@VERSION
  259. * https://github.com/jquery/jquery-color
  260. *
  261. * Copyright jQuery Foundation and other contributors
  262. * Released under the MIT license.
  263. * http://jquery.org/license
  264. *
  265. * Date: @DATE
  266. */
  267. (function( jQuery, undefined ) {
  268. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  269. // plusequals test for += 100 -= 100
  270. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  271. // a set of RE's that can match strings and generate color tuples.
  272. stringParsers = [{
  273. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  274. parse: function( execResult ) {
  275. return [
  276. execResult[ 1 ],
  277. execResult[ 2 ],
  278. execResult[ 3 ],
  279. execResult[ 4 ]
  280. ];
  281. }
  282. }, {
  283. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  284. parse: function( execResult ) {
  285. return [
  286. execResult[ 1 ] * 2.55,
  287. execResult[ 2 ] * 2.55,
  288. execResult[ 3 ] * 2.55,
  289. execResult[ 4 ]
  290. ];
  291. }
  292. }, {
  293. // this regex ignores A-F because it's compared against an already lowercased string
  294. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  295. parse: function( execResult ) {
  296. return [
  297. parseInt( execResult[ 1 ], 16 ),
  298. parseInt( execResult[ 2 ], 16 ),
  299. parseInt( execResult[ 3 ], 16 )
  300. ];
  301. }
  302. }, {
  303. // this regex ignores A-F because it's compared against an already lowercased string
  304. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  305. parse: function( execResult ) {
  306. return [
  307. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  308. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  309. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  310. ];
  311. }
  312. }, {
  313. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  314. space: "hsla",
  315. parse: function( execResult ) {
  316. return [
  317. execResult[ 1 ],
  318. execResult[ 2 ] / 100,
  319. execResult[ 3 ] / 100,
  320. execResult[ 4 ]
  321. ];
  322. }
  323. }],
  324. // jQuery.Color( )
  325. color = jQuery.Color = function( color, green, blue, alpha ) {
  326. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  327. },
  328. spaces = {
  329. rgba: {
  330. props: {
  331. red: {
  332. idx: 0,
  333. type: "byte"
  334. },
  335. green: {
  336. idx: 1,
  337. type: "byte"
  338. },
  339. blue: {
  340. idx: 2,
  341. type: "byte"
  342. }
  343. }
  344. },
  345. hsla: {
  346. props: {
  347. hue: {
  348. idx: 0,
  349. type: "degrees"
  350. },
  351. saturation: {
  352. idx: 1,
  353. type: "percent"
  354. },
  355. lightness: {
  356. idx: 2,
  357. type: "percent"
  358. }
  359. }
  360. }
  361. },
  362. propTypes = {
  363. "byte": {
  364. floor: true,
  365. max: 255
  366. },
  367. "percent": {
  368. max: 1
  369. },
  370. "degrees": {
  371. mod: 360,
  372. floor: true
  373. }
  374. },
  375. support = color.support = {},
  376. // element for support tests
  377. supportElem = jQuery( "<p>" )[ 0 ],
  378. // colors = jQuery.Color.names
  379. colors,
  380. // local aliases of functions called often
  381. each = jQuery.each;
  382. // determine rgba support immediately
  383. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  384. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  385. // define cache name and alpha properties
  386. // for rgba and hsla spaces
  387. each( spaces, function( spaceName, space ) {
  388. space.cache = "_" + spaceName;
  389. space.props.alpha = {
  390. idx: 3,
  391. type: "percent",
  392. def: 1
  393. };
  394. });
  395. function clamp( value, prop, allowEmpty ) {
  396. var type = propTypes[ prop.type ] || {};
  397. if ( value == null ) {
  398. return (allowEmpty || !prop.def) ? null : prop.def;
  399. }
  400. // ~~ is an short way of doing floor for positive numbers
  401. value = type.floor ? ~~value : parseFloat( value );
  402. // IE will pass in empty strings as value for alpha,
  403. // which will hit this case
  404. if ( isNaN( value ) ) {
  405. return prop.def;
  406. }
  407. if ( type.mod ) {
  408. // we add mod before modding to make sure that negatives values
  409. // get converted properly: -10 -> 350
  410. return (value + type.mod) % type.mod;
  411. }
  412. // for now all property types without mod have min and max
  413. return 0 > value ? 0 : type.max < value ? type.max : value;
  414. }
  415. function stringParse( string ) {
  416. var inst = color(),
  417. rgba = inst._rgba = [];
  418. string = string.toLowerCase();
  419. each( stringParsers, function( i, parser ) {
  420. var parsed,
  421. match = parser.re.exec( string ),
  422. values = match && parser.parse( match ),
  423. spaceName = parser.space || "rgba";
  424. if ( values ) {
  425. parsed = inst[ spaceName ]( values );
  426. // if this was an rgba parse the assignment might happen twice
  427. // oh well....
  428. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  429. rgba = inst._rgba = parsed._rgba;
  430. // exit each( stringParsers ) here because we matched
  431. return false;
  432. }
  433. });
  434. // Found a stringParser that handled it
  435. if ( rgba.length ) {
  436. // if this came from a parsed string, force "transparent" when alpha is 0
  437. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  438. if ( rgba.join() === "0,0,0,0" ) {
  439. jQuery.extend( rgba, colors.transparent );
  440. }
  441. return inst;
  442. }
  443. // named colors
  444. return colors[ string ];
  445. }
  446. color.fn = jQuery.extend( color.prototype, {
  447. parse: function( red, green, blue, alpha ) {
  448. if ( red === undefined ) {
  449. this._rgba = [ null, null, null, null ];
  450. return this;
  451. }
  452. if ( red.jquery || red.nodeType ) {
  453. red = jQuery( red ).css( green );
  454. green = undefined;
  455. }
  456. var inst = this,
  457. type = jQuery.type( red ),
  458. rgba = this._rgba = [];
  459. // more than 1 argument specified - assume ( red, green, blue, alpha )
  460. if ( green !== undefined ) {
  461. red = [ red, green, blue, alpha ];
  462. type = "array";
  463. }
  464. if ( type === "string" ) {
  465. return this.parse( stringParse( red ) || colors._default );
  466. }
  467. if ( type === "array" ) {
  468. each( spaces.rgba.props, function( key, prop ) {
  469. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  470. });
  471. return this;
  472. }
  473. if ( type === "object" ) {
  474. if ( red instanceof color ) {
  475. each( spaces, function( spaceName, space ) {
  476. if ( red[ space.cache ] ) {
  477. inst[ space.cache ] = red[ space.cache ].slice();
  478. }
  479. });
  480. } else {
  481. each( spaces, function( spaceName, space ) {
  482. var cache = space.cache;
  483. each( space.props, function( key, prop ) {
  484. // if the cache doesn't exist, and we know how to convert
  485. if ( !inst[ cache ] && space.to ) {
  486. // if the value was null, we don't need to copy it
  487. // if the key was alpha, we don't need to copy it either
  488. if ( key === "alpha" || red[ key ] == null ) {
  489. return;
  490. }
  491. inst[ cache ] = space.to( inst._rgba );
  492. }
  493. // this is the only case where we allow nulls for ALL properties.
  494. // call clamp with alwaysAllowEmpty
  495. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  496. });
  497. // everything defined but alpha?
  498. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  499. // use the default of 1
  500. inst[ cache ][ 3 ] = 1;
  501. if ( space.from ) {
  502. inst._rgba = space.from( inst[ cache ] );
  503. }
  504. }
  505. });
  506. }
  507. return this;
  508. }
  509. },
  510. is: function( compare ) {
  511. var is = color( compare ),
  512. same = true,
  513. inst = this;
  514. each( spaces, function( _, space ) {
  515. var localCache,
  516. isCache = is[ space.cache ];
  517. if (isCache) {
  518. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  519. each( space.props, function( _, prop ) {
  520. if ( isCache[ prop.idx ] != null ) {
  521. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  522. return same;
  523. }
  524. });
  525. }
  526. return same;
  527. });
  528. return same;
  529. },
  530. _space: function() {
  531. var used = [],
  532. inst = this;
  533. each( spaces, function( spaceName, space ) {
  534. if ( inst[ space.cache ] ) {
  535. used.push( spaceName );
  536. }
  537. });
  538. return used.pop();
  539. },
  540. transition: function( other, distance ) {
  541. var end = color( other ),
  542. spaceName = end._space(),
  543. space = spaces[ spaceName ],
  544. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  545. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  546. result = start.slice();
  547. end = end[ space.cache ];
  548. each( space.props, function( key, prop ) {
  549. var index = prop.idx,
  550. startValue = start[ index ],
  551. endValue = end[ index ],
  552. type = propTypes[ prop.type ] || {};
  553. // if null, don't override start value
  554. if ( endValue === null ) {
  555. return;
  556. }
  557. // if null - use end
  558. if ( startValue === null ) {
  559. result[ index ] = endValue;
  560. } else {
  561. if ( type.mod ) {
  562. if ( endValue - startValue > type.mod / 2 ) {
  563. startValue += type.mod;
  564. } else if ( startValue - endValue > type.mod / 2 ) {
  565. startValue -= type.mod;
  566. }
  567. }
  568. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  569. }
  570. });
  571. return this[ spaceName ]( result );
  572. },
  573. blend: function( opaque ) {
  574. // if we are already opaque - return ourself
  575. if ( this._rgba[ 3 ] === 1 ) {
  576. return this;
  577. }
  578. var rgb = this._rgba.slice(),
  579. a = rgb.pop(),
  580. blend = color( opaque )._rgba;
  581. return color( jQuery.map( rgb, function( v, i ) {
  582. return ( 1 - a ) * blend[ i ] + a * v;
  583. }));
  584. },
  585. toRgbaString: function() {
  586. var prefix = "rgba(",
  587. rgba = jQuery.map( this._rgba, function( v, i ) {
  588. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  589. });
  590. if ( rgba[ 3 ] === 1 ) {
  591. rgba.pop();
  592. prefix = "rgb(";
  593. }
  594. return prefix + rgba.join() + ")";
  595. },
  596. toHslaString: function() {
  597. var prefix = "hsla(",
  598. hsla = jQuery.map( this.hsla(), function( v, i ) {
  599. if ( v == null ) {
  600. v = i > 2 ? 1 : 0;
  601. }
  602. // catch 1 and 2
  603. if ( i && i < 3 ) {
  604. v = Math.round( v * 100 ) + "%";
  605. }
  606. return v;
  607. });
  608. if ( hsla[ 3 ] === 1 ) {
  609. hsla.pop();
  610. prefix = "hsl(";
  611. }
  612. return prefix + hsla.join() + ")";
  613. },
  614. toHexString: function( includeAlpha ) {
  615. var rgba = this._rgba.slice(),
  616. alpha = rgba.pop();
  617. if ( includeAlpha ) {
  618. rgba.push( ~~( alpha * 255 ) );
  619. }
  620. return "#" + jQuery.map( rgba, function( v ) {
  621. // default to 0 when nulls exist
  622. v = ( v || 0 ).toString( 16 );
  623. return v.length === 1 ? "0" + v : v;
  624. }).join("");
  625. },
  626. toString: function() {
  627. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  628. }
  629. });
  630. color.fn.parse.prototype = color.fn;
  631. // hsla conversions adapted from:
  632. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  633. function hue2rgb( p, q, h ) {
  634. h = ( h + 1 ) % 1;
  635. if ( h * 6 < 1 ) {
  636. return p + (q - p) * h * 6;
  637. }
  638. if ( h * 2 < 1) {
  639. return q;
  640. }
  641. if ( h * 3 < 2 ) {
  642. return p + (q - p) * ((2/3) - h) * 6;
  643. }
  644. return p;
  645. }
  646. spaces.hsla.to = function ( rgba ) {
  647. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  648. return [ null, null, null, rgba[ 3 ] ];
  649. }
  650. var r = rgba[ 0 ] / 255,
  651. g = rgba[ 1 ] / 255,
  652. b = rgba[ 2 ] / 255,
  653. a = rgba[ 3 ],
  654. max = Math.max( r, g, b ),
  655. min = Math.min( r, g, b ),
  656. diff = max - min,
  657. add = max + min,
  658. l = add * 0.5,
  659. h, s;
  660. if ( min === max ) {
  661. h = 0;
  662. } else if ( r === max ) {
  663. h = ( 60 * ( g - b ) / diff ) + 360;
  664. } else if ( g === max ) {
  665. h = ( 60 * ( b - r ) / diff ) + 120;
  666. } else {
  667. h = ( 60 * ( r - g ) / diff ) + 240;
  668. }
  669. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  670. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  671. if ( diff === 0 ) {
  672. s = 0;
  673. } else if ( l <= 0.5 ) {
  674. s = diff / add;
  675. } else {
  676. s = diff / ( 2 - add );
  677. }
  678. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  679. };
  680. spaces.hsla.from = function ( hsla ) {
  681. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  682. return [ null, null, null, hsla[ 3 ] ];
  683. }
  684. var h = hsla[ 0 ] / 360,
  685. s = hsla[ 1 ],
  686. l = hsla[ 2 ],
  687. a = hsla[ 3 ],
  688. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  689. p = 2 * l - q;
  690. return [
  691. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  692. Math.round( hue2rgb( p, q, h ) * 255 ),
  693. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  694. a
  695. ];
  696. };
  697. each( spaces, function( spaceName, space ) {
  698. var props = space.props,
  699. cache = space.cache,
  700. to = space.to,
  701. from = space.from;
  702. // makes rgba() and hsla()
  703. color.fn[ spaceName ] = function( value ) {
  704. // generate a cache for this space if it doesn't exist
  705. if ( to && !this[ cache ] ) {
  706. this[ cache ] = to( this._rgba );
  707. }
  708. if ( value === undefined ) {
  709. return this[ cache ].slice();
  710. }
  711. var ret,
  712. type = jQuery.type( value ),
  713. arr = ( type === "array" || type === "object" ) ? value : arguments,
  714. local = this[ cache ].slice();
  715. each( props, function( key, prop ) {
  716. var val = arr[ type === "object" ? key : prop.idx ];
  717. if ( val == null ) {
  718. val = local[ prop.idx ];
  719. }
  720. local[ prop.idx ] = clamp( val, prop );
  721. });
  722. if ( from ) {
  723. ret = color( from( local ) );
  724. ret[ cache ] = local;
  725. return ret;
  726. } else {
  727. return color( local );
  728. }
  729. };
  730. // makes red() green() blue() alpha() hue() saturation() lightness()
  731. each( props, function( key, prop ) {
  732. // alpha is included in more than one space
  733. if ( color.fn[ key ] ) {
  734. return;
  735. }
  736. color.fn[ key ] = function( value ) {
  737. var vtype = jQuery.type( value ),
  738. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  739. local = this[ fn ](),
  740. cur = local[ prop.idx ],
  741. match;
  742. if ( vtype === "undefined" ) {
  743. return cur;
  744. }
  745. if ( vtype === "function" ) {
  746. value = value.call( this, cur );
  747. vtype = jQuery.type( value );
  748. }
  749. if ( value == null && prop.empty ) {
  750. return this;
  751. }
  752. if ( vtype === "string" ) {
  753. match = rplusequals.exec( value );
  754. if ( match ) {
  755. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  756. }
  757. }
  758. local[ prop.idx ] = value;
  759. return this[ fn ]( local );
  760. };
  761. });
  762. });
  763. // add cssHook and .fx.step function for each named hook.
  764. // accept a space separated string of properties
  765. color.hook = function( hook ) {
  766. var hooks = hook.split( " " );
  767. each( hooks, function( i, hook ) {
  768. jQuery.cssHooks[ hook ] = {
  769. set: function( elem, value ) {
  770. var parsed, curElem,
  771. backgroundColor = "";
  772. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  773. value = color( parsed || value );
  774. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  775. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  776. while (
  777. (backgroundColor === "" || backgroundColor === "transparent") &&
  778. curElem && curElem.style
  779. ) {
  780. try {
  781. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  782. curElem = curElem.parentNode;
  783. } catch ( e ) {
  784. }
  785. }
  786. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  787. backgroundColor :
  788. "_default" );
  789. }
  790. value = value.toRgbaString();
  791. }
  792. try {
  793. elem.style[ hook ] = value;
  794. } catch( e ) {
  795. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  796. }
  797. }
  798. };
  799. jQuery.fx.step[ hook ] = function( fx ) {
  800. if ( !fx.colorInit ) {
  801. fx.start = color( fx.elem, hook );
  802. fx.end = color( fx.end );
  803. fx.colorInit = true;
  804. }
  805. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  806. };
  807. });
  808. };
  809. color.hook( stepHooks );
  810. jQuery.cssHooks.borderColor = {
  811. expand: function( value ) {
  812. var expanded = {};
  813. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  814. expanded[ "border" + part + "Color" ] = value;
  815. });
  816. return expanded;
  817. }
  818. };
  819. // Basic color names only.
  820. // Usage of any of the other color names requires adding yourself or including
  821. // jquery.color.svg-names.js.
  822. colors = jQuery.Color.names = {
  823. // 4.1. Basic color keywords
  824. aqua: "#00ffff",
  825. black: "#000000",
  826. blue: "#0000ff",
  827. fuchsia: "#ff00ff",
  828. gray: "#808080",
  829. green: "#008000",
  830. lime: "#00ff00",
  831. maroon: "#800000",
  832. navy: "#000080",
  833. olive: "#808000",
  834. purple: "#800080",
  835. red: "#ff0000",
  836. silver: "#c0c0c0",
  837. teal: "#008080",
  838. white: "#ffffff",
  839. yellow: "#ffff00",
  840. // 4.2.3. "transparent" color keyword
  841. transparent: [ null, null, null, 0 ],
  842. _default: "#ffffff"
  843. };
  844. }( jQuery ));
  845. /* Radio Funtions */
  846. /*
  847. Version: 1.1
  848. Author: Dan Pastori
  849. Company: 521 Dimensions
  850. */
  851. 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));
  852. 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);
  853. (function( $ ) {
  854. $.fn.lfmr = function(options){
  855. var urla = "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&format=json&limit=100";
  856. var tracks = [];
  857. function isLoadedr (recentElement) {
  858. for (var i = 0; i < tracks.length; i++){
  859. var markup = $("<li class='list-group-item'>" + tracks[i].artist + " - <span class='artist'>" + tracks[i].title + " : " + tracks[i].album + "</li>");
  860. recentElement.append(markup);
  861. }
  862. }
  863. return this.each(function(){
  864. var $this = $(this);
  865. $.getJSON( urla, function(data){
  866. $(data.recenttracks.track).each(function(){
  867. tracks.push ({
  868. artist: this.artist["#text"],
  869. title: this.name,
  870. album: this.album["#text"]
  871. });
  872. });
  873. isLoadedr($this);
  874. });
  875. });
  876. };
  877. $('.recent').lfmr();
  878. })( jQuery );
  879. /* ======= SAVE FOR LATER Icecast 2.4 upgrade to fix CORs headers @ http://64.207.154.37:8008/status2.xsl ========
  880. (function($){
  881. $.fn.icecast = function(options){
  882. $.ajaxSetup({
  883. cache:true,
  884. scriptCharset:"utf-8",
  885. contentType:"text/json;charset=utf-8"
  886. });
  887. var defaults = {
  888. server:"http://stream.davidawindham.com:8008/stream",
  889. stationlogo:""
  890. };
  891. var options = $.extend(defaults,options);
  892. return this.each(function(){var icecast = $(this);
  893. $.getJSON('http://'+options.server+'/status2.xsl',
  894. function(data){$.each(data.mounts,function(i,mount){
  895. $(icecast).append('<li class="mount"><div class="track">'+mount.title+'</div><div class="listeners">Listeners: '+mount.listeners+' at '+mount.bitrate+'kbps</div></li>');
  896. });
  897. });
  898. });
  899. };})(jQuery);
  900. $(function(){
  901. $('.mounts').icecast({server:"64.207.154.37:8008"});
  902. });
  903. */
  904. amplitude_config = {
  905. amplitude_songs: []
  906. // "amplitude_songs": [{
  907. // "url": "http://code.davidawindham.com:8008/stream",
  908. // "live": true
  909. // }],
  910. // "amplitude_volume": 90
  911. }
  912. function get_radio_tower() {return 'img/radio.gif';}
  913. function get_radio_none() {return 'img/none.svg';}
  914. function get_radio_eq() {return 'img/eq.gif';}
  915. function get_radio_eq_none() {return 'img/1.png';}
  916. function radioTitle() {
  917. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  918. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  919. // var url = 'http://code.davidawindham.com:8008/status2.xsl';
  920. /* var mountpoint = '/stream';
  921. $.ajax({ type: 'GET',
  922. url: url,
  923. async: true,
  924. jsonpCallback: 'parseMusic',
  925. contentType: "application/json",
  926. dataType: 'jsonp',
  927. success: function (json) {
  928. $('#track').text(json[mountpoint].title);
  929. $('#listeners').text(json[mountpoint].listeners);
  930. $('#peak-listeners').text(json[mountpoint].peak_listeners);
  931. $('#bitrate').text(json[mountpoint].bitrate);
  932. $('#radio').attr('src', get_radio_tower()).fadeIn(300);
  933. $('#eq').attr('src', get_radio_eq()).fadeIn(300);
  934. },
  935. error: function (e) { console.log(e.message);
  936. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  937. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  938. }
  939. });
  940. */
  941. }
  942. $(function() {
  943. var el, newPoint, newPlace, offset;
  944. $("input[type='range']").change(function() {
  945. el = $(this);
  946. width = el.width();
  947. newPoint = (el.val() - el.attr("min")) / (el.attr("max") - el.attr("min"));
  948. offset = -1.3;
  949. if (newPoint < 0) { newPlace = 0; }
  950. else if (newPoint > 1) { newPlace = width; }
  951. else { newPlace = width * newPoint + offset; offset -= newPoint;}
  952. el
  953. .next("output")
  954. .css({
  955. left: newPlace,
  956. marginLeft: offset + "%"
  957. })
  958. .text(el.val());
  959. })
  960. .trigger('change');
  961. });
  962. $(document).ready(function () {
  963. //setTimeout(function () {radioTitle();}, 2000);
  964. //setInterval(function () {radioTitle();}, 30000); // update every 30 seconds
  965. spectrum();
  966. function spectrum() {
  967. var randomColor = Math.floor(Math.random()*16777215).toString(16);
  968. $("span#user-label").css({ backgroundColor: '#' + randomColor });
  969. //$("body").animate({ backgroundColor: '#' + randomColor });
  970. //$("body").animate({ backgroundColor: '#' + randomColor }, 1000);
  971. //spectrum();
  972. }
  973. });