radio.js 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. /*!
  2. * jQuery Color Animations v@VERSION
  3. * https://github.com/jquery/jquery-color
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. *
  9. * Date: @DATE
  10. */
  11. (function( jQuery, undefined ) {
  12. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  13. // plusequals test for += 100 -= 100
  14. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  15. // a set of RE's that can match strings and generate color tuples.
  16. stringParsers = [{
  17. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  18. parse: function( execResult ) {
  19. return [
  20. execResult[ 1 ],
  21. execResult[ 2 ],
  22. execResult[ 3 ],
  23. execResult[ 4 ]
  24. ];
  25. }
  26. }, {
  27. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  28. parse: function( execResult ) {
  29. return [
  30. execResult[ 1 ] * 2.55,
  31. execResult[ 2 ] * 2.55,
  32. execResult[ 3 ] * 2.55,
  33. execResult[ 4 ]
  34. ];
  35. }
  36. }, {
  37. // this regex ignores A-F because it's compared against an already lowercased string
  38. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
  39. parse: function( execResult ) {
  40. return [
  41. parseInt( execResult[ 1 ], 16 ),
  42. parseInt( execResult[ 2 ], 16 ),
  43. parseInt( execResult[ 3 ], 16 )
  44. ];
  45. }
  46. }, {
  47. // this regex ignores A-F because it's compared against an already lowercased string
  48. re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
  49. parse: function( execResult ) {
  50. return [
  51. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  52. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  53. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
  54. ];
  55. }
  56. }, {
  57. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  58. space: "hsla",
  59. parse: function( execResult ) {
  60. return [
  61. execResult[ 1 ],
  62. execResult[ 2 ] / 100,
  63. execResult[ 3 ] / 100,
  64. execResult[ 4 ]
  65. ];
  66. }
  67. }],
  68. // jQuery.Color( )
  69. color = jQuery.Color = function( color, green, blue, alpha ) {
  70. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  71. },
  72. spaces = {
  73. rgba: {
  74. props: {
  75. red: {
  76. idx: 0,
  77. type: "byte"
  78. },
  79. green: {
  80. idx: 1,
  81. type: "byte"
  82. },
  83. blue: {
  84. idx: 2,
  85. type: "byte"
  86. }
  87. }
  88. },
  89. hsla: {
  90. props: {
  91. hue: {
  92. idx: 0,
  93. type: "degrees"
  94. },
  95. saturation: {
  96. idx: 1,
  97. type: "percent"
  98. },
  99. lightness: {
  100. idx: 2,
  101. type: "percent"
  102. }
  103. }
  104. }
  105. },
  106. propTypes = {
  107. "byte": {
  108. floor: true,
  109. max: 255
  110. },
  111. "percent": {
  112. max: 1
  113. },
  114. "degrees": {
  115. mod: 360,
  116. floor: true
  117. }
  118. },
  119. support = color.support = {},
  120. // element for support tests
  121. supportElem = jQuery( "<p>" )[ 0 ],
  122. // colors = jQuery.Color.names
  123. colors,
  124. // local aliases of functions called often
  125. each = jQuery.each;
  126. // determine rgba support immediately
  127. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  128. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  129. // define cache name and alpha properties
  130. // for rgba and hsla spaces
  131. each( spaces, function( spaceName, space ) {
  132. space.cache = "_" + spaceName;
  133. space.props.alpha = {
  134. idx: 3,
  135. type: "percent",
  136. def: 1
  137. };
  138. });
  139. function clamp( value, prop, allowEmpty ) {
  140. var type = propTypes[ prop.type ] || {};
  141. if ( value == null ) {
  142. return (allowEmpty || !prop.def) ? null : prop.def;
  143. }
  144. // ~~ is an short way of doing floor for positive numbers
  145. value = type.floor ? ~~value : parseFloat( value );
  146. // IE will pass in empty strings as value for alpha,
  147. // which will hit this case
  148. if ( isNaN( value ) ) {
  149. return prop.def;
  150. }
  151. if ( type.mod ) {
  152. // we add mod before modding to make sure that negatives values
  153. // get converted properly: -10 -> 350
  154. return (value + type.mod) % type.mod;
  155. }
  156. // for now all property types without mod have min and max
  157. return 0 > value ? 0 : type.max < value ? type.max : value;
  158. }
  159. function stringParse( string ) {
  160. var inst = color(),
  161. rgba = inst._rgba = [];
  162. string = string.toLowerCase();
  163. each( stringParsers, function( i, parser ) {
  164. var parsed,
  165. match = parser.re.exec( string ),
  166. values = match && parser.parse( match ),
  167. spaceName = parser.space || "rgba";
  168. if ( values ) {
  169. parsed = inst[ spaceName ]( values );
  170. // if this was an rgba parse the assignment might happen twice
  171. // oh well....
  172. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  173. rgba = inst._rgba = parsed._rgba;
  174. // exit each( stringParsers ) here because we matched
  175. return false;
  176. }
  177. });
  178. // Found a stringParser that handled it
  179. if ( rgba.length ) {
  180. // if this came from a parsed string, force "transparent" when alpha is 0
  181. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  182. if ( rgba.join() === "0,0,0,0" ) {
  183. jQuery.extend( rgba, colors.transparent );
  184. }
  185. return inst;
  186. }
  187. // named colors
  188. return colors[ string ];
  189. }
  190. color.fn = jQuery.extend( color.prototype, {
  191. parse: function( red, green, blue, alpha ) {
  192. if ( red === undefined ) {
  193. this._rgba = [ null, null, null, null ];
  194. return this;
  195. }
  196. if ( red.jquery || red.nodeType ) {
  197. red = jQuery( red ).css( green );
  198. green = undefined;
  199. }
  200. var inst = this,
  201. type = jQuery.type( red ),
  202. rgba = this._rgba = [];
  203. // more than 1 argument specified - assume ( red, green, blue, alpha )
  204. if ( green !== undefined ) {
  205. red = [ red, green, blue, alpha ];
  206. type = "array";
  207. }
  208. if ( type === "string" ) {
  209. return this.parse( stringParse( red ) || colors._default );
  210. }
  211. if ( type === "array" ) {
  212. each( spaces.rgba.props, function( key, prop ) {
  213. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  214. });
  215. return this;
  216. }
  217. if ( type === "object" ) {
  218. if ( red instanceof color ) {
  219. each( spaces, function( spaceName, space ) {
  220. if ( red[ space.cache ] ) {
  221. inst[ space.cache ] = red[ space.cache ].slice();
  222. }
  223. });
  224. } else {
  225. each( spaces, function( spaceName, space ) {
  226. var cache = space.cache;
  227. each( space.props, function( key, prop ) {
  228. // if the cache doesn't exist, and we know how to convert
  229. if ( !inst[ cache ] && space.to ) {
  230. // if the value was null, we don't need to copy it
  231. // if the key was alpha, we don't need to copy it either
  232. if ( key === "alpha" || red[ key ] == null ) {
  233. return;
  234. }
  235. inst[ cache ] = space.to( inst._rgba );
  236. }
  237. // this is the only case where we allow nulls for ALL properties.
  238. // call clamp with alwaysAllowEmpty
  239. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  240. });
  241. // everything defined but alpha?
  242. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  243. // use the default of 1
  244. inst[ cache ][ 3 ] = 1;
  245. if ( space.from ) {
  246. inst._rgba = space.from( inst[ cache ] );
  247. }
  248. }
  249. });
  250. }
  251. return this;
  252. }
  253. },
  254. is: function( compare ) {
  255. var is = color( compare ),
  256. same = true,
  257. inst = this;
  258. each( spaces, function( _, space ) {
  259. var localCache,
  260. isCache = is[ space.cache ];
  261. if (isCache) {
  262. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  263. each( space.props, function( _, prop ) {
  264. if ( isCache[ prop.idx ] != null ) {
  265. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  266. return same;
  267. }
  268. });
  269. }
  270. return same;
  271. });
  272. return same;
  273. },
  274. _space: function() {
  275. var used = [],
  276. inst = this;
  277. each( spaces, function( spaceName, space ) {
  278. if ( inst[ space.cache ] ) {
  279. used.push( spaceName );
  280. }
  281. });
  282. return used.pop();
  283. },
  284. transition: function( other, distance ) {
  285. var end = color( other ),
  286. spaceName = end._space(),
  287. space = spaces[ spaceName ],
  288. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  289. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  290. result = start.slice();
  291. end = end[ space.cache ];
  292. each( space.props, function( key, prop ) {
  293. var index = prop.idx,
  294. startValue = start[ index ],
  295. endValue = end[ index ],
  296. type = propTypes[ prop.type ] || {};
  297. // if null, don't override start value
  298. if ( endValue === null ) {
  299. return;
  300. }
  301. // if null - use end
  302. if ( startValue === null ) {
  303. result[ index ] = endValue;
  304. } else {
  305. if ( type.mod ) {
  306. if ( endValue - startValue > type.mod / 2 ) {
  307. startValue += type.mod;
  308. } else if ( startValue - endValue > type.mod / 2 ) {
  309. startValue -= type.mod;
  310. }
  311. }
  312. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  313. }
  314. });
  315. return this[ spaceName ]( result );
  316. },
  317. blend: function( opaque ) {
  318. // if we are already opaque - return ourself
  319. if ( this._rgba[ 3 ] === 1 ) {
  320. return this;
  321. }
  322. var rgb = this._rgba.slice(),
  323. a = rgb.pop(),
  324. blend = color( opaque )._rgba;
  325. return color( jQuery.map( rgb, function( v, i ) {
  326. return ( 1 - a ) * blend[ i ] + a * v;
  327. }));
  328. },
  329. toRgbaString: function() {
  330. var prefix = "rgba(",
  331. rgba = jQuery.map( this._rgba, function( v, i ) {
  332. return v == null ? ( i > 2 ? 1 : 0 ) : v;
  333. });
  334. if ( rgba[ 3 ] === 1 ) {
  335. rgba.pop();
  336. prefix = "rgb(";
  337. }
  338. return prefix + rgba.join() + ")";
  339. },
  340. toHslaString: function() {
  341. var prefix = "hsla(",
  342. hsla = jQuery.map( this.hsla(), function( v, i ) {
  343. if ( v == null ) {
  344. v = i > 2 ? 1 : 0;
  345. }
  346. // catch 1 and 2
  347. if ( i && i < 3 ) {
  348. v = Math.round( v * 100 ) + "%";
  349. }
  350. return v;
  351. });
  352. if ( hsla[ 3 ] === 1 ) {
  353. hsla.pop();
  354. prefix = "hsl(";
  355. }
  356. return prefix + hsla.join() + ")";
  357. },
  358. toHexString: function( includeAlpha ) {
  359. var rgba = this._rgba.slice(),
  360. alpha = rgba.pop();
  361. if ( includeAlpha ) {
  362. rgba.push( ~~( alpha * 255 ) );
  363. }
  364. return "#" + jQuery.map( rgba, function( v ) {
  365. // default to 0 when nulls exist
  366. v = ( v || 0 ).toString( 16 );
  367. return v.length === 1 ? "0" + v : v;
  368. }).join("");
  369. },
  370. toString: function() {
  371. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  372. }
  373. });
  374. color.fn.parse.prototype = color.fn;
  375. // hsla conversions adapted from:
  376. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  377. function hue2rgb( p, q, h ) {
  378. h = ( h + 1 ) % 1;
  379. if ( h * 6 < 1 ) {
  380. return p + (q - p) * h * 6;
  381. }
  382. if ( h * 2 < 1) {
  383. return q;
  384. }
  385. if ( h * 3 < 2 ) {
  386. return p + (q - p) * ((2/3) - h) * 6;
  387. }
  388. return p;
  389. }
  390. spaces.hsla.to = function ( rgba ) {
  391. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  392. return [ null, null, null, rgba[ 3 ] ];
  393. }
  394. var r = rgba[ 0 ] / 255,
  395. g = rgba[ 1 ] / 255,
  396. b = rgba[ 2 ] / 255,
  397. a = rgba[ 3 ],
  398. max = Math.max( r, g, b ),
  399. min = Math.min( r, g, b ),
  400. diff = max - min,
  401. add = max + min,
  402. l = add * 0.5,
  403. h, s;
  404. if ( min === max ) {
  405. h = 0;
  406. } else if ( r === max ) {
  407. h = ( 60 * ( g - b ) / diff ) + 360;
  408. } else if ( g === max ) {
  409. h = ( 60 * ( b - r ) / diff ) + 120;
  410. } else {
  411. h = ( 60 * ( r - g ) / diff ) + 240;
  412. }
  413. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  414. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  415. if ( diff === 0 ) {
  416. s = 0;
  417. } else if ( l <= 0.5 ) {
  418. s = diff / add;
  419. } else {
  420. s = diff / ( 2 - add );
  421. }
  422. return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
  423. };
  424. spaces.hsla.from = function ( hsla ) {
  425. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  426. return [ null, null, null, hsla[ 3 ] ];
  427. }
  428. var h = hsla[ 0 ] / 360,
  429. s = hsla[ 1 ],
  430. l = hsla[ 2 ],
  431. a = hsla[ 3 ],
  432. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  433. p = 2 * l - q;
  434. return [
  435. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  436. Math.round( hue2rgb( p, q, h ) * 255 ),
  437. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  438. a
  439. ];
  440. };
  441. each( spaces, function( spaceName, space ) {
  442. var props = space.props,
  443. cache = space.cache,
  444. to = space.to,
  445. from = space.from;
  446. // makes rgba() and hsla()
  447. color.fn[ spaceName ] = function( value ) {
  448. // generate a cache for this space if it doesn't exist
  449. if ( to && !this[ cache ] ) {
  450. this[ cache ] = to( this._rgba );
  451. }
  452. if ( value === undefined ) {
  453. return this[ cache ].slice();
  454. }
  455. var ret,
  456. type = jQuery.type( value ),
  457. arr = ( type === "array" || type === "object" ) ? value : arguments,
  458. local = this[ cache ].slice();
  459. each( props, function( key, prop ) {
  460. var val = arr[ type === "object" ? key : prop.idx ];
  461. if ( val == null ) {
  462. val = local[ prop.idx ];
  463. }
  464. local[ prop.idx ] = clamp( val, prop );
  465. });
  466. if ( from ) {
  467. ret = color( from( local ) );
  468. ret[ cache ] = local;
  469. return ret;
  470. } else {
  471. return color( local );
  472. }
  473. };
  474. // makes red() green() blue() alpha() hue() saturation() lightness()
  475. each( props, function( key, prop ) {
  476. // alpha is included in more than one space
  477. if ( color.fn[ key ] ) {
  478. return;
  479. }
  480. color.fn[ key ] = function( value ) {
  481. var vtype = jQuery.type( value ),
  482. fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
  483. local = this[ fn ](),
  484. cur = local[ prop.idx ],
  485. match;
  486. if ( vtype === "undefined" ) {
  487. return cur;
  488. }
  489. if ( vtype === "function" ) {
  490. value = value.call( this, cur );
  491. vtype = jQuery.type( value );
  492. }
  493. if ( value == null && prop.empty ) {
  494. return this;
  495. }
  496. if ( vtype === "string" ) {
  497. match = rplusequals.exec( value );
  498. if ( match ) {
  499. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  500. }
  501. }
  502. local[ prop.idx ] = value;
  503. return this[ fn ]( local );
  504. };
  505. });
  506. });
  507. // add cssHook and .fx.step function for each named hook.
  508. // accept a space separated string of properties
  509. color.hook = function( hook ) {
  510. var hooks = hook.split( " " );
  511. each( hooks, function( i, hook ) {
  512. jQuery.cssHooks[ hook ] = {
  513. set: function( elem, value ) {
  514. var parsed, curElem,
  515. backgroundColor = "";
  516. if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  517. value = color( parsed || value );
  518. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  519. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  520. while (
  521. (backgroundColor === "" || backgroundColor === "transparent") &&
  522. curElem && curElem.style
  523. ) {
  524. try {
  525. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  526. curElem = curElem.parentNode;
  527. } catch ( e ) {
  528. }
  529. }
  530. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  531. backgroundColor :
  532. "_default" );
  533. }
  534. value = value.toRgbaString();
  535. }
  536. try {
  537. elem.style[ hook ] = value;
  538. } catch( e ) {
  539. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  540. }
  541. }
  542. };
  543. jQuery.fx.step[ hook ] = function( fx ) {
  544. if ( !fx.colorInit ) {
  545. fx.start = color( fx.elem, hook );
  546. fx.end = color( fx.end );
  547. fx.colorInit = true;
  548. }
  549. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  550. };
  551. });
  552. };
  553. color.hook( stepHooks );
  554. jQuery.cssHooks.borderColor = {
  555. expand: function( value ) {
  556. var expanded = {};
  557. each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
  558. expanded[ "border" + part + "Color" ] = value;
  559. });
  560. return expanded;
  561. }
  562. };
  563. // Basic color names only.
  564. // Usage of any of the other color names requires adding yourself or including
  565. // jquery.color.svg-names.js.
  566. colors = jQuery.Color.names = {
  567. // 4.1. Basic color keywords
  568. aqua: "#00ffff",
  569. black: "#000000",
  570. blue: "#0000ff",
  571. fuchsia: "#ff00ff",
  572. gray: "#808080",
  573. green: "#008000",
  574. lime: "#00ff00",
  575. maroon: "#800000",
  576. navy: "#000080",
  577. olive: "#808000",
  578. purple: "#800080",
  579. red: "#ff0000",
  580. silver: "#c0c0c0",
  581. teal: "#008080",
  582. white: "#ffffff",
  583. yellow: "#ffff00",
  584. // 4.2.3. "transparent" color keyword
  585. transparent: [ null, null, null, 0 ],
  586. _default: "#ffffff"
  587. };
  588. }( jQuery ));
  589. /* Radio Funtions */
  590. /*
  591. Version: 1.1
  592. Author: Dan Pastori
  593. Company: 521 Dimensions
  594. */
  595. 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));
  596. 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);
  597. (function( $ ) {
  598. $.fn.lfmr = function(options){
  599. var urla = "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&format=json&limit=100";
  600. var tracks = [];
  601. function isLoadedr (recentElement) {
  602. for (var i = 0; i < tracks.length; i++){
  603. var markup = $("<li class='list-group-item'>" + tracks[i].artist + " - <span class='artist'>" + tracks[i].title + " : " + tracks[i].album + "</li>");
  604. recentElement.append(markup);
  605. }
  606. }
  607. return this.each(function(){
  608. var $this = $(this);
  609. $.getJSON( urla, function(data){
  610. $(data.recenttracks.track).each(function(){
  611. tracks.push ({
  612. artist: this.artist["#text"],
  613. title: this.name,
  614. album: this.album["#text"]
  615. });
  616. });
  617. isLoadedr($this);
  618. });
  619. });
  620. };
  621. $('.recent').lfmr();
  622. })( jQuery );
  623. /* ======= SAVE FOR LATER Icecast 2.4 upgrade to fix CORs headers @ http://64.207.154.37:8008/status2.xsl ========
  624. (function($){
  625. $.fn.icecast = function(options){
  626. $.ajaxSetup({
  627. cache:true,
  628. scriptCharset:"utf-8",
  629. contentType:"text/json;charset=utf-8"
  630. });
  631. var defaults = {
  632. server:"http://stream.davidawindham.com:8008/stream",
  633. stationlogo:""
  634. };
  635. var options = $.extend(defaults,options);
  636. return this.each(function(){var icecast = $(this);
  637. $.getJSON('http://'+options.server+'/status2.xsl',
  638. function(data){$.each(data.mounts,function(i,mount){
  639. $(icecast).append('<li class="mount"><div class="track">'+mount.title+'</div><div class="listeners">Listeners: '+mount.listeners+' at '+mount.bitrate+'kbps</div></li>');
  640. });
  641. });
  642. });
  643. };})(jQuery);
  644. $(function(){
  645. $('.mounts').icecast({server:"64.207.154.37:8008"});
  646. });
  647. */
  648. amplitude_config = {
  649. amplitude_songs: []
  650. // "amplitude_songs": [{
  651. // "url": "http://code.davidawindham.com:8008/stream",
  652. // "live": true
  653. // }],
  654. // "amplitude_volume": 90
  655. }
  656. function get_radio_tower() {return 'img/radio.gif';}
  657. function get_radio_none() {return 'img/none.svg';}
  658. function get_radio_eq() {return 'img/eq.gif';}
  659. function get_radio_eq_none() {return 'img/1.png';}
  660. function radioTitle() {
  661. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  662. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  663. // var url = 'http://code.davidawindham.com:8008/status2.xsl';
  664. /* var mountpoint = '/stream';
  665. $.ajax({ type: 'GET',
  666. url: url,
  667. async: true,
  668. jsonpCallback: 'parseMusic',
  669. contentType: "application/json",
  670. dataType: 'jsonp',
  671. success: function (json) {
  672. $('#track').text(json[mountpoint].title);
  673. $('#listeners').text(json[mountpoint].listeners);
  674. $('#peak-listeners').text(json[mountpoint].peak_listeners);
  675. $('#bitrate').text(json[mountpoint].bitrate);
  676. $('#radio').attr('src', get_radio_tower()).fadeIn(300);
  677. $('#eq').attr('src', get_radio_eq()).fadeIn(300);
  678. },
  679. error: function (e) { console.log(e.message);
  680. $('#radio').attr('src', get_radio_none()).fadeIn(300);
  681. $('#eq').attr('src', get_radio_eq_none()).fadeIn(300);
  682. }
  683. });
  684. */
  685. }
  686. $(function() {
  687. var el, newPoint, newPlace, offset;
  688. $("input[type='range']").change(function() {
  689. el = $(this);
  690. width = el.width();
  691. newPoint = (el.val() - el.attr("min")) / (el.attr("max") - el.attr("min"));
  692. offset = -1.3;
  693. if (newPoint < 0) { newPlace = 0; }
  694. else if (newPoint > 1) { newPlace = width; }
  695. else { newPlace = width * newPoint + offset; offset -= newPoint;}
  696. el
  697. .next("output")
  698. .css({
  699. left: newPlace,
  700. marginLeft: offset + "%"
  701. })
  702. .text(el.val());
  703. })
  704. .trigger('change');
  705. });
  706. $(document).ready(function () {
  707. //setTimeout(function () {radioTitle();}, 2000);
  708. //setInterval(function () {radioTitle();}, 30000); // update every 30 seconds
  709. spectrum();
  710. function spectrum() {
  711. var randomColor = Math.floor(Math.random()*16777215).toString(16);
  712. $("span#user-label").css({ backgroundColor: '#' + randomColor });
  713. //$("body").animate({ backgroundColor: '#' + randomColor });
  714. //$("body").animate({ backgroundColor: '#' + randomColor }, 1000);
  715. //spectrum();
  716. }
  717. });