PageSourceSearch

https://www.stackradioapp.com/assets/playlist/dist/amplitude.js

js stackradioapp.com collected 2026-09-24 14:18:49 UTC 222,634 bytes, 7,397 lines download raw bytes

vendor: 4,071 bytes, lines 1-103
1(function webpackUniversalModuleDefinition(root, factory) {
2	if(typeof exports === 'object' && typeof module === 'object')
3		module.exports = factory();
4	else if(typeof define === 'function' && define.amd)
5		define("Amplitude", [], factory);
6	else if(typeof exports === 'object')
7		exports["Amplitude"] = factory();
8	else
9		root["Amplitude"] = factory();
10})(this, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ 	// The module cache
13/******/ 	var installedModules = {};
14/******/
15/******/ 	// The require function
16/******/ 	function __webpack_require__(moduleId) {
17/******/
18/******/ 		// Check if module is in cache
19/******/ 		if(installedModules[moduleId]) {
20/******/ 			return installedModules[moduleId].exports;
21/******/ 		}
22/******/ 		// Create a new module (and put it into the cache)
23/******/ 		var module = installedModules[moduleId] = {
24/******/ 			i: moduleId,
25/******/ 			l: false,
26/******/ 			exports: {}
27/******/ 		};
28/******/
29/******/ 		// Execute the module function
30/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ 		// Flag the module as loaded
33/******/ 		module.l = true;
34/******/
35/******/ 		// Return the exports of the module
36/******/ 		return module.exports;
37/******/ 	}
38/******/
39/******/
40/******/ 	// expose the modules object (__webpack_modules__)
41/******/ 	__webpack_require__.m = modules;
42/******/
43/******/ 	// expose the module cache
44/******/ 	__webpack_require__.c = installedModules;
45/******/
46/******/ 	// identity function for calling harmony imports with the correct context
47/******/ 	__webpack_require__.i = function(value) { return value; };
48/******/
49/******/ 	// define getter function for harmony exports
50/******/ 	__webpack_require__.d = function(exports, name, getter) {
51/******/ 		if(!__webpack_require__.o(exports, name)) {
52/******/ 			Object.defineProperty(exports, name, {
53/******/ 				configurable: false,
54/******/ 				enumerable: true,
55/******/ 				get: getter
56/******/ 			});
57/******/ 		}
58/******/ 	};
59/******/
60/******/ 	// getDefaultExport function for compatibility with non-harmony modules
61/******/ 	__webpack_require__.n = function(module) {
62/******/ 		var getter = module && module.__esModule ?
63/******/ 			function getDefault() { return module['default']; } :
64/******/ 			function getModuleExports() { return module; };
65/******/ 		__webpack_require__.d(getter, 'a', getter);
66/******/ 		return getter;
67/******/ 	};
68/******/
69/******/ 	// Object.prototype.hasOwnProperty.call
70/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
71/******/
72/******/ 	// __webpack_public_path__
73/******/ 	__webpack_require__.p = "";
74/******/
75/******/ 	// Load entry module and return exports
76/******/ 	return __webpack_require__(__webpack_require__.s = 8);
77/******/ })
78/************************************************************************/
79/******/ ([
80/* 0 */
81/***/ (function(module, exports, __webpack_require__) {
82
83"use strict";
84
85
86/**
87 * These variables make Amplitude run. The config is the most important
88 * containing active settings and parameters.
89 *
90 * The config JSON is the global settings for ALL of Amplitude functions.
91 * This is global and contains all of the user preferences. The default
92 * settings are set, and the user overwrites them when they initialize
93 * Amplitude.
94 *
95 * @module config
96 * @type {object}
97 * @property {string}  	config.version          				- The current version of AmplitudeJS.
98 * @property {object} 	config.active_song 		 					-	Handles all of the audio.
99 * @property {object} 	config.active_metadata					- Contains the active metadata for the song.
100 * @property {string} 	config.active_album							- Holds the active album name. Used to check and see if the album changed and run the album changed callback.
101 * @property {number} 	config.active_index							- Contains the index of the actively playing song.
102 * @property {string} 	config.active_playlist					- Contains the key to the active playlist index.
103 * @property {boolean}
103	config.autoplay									- Set to true to autoplay the song
104 * @property {number} 	config.playback_speed						- Sets the initial playback speed of the song. The values for this can be 1.0, 1.5, 2.0
105 * @property {object} 	config.callbacks								- The user can pass a JSON object with a key => value store of callbacks to be run at certain events.
106 * @property {array} 		config.songs										- Contains all of the songs the user has passed to Amplitude to use.
107 * @property {object} 	config.playlists								- Contains all of the playlists the user created.
108 * @property {object} 	config.start_song 							- The index of the song that AmplitudeJS should start with.
109 * @property {object} 	config.shuffled_playlists				- Will contain shuffled playlists.
110 * @property {string} 	config.starting_playlist 				- The starting playlist the player will intiialize to.
111 * @property {string} 	config.starting_playlist_song 	- The index of the song in the playlist that should be started.
112 * @property {object} 	config.shuffled_statuses 				- Contains whether the current playlist is in shuffle mode or not.
113 * @property {object} 	config.repeat_statuses 					- Contains whether the playlist is in repeat mode or not.
114 * @property {object} 	config.shuffled_active_indexes	- Contains the active index in a shuffled playlist.
115 * @property {boolean} 	config.repeat 									- When repeat is on, when the song ends the song will replay itself.
116 * @property {object} 	config.shuffle_list							- When shuffled, gets populated with the songs the user provided in a random order.
117 * @property {boolean} 	config.shuffle_on								- When on, gets set to true so when traversing through songs, AmplitudeJS knows whether or not to use the songs object or the shuffle_list
118 * @property {number} 	config.shuffle_active_index 		- When shuffled, this index is used to let AmplitudeJS know where it's at when traversing.
119 * @property {string}		config.default_album_art 				- The user can set default album art to be displayed if the song they set doesn't contain album art.
120 * @property {boolean} 	config.debug										- When set to true, AmplitudeJS will print to the console any errors providing helpful feedback to the user.
121 * @property {number} 	config.volume 									- The user can set the initial volume to a number between 0 and 1 over-riding the default of .5
122 * @property {number} 	config.pre_mute_volume 					- This is set on mute so that when a user un-mutes AmplitudeJS knows what to restore the volume to.
123 * @property {number}		config.volume_increment 				- The default values are an integer between 1 and 100 for how much the volume should increase when the user presses the volume up button.
124 * @property {number}		config.volume_decrement 				- The default values are an integer between 1 and 100 for how much the volume should decrease when the user presses the volume down button.
125 * @property {string} 	config.soundcloud_client 				- When using SoundCloud, the user will have to provide their API Client ID
126 * @property {boolean} 	config.soundcloud_use_art 			- The user can set this to true and AmplitudeJS will use the album art for the song returned from the Soundcloud API
127 * @property {number} 	config.soundcloud_song_count 		- Used on config to count how many songs are from Soundcloud and compare it to how many are ready for when to move to the rest of the configuration
128 * @property {number} 	config.soundcloud_songs_ready 	- Used on config to count how many songs are ready so when we get all of the data from the SoundCloud API that we need this should match the SoundCloud song count meaning we can move to the rest of the config.
129 * @property {integer}	config.is_touch_moving 					- Flag for if the user is moving the screen.
130 * @property {boolean}	config.buffered									- How much of the song is buffered.
131 * @property {object} 	config.bindings									- Array of bindings to certain key events.
132 * @property {boolean} 	config.continue_next 						- Determines when a song ends, we should continue to the next song.
133 * @property {number}   config.delay 										- Sets the delay between songs in MS.
134 */
135module.exports = {
136  version: '3.3.1',
137
138  active_song: new Audio(),
139
140  active_metadata: {},
141
142  active_album: '',
143
144  active_index: 0,
145
146  active_playlist: '',
147
148  autoplay: true,
149
150  playback_speed: 1.0,
151
152  callbacks: {},
153
154  songs: [],
155
156  playlists: {},
157
158  start_song: '',
159
160  shuffled_playlists: {},
161
162  starting_playlist: '',
163
164  starting_playlist_song: '',
165
166  shuffled_statuses: {},
167
168  shuffled_active_indexes: {},
169
170  repeat_statuses: {},
171
172  repeat: false,
173
174  repeat_song: false,
175
176  shuffle_list: {},
177
178  shuffle_on: false,
179
180  shuffle_active_index: 0,
181
182  default_album_art: '',
183
184  debug: false,
185
186  volume: .5,
187
188  pre_mute_volume: .5,
189
190  volume_increment: 5,
191
192  volume_decrement: 5,
193
194  soundcloud_client: '',
195
196  soundcloud_use_art: false,
197
198  soundcloud_song_count: 0,
199
200  soundcloud_songs_ready: 0,
201
202  is_touch_moving: false,
203
204  buffered: 0,
205
206  bindings: {},
207
208  continue_next: true,
209
210  delay: 0
211};
212
213/***/ }),
214/* 1 */
215/***/ (function(module, exports, __webpack_require__) {
216
217"use strict";
218
219
220Object.defineProperty(exports, "__esModule", {
221	value: true
222});
223
224var _config = __webpack_require__(0);
225
226var _config2 = _interopRequireDefault(_config);
227
228var _core = __webpack_require__(3);
229
230var _core2 = _interopRequireDefault(_core);
231
232var _visual = __webpack_require__(2);
233
234var _visual2 = _interopRequireDefault(_visual);
235
236function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
237
238/**
239 * For the sake of code clarity, these functions perform helper tasks
240 * assisting the logical functions with what they need such as setting
241 * the proper song index after an event has occured.
242 *
243 * @module core/AmplitudeHelpers
244 */
245
246
247/**
248 * AmplitudeJS Core Module
249 * @module core/AmplitudeCore
250 */
251var AmplitudeHelpers = function () {
252	/**
253  * Resets the config to the default state. This is called on initialize
254  * to ensure the user's config is what matters.
255  *
256  * Public Accessor: AmplitudeHelpers.resetConfig()
257  *
258  * @access public
259  */
260	function resetConfig() {
261		_config2.default.active_song = new Audio();
262		_config2.default.active_metadata = {};
263		_config2.default.active_album = '';
264		_config2.default.active_index = 0;
265		_config2.default.active_playlist = '';
266		_config2.default.active_playlist = '';
267		_config2.default.autoplay = true;
268		_config2.default.playback_speed = 1.0;
269		_config2.default.callbacks = {};
270		_config2.default.songs = [];
271		_config2.default.playlists = {};
272		_config2.default.start_song = '';
273		_config2.default.shuffled_playlists = {};
274		_config2.default.starting_playlist = '';
275		_config2.default.starting_playlist_song = '';
276		_config2.default.shuffled_statuses = {};
277		_config2.default.repeat = false;
278		_config2.default.shuffle_list = {};
279		_config2.default.shuffle_on = false;
280		_config2.default.shuffle_active_index = 0;
281		_config2.default.default_album_art = '';
282		_config2.default.debug = false;
283		_config2.default.handle_song_elements = true;
284		_config2.default.volume = .5;
285		_config2.default.pre_mute_volume = .5;
286		_config2.default.volume_increment = 5;
287		_config2.default.volume_decrement = 5;
288		_config2.default.soundcloud_client = '';
289		_config2.default.soundcloud_use_art = false;
290		_config2.default.soundcloud_song_count = 0;
291		_config2.default.soundcloud_songs_ready = 0;
292		_config2.default.continue_next = true;
293	}
294
295	/**
296  * Writes out debug message to the console if enabled.
297  *
298  * Public Accessor: AmplitudeHelpers.writeDebugMessage( message )
299  *
300  * @access public
301  * @param {string} message - The string that gets printed to alert the user of a debugging error.
302  */
303	function writeDebugMessage(message) {
304		if (_config2.default.debug) {
305			console.log(message);
306		}
307	}
308
309	/**
310  * Runs a user defined callback method
311  *
312  * Public Accessor: AmplitudeHelpers.runCallback( callbackName )
313  *
314  * @access public
315  * @param {string} callbackName - The name of the callback we are going to run.
316  */
317	function runCallback(callbackName) {
318		/*
319  	Checks to see if a user defined a callback method for the
320  	callback we are running.
321  */
322		if (_config2.default.callbacks[callbackName]) {
323			/*
324   	Build the callback function
325   */
326			var callbackFunction = _config2.default.callbacks[callbackName];
327
328			/*
329   	Write a debug message stating the callback we are running
330   */
331			writeDebugMessage('Running Callback: ' + callbackName);
332
333			/*
334   	Run the callback function and catch any errors
335   */
336			try {
337				callbackFunction();
338			} catch (error) {
339				if (error.message == "CANCEL EVENT") {
340					throw error;
341				} else {
342					writeDebugMessage('Callback error: ' + error.message);
343				}
344			}
345		}
346	}
347
348	/**
349  * Changes the active song in the config. This happens in multiple
350  * scenarios: The user clicks a play button that has an index that is
351  * different than what is currently playing, the song ends and the next
352  * song begins, etc.
353  *
354  * Public Accessor: AmplitudeHelpers.changeSong( songIndex )
355  *
356  * @access public
357  * @param {number} songIndex - The song index we are changing to
358  *
359  */
360	function changeSong(songIndex) {
361		/*
362  	Grab the song at the index defined by the user.
363  */
364		var song = _config2.default.songs[songIndex];
365
366		/*
367  	Stops the currently playing song so we can adjust
368  	what we need.
369  */
370		_core2.default.stop();
371
372		/**
373   * @todo: Stop Visualization
374   */
375
376		/*
377  	Set all play buttons to pause while we change
378  	the song.
379  */
380		_visual2.default.setPlayPauseButtonsToPause();
381
382		/*
383  	Since it is a new song, we reset the song sliders. These
384  	react to time updates and will eventually be updated but we
385  	force update them is if there is a song slider bound to a
386  	specific song, they won't update.
387  */
388		_visual2.default.resetSongSliders();
389
390		/*
391  	Resets the progress bars
392  */
393		_visual2.default.resetSongPlayedProgressBars();
394
395		/*
396  	Reset all the time place holders accordingly.
397  */
398		_visual2.default.resetTimes();
399
400		/*
401  	Run a callback if an album is going
402  	to change.
403  */
404		if (checkNewAlbum(song)) {
405			runCallback('album_change');
406		}
407
408		/*
409  	Set the new song information so we can use the
410  	active meta data later on.
411  */
412		setNewSong(song, songIndex);
413
414		/*
415  	Display the new visual metadata now that the config has
416  	been changed. This will show the new song.
417  */
418		_visual2.default.displaySongMetadata();
419
420		/*
421  	Sets the active container. This is a class that
422  	designers can use on an element that contains the current
423  	song's controls to show it's highlighted.
424  */
425		_visual2.default.setActiveContainer();
426
427		/*
428  	Sets the active song's duration
429  */
430		_visual2.default.syncSongDuration();
431
432		/*
433  	Run song change callback.
434  */
435		runCallback('song_change');
436	}
437
438	/**
439  * Checks to see if the new song to be played is different than the song
440  * that is currently playing. To be true, the user would have selected
441  * play on a new song with a new index. To be false, the user would have
442  * clicked play/pause on the song that was playing.
443  *
444  * Public Accessor: AmplitudeHelpers.checkNewSong( songIndex )
445  *
446  * @access public
447  * @param {number} songIndex - The index of the new song to be played.
448  * @returns {boolean} True if we are setting a new song, false if we are not setting a new song.
449  */
450	function checkNewSong(songIndex) {
451		if (songIndex != _config2.default.active_index) {
452			return true;
453		} else {
454			return false;
455		}
456	}
457
458	/**
459  * Checks to see if there is a new album
460  *
461  * Public Accessor: AmplitudeHelpers.checkNewAlbum( new Album )
462  *
463  * @access public
464  * @param {string} newAlbum - Checks to see if the new song will have a new album.
465  * @returns {boolean} True if there is a new album, false if there is not a new ablum.
466  */
467	function checkNewAlbum(newAlbum) {
468		if (_config2.default.active_album != newAlbum) {
469			return true;
470		} else {
471			return false;
472		}
473	}
474
475	/**
476  * Checks to see if there is a new playlist
477  *
478  * Public Accessor: AmplitudeHelpers.checkNewPlaylist( playlist )
479  *
480  * @access public
481  * @param {string} playlist - The playlist passed in to check against the active playlist.
482  * @returns {boolean} True if there is a new playlist, false if there is not a new playlist.
483  */
484	function checkNewPlaylist(playlist) {
485		if (_config2.default.active_playlist != playlist) {
486			return true;
487		} else {
488			return false;
489		}
490	}
491
492	/**
493  * Sets the new song in the config. Sets the src of the audio object,
494  * updates the	metadata and sets the active album.
495  *
496  * @access private
497  * @param {object} song 	- The song object of the song we are changing to.
498  * @param {number} index 	- The index of the song in the songs object we are changing.
499  */
500	function setNewSong(song, index) {
501		_config2.default.active_song.src = song.url;
502		_config2.default.active_metadata = song;
503		_config2.default.active_album = song.album;
504		_config2.default.active_index = index;
505	}
506
507	/**
508  * Shuffles individual songs in the config
509  * Based off of: http://www.codinghorror.com/blog/2007/12/the-danger-of-naivete.html
510  *
511  * Public Accessor: AmplitudeHelpers.shuffleSongs()
512  *
513  * @access public
514  */
515	function shuffleSongs() {
516		/*
517  	Builds a temporary array with the length of the config.
518  */
519		var shuffleTemp = new Array(_config2.default.songs.length);
520
521		/*
522  	Set the temporary array equal to the songs array.
523  */
524		for (var i = 0; i < _config2.default.songs.length; i++) {
525			shuffleTemp[i] = _config2.default.songs[i];
526			shuffleTemp[i].original_index = i;
527		}
528
529		/*
530  	Iterate ove rthe songs and generate random numbers to
531  	swap the indexes of the shuffle array.
532  */
533		for (var _i = _config2.default.songs.length - 1; _i > 0; _i--) {
534			var randNum = Math.floor(Math.random() * _config2.default.songs.length + 1);
535			shuffleSwap(shuffleTemp, _i, randNum - 1);
536		}
537
538		/*
539  	Set the shuffle list to the shuffle temp.
540  */
541		_config2.default.shuffle_list = shuffleTemp;
542	}
543
544	/**
545  * Shuffle songs in a playlist
546  *
547  * Public Accessor: AmplitudeHelpers.shufflePlaylistSongs( playlist )
548  *
549  * @access public
550  * @param {string} playlist - The playlist we are shuffling.
551  */
552	function shufflePlaylistSongs(playlist) {
553		/*
554  	Builds a temporary array with the length of the playlist songs.
555  */
556		var shuffleTemp = new Array(_config2.default.playlists[playlist].length);
557
558		/*
559  	Set the temporary array equal to the playlist array.
560  */
561		for (var i = 0; i < _config2.default.playlists[playlist].length; i++) {
562			shuffleTemp[i] = _config2.default.songs[_config2.default.playlists[playlist][i]];
563			shuffleTemp[i].original_index = _config2.default.playlists[playlist][i];
564		}
565
566		/*
567  	Iterate ove rthe songs and generate random numbers to
568  	swap the indexes of the shuffle array.
569  */
570		for (var _i2 = _config2.default.playlists[playlist].length - 1; _i2 > 0; _i2--) {
571			var randNum = Math.floor(Math.random() * _config2.default.playlists[playlist].length + 1);
572			shuffleSwap(shuffleTemp, _i2, randNum - 1);
573		}
574
575		/*
576  	Set the shuffle list to the shuffle temp.
577  */
578		_config2.default.shuffled_playlists[playlist] = shuffleTemp;
579	}
580
581	/**
582  * Swaps and randomizes the song shuffle.
583  *
584  * @access private
585  * @param {object} shuffleList 	- The list of songs that is going to be shuffled
586  * @param {number} original 		- The original index of he song in the songs array
587  * @param {number} random 			- The randomized index that will be the new index of the song in the shuffle array.
588  */
589	function shuffleSwap(shuffleList, original, random) {
590		var temp = shuffleList[original];
591		shuffleList[original] = shuffleList[random];
592		shuffleList[random] = temp;
593	}
594
595	/**
596  * Sets the active playlist
597  *
598  * Public Accessor: AmplitudeHelpers.setActivePlaylist( playlist )
599  *
600  * @access public
601  * @param {string} playlist - The string of the playlist being set to active.
602  */
603	function setActivePlaylist(playlist) {
604		/*
605  	If the active playlist is different than the playlist being set,
606  	we run the `playlist_changed` callback.
607  */
608		if (_config2.default.active_playlist != playlist) {
609			runCallback('playlist_changed');
610		}
611
612		/*
613  	Set the active playlist to the playlist parameter.
614  */
615		_config2.default.active_playlist = playlist;
616	}
617
618	/**
619  * Determines if the string passed in is a URL or not
620  *
621  * Public Accessor: AmplitudeHelpers.isURL( url )
622  *
623  * @access public
624  * @param {string} url - The string we are testing to see if it's a URL.
625  * @returns {boolean} True if the string is a url, false if it is not.
626  */
627	function isURL(url) {
628		/*
629  	Test the string against the URL pattern and return if it matches
630  */
631		var pattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
632
633		return pattern.test(url);
634	}
635
636	/**
637  * Determines if what is passed in is an integer or not.
638  *
639  * Public Accessor: AmplitudeHelpers.isInt( int )
640  *
641  * @access public
642  * @param {string|number} int - The variable we are testing to see is an integer or not.
643  * @returns {boolean} If the variable is an integer or not.
644  */
645	function isInt(int) {
646		return !isNaN(int) && parseInt(Number(int)) == int && !isNaN(parseInt(int, 10));
647	}
648
649	/*
650 	Returns the public functions
651 */
652	return {
653		resetConfig: resetConfig,
654		writeDebugMessage: writeDebugMessage,
655		runCallback: runCallback,
656		changeSong: changeSong,
657		checkNewSong: checkNewSong,
658		checkNewAlbum: checkNewAlbum,
659		checkNewPlaylist: checkNewPlaylist,
660		shuffleSongs: shuffleSongs,
661		shufflePlaylistSongs: shufflePlaylistSongs,
662		setActivePlaylist: setActivePlaylist,
663		isURL: isURL,
664		isInt: isInt
665	};
666}();
667
668/**
669 * AmplitudeJS Visual Sync
670 * @module visual/AmplitudeVisualSync
671*/
672/**
673 * Imports the config module
674 * @module config
675 */
676exports.default = AmplitudeHelpers;
677module.exports = exports['default'];
678
679/***/ }),
680/* 2 */
681/***/ (function(module, exports, __webpack_require__) {
682
683"use strict";
684
685
686Object.defineProperty(exports, "__esModule", {
687	value: true
688});
689
690var _config = __webpack_require__(0);
691
692var _config2 = _interopRequireDefault(_config);
693
694var _helpers = __webpack_require__(10);
695
696var _helpers2 = _interopRequireDefault(_helpers);
697
698function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
699
700/**
701 * Helps with the syncing of the display data
702 *
703 * @module visual/AmplitudeVisualSync
704 */
705/**
706 * Imports the config module
707 * @module config
708 */
709var AmplitudeVisualSync = function () {
710	/**
711  * Visually displays the current time on the screen. This is called on
712  * time update for the current song.
713  *
714  * @access public
715  * @param {object} currentTime 					- An object containing the current time for the song in seconds, minutes, and hours.
716  * @param {float} completionPercentage	- The percent of the way through the song the user is at.
717  */
718	function syncCurrentTime(currentTime, completionPercentage) {
719		/*
720  	Set current hour display.
721  */
722		_helpers2.default.syncCurrentHours(currentTime.hours);
723
724		/*
725  	Set current minute display.
726  */
727		_helpers2.default.syncCurrentMinutes(currentTime.minutes);
728
729		/*
730  	Set current second display.
731  */
732		_helpers2.default.syncCurrentSeconds(currentTime.seconds);
733
734		/*
735  	Set current time display.
736  */
737		_helpers2.default.syncCurrentTime(currentTime);
738
739		/*
740  	Set all song sliders to be to the current percentage
741  	of the song played.
742  */
743		syncMainSliderLocation(completionPercentage);
744		syncPlaylistSliderLocation(_config2.default.active_playlist, completionPercentage);
745		syncSongSliderLocation(_config2.default.active_playlist, _config2.default.active_index, completionPercentage);
746
747		_helpers2.default.syncSongPlayedProgressBar(completionPercentage);
748	}
749
750	/**
751  * Visually sync all of the times to the initial time of 0. This is so
752  * we can keep all the players in sync
753  *
754  * @access public
755  */
756	function resetTimes() {
757		_helpers2.default.resetCurrentHours();
758		_helpers2.default.resetCurrentMinutes();
759		_helpers2.default.resetCurrentSeconds();
760		_helpers2.default.resetCurrentTime();
761	}
762
763	/**
764  * Visually syncs the song sliders back to 0. This usually happens when
765  * a song has changed, we ensure that all song sliders get reset.
766  *
767  * @access public
768  */
769	function resetSongSliders() {
770		var songSliders = document.getElementsByClassName("amplitude-song-slider");
771
772		/*
773  	Iterate over all of the song sliders and set them to
774  	0 essentially resetting them.
775  */
776		for (var i = 0; i < songSliders.length; i++) {
777			songSliders[i].value = 0;
778		}
779	}
780
781	/**
782  * Sets all of the song buffered progress bars to 0
783  *
784  * @access public
785  */
786	function resetSongBufferedProgressBars() {
787		/*
788  	Gets all of the song buffered progress bars.
789  */
790		var songBufferedProgressBars = document.getElementsByClassName("amplitude-buffered-progress");
791
792		/*
793  	Iterate over all of the song buffered progress bar and
794  	set them to 0 which is like re-setting them.
795  */
796		for (var i = 0; i < songBufferedProgressBars.length; i++) {
797			songBufferedProgressBars[i].value = 0;
798		}
799	}
800
801	/**
802  * Sets all of the song played progress bars to 0
803  *
804  * @access public
805  */
806	function resetSongPlayedProgressBars() {
807		var songPlayedProgressBars = document.getElementsByClassName("amplitude-song-played-progress");
808
809		for (var i = 0; i < songPlayedProgressBars.length; i++) {
810			songPlayedProgressBars[i].value = 0;
811		}
812	}
813
814	/**
815  * Applies the class 'amplitude-active-song-container' to the element
816  * containing visual information regarding the active song.
817  *
818  * @access public
819  */
820	function setActiveContainer() {
821		var songContainers = document.getElementsByClassName('amplitude-song-container');
822
823		/*
824  	Removes all of the active song containrs.
825  */
826		for (var i = 0; i < songContainers.length; i++) {
827			songContainers[i].classList.remove('amplitude-active-song-container');
828		}
829
830		/*
831  	Finds the active index and adds the active song container to the element
832  	that represents the song at the index.
833  */
834		if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
835			if (document.querySelectorAll('.amplitude-song-container[amplitude-song-index="' + _config2.default.active_index + '"]')) {
836				var _songContainers = document.querySelectorAll('.amplitude-song-container[amplitude-song-index="' + _config2.default.active_index + '"]');
837
838				for (var _i = 0; _i < _songContainers.length; _i++) {
839					if (!_songContainers[_i].hasAttribute('amplitude-playlist')) {
840						_songContainers[_i].classList.add('amplitude-active-song-container');
841					}
842				}
843			}
844		} else {
845			if (document.querySelectorAll('.amplitude-song-container[amplitude-song-index="' + _config2.default.active_index + '"][amplitude-playlist="' + _config2.default.active_playlist + '"]')) {
846				var _songContainers2 = document.querySelectorAll('.amplitude-song-container[amplitude-song-index="' + _config2.default.active_index + '"][amplitude-playlist="' + _config2.default.active_playlist + '"]');
847
848				for (var _i2 = 0; _i2 < _songContainers2.length; _i2++) {
849					_songContainers2[_i2].classList.add('amplitude-active-song-container');
850				}
851			}
852		}
853	}
854
855	/**
856  * Displays the active song's metadata. This is called after a song has
857  * been changed. This method takes the active song and displays the
858  * metadata. So once the new active song is set, we update all of the
859  * screen elements.
860  *
861  * @access public
862  */
863	function displaySongMetadata() {
864		/*
865  	Define the image meta data keys. These are managed separately
866  	since we aren't actually changing the inner HTML of these elements.
867  */
868		var imageMetaDataKeys = ['cover_art_url', 'station_art_url', 'podcast_episode_cover_art_url'];
869
870		/*
871  	These are the ignored keys that we won't be worrying about displaying.
872  	Every other key in the song object can be displayed.
873  */
874		var ignoredKeys = ['url', 'live'];
875
876		/*
877  	Get all of the song info elements
878  */
879		var songInfoElements = document.querySelectorAll('[amplitude-song-info]');
880
881		/*
882  	Iterate over all of the song info elements. We will either
883  	set these to the new values, or clear them if the active song
884  	doesn't have the info set.
885  */
886		for (var i = 0; i < songInfoElements.length; i++) {
887			/*
888   	Get the info so we can check if the active meta data has the
889   	key.
890   */
891			var info = songInfoElements[i].getAttribute('amplitude-song-info');
892
893			/*
894   	Get the song info element playlist.
895   */
vendor: 5,178 bytes, lines 896-1061
896			var playlist = songInfoElements[i].getAttribute('amplitude-playlist');
897
898			/*
899   	Get the main song info flag.
900   */
901			var main = songInfoElements[i].getAttribute('amplitude-main-song-info');
902
903			/*
904   	If the playlists match or the element is a main element, then
905   	we set the song info.
906   */
907			if (_config2.default.active_playlist == playlist || main == 'true') {
908				/*
909    	If the active metadata has the key, then we set it,
910    	otherwise we clear it. If it's an image element then
911    	we default it to the default info if needed.
912    */
913				if (_config2.default.active_metadata[info] != undefined) {
914					if (imageMetaDataKeys.indexOf(info) >= 0) {
915						songInfoElements[i].setAttribute('src', _config2.default.active_metadata[info]);
916					} else {
917						songInfoElements[i].innerHTML = _config2.default.active_metadata[info];
918					}
919				} else {
920					/*
921     	We look for the default album art because
922     	the actual key didn't exist. If the default album
923     	art doesn't exist then we set the src attribute
924     	to null.
925     */
926					if (imageMetaDataKeys.indexOf(info) >= 0) {
927						if (_config2.default.default_album_art != '') {
928							songInfoElements[i].setAttribute('src', _config2.default.default_album_art);
929						} else {
930							songInfoElements[i].setAttribute('src', '');
931						}
932					} else {
933						songInfoElements[i].innerHTML = '';
934					}
935				}
936			}
937		}
938	}
939
940	/**
941   * Sets the first song in the playlist. This is used to fill in the meta
942  * data in the playlist
943  *
944  * @param {object} song 			- The song we are setting to be the first song in the playlist
945  * @param {string} playlist 	- Key of the playlist we are setting the first song in
946  */
947	function setFirstSongInPlaylist(song, playlist) {
948		/*
949  	Define the image meta data keys. These are managed separately
950  	since we aren't actually changing the inner HTML of these elements.
951  */
952		var imageMetaDataKeys = ['cover_art_url', 'station_art_url', 'podcast_episode_cover_art_url'];
953
954		/*
955  	These are the ignored keys that we won't be worrying about displaying.
956  	Every other key in the song object can be displayed.
957  */
958		var ignoredKeys = ['url', 'live'];
959
960		/*
961  	Get all of the song info elements
962  */
963		var songInfoElements = document.querySelectorAll('[amplitude-song-info][amplitude-playlist="' + playlist + '"]');
964
965		/*
966  	Iterate over all of the song info elements. We will either
967  	set these to the new values, or clear them if the active song
968  	doesn't have the info set.
969  */
970		for (var i = 0; i < songInfoElements.length; i++) {
971			/*
972   	Get the info so we can check if the active meta data has the
973   	key.
974   */
975			var info = songInfoElements[i].getAttribute('amplitude-song-info');
976
977			/*
978   	Get the song info element playlist.
979   */
980			var elementPlaylist = songInfoElements[i].getAttribute('amplitude-playlist');
981
982			/*
983   	If the playlists match or the element is a main element, then
984   	we set the song info.
985   */
986			if (elementPlaylist == playlist) {
987				/*
988    	If the active metadata has the key, then we set it,
989    	otherwise we clear it. If it's an image element then
990    	we default it to the default info if needed.
991    */
992				if (song[info] != undefined) {
993					if (imageMetaDataKeys.indexOf(info) >= 0) {
994						songInfoElements[i].setAttribute('src', song[info]);
995					} else {
996						songInfoElements[i].innerHTML = song[info];
997					}
998				} else {
999					/*
1000     	We look for the default album art because
1001     	the actual key didn't exist. If the default album
1002     	art doesn't exist then we set the src attribute
1003     	to null.
1004     */
1005					if (imageMetaDataKeys.indexOf(info) >= 0) {
1006						if (song.default_album_art != '') {
1007							songInfoElements[i].setAttribute('src', song.default_album_art);
1008						} else {
1009							songInfoElements[i].setAttribute('src', '');
1010						}
1011					} else {
1012						songInfoElements[i].innerHTML = '';
1013					}
1014				}
1015			}
1016		}
1017	}
1018
1019	/**
1020  * Sets all of the visual playback speed buttons to have the right class
1021  * to display the background image that represents the current playback
1022  * speed.
1023  *
1024  * @access public
1025  */
1026	function syncPlaybackSpeed() {
1027		/*
1028  	Gets all of the playback speed classes.
1029  */
1030		var playbackSpeedClasses = document.getElementsByClassName("amplitude-playback-speed");
1031
1032		/*
1033  	Iterates over all of the playback speed classes
1034  	applying the right speed class for visual purposes.
1035  */
1036		for (var i = 0; i < playbackSpeedClasses.length; i++) {
1037			/*
1038   	Removes all of the old playback speed classes.
1039   */
1040			playbackSpeedClasses[i].classList.remove('amplitude-playback-speed-10');
1041			playbackSpeedClasses[i].classList.remove('amplitude-playback-speed-15');
1042			playbackSpeedClasses[i].classList.remove('amplitude-playback-speed-20');
1043
1044			/*
1045   	Switch the current playback speed and apply the appropriate
1046   	speed class.
1047   */
1048			switch (_config2.default.playback_speed) {
1049				case 1:
1050					playbackSpeedClasses[i].classList.add('amplitude-playback-speed-10');
1051					break;
1052				case 1.5:
1053					playbackSpeedClasses[i].classList.add('amplitude-playback-speed-15');
1054					break;
1055				case 2:
1056					playbackSpeedClasses[i].classList.add('amplitude-playback-speed-20');
1057					break;
1058			}
1059		}
1060	}
1061
1062	/**
1063  * Syncs the buffered progress bars to the current percentage in the config
1064  *
1065  * @access public
1066  */
1067	function syncBufferedProgressBars() {
1068		/*
1069  	Gets all of the song buffered progress bars.
1070  */
1071		var songBufferedProgressBars = document.getElementsByClassName("amplitude-buffered-progress");
1072
1073		/*
1074  	Iterate over all of the song buffered progress bar and
1075  	set them to 0 which is like re-setting them.
1076  */
1077		for (var i = 0; i < songBufferedProgressBars.length; i++) {
1078			songBufferedProgressBars[i].value = parseFloat(parseFloat(_config2.default.buffered) / 100);
1079		}
1080	}
1081
1082	/**
1083  * Visually syncs the volume sliders so they are all the same if there
1084  * are more than one.
1085  *
1086  * @access public
1087  */
1088	function syncVolumeSliders() {
1089		var amplitudeVolumeSliders = document.getElementsByClassName("amplitude-volume-slider");
1090
1091		/*
1092  	Iterates over all of the volume sliders for the song, setting the value
1093  	to the config value.
1094  */
1095		for (var i = 0; i < amplitudeVolumeSliders.length; i++) {
1096			amplitudeVolumeSliders[i].value = _config2.default.active_song.volume * 100;
1097		}
1098	}
1099
1100	/**
1101  * Sets all of the play pause buttons to paused.
1102  *
1103  * @access public
1104  */
1105	function setPlayPauseButtonsToPause() {
1106		/*
1107  	Gets all of the play pause elements
1108  */
1109		var playPauseElements = document.querySelectorAll('.amplitude-play-pause');
1110
1111		/*
1112  	Sets all of the elements to pause
1113  */
1114		for (var i = 0; i < playPauseElements.length; i++) {
1115			_helpers2.default.setElementPause(playPauseElements[i]);
1116		}
1117	}
1118
1119	/**
1120  * Syncs the main play pause buttons to the state of the active song.
1121  *
1122  * @param {string} state The state of the player
1123  * @access public
1124  */
1125	function syncMainPlayPause(state) {
1126		/*
1127  	Ensures we have a string for the state otherwise we grab the
1128  	state from the config.
1129  */
1130		if (typeof state != "string") {
1131			state = _config2.default.active_song.paused ? "paused" : "playing";
1132		}
1133
1134		/*
1135  	Get all play pause buttons.
1136  */
1137		var playPauseElements = document.querySelectorAll('.amplitude-play-pause[amplitude-main-play-pause="true"]');
1138
1139		/*
1140  	Iterate over all of the play pause elements syncing the
1141  	display visually.
1142  */
1143		for (var i = 0; i < playPauseElements.length; i++) {
1144			/*
1145   	Determines what classes we should add and remove
1146   	from the elements.
1147   */
1148			switch (state) {
1149				case 'playing':
1150					_helpers2.default.setElementPlay(playPauseElements[i]);
1151					break;
1152				case 'paused':
1153					_helpers2.default.setElementPause(playPauseElements[i]);
1154					break;
1155			}
1156		}
1157	}
1158
1159	/**
1160  * Syncs the main playlist play pause buttons to the state of the active song.
1161  *
1162  * @access public
1163  * @param {string} playlist 	- The playlist we are setting the play pause state for.
1164  * @param {string} state 			- Either playing or paused for the state of the active song.
1165  */
1166	function syncPlaylistPlayPause(playlist, state) {
1167		/*
1168  	Ensures we have a string for the state otherwise we grab the
1169  	state from the config.
1170  */
1171		if (typeof state != "string") {
1172			state = _config2.default.active_song.paused ? "paused" : "playing";
1173		}
1174
1175		/*
1176  	Get all of the main playlist play pause elements
1177  */
1178		var playlistPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[amplitude-playlist-main-play-pause="true"]');
1179
1180		/*
1181  	Iterate over the play pause elements, syncing the state accordingly.
1182  */
1183		for (var i = 0; i < playlistPlayPauseElements.length; i++) {
1184			/*
1185   	If the element has the same playlist attribute as the playlist
1186   	passed in and the state is playing, we set the element to
1187   	be playing otherwise we set it to pause. Setting to pause
1188   	means the element doesn't match the active playlist or the
1189   	state is paused.
1190   */
1191			if (playlistPlayPauseElements[i].getAttribute('amplitude-playlist') == playlist && state == 'playing') {
1192
1193				_helpers2.default.setElementPlay(playlistPlayPauseElements[i]);
1194			} else {
1195				_helpers2.default.setElementPause(playlistPlayPauseElements[i]);
1196			}
1197		}
1198	}
1199
1200	/**
1201  * Syncs the song play pause buttons to the state of the active song.
1202  *
1203  * @access public
1204  * @param {string} playlist 	- The playlist we are setting the play pause state for.
1205  * @param {int} song 					- The index of the song we are syncing the state for
1206  * @param {string} state 			- Either playing or paused for the state of the active song.
1207  */
1208	function syncSongPlayPause(playlist, song, state) {
1209		/*
1210  	Ensures we have a string for the state otherwise we grab the
1211  	state from the config.
1212  */
1213		if (typeof state != "string") {
1214			state = _config2.default.active_song.paused ? "paused" : "playing";
1215		}
1216
1217		/*
1218  	If the playlist is null or empty, we make sure that any song
1219  	that is a part of a playlist is set to paused.
1220  */
1221		if (playlist == null || playlist == '') {
1222			/*
1223   	Get all of the individual song play pause buttons. These have an
1224   	amplitude-song-index attribute. Some have amplitude-playlist which
1225   	means they are individual songs within a playlist.
1226   */
1227			var songPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[amplitude-song-index]');
1228
1229			/*
1230   	Iterate over all of the song play pause elements
1231   */
1232			for (var i = 0; i < songPlayPauseElements.length; i++) {
1233				/*
1234    	If the song element has an attribute for amplitude-playlist then
1235    	we set it to paused no matter what because the state of the player
1236    	is not in a playlist mode.
1237    */
1238				if (songPlayPauseElements[i].hasAttribute('amplitude-playlist')) {
1239					_helpers2.default.setElementPause(songPlayPauseElements[i]);
1240				} else {
1241					/*
1242     	If the state of the song is playing and the song index matches the
1243     	index of the song we have, we set the element to playing otherwise
1244     	we set the element to paused.
1245     */
1246					if (state == 'playing' && songPlayPauseElements[i].getAttribute('amplitude-song-index') == song) {
1247						_helpers2.default.setElementPlay(songPlayPauseElements[i]);
1248					} else {
1249						_helpers2.default.setElementPause(songPlayPauseElements[i]);
1250					}
1251				}
1252			}
1253		} else {
1254			/*
1255   	Get all of the individual song play pause buttons. These have an
1256   	amplitude-song-index attribute. Some have amplitude-playlist which
1257   	means they are individual songs within a playlist.
1258   */
1259			var _songPlayPauseElements = document.querySelectorAll('.amplitude-play-pause[amplitude-song-index]');
1260
1261			/*
1262   	Iterate over all of the individual play pause elements.
1263   */
1264			for (var _i3 = 0; _i3 < _songPlayPauseElements.length; _i3++) {
1265				/*
1266    	Since we have an active playlist this time, we want any stand alone
1267    	songs to be set to paused since the scope is within a playlist.
1268    		We check to see if the element has an amplitude-playlist attribute.
1269    */
1270				if (_songPlayPauseElements[_i3].hasAttribute('amplitude-playlist')) {
1271
1272					/*
1273     	Check to see if the song index matches the index passed in and the
1274     	playlist matches the scoped playlist we are looking for and the
1275     	state of the player is playing, then we set the element to play. If those
1276     	three parameters are not met, set the element to pause.
1277     */
1278					if (_songPlayPauseElements[_i3].getAttribute('amplitude-song-index') == song && _songPlayPauseElements[_i3].getAttribute('amplitude-playlist') == playlist && state == 'playing') {
1279						_helpers2.default.setElementPlay(_songPlayPauseElements[_i3]);
1280					} else {
1281						_helpers2.default.setElementPause(_songPlayPauseElements[_i3]);
1282					}
1283				} else {
1284					/*
1285     	Set any individual songs (songs outside of a playlist scope) to pause
1286     	since we are in the scope of a playlist.
1287     */
1288					_helpers2.default.setElementPause(_songPlayPauseElements[_i3]);
1289				}
1290			}
1291		}
1292	}
1293
vendor: 5,107 bytes, lines 1294-1455
1294	/**
1295  * Syncs repeat for all of the repeat buttons. Users
1296  * can apply styles to the 'amplitude-repeat-on' and
1297  * 'amplitude-repeat-off' classes. They represent the state
1298  * of the player.
1299  */
1300	function syncRepeat() {
1301		/*
1302  	Gets all of the repeat classes
1303  */
1304		var repeatClasses = document.getElementsByClassName("amplitude-repeat");
1305
1306		/*
1307  	Iterate over all of the repeat classes. If repeat is on,
1308  	then add the 'amplitude-repeat-on' class and remove the
1309  	'amplitude-repeat-off' class. If it's off, then do the
1310  	opposite.
1311  */
1312		for (var i = 0; i < repeatClasses.length; i++) {
1313			if (_config2.default.repeat) {
1314				repeatClasses[i].classList.add('amplitude-repeat-on');
1315				repeatClasses[i].classList.remove('amplitude-repeat-off');
1316			} else {
1317				repeatClasses[i].classList.remove('amplitude-repeat-on');
1318				repeatClasses[i].classList.add('amplitude-repeat-off');
1319			}
1320		}
1321	}
1322
1323	/**
1324  * Syncs repeat for all of the playlist repeat buttons. Users
1325  * can apply styles to the `amplitude-repeat-on` and `amplitude-repeat-off`
1326  * classes. They repreent the state of the playlist in the player.
1327  */
1328	function syncRepeatPlaylist(playlist) {
1329		/*
1330   Gets all of the repeat buttons.
1331  */
1332		var repeatButtons = document.getElementsByClassName("amplitude-repeat");
1333
1334		/*
1335   Iterate over all of the repeat buttons
1336  */
1337		for (var i = 0; i < repeatButtons.length; i++) {
1338			/*
1339    Ensure that the repeat button belongs to matches the
1340    playlist we are syncing the state for.
1341   */
1342			if (repeatButtons[i].getAttribute('amplitude-playlist') == playlist) {
1343				/*
1344     If the state of the playlist is shuffled on, true, then
1345     we add the 'amplitude-repeat-on' class and remove the
1346     'amplitude-repeat-off' class. If the player is not shuffled
1347     then we do the opposite.
1348    */
1349				if (_config2.default.repeat_statuses[playlist]) {
1350					repeatButtons[i].classList.add('amplitude-repeat-on');
1351					repeatButtons[i].classList.remove('amplitude-repeat-off');
1352				} else {
1353					repeatButtons[i].classList.add('amplitude-repeat-off');
1354					repeatButtons[i].classList.remove('amplitude-repeat-on');
1355				}
1356			}
1357		}
1358	}
1359
1360	/**
1361  * Syncs repeat for all of the repeat song buttons. Users
1362  * can apply styles to the 'amplitude-repeat-song-on' and
1363  * 'amplitude-repeat-song-off' classes. They represent the state
1364  * of the player.
1365  */
1366	function syncRepeatSong() {
1367		/*
1368  	Gets all of the repeat song classes
1369  */
1370		var repeatSongClasses = document.getElementsByClassName("amplitude-repeat-song");
1371
1372		/*
1373  	Iterate over all of the repeat song classes. If repeat is on,
1374  	then add the 'amplitude-repeat-song-on' class and remove the
1375  	'amplitude-repeat-song-off' class. If it's off, then do the
1376  	opposite.
1377  */
1378		for (var i = 0; i < repeatSongClasses.length; i++) {
1379			if (_config2.default.repeat_song) {
1380				repeatSongClasses[i].classList.add('amplitude-repeat-song-on');
1381				repeatSongClasses[i].classList.remove('amplitude-repeat-song-off');
1382			} else {
1383				repeatSongClasses[i].classList.remove('amplitude-repeat-song-on');
1384				repeatSongClasses[i].classList.add('amplitude-repeat-song-off');
1385			}
1386		}
1387	}
1388
1389	/**
1390  * Syncs mute for all of the mute buttons. This represents the
1391  * state of the player if it's muted or not.
1392  *
1393  * @access public
1394  * @param {string} state 	- The muted state of the player.
1395  */
1396	function syncMute(state) {
1397		/*
1398  	Get all of the mute buttons.
1399  */
1400		var muteClasses = document.getElementsByClassName("amplitude-mute");
1401
1402		/*
1403  	Iterate over all of the mute classes. If the state of the player
1404  	is not-muted then we add the amplitude-not-muted classe and remove
1405  	the amplitude muted class otherwise we do the opposite.
1406  */
1407		for (var i = 0; i < muteClasses.length; i++) {
1408			if (!state) {
1409				muteClasses[i].classList.add('amplitude-not-muted');
1410				muteClasses[i].classList.remove('amplitude-muted');
1411			} else {
1412				muteClasses[i].classList.remove('amplitude-not-muted');
1413				muteClasses[i].classList.add('amplitude-muted');
1414			}
1415		}
1416	}
1417
1418	/**
1419  * Syncs the global shuffle button visual state.
1420  *
1421  * @access public
1422  * @param {boolean} state  	- The shuffled state of the player.
1423  */
1424	function syncShuffle(state) {
1425		/*
1426  	Gets the shuffle buttons.
1427  */
1428		var shuffleButtons = document.getElementsByClassName("amplitude-shuffle");
1429
1430		/*
1431  	Iterate over all of the shuffle buttons.
1432  */
1433		for (var i = 0; i < shuffleButtons.length; i++) {
1434			/*
1435   	Ensure the shuffle button doesn't belong to a playlist. We have
1436   	a separate method for that.
1437   */
1438			if (shuffleButtons[i].getAttribute('amplitude-playlist') == null) {
1439				/*
1440    	If the state of the player is shuffled on, true, then
1441    	we add the 'amplitude-shuffle-on' class and remove the
1442    	'amplitude-shuffle-off' class. If the player is not shuffled
1443    	then we do the opposite.
1444    */
1445				if (state) {
1446					shuffleButtons[i].classList.add('amplitude-shuffle-on');
1447					shuffleButtons[i].classList.remove('amplitude-shuffle-off');
1448				} else {
1449					shuffleButtons[i].classList.add('amplitude-shuffle-off');
1450					shuffleButtons[i].classList.remove('amplitude-shuffle-on');
1451				}
1452			}
1453		}
1454	}
1455
1456	/**
1457  * Syncs the playlist shuffle button visual state.
1458  *
1459  * @access public
1460  * @param {boolean} state 	- The shuffled state of the player.
1461  * @param {string} playlist - The playlist string the shuffle button belongs to.
1462  */
1463	function syncPlaylistShuffle(state, playlist) {
1464		/*
1465  	Gets all of the shuffle buttons.
1466  */
1467		var shuffleButtons = document.getElementsByClassName("amplitude-shuffle");
1468
1469		/*
1470  	Iterate over all of the shuffle buttons
1471  */
1472		for (var i = 0; i < shuffleButtons.length; i++) {
1473			/*
1474   	Ensure that the playlist the shuffle button belongs to matches the
1475   	playlist we are syncing the state for.
1476   */
1477			if (shuffleButtons[i].getAttribute('amplitude-playlist') == playlist) {
1478				/*
1479    	If the state of the playlist is shuffled on, true, then
1480    	we add the 'amplitude-shuffle-on' class and remove the
1481    	'amplitude-shuffle-off' class. If the player is not shuffled
1482    	then we do the opposite.
1483    */
1484				if (state) {
1485					shuffleButtons[i].classList.add('amplitude-shuffle-on');
1486					shuffleButtons[i].classList.remove('amplitude-shuffle-off');
1487				} else {
1488					shuffleButtons[i].classList.add('amplitude-shuffle-off');
1489					shuffleButtons[i].classList.remove('amplitude-shuffle-on');
1490				}
1491			}
1492		}
1493	}
1494
1495	/**
1496  * Syncs the main slider location
1497  *
1498  * @access public
1499  * @param {number} location 	- The location of the song as a percentage.
1500  */
1501	function syncMainSliderLocation(location) {
1502		/*
1503  	Ensure we have a location that's a number
1504  */
1505		location = !isNaN(location) ? location : 0;
1506
1507		/*
1508  	Gets the main song sliders
1509  */
1510		var mainSongSliders = document.querySelectorAll('.amplitude-song-slider[amplitude-main-song-slider="true"]');
1511
1512		/*
1513  	Iterates over all of the main sliders and sets the value to the
1514  	percentage of the song played.
1515  */
1516		for (var i = 0; i < mainSongSliders.length; i++) {
1517			mainSongSliders[i].value = location;
1518		}
1519	}
1520
1521	/**
1522  * Syncs playlist song slider locations
1523  *
1524  * @access public
1525  * @param {string} playlist 	- The playlist we are setting the song slider for.
1526  * @param {number} location 	- The location of the song as a percentage.
1527  */
1528	function syncPlaylistSliderLocation(playlist, location) {
1529		/*
1530  	Ensure we have a location that's a number
1531  */
1532		location = !isNaN(location) ? location : 0;
1533
1534		/*
1535  	Gets the playlist song sliders
1536  */
1537		var playlistSongSliders = document.querySelectorAll('.amplitude-song-slider[amplitude-playlist-song-slider="true"][amplitude-playlist="' + playlist + '"]');
1538
1539		/*
1540  	Iterates over all of the playlist sliders and sets the value to the
1541  	percentage of the song played.
1542  */
1543		for (var i = 0; i < playlistSongSliders.length; i++) {
1544			playlistSongSliders[i].value = location;
1545		}
1546	}
1547
1548	/**
1549  * Syncs individual song slider locations
1550  *
1551  * @access public
1552  * @param {string} playlist 	- The playlist we are setting the song slider for.
1553  * @param {number} songIndex 	- The index of the song we are adjusting the song slider for.
1554  * @param {number} location 	- The location of the song as a percentage.
1555  */
1556	function syncSongSliderLocation(playlist, songIndex, location) {
1557		/*
1558  	Ensure we have a location that's a number
1559  */
1560		location = !isNaN(location) ? location : 0;
1561		/*
1562  	If the playlist is set, we get all of the individual song sliders
1563  	that relate to the song and the playlist.
1564  */
1565		if (playlist != '' && playlist != null) {
1566			/*
1567   	Gets the song sliders for the individual songs and the
1568   	playlist
1569   */
1570			var songSliders = document.querySelectorAll('.amplitude-song-slider[amplitude-playlist="' + playlist + '"][amplitude-song-index="' + songIndex + '"]');
1571
1572			/*
1573   	Iterates over all of the playlist sliders and set the value to the
1574   	percentage of the song played.
1575   */
1576			for (var i = 0; i < songSliders.length; i++) {
1577				songSliders[i].value = location;
1578			}
1579		} else {
1580			/*
1581   	Get the individual song slider by index
1582   */
1583			var _songSliders = document.querySelectorAll('.amplitude-song-slider[amplitude-song-index="' + songIndex + '"]');
1584
1585			/*
1586   	Iterats over all of the song sliders that have the index of
1587   	the song we are sliding. If the song doesn't have a playlist
1588   	attribute, we set the location.
1589   */
1590			for (var _i4 = 0; _i4 < _songSliders.length; _i4++) {
1591				if (!_songSliders[_i4].hasAttribute('amplitude-playlist')) {
1592					if (location != 0) {
1593						_songSliders[_i4].value = location;
1594					}
1595				}
1596			}
1597		}
1598	}
1599
1600	/**
1601  * Sets the volume slider location
1602  *
1603  * @access public
1604  * @param {number} volume 	- The volume from 0 - 1 for song volume.
1605  */
1606	function syncVolumeSliderLocation(volume) {
1607		/*
1608  	Gets all of the volume sliders
1609  */
1610		var volumeSliders = document.querySelectorAll('.amplitude-volume-slider');
1611
1612		/*
1613  	Iterates over all of the sliders and sets their volume
1614  	to the volume of the song.
1615  */
1616		for (var i = 0; i < volumeSliders.length; i++) {
1617			volumeSliders[i].value = volume;
1618		}
1619	}
1620
1621	/**
1622  * Syncs the song's duration
1623  *
1624  * @access public
1625  * @param {object} currentTime 		- Object containing information about the current time of the song.
1626  * @param {object} songDuration 	- Object containing information about the duration of the song.
1627  */
1628	function syncSongDuration(currentTime, songDuration) {
1629		/*
1630  	Set duration hour display.
1631  */
1632		_helpers2.default.syncDurationHours(songDuration != undefined && !isNaN(songDuration.hours) ? songDuration.hours : '00');
1633
1634		/*
1635  	Set duration minute display.
1636  */
1637		_helpers2.default.syncDurationMinutes(songDuration != undefined && !isNaN(songDuration.minutes) ? songDuration.minutes : '00');
1638
1639		/*
1640  	Set duration second display.
1641  */
1642		_helpers2.default.syncDurationSeconds(songDuration != undefined && !isNaN(songDuration.seconds) ? songDuration.seconds : '00');
1643
1644		/*
1645  	Set duration time display.
1646  */
1647		_helpers2.default.syncDurationTime(songDuration != undefined ? songDuration : {});
1648
1649		/*
1650  	Set count down time display.
1651  */
1652		_helpers2.default.syncCountDownTime(currentTime, songDuration);
1653	}
1654
1655	/**
1656  * Sets the meta data for songs loaded in the songs array
1657  */
1658	function syncSongsMetaData() {
1659		/*
1660  	Define the image meta data keys. These are managed separately
1661  	since we aren't actually changing the inner HTML of these elements.
1662  */
1663		var imageMetaDataKeys = ['cover_art_url', 'station_art_url', 'podcast_episode_cover_art_url'];
1664
1665		/*
1666  	These are the ignored keys that we won't be worrying about displaying.
1667  	Every other key in the song object can be displayed.
1668  */
1669		var ignoredKeys = ['url', 'live'];
1670
1671		/*
1672  	Get all of the song info elements
1673  */
1674		var songInfoElements = document.querySelectorAll('[amplitude-song-info]');
1675
1676		/*
1677  	Iterate over all of the song info elements. We will either
1678  	set these to the new values, or clear them if the active song
1679  	doesn't have the info set.
1680  */
1681		for (var i = 0; i < songInfoElements.length; i++) {
1682
1683			/*
1684   	For this method we do not want the element to have any playlist or
1685   	main song info. This way we aren't adjusting the main song information for the
1686   	global player or the playlist player.
1687   */
1688			if (songInfoElements[i].getAttribute('amplitude-playlist') == null && songInfoElements[i].getAttribute('amplitude-main-song-info') == null && songInfoElements[i].getAttribute('amplitude-song-index') != null) {
1689
1690				/*
1691    		Get the info so we can check if the active meta data has the
1692    		key.
1693    	*/
1694				var info = songInfoElements[i].getAttribute('amplitude-song-info');
1695				var index = songInfoElements[i].getAttribute('amplitude-song-index');
1696
1697				/*
1698    	Make sure that the song index they are referencing is defined.
1699    */
1700				if (_config2.default.songs[index][info] != undefined) {
1701
1702					/*
1703     	If it's an image meta data key, then we set the src attribute of
1704     	the element. Otherwise we set the inner HTML of the element.
1705     */
1706					if (imageMetaDataKeys.indexOf(info) >= 0) {
1707						songInfoElements[i].setAttribute('src', _config2.default.songs[index][info]);
1708					} else {
1709						songInfoElements[i].innerHTML = _config2.default.songs[index][info];
1710					}
1711				}
1712			}
1713		}
1714	}
1715
1716	/**
1717 	Returns the publically available functions
1718 	@TODO Re-order to order of methods in module
1719 */
1720	return {
1721		syncCurrentTime: syncCurrentTime,
1722		resetTimes: resetTimes,
1723		resetSongSliders: resetSongSliders,
1724		resetSongPlayedProgressBars: resetSongPlayedProgressBars,
1725		resetSongBufferedProgressBars: resetSongBufferedProgressBars,
1726		setActiveContainer: setActiveContainer,
1727		displaySongMetadata: displaySongMetadata,
1728		syncPlaybackSpeed: syncPlaybackSpeed,
1729		syncBufferedProgressBars: syncBufferedProgressBars,
1730		syncVolumeSliders: syncVolumeSliders,
1731		setPlayPauseButtonsToPause: setPlayPauseButtonsToPause,
1732		setFirstSongInPlaylist: setFirstSongInPlaylist,
1733		syncMainPlayPause: syncMainPlayPause,
1734		syncPlaylistPlayPause: syncPlaylistPlayPause,
1735		syncSongPlayPause: syncSongPlayPause,
1736		syncRepeat: syncRepeat,
1737		syncRepeatSong: syncRepeatSong,
1738		syncRepeatPlaylist: syncRepeatPlaylist,
1739		syncMute: syncMute,
1740		syncShuffle: syncShuffle,
1741		syncPlaylistShuffle: syncPlaylistShuffle,
1742		syncMainSliderLocation: syncMainSliderLocation,
1743		syncPlaylistSliderLocation: syncPlaylistSliderLocation,
1744		syncSongSliderLocation: syncSongSliderLocation,
1745		syncVolumeSliderLocation: syncVolumeSliderLocation,
1746		syncSongDuration: syncSongDuration,
1747		syncSongsMetaData: syncSongsMetaData
1748	};
1749}();
1750
1751/**
1752 * Imports the Amplitude Visual Sync Helpers to keep the display in sync
1753 * @module visual/AmplitudeVisualSyncHelpers
1754 */
1755exports.default = AmplitudeVisualSync;
1756module.exports = exports['default'];
1757
1758/***/ }),
1759/* 3 */
1760/***/ (function(module, exports, __webpack_require__) {
1761
1762"use strict";
1763
1764
1765Object.defineProperty(exports, "__esModule", {
1766	value: true
1767});
1768
1769var _config = __webpack_require__(0);
1770
1771var _config2 = _interopRequireDefault(_config);
1772
1773var _helpers = __webpack_require__(1);
1774
1775var _helpers2 = _interopRequireDefault(_helpers);
1776
1777var _visual = __webpack_require__(2);
1778
1779var _visual2 = _interopRequireDefault(_visual);
1780
1781function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1782
1783/**
1784 * Interacts directly with native functions of the Audio element. Logic
1785 * leading up to these methods are handled by click handlers which call
1786 * helpers and visual synchronizers. These are the core functions of AmplitudeJS.
1787 * Every other function that leads to these prepare the information to be
1788 * acted upon by these functions.
1789 *
1790 * @module core/AmplitudeCore
1791 */
1792
1793
1794/**
1795 * AmplitudeJS Core Helpers
1796 * @module core/helpers
1797 */
1798var AmplitudeCore = function () {
1799	/**
1800  * Plays the active song. If the current song is live, it reconnects
1801  * the stream before playing.
1802  *
1803  * Public Accessor: Amplitude.play()
1804  *
1805  * @access public
1806  */
1807	function play() {
1808		/*
1809  	Run the before play callback
1810  */
1811		_helpers2.default.runCallback('before_play');
1812
1813		/*
1814  	If the audio is live we re-conenct the stream.
1815  */
1816		if (_config2.default.active_metadata.live) {
1817			reconnectStream();
1818		}
1819
1820		/*
1821  	Mobile remote sources need to be reconnected on play. I think this is
1822  	because mobile browsers are optimized not to load all resources
1823  	for speed reasons. We only do this if mobile and the paused button
1824  	is not clicked. If the pause button was clicked then we don't reconnect
1825  	or the user will lose their place in the stream.
1826  */
1827		if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && !_config2.default.paused) {
1828			reconnectStream();
1829		}
1830
1831		/*
1832  	Play the song and set the playback rate to the playback
1833  	speed.
1834  */
1835		_config2.default.active_song.play();
1836		_config2.default.active_song.playbackRate = _config2.default.playback_speed;
1837
1838		/*
1839  	Run the after play callback
1840  */
1841		_helpers2.default.runCallback('after_play');
1842	}
1843
1844	/**
1845  * Pauses the active song. If it's live, it disconnects the stream.
1846  *
1847  * Public Accessor: Amplitude.pause()
1848  *
1849  * @access public
1850  */
1851	function pause() {
1852		/*
1853  	Run the before pause callback.
1854  */
1855		_helpers2.default.runCallback('before_pause');
1856
1857		/*
1858  	Pause the active song.
1859  */
1860		_config2.default.active_song.pause();
1861
1862		/*
1863  	Flag that pause button was clicked.
1864  */
1865		_config2.default.paused = true;
1866
1867		/*
1868  	If the song is live, we disconnect the stream so we aren't
1869  	saving it to memory.
1870  */
1871		if (_config2.default.active_metadata.live) {
1872			disconnectStream();
1873		}
1874
1875		/*
1876  	Run the after pause callback.
1877  */
1878		_helpers2.default.runCallback('after_pause');
1879	}
1880
1881	/**
1882  * Stops the active song by setting the current song time to 0.
1883  * When the user resumes, it will be from the beginning.
1884  * If it's a live stream it disconnects.
1885  *
1886  * Public Accessor: Amplitude.stop()
1887  *
1888  * @access public
1889  */
1890	function stop() {
1891		/*
1892  	Runs the before stop callback.
1893  */
1894		_helpers2.default.runCallback('before_stop');
1895
1896		/*
1897  	Set the current time of the song to 0 which will reset the song.
1898  */
1899		if (_config2.default.active_song.currentTime != 0) {
1900			_config2.default.active_song.currentTime = 0;
1901		}
1902
1903		/*
1904  	Run pause so the song will stop
1905  */
1906		_config2.default.active_song.pause();
1907
1908		/*
1909  	If the song is live, disconnect the stream.
1910  */
1911		if (_config2.default.active_metadata.live) {
1912			disconnectStream();
1913		}
1914
1915		/*
1916  	Run the after stop callback
1917  */
1918		_helpers2.default.runCallback('after_stop');
1919	}
1920
1921	/**
1922  * Sets the song volume.
1923  *
1924  * Public Accessor: Amplitude.setVolume( volumeLevel )
1925  *
1926  * @access public
1927  * @param {number} volumeLevel - A number between 1 and 100 as a percentage of
1928  * min to max for a volume level.
1929  */
1930	function setVolume(volumeLevel) {
1931		/*
1932  	If the volume is set to mute somewhere else, we sync the display.
1933  */
1934		if (volumeLevel == 0) {
1935			_visual2.default.syncMute(true);
1936			_config2.default.active_song.muted = true;
1937		} else {
1938			_visual2.default.syncMute(false);
1939			_config2.default.active_song.muted = false;
vendor: 39,115 bytes, lines 1940-3130
1940		}
1941
1942		/*
1943  	Sets the volume in the config so we can reference it later on.
1944  */
1945		_config2.default.volume = volumeLevel;
1946
1947		/*
1948  	Set the volume of the active song.
1949  */
1950		_config2.default.active_song.volume = volumeLevel / 100;
1951	}
1952
1953	/**
1954  * Sets the song percentage. If it's a live song, we ignore this because
1955  * we can't skip ahead. This is an issue if you have a playlist with
1956  * a live source.
1957  *
1958  * Public Accessor: Amplitude.setSongLocation( songPercentage )
1959  *
1960  * @access public
1961  * @param {number} songPercentage - A number between 1 and 100 as a percentage of song completion.
1962  */
1963	function setSongLocation(songPercentage) {
1964		/*
1965  	As long as the song is not live, we can set the current time of the
1966  	song to the percentage the user passed in.
1967  */
1968		if (!_config2.default.active_metadata.live) {
1969			_config2.default.active_song.currentTime = _config2.default.active_song.duration * (song_percentage / 100);
1970		}
1971	}
1972
1973	/**
1974  * Skips to a location in a song
1975  *
1976  * Public Accessor: Amplitude.skipToLocation( seconds )
1977  *
1978  * @access public
1979  * @param {number} seconds - An integer containing the seconds to skip to
1980  */
1981	function skipToLocation(seconds) {
1982		/*
1983  	When the active song can be played through, we can check to
1984  	see if the seconds will work. We only bind the event handler
1985  	once and remove it once it's fired.
1986  */
1987		_config2.default.active_song.addEventListener('canplaythrough', function () {
1988			/*
1989   	If the active song duration is greater than or equal to the
1990   	amount of seconds the user wants to skip to and the seconds
1991   	is greater than 0, we skip to the seconds defined.
1992   */
1993			if (_config2.default.active_song.duration >= seconds && seconds > 0) {
1994				_config2.default.active_song.currentTime = seconds;
1995			} else {
1996				_helpers2.default.writeDebugMessage('Amplitude can\'t skip to a location greater than the duration of the audio or less than 0');
1997			}
1998		}, { once: true });
1999	}
2000
2001	/**
2002  * Disconnects the live stream
2003  *
2004  * Public Accessor: Amplitude.disconnectStream()
2005  *
2006  * @access public
2007  */
2008	function disconnectStream() {
2009		_config2.default.active_song.src = '';
2010		_config2.default.active_song.load();
2011	}
2012
2013	/**
2014  * Reconnects the live stream
2015  *
2016  * Public Accessor: Amplitude.reconnectStream()
2017  *
2018  * @access public\
2019  */
2020	function reconnectStream() {
2021		_config2.default.active_song.src = _config2.default.active_metadata.url;
2022		_config2.default.active_song.load();
2023	}
2024
2025	/**
2026  * When you pass a song object it plays that song right awawy.  It sets
2027  * the active song in the config to the song you pass in and synchronizes
2028  * the visuals.
2029  *
2030  * Public Accessor: Amplitude.playNow( song )
2031  *
2032  * @access public
2033  * @param {object} song - JSON representation of a song.
2034  */
2035	function playNow(song) {
2036		/*
2037  	Makes sure the song object has a URL associated with it
2038  	or there will be nothing to play.
2039  */
2040		if (song.url) {
2041			_config2.default.active_song.src = song.url;
2042			_config2.default.active_metadata = song;
2043			_config2.default.active_album = song.album;
2044		} else {
2045			/*
2046   	Write error message since the song passed in doesn't
2047   	have a URL.
2048   */
2049			_helpers2.default.writeDebugMessage('The song needs to have a URL!');
2050		}
2051
2052		/*
2053  	Sets the main song control status visual
2054  */
2055		_visual2.default.syncMainPlayPause('playing');
2056
2057		/*
2058  	Update the song meta data
2059  */
2060		_visual2.default.displaySongMetadata();
2061
2062		/*
2063  	Reset the song sliders, song progress bar info, and
2064  	reset times. This ensures everything stays in sync.
2065  */
2066		_visual2.default.resetSongSliders();
2067
2068		_visual2.default.resetSongPlayedProgressBars();
2069
2070		_visual2.default.resetTimes();
2071
2072		/*
2073  	Plays the song.
2074  */
2075		play();
2076	}
2077
2078	/**
2079  * Plays the song at a specific index in the songs array
2080  *
2081  * Public Accessor: Amplitude.playSongAtIndex( song )
2082  *
2083  * @access public
2084  * @param {number} index - The number representing the song in the songs array
2085  */
2086	function playSongAtIndex(index) {
2087		/*
2088  	Stop the current song.
2089  */
2090		stop();
2091
2092		/*
2093  	Determine if there is a new playlist, if so set the active playlist and change the song.
2094  */
2095		if (_helpers2.default.checkNewPlaylist(null)) {
2096			_helpers2.default.setActivePlaylist(null);
2097
2098			_helpers2.default.changeSong(index);
2099		}
2100
2101		/*
2102  	Check if the song is new. If so, change the song.
2103  */
2104		if (_helpers2.default.checkNewSong(index)) {
2105			_helpers2.default.changeSong(index);
2106		}
2107
2108		/*
2109   Sync all of the play pause buttons.
2110  */
2111		_visual2.default.syncMainPlayPause('playing');
2112		_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'playing');
2113		_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'playing');
2114
2115		/*
2116   Play the song
2117  */
2118		play();
2119	}
2120
2121	/**
2122 * Plays a song at the index passed in for the playlist provided. The index passed
2123 * in should be the index of the song in the playlist and not the songs array.
2124 *
2125 * @access public
2126 * @param {number} index 		- The number representing the song in the playlist array.
2127 * @param {string} playlist 	- The key string representing the playlist we are playing the song from.
2128 *
2129 */
2130	function playPlaylistSongAtIndex(index, playlist) {
2131		/*
2132  		Stop the current song.
2133  */
2134		stop();
2135
2136		/*
2137  		Get the index of the song in the songs array. This is the integer at the index
2138  	in the playlist.
2139  */
2140		var songIndex = _config2.default.playlists[playlist][index];
2141
2142		/*
2143  		Determine if there is a new playlist, if so set the active playlist and change the song.
2144  */
2145		if (_helpers2.default.checkNewPlaylist(playlist)) {
2146			_helpers2.default.setActivePlaylist(playlist);
2147
2148			_helpers2.default.changeSong(songIndex);
2149		}
2150
2151		/*
2152  		Check if the song is new. If so, change the song.
2153  */
2154		if (_helpers2.default.checkNewSong(songIndex)) {
2155			_helpers2.default.changeSong(songIndex);
2156		}
2157
2158		/*
2159  	Sync all of the play pause buttons.
2160  */
2161		_visual2.default.syncMainPlayPause('playing');
2162		_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'playing');
2163		_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'playing');
2164
2165		/*
2166  	Play the song
2167  */
2168		play();
2169	}
2170
2171	/**
2172  * Sets the playback speed for the song.
2173  *
2174  * @param {number} playbackSpeed The speed we want the song to play back at.
2175  */
2176	function setPlaybackSpeed(playbackSpeed) {
2177		/*
2178  	Set the config playback speed.
2179  */
2180		_config2.default.playback_speed = playbackSpeed;
2181
2182		/*
2183  	Set the active song playback rate.
2184  */
2185		_config2.default.active_song.playbackRate = _config2.default.playback_speed;
2186	}
2187
2188	/*
2189 	Return publically facing functions
2190 */
2191	return {
2192		play: play,
2193		pause: pause,
2194		stop: stop,
2195		setVolume: setVolume,
2196		setSongLocation: setSongLocation,
2197		skipToLocation: skipToLocation,
2198		disconnectStream: disconnectStream,
2199		reconnectStream: reconnectStream,
2200		playNow: playNow,
2201		playSongAtIndex: playSongAtIndex,
2202		playPlaylistSongAtIndex: playPlaylistSongAtIndex,
2203		setPlaybackSpeed: setPlaybackSpeed
2204	};
2205}();
2206
2207/**
2208 * AmplitudeJS Visual Sync
2209 * @module visual/visual
2210*/
2211/**
2212 * Imports the config module
2213 * @module config
2214 */
2215exports.default = AmplitudeCore;
2216module.exports = exports['default'];
2217
2218/***/ }),
2219/* 4 */
2220/***/ (function(module, exports, __webpack_require__) {
2221
2222"use strict";
2223
2224
2225Object.defineProperty(exports, "__esModule", {
2226	value: true
2227});
2228
2229var _config = __webpack_require__(0);
2230
2231var _config2 = _interopRequireDefault(_config);
2232
2233var _helpers = __webpack_require__(1);
2234
2235var _helpers2 = _interopRequireDefault(_helpers);
2236
2237var _handlers = __webpack_require__(7);
2238
2239var _handlers2 = _interopRequireDefault(_handlers);
2240
2241function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2242
2243/*
2244|----------------------------------------------------------------------------------------------------
2245| EVENTS METHODS
2246|----------------------------------------------------------------------------------------------------
2247| These methods are called when we need to bind events to certain elements.
2248|
2249| METHODS:
2250| 	initializeEvents()
2251|	bindPlay()
2252|	bindPause()
2253|	bindPlayPause()
2254|	bindStop()
2255|	bindMute()
2256|	bindVolumeUp()
2257|	bindVolumeDown()
2258|	bindSongSlider()
2259|	bindVolumeSlider()
2260|	bindNext()
2261|	bindPrev()
2262|	bindShuffle()
2263|	bindRepeat()
2264|	bindPlaybackSpeed()
2265|	bindSkipTo()
2266|      bindProgress()
2267*/
2268var AmplitudeEvents = function () {
2269	/*--------------------------------------------------------------------------
2270 	Initializes the handlers for the events listened to by Amplitude
2271 --------------------------------------------------------------------------*/
2272	function initializeEvents() {
2273		/*
2274  	Write out debug message
2275  */
2276		_helpers2.default.writeDebugMessage('Beginning initialization of event handlers..');
2277
2278		/*
2279  	Sets flag that the screen is moving and not a tap
2280  */
2281		document.addEventListener('touchmove', function () {
2282			_config2.default.is_touch_moving = true;
2283		});
2284
2285		/*
2286  	On touch end if it was a touch move event, set moving to
2287  	false
2288  */
2289		document.addEventListener('touchend', function () {
2290			if (_config2.default.is_touch_moving) {
2291				_config2.default.is_touch_moving = false;
2292			}
2293		});
2294
2295		/*
2296  	On time update for the audio element, update visual displays that
2297  	represent the time on either a visualized element or time display.
2298  */
2299		bindTimeUpdate();
2300
2301		/*
2302  	Binds key down event handlers for matching key codes to functions.
2303  */
2304		bindKeyDownEventHandlers();
2305
2306		/*
2307  	When the audio element has ended playing, we handle the song
2308  	ending. In a single song or multiple modular song instance,
2309  	this just synchronizes the visuals for time and song time
2310  	visualization, but for a playlist it determines whether
2311  	it should play the next song or not.
2312  */
2313		bindSongEnded();
2314
2315		/*
2316  	Binds progress event so we can see how much of the song is loaded.
2317  */
2318		bindProgress();
2319
2320		/*
2321  	Binds 'amplitude-play' event handlers
2322  */
2323		bindPlay();
2324
2325		/*
2326  	Binds 'amplitude-pause' event handlers.
2327  */
2328		bindPause();
2329
2330		/*
2331  	Binds 'amplitude-play-pause' event handlers.
2332  */
2333		bindPlayPause();
2334
2335		/*
2336  	Binds 'amplitude-stop' event handlers.
2337  */
2338		bindStop();
2339
2340		/*
2341  	Binds 'amplitude-mute' event handlers.
2342  */
2343		bindMute();
2344
2345		/*
2346  	Binds 'amplitude-volume-up' event handlers
2347  */
2348		bindVolumeUp();
2349
2350		/*
2351  	Binds 'amplitude-volume-down' event handlers
2352  */
2353		bindVolumeDown();
2354
2355		/*
2356  	Binds 'amplitude-song-slider' event handlers
2357  */
2358		bindSongSlider();
2359
2360		/*
2361  	Binds 'amplitude-volume-slider' event handlers.
2362  */
2363		bindVolumeSlider();
2364
2365		/*
2366  	Binds 'amplitude-next' event handlers.
2367  */
2368		bindNext();
2369
2370		/*
2371  	Binds 'amplitude-prev' event handlers.
2372  */
2373		bindPrev();
2374
2375		/*
2376  	Binds 'amplitude-shuffle' event handlers.
2377  */
2378		bindShuffle();
2379
2380		/*
2381  	Binds 'amplitude-repeat' event handlers.
2382  */
2383		bindRepeat();
2384
2385		/*
2386  	Binds 'amplitude-playback-speed' event handlers.
2387  */
2388		bindPlaybackSpeed();
2389
2390		/*
2391  	Binds 'amplitude-skip-to' event handlers.
2392  */
2393		bindSkipTo();
2394	}
2395
2396	/*--------------------------------------------------------------------------
2397 	On time update for the audio element, update visual displays that
2398 		represent the time on either a visualized element or time display.
2399 --------------------------------------------------------------------------*/
2400	function bindTimeUpdate() {
2401		_config2.default.active_song.removeEventListener('timeupdate', _handlers2.default.updateTime);
2402		_config2.default.active_song.addEventListener('timeupdate', _handlers2.default.updateTime);
2403
2404		// also bind change of duratuion
2405		_config2.default.active_song.removeEventListener('durationchange', _handlers2.default.updateTime);
2406		_config2.default.active_song.addEventListener('durationchange', _handlers2.default.updateTime);
2407	}
2408
2409	/*--------------------------------------------------------------------------
2410 	On keydown, we listen to what key got pressed so we can map the key to
2411 	a function. This allows the user to map pause and play, next, etc. to key
2412 	presses.
2413 --------------------------------------------------------------------------*/
2414	function bindKeyDownEventHandlers() {
2415		document.removeEventListener("keydown", _helpers2.default.keydown);
2416		document.addEventListener("keydown", _handlers2.default.keydown);
2417	}
2418
2419	/*--------------------------------------------------------------------------
2420 	When the audio element has ended playing, we handle the song
2421 	ending. In a single song or multiple modular song instance,
2422 	this just synchronizes the visuals for time and song time
2423 	visualization, but for a playlist it determines whether
2424 	it should play the next song or not.
2425 --------------------------------------------------------------------------*/
2426	function bindSongEnded() {
2427		_config2.default.active_song.removeEventListener('ended', _handlers2.default.songEnded);
2428		_config2.default.active_song.addEventListener('ended', _handlers2.default.songEnded);
2429	}
2430
2431	/*--------------------------------------------------------------------------
2432 	As the audio is loaded, the progress event gets fired. We bind into this
2433 	to grab the buffered percentage of the song. We can then add more elements
2434 	to show the buffered amount.
2435 --------------------------------------------------------------------------*/
2436	function bindProgress() {
2437		_config2.default.active_song.removeEventListener('progress', _handlers2.default.progess);
2438		_config2.default.active_song.addEventListener('progress', _handlers2.default.progress);
2439	}
2440
2441	/*--------------------------------------------------------------------------
2442 	BINDS: class="amplitude-play"
2443 		Binds click and touchend events for amplitude play buttons.
2444 --------------------------------------------------------------------------*/
2445	function bindPlay() {
2446		/*
2447  	Gets all of the elements with the class amplitude-play
2448  */
2449		var play_classes = document.getElementsByClassName("amplitude-play");
2450
2451		/*
2452  	Iterates over all of the play classes and binds the event interaction
2453  	method to the element. If the browser is mobile, then the event is touchend
2454  	otherwise it is click.
2455  */
2456		for (var i = 0; i < play_classes.length; i++) {
2457			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2458				play_classes[i].removeEventListener('touchend', _handlers2.default.play);
2459				play_classes[i].addEventListener('touchend', _handlers2.default.play);
2460			} else {
2461				play_classes[i].removeEventListener('click', _handlers2.default.play);
2462				play_classes[i].addEventListener('click', _handlers2.default.play);
2463			}
2464		}
2465	}
2466
2467	/*--------------------------------------------------------------------------
2468 	BINDS: class="amplitude-pause"
2469 		Binds click and touchend events for amplitude pause buttons.
2470 --------------------------------------------------------------------------*/
2471	function bindPause() {
2472		/*
2473  	Gets all of the elements with the class amplitude-pause
2474  */
2475		var pause_classes = document.getElementsByClassName("amplitude-pause");
2476
2477		/*
2478  	Iterates over all of the pause classes and binds the event interaction
2479  	method to the element. If the browser is mobile, then the event is touchend
2480  	otherwise it is click.
2481  */
2482		for (var i = 0; i < pause_classes.length; i++) {
2483			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2484				pause_classes[i].removeEventListener('touchend', _handlers2.default.pause);
2485				pause_classes[i].addEventListener('touchend', _handlers2.default.pause);
2486			} else {
2487				pause_classes[i].removeEventListener('click', _handlers2.default.pause);
2488				pause_classes[i].addEventListener('click', _handlers2.default.pause);
2489			}
2490		}
2491	}
2492
2493	/*--------------------------------------------------------------------------
2494 	BINDS: class="amplitude-play-pause"
2495 		Binds click and touchend events for amplitude play pause buttons.
2496 --------------------------------------------------------------------------*/
2497	function bindPlayPause() {
2498		/*
2499  	Gets all of the elements with the class amplitude-play-pause
2500  */
2501		var play_pause_classes = document.getElementsByClassName("amplitude-play-pause");
2502
2503		/*
2504  	Iterates over all of the play/pause classes and binds the event interaction
2505  	method to the element. If the browser is mobile, then the event is touchend
2506  	otherwise it is click.
2507  */
2508		for (var i = 0; i < play_pause_classes.length; i++) {
2509			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2510				play_pause_classes[i].removeEventListener('touchend', _handlers2.default.playPause);
2511				play_pause_classes[i].addEventListener('touchend', _handlers2.default.playPause);
2512			} else {
2513				play_pause_classes[i].removeEventListener('click', _handlers2.default.playPause);
2514				play_pause_classes[i].addEventListener('click', _handlers2.default.playPause);
2515			}
2516		}
2517	}
2518
2519	/*--------------------------------------------------------------------------
2520 	BINDS: class="amplitude-stop"
2521 		Binds click and touchend events for amplitude stop buttons
2522 --------------------------------------------------------------------------*/
2523	function bindStop() {
2524		/*
2525  	Gets all of the elements with the class amplitude-stop
2526  */
2527		var stop_classes = document.getElementsByClassName("amplitude-stop");
2528
2529		/*
2530  	Iterates over all of the stop classes and binds the event interaction
2531  	method to the element.  If the browser is mobile, then the event is touchend
2532  	otherwise it is click.
2533  */
2534		for (var i = 0; i < stop_classes.length; i++) {
2535			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2536				stop_classes[i].removeEventListener('touchend', _handlers2.default.stop);
2537				stop_classes[i].addEventListener('touchend', _handlers2.default.stop);
2538			} else {
2539				stop_classes[i].removeEventListener('click', _handlers2.default.stop);
2540				stop_classes[i].addEventListener('click', _handlers2.default.stop);
2541			}
2542		}
2543	}
2544
2545	/*--------------------------------------------------------------------------
2546 	BINDS: class="amplitude-mute"
2547 		Binds click and touchend events for amplitude mute buttons
2548 --------------------------------------------------------------------------*/
2549	function bindMute() {
2550		/*
2551  	Gets all of the elements with the class amplitue-mute
2552  */
2553		var mute_classes = document.getElementsByClassName("amplitude-mute");
2554
2555		/*
2556  	Iterates over all of the mute classes and binds the event interaction
2557  	method to the element. If the browser is mobile, then the event is touchend
2558  	otherwise it is click.
2559  */
2560		for (var i = 0; i < mute_classes.length; i++) {
2561			/*
2562   	WARNING: If iOS, we don't do anything because iOS does not allow the
2563   	volume to be adjusted through anything except the buttons on the side of
2564   	the device.
2565   */
2566			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2567				/*
2568    	Checks for an iOS device and displays an error message if debugging
2569    	is turned on.
2570    */
2571				if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
2572					_helpers2.default.writeDebugMessage('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');
2573				} else {
2574					mute_classes[i].removeEventListener('touchend', _handlers2.default.mute);
2575					mute_classes[i].addEventListener('touchend', _handlers2.default.mute);
2576				}
2577			} else {
2578				mute_classes[i].removeEventListener('click', _handlers2.default.mute);
2579				mute_classes[i].addEventListener('click', _handlers2.default.mute);
2580			}
2581		}
2582	}
2583
2584	/*--------------------------------------------------------------------------
2585 	BINDS: class="amplitude-volume-up"
2586 		Binds click and touchend events for amplitude volume up buttons
2587 --------------------------------------------------------------------------*/
2588	function bindVolumeUp() {
2589		/*
2590  	Gets all of the elements with the class amplitude-volume-up
2591  */
2592		var volume_up_classes = document.getElementsByClassName("amplitude-volume-up");
2593
2594		/*
2595  	Iterates over all of the volume up classes and binds the event interaction
2596  	methods to the element. If the browser is mobile, then the event is touchend
2597  	otherwise it is click.
2598  */
2599		for (var i = 0; i < volume_up_classes.length; i++) {
2600			/*
2601   	WARNING: If iOS, we don't do anything because iOS does not allow the
2602   	volume to be adjusted through anything except the buttons on the side of
2603   	the device.
2604   */
2605			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2606				/*
2607    	Checks for an iOS device and displays an error message if debugging
2608    	is turned on.
2609    */
2610				if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
2611					_helpers2.default.writeDebugMessage('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');
2612				} else {
2613					volume_up_classes[i].removeEventListener('touchend', _handlers2.default.volumeUp);
2614					volume_up_classes[i].addEventListener('touchend', _handlers2.default.volumeUp);
2615				}
2616			} else {
2617				volume_up_classes[i].removeEventListener('click', _handlers2.default.volumeUp);
2618				volume_up_classes[i].addEventListener('click', _handlers2.default.volumeUp);
2619			}
2620		}
2621	}
2622
2623	/*--------------------------------------------------------------------------
2624 	BINDS: class="amplitude-volume-down"
2625 		Binds click and touchend events for amplitude volume down buttons
2626 --------------------------------------------------------------------------*/
2627	function bindVolumeDown() {
2628		/*
2629  	Gets all of the elements with the class amplitude-volume-down
2630  */
2631		var volume_down_classes = document.getElementsByClassName("amplitude-volume-down");
2632
2633		/*
2634  	Iterates over all of the volume down classes and binds the event interaction
2635  	methods to the element. If the browser is mobile, then the event is touchend
2636  	otherwise it is click.
2637  */
2638		for (var i = 0; i < volume_down_classes.length; i++) {
2639			/*
2640   	WARNING: If iOS, we don't do anything because iOS does not allow the
2641   	volume to be adjusted through anything except the buttons on the side of
2642   	the device.
2643   */
2644			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2645				/*
2646    	Checks for an iOS device and displays an error message if debugging
2647    	is turned on.
2648    */
2649				if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
2650					_helpers2.default.writeDebugMessage('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');
2651				} else {
2652					volume_down_classes[i].removeEventListener('touchend', _handlers2.default.volumeDown);
2653					volume_down_classes[i].addEventListener('touchend', _handlers2.default.volumeDown);
2654				}
2655			} else {
2656				volume_down_classes[i].removeEventListener('click', _handlers2.default.volumeDown);
2657				volume_down_classes[i].addEventListener('click', _handlers2.default.volumeDown);
2658			}
2659		}
2660	}
2661
2662	/*--------------------------------------------------------------------------
2663 	BINDS: class="amplitude-song-slider"
2664 		Binds change and input events for amplitude song slider inputs
2665 --------------------------------------------------------------------------*/
2666	function bindSongSlider() {
2667		/*
2668  	Gets browser so if we need to apply overrides, like we usually
2669  	have to do for anything cool in IE, we can do that.
2670  */
2671		var ua = window.navigator.userAgent;
2672		var msie = ua.indexOf("MSIE ");
2673
2674		/*
2675  	Gets all of the elements with the class amplitude-song-slider
2676  */
2677		var song_sliders = document.getElementsByClassName("amplitude-song-slider");
2678
2679		/*
2680  	Iterates over all of the song slider classes and binds the event interaction
2681  	methods to the element. If the browser is IE we listen to the change event
2682  	where if it is anything else, it's the input method.
2683  */
2684		for (var i = 0; i < song_sliders.length; i++) {
2685			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
2686				song_sliders[i].removeEventListener('change', _handlers2.default.songSlider);
2687				song_sliders[i].addEventListener('change', _handlers2.default.songSlider);
2688			} else {
2689				song_sliders[i].removeEventListener('input', _handlers2.default.songSlider);
2690				song_sliders[i].addEventListener('input', _handlers2.default.songSlider);
2691			}
2692		}
2693	}
2694
2695	/*--------------------------------------------------------------------------
2696 	BINDS: class="amplitude-volume-slider"
2697 		Binds change and input events for amplitude volume slider inputs
2698 --------------------------------------------------------------------------*/
2699	function bindVolumeSlider() {
2700		/*
2701  	Gets browser so if we need to apply overrides, like we usually
2702  	have to do for anything cool in IE, we can do that.
2703  */
2704		var ua = window.navigator.userAgent;
2705		var msie = ua.indexOf("MSIE ");
2706
2707		/*
2708  Gets all of the elements with the class amplitude-volume-slider
2709  */
2710		var volume_sliders = document.getElementsByClassName("amplitude-volume-slider");
2711
2712		/*
2713  	Iterates over all of the volume slider classes and binds the event interaction
2714  	methods to the element. If the browser is IE we listen to the change event
2715  	where if it is anything else, it's the input method.
2716  */
2717		for (var i = 0; i < volume_sliders.length; i++) {
2718			/*
2719   	WARNING: If iOS, we don't do anything because iOS does not allow the
2720   	volume to be adjusted through anything except the buttons on the side of
2721   	the device.
2722   */
2723			if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
2724				_helpers2.default.writeDebugMessage('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');
2725			} else {
2726				if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
2727					volume_sliders[i].removeEventListener('change', _handlers2.default.volumeSlider);
2728					volume_sliders[i].addEventListener('change', _handlers2.default.volumeSlider);
2729				} else {
2730					volume_sliders[i].removeEventListener('input', _handlers2.default.volumeSlider);
2731					volume_sliders[i].addEventListener('input', _handlers2.default.volumeSlider);
2732				}
2733			}
2734		}
2735	}
2736
2737	/*--------------------------------------------------------------------------
2738 	BINDS: class="amplitude-next"
2739 		Binds click and touchend events for amplitude next buttons.
2740 --------------------------------------------------------------------------*/
2741	function bindNext() {
2742		/*
2743  	Gets all of the elements with the class amplitude-next
2744        */
2745		var next_classes = document.getElementsByClassName("amplitude-next");
2746
2747		/*
2748  	Iterates over all of the next classes and binds the event interaction
2749  	methods to the element. If the browser is mobile, then the event is touchend
2750  	otherwise it is click.
2751  */
2752		for (var i = 0; i < next_classes.length; i++) {
2753			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2754				next_classes[i].removeEventListener('touchend', _handlers2.default.next);
2755				next_classes[i].addEventListener('touchend', _handlers2.default.next);
2756			} else {
2757				next_classes[i].removeEventListener('click', _handlers2.default.next);
2758				next_classes[i].addEventListener('click', _handlers2.default.next);
2759			}
2760		}
2761	}
2762
2763	/*--------------------------------------------------------------------------
2764 	BINDS: class="amplitude-prev"
2765 		Binds click and touchend events for amplitude prev buttons.
2766 --------------------------------------------------------------------------*/
2767	function bindPrev() {
2768		/*
2769  	Gets all of the elements with the class amplitude-prev
2770  */
2771		var prev_classes = document.getElementsByClassName("amplitude-prev");
2772
2773		/*
2774  	Iterates over all of the prev classes and binds the event interaction
2775  	methods to the element. If the browser is mobile, then the event is touchend
2776  	otherwise it is click.
2777  */
2778		for (var i = 0; i < prev_classes.length; i++) {
2779			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2780				prev_classes[i].removeEventListener('touchend', _handlers2.default.prev);
2781				prev_classes[i].addEventListener('touchend', _handlers2.default.prev);
2782			} else {
2783				prev_classes[i].removeEventListener('click', _handlers2.default.prev);
2784				prev_classes[i].addEventListener('click', _handlers2.default.prev);
2785			}
2786		}
2787	}
2788
2789	/*--------------------------------------------------------------------------
2790 	BINDS: class="amplitude-shuffle"
2791 		Binds click and touchend events for amplitude shuffle buttons.
2792 --------------------------------------------------------------------------*/
2793	function bindShuffle() {
2794		/*
2795  	Gets all of the elements with the class amplitude-shuffle
2796  */
2797		var shuffle_classes = document.getElementsByClassName("amplitude-shuffle");
2798
2799		/*
2800  	Iterates over all of the shuffle classes and binds the event interaction
2801  	methods to the element. If the browser is mobile, then the event is touchend
2802  	otherwise it is click.
2803  */
2804		for (var i = 0; i < shuffle_classes.length; i++) {
2805			/*
2806   	Since we are re-binding everything we remove any classes that signify
2807   	a state of the shuffle control.
2808   */
2809			shuffle_classes[i].classList.remove('amplitude-shuffle-on');
2810			shuffle_classes[i].classList.add('amplitude-shuffle-off');
2811
2812			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2813				shuffle_classes[i].removeEventListener('touchend', _handlers2.default.shuffle);
2814				shuffle_classes[i].addEventListener('touchend', _handlers2.default.shuffle);
2815			} else {
2816				shuffle_classes[i].removeEventListener('click', _handlers2.default.shuffle);
2817				shuffle_classes[i].addEventListener('click', _handlers2.default.shuffle);
2818			}
2819		}
2820	}
2821
2822	/*--------------------------------------------------------------------------
2823 	BINDS: class="amplitude-repeat"
2824 		Binds click and touchend events for amplitude repeat buttons.
2825 --------------------------------------------------------------------------*/
2826	function bindRepeat() {
2827		/*
2828  	Gets all of the elements with the class amplitude-repeat
2829  */
2830		var repeat_classes = document.getElementsByClassName("amplitude-repeat");
2831
2832		/*
2833  	Iterates over all of the repeat classes and binds the event interaction
2834  	methods to the element. If the browser is mobile, then the event is touchend
2835  	otherwise it is click.
2836  */
2837		for (var i = 0; i < repeat_classes.length; i++) {
2838			/*
2839   	Since we are re-binding everything we remove any classes that signify
2840   	a state of the repeat control.
2841   */
2842			repeat_classes[i].classList.remove('amplitude-repeat-on');
2843			repeat_classes[i].classList.add('amplitude-repeat-off');
2844
2845			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2846				repeat_classes[i].removeEventListener('touchend', _handlers2.default.repeat);
2847				repeat_classes[i].addEventListener('touchend', _handlers2.default.repeat);
2848			} else {
2849				repeat_classes[i].removeEventListener('click', _handlers2.default.repeat);
2850				repeat_classes[i].addEventListener('click', _handlers2.default.repeat);
2851			}
2852		}
2853	}
2854
2855	/*--------------------------------------------------------------------------
2856 	BINDS: class="amplitude-playback-speed"
2857 		Binds click and touchend events for amplitude playback speed buttons.
2858 --------------------------------------------------------------------------*/
2859	function bindPlaybackSpeed() {
2860		/*
2861  	Gets all of the elements with the class amplitude-playback-speed
2862  */
2863		var playback_speed_classes = document.getElementsByClassName("amplitude-playback-speed");
2864
2865		/*
2866  	Iterates over all of the playback speed classes and binds the event interaction
2867  	methods to the element. If the browser is mobile, then the event is touchend
2868  	otherwise it is click.
2869  */
2870		for (var i = 0; i < playback_speed_classes.length; i++) {
2871			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2872				playback_speed_classes[i].removeEventListener('touchend', _handlers2.default.playbackSpeed);
2873				playback_speed_classes[i].addEventListener('touchend', _handlers2.default.playbackSpeed);
2874			} else {
2875				playback_speed_classes[i].removeEventListener('click', _handlers2.default.playbackSpeed);
2876				playback_speed_classes[i].addEventListener('click', _handlers2.default.playbackSpeed);
2877			}
2878		}
2879	}
2880
2881	/*--------------------------------------------------------------------------
2882 	BINDS: class="amplitude-skip-to"
2883 		Binds click and touchend events for amplitude skip to buttons.
2884 --------------------------------------------------------------------------*/
2885	function bindSkipTo() {
2886		/*
2887  	Gets all of the skip to elements with the class 'amplitude-skip-to'
2888  */
2889		var skipToClasses = document.getElementsByClassName("amplitude-skip-to");
2890
2891		/*
2892  	Iterates over all of the skip to classes and binds the event interaction
2893  	methods to the element. If the browser is mobile, then the event is touchend
2894  	otherwise it's a click.
2895  */
2896		for (var i = 0; i < skipToClasses.length; i++) {
2897			if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
2898				skipToClasses[i].removeEventListener('touchend', _handlers2.default.skipTo);
2899				skipToClasses[i].addEventListener('touchend', _handlers2.default.skipTo);
2900			} else {
2901				skipToClasses[i].removeEventListener('click', _handlers2.default.skipTo);
2902				skipToClasses[i].addEventListener('click', _handlers2.default.skipTo);
2903			}
2904		}
2905	}
2906
2907	return {
2908		initializeEvents: initializeEvents
2909	};
2910}(); /*
2911     	Import the necessary classes and config to use
2912     	with the events.
2913     */
2914exports.default = AmplitudeEvents;
2915module.exports = exports['default'];
2916
2917/***/ }),
2918/* 5 */
2919/***/ (function(module, exports, __webpack_require__) {
2920
2921"use strict";
2922
2923
2924Object.defineProperty(exports, "__esModule", {
2925	value: true
2926});
2927
2928var _config = __webpack_require__(0);
2929
2930var _config2 = _interopRequireDefault(_config);
2931
2932var _visual = __webpack_require__(2);
2933
2934var _visual2 = _interopRequireDefault(_visual);
2935
2936var _core = __webpack_require__(3);
2937
2938var _core2 = _interopRequireDefault(_core);
2939
2940var _helpers = __webpack_require__(1);
2941
2942var _helpers2 = _interopRequireDefault(_helpers);
2943
2944function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2945
2946/**
2947 * These methods help handle interactions whether it's computation or shuffling
2948 * songs.
2949 *
2950 * @module events/AmplitudeEventsHelpers
2951 */
2952
2953
2954/**
2955 * Imports the Amplitude Core module
2956 * @module core/AmplitudeCore
2957 */
2958/**
2959 * Imports the config module
2960 * @module config
2961 */
2962var AmplitudeEventsHelpers = function () {
2963	/**
2964  * Computes the current song time. Breaks down where the song is into
2965  * hours, minutes, seconds and formats it to be displayed to the user.
2966  *
2967  * @access public
2968  */
2969	function computeCurrentTimes() {
2970		/*
2971  	Initialize the current time object that will be returned.
2972  */
2973		var currentTime = {};
2974
2975		/*
2976  	Computes the current seconds for the song.
2977  */
2978		var currentSeconds = (Math.floor(_config2.default.active_song.currentTime % 60) < 10 ? '0' : '') + Math.floor(_config2.default.active_song.currentTime % 60);
2979
2980		/*
2981  	Computes the current minutes for the song.
2982  */
2983		var currentMinutes = Math.floor(_config2.default.active_song.currentTime / 60);
2984
2985		/*
2986  	Initialize the current hours variable.
2987  */
2988		var currentHours = '00';
2989
2990		/*
2991  	If the current minutes is less than 10, we add a leading 0.
2992  */
2993		if (currentMinutes < 10) {
2994			currentMinutes = '0' + currentMinutes;
2995		}
2996
2997		/*
2998  	If the user is more than 60 minutes into the song, then
2999  	we extract the hours.
3000  */
3001		if (currentMinutes >= 60) {
3002			currentHours = Math.floor(currentMinutes / 60);
3003			currentMinutes = currentMinutes % 60;
3004
3005			/*
3006   	If the user is less than 10 minutes in, we append the
3007   	additional 0 to the minutes.
3008   */
3009			if (currentMinutes < 10) {
3010				currentMinutes = '0' + currentMinutes;
3011			}
3012		}
3013
3014		/*
3015  	Build a clean current time object and send back the appropriate information.
3016  */
3017		currentTime.seconds = currentSeconds;
3018		currentTime.minutes = currentMinutes;
3019		currentTime.hours = currentHours;
3020
3021		return currentTime;
3022	}
3023
3024	/**
3025  * Computes the current song duration. Breaks down where the song is into
3026  * hours, minutes, seconds and formats it to be displayed to the user.
3027  *
3028  * @access public
3029  */
3030	function computeSongDuration() {
3031		/*
3032  	Initialize the song duration object that will be returned.
3033  */
3034		var songDuration = {};
3035
3036		/*
3037  	Computes the duration of the song's seconds.
3038  */
3039		var songDurationSeconds = (Math.floor(_config2.default.active_song.duration % 60) < 10 ? '0' : '') + Math.floor(_config2.default.active_song.duration % 60);
3040
3041		/*
3042  	Computes the duration of the song's minutes.
3043  */
3044		var songDurationMinutes = Math.floor(_config2.default.active_song.duration / 60);
3045
3046		/*
3047  	Initialize the hours duration variable.
3048  */
3049		var songDurationHours = '0';
3050
3051		/*
3052  	If the song duration minutes is less than 10, we add a leading 0.
3053  */
3054		if (songDurationMinutes < 10) {
3055			songDurationMinutes = '0' + songDurationMinutes;
3056		}
3057
3058		/*
3059  	If there is more than 60 minutes in the song, then we
3060  	extract the hours.
3061  */
3062		if (songDurationMinutes >= 60) {
3063			songDurationHours = Math.floor(songDurationMinutes / 60);
3064			songDurationMinutes = songDurationMinutes % 60;
3065
3066			/*
3067   	If the song duration minutes is less than 10 we append
3068   	the additional 0.
3069   */
3070			if (songDurationMinutes < 10) {
3071				songDurationMinutes = '0' + songDurationMinutes;
3072			}
3073		}
3074
3075		/*
3076  	Build a clean song duration object and send back the appropriate information.
3077  */
3078		songDuration.seconds = songDurationSeconds;
3079		songDuration.minutes = songDurationMinutes;
3080		songDuration.hours = songDurationHours;
3081
3082		return songDuration;
3083	}
3084
3085	/**
3086  * Computes the song completion percentage.
3087  *
3088  * @access public
3089  */
3090	function computeSongCompletionPercentage() {
3091		return _config2.default.active_song.currentTime / _config2.default.active_song.duration * 100;
3092	}
3093
3094	/**
3095  * Sets the current song's playback speed
3096  *
3097  * @access public
3098  * @param {number} speed 	- The float with a base of 1 representing the speed
3099  *
3100  */
3101	function setPlaybackSpeed(speed) {
3102		_core2.default.setPlaybackSpeed(speed);
3103	}
3104
3105	/**
3106  * Sets the state of the repeat for the current song.
3107  *
3108  * @access public
3109  * @param {boolean} repeat - A boolean representing whether the repeat should be on or off
3110  * @param {string} playlist - The key of the playlist for repeating
3111  */
3112	function setRepeat(repeat, playlist) {
3113		/*
3114    If the playlist is null, then we are dealing with the global
3115    repeat status.
3116  */
3117		if (playlist == null) {
3118			/*
3119   	Set the global repeat to be toggled
3120   */
3121			_config2.default.repeat = repeat;
3122
3123			/*
3124   	Visually sync repeat
3125   */
3126			_visual2.default.syncRepeat();
3127		} else {
3128			/*
3129   	Set the playlist repeat to be toggled.
3130   */
3131			_config2.default.repeat_statuses[playlist] = repeat;
3132
3133			/*
3134   	Visually sync playlist repeat
3135   */
3136			_visual2.default.syncRepeatPlaylist(playlist);
3137		}
3138
3139		/** When song ends and in playlis mode and done with playlist check repeat  **/
3140	}
3141
3142	/**
3143  * Sets the state of the repeat song
3144  *
3145  * @access public
3146  * @param {boolean} repeat - A boolean representing whether the repeat shoudl be on or off for the song.
3147  */
3148	function setRepeatSong(repeat) {
3149		_config2.default.repeat_song = repeat;
3150	}
3151
3152	/**
3153  * Sets the main play pause buttons to the current state of the song.
3154  *
3155  * @access public
3156  */
3157	function setMainPlayPause() {
3158		/*
3159  	Determines what action we should take based on the
3160  	state of the song.
3161  */
3162		if (_config2.default.active_song.paused) {
3163			/*
3164   	The song was paused so we sync visually for the song
3165   	that is playing and we play the song.
3166   */
3167			_visual2.default.syncMainPlayPause('playing');
3168
3169			/*
3170   	If there is an active playlist, then
3171   	we need to sync that playlist's play pause
3172   	button to the state of playing.
3173   */
3174			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'playing');
3175
3176			/*
3177   	Sync the song play pause buttons
3178   */
3179			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'playing');
3180
3181			/*
3182   	Play the song
3183   */
3184			_core2.default.play();
3185		} else {
3186			/*
3187   	The song was playing so we sync visually for the song
3188   	to be paused and we pause the song.
3189   */
3190			_visual2.default.syncMainPlayPause('paused');
3191
3192			/*
3193   	If there is an active playlist, then
3194   	we need to sync that playlist's play pause
3195   	button to the state of paused.
3196   */
3197			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'paused');
3198
3199			/*
3200   	Sync the song play pause buttons
3201   */
3202			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'paused');
3203
3204			/*
3205   	Pause the song
3206   */
3207			_core2.default.pause();
3208		}
3209	}
3210
3211	/**
3212  * Sets the playlist main play pause buttons to the current state of the song.
3213  *
3214  * @access public
3215  * @param {string} playlist The playlist the main play pause button controls
3216  */
3217	function setPlaylistPlayPause(playlist) {
3218		/*
3219  	The only thing that can change when you click a playlist
3220  	play pause is the playlist. Main play pauses have no change
3221  	in song, song play pauses can change playlist and song.
3222  */
3223		if (_helpers2.default.checkNewPlaylist(playlist)) {
3224			_helpers2.default.setActivePlaylist(playlist);
3225
3226			/*
3227   	Play first song in the playlist since we just
3228   	switched playlists, we start from the first song.
3229   		If the user has shuffle on for the playlist, then
3230   	we go from the first song in the shuffle playlist array.
3231   */
3232			if (_config2.default.shuffled_statuses[playlist]) {
3233				_helpers2.default.changeSong(_config2.default.shuffled_playlists[playlist][0].original_index);
3234			} else {
3235				_helpers2.default.changeSong(_config2.default.playlists[playlist][0]);
3236			}
3237		}
3238
3239		/*
3240  	Determines what action we should take based on the
3241  	state of the song.
3242  */
3243		if (_config2.default.active_song.paused) {
3244			/*
3245   	The song was paused so we sync visually for the song
3246   	that is playing and we play the song.
3247   */
3248			_visual2.default.syncMainPlayPause('playing');
3249
3250			/*
3251   	If there is an active playlist, then
3252   	we need to sync that playlist's play pause
3253   	button to the state of playing.
3254   */
3255			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'playing');
3256
3257			/*
3258   	Sync the song play pause buttons
3259   */
3260			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'playing');
3261
3262			/*
3263   	Play the song
3264   */
3265			_core2.default.play();
3266		} else {
3267			/*
3268   	The song was playing so we sync visually for the song
3269   	to be paused and we pause the song.
3270   */
3271			_visual2.default.syncMainPlayPause('paused');
3272
3273			/*
3274   	If there is an active playlist, then
3275   	we need to sync that playlist's play pause
3276   	button to the state of paused.
3277   */
3278			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'paused');
3279
3280			/*
3281   	Sync the song play pause buttons
3282   */
3283			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _c
3283onfig2.default.active_index, 'paused');
3284
3285			/*
3286   	Pause the song
3287   */
3288			_core2.default.pause();
3289		}
3290	}
3291
3292	/**
3293  * Sets the song play pause buttons to the current state of the song.
3294  *
3295  * @access public
3296  * @param {string} playlist The playlist the song is a part of
3297  * @param {number} songIndex The index of the song being played/paused
3298  *
3299  */
3300	function setSongPlayPause(playlist, songIndex) {
3301		/*
3302  	There can be multiple playlists on the page and there can be
3303  	multiple songs on the page AND there can be songs in multiple
3304  	playlists, so we have some checking to do.
3305  */
3306
3307		/*
3308  	Check to see if the playlist has changed. If it has,
3309  	set the active playlist.
3310  */
3311		if (_helpers2.default.checkNewPlaylist(playlist)) {
3312			_helpers2.default.setActivePlaylist(playlist);
3313
3314			/*
3315   	If there's a new playlist then we reset the
3316   	song since the song could be in 2 playlists,
3317   	but the user selects another playlist.
3318   */
3319			_helpers2.default.changeSong(songIndex);
3320		}
3321
3322		/*
3323  	Check to see if the song has changed. If it has,
3324  	set the active song. If it was in a playlist, the
3325  	song wouldn't change here, since we already set the
3326  	song when we checked for a playlist.
3327  */
3328		if (_helpers2.default.checkNewSong(songIndex)) {
3329			/*
3330   	The song selected is different, so we change the
3331   	song.
3332   */
3333			_helpers2.default.changeSong(songIndex);
3334		}
3335
3336		/*
3337  	Determines what action we should take based on the
3338  	state of the song.
3339  */
3340		if (_config2.default.active_song.paused) {
3341			/*
3342   	The song was paused so we sync visually for the song
3343   	that is playing and we play the song.
3344   */
3345			_visual2.default.syncMainPlayPause('playing');
3346
3347			/*
3348   	If there is an active playlist, then
3349   	we need to sync that playlist's play pause
3350   	button to the state of playing.
3351   */
3352			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'playing');
3353
3354			/*
3355   	Sync the song play pause buttons
3356   */
3357			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'playing');
3358
3359			/*
3360   	Play the song
3361   */
3362			_core2.default.play();
3363		} else {
3364			/*
3365   	The song was playing so we sync visually for the song
3366   	to be paused and we pause the song.
3367   */
3368			_visual2.default.syncMainPlayPause('paused');
3369
3370			/*
3371   	If there is an active playlist, then
3372   	we need to sync that playlist's play pause
3373   	button to the state of paused.
3374   */
3375			_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'paused');
3376
3377			/*
3378   	Sync the song play pause buttons
3379   */
3380			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'paused');
3381
3382			/*
3383   	Pause the song
3384   */
3385			_core2.default.pause();
3386		}
3387	}
3388
3389	/**
3390  * Sets the shuffle state for a playlist
3391  *
3392  * @access public
3393  * @param {string} playlist - The playlist being shuffled
3394  */
3395	function setShuffle(playlist) {
3396		/*
3397  	If the playlist is null, then we are dealing with the global
3398  	shuffle status.
3399  */
3400		if (playlist == null) {
3401			/*
3402   	If shuffle is on, we toggle it off. If shuffle is off, we
3403   	toggle on.
3404   */
3405			if (_config2.default.shuffle_on) {
3406				_config2.default.shuffle_on = false;
3407				_config2.default.shuffle_list = {};
3408			} else {
3409				_config2.default.shuffle_on = true;
3410				_helpers2.default.shuffleSongs();
3411			}
3412
3413			/*
3414   	Visually sync the shuffle statuses
3415   */
3416			_visual2.default.syncShuffle(_config2.default.shuffle_on);
3417		} else {
3418			/*
3419   	If the playlist shuffled is on, we toggle it off. If the
3420   	playlist shuffled is off, we toggle it on.
3421   */
3422			if (_config2.default.shuffled_statuses[playlist]) {
3423				_config2.default.shuffled_statuses[playlist] = false;
3424				_config2.default.shuffled_playlists[playlist] = [];
3425			} else {
3426				_config2.default.shuffled_statuses[playlist] = true;
3427				_helpers2.default.shufflePlaylistSongs(playlist);
3428			}
3429
3430			/*
3431   	Visually sync the playlist shuffle statuses.
3432   */
3433			_visual2.default.syncPlaylistShuffle(_config2.default.shuffled_statuses[playlist], playlist);
3434		}
3435	}
3436
3437	/**
3438  * Sets the next song when next is clicked
3439  *
3440  * @access public
3441  * @param {boolean} [songEnded=false] If the song ended, this is set to true
3442  * so we take into effect the repeat setting.
3443 */
3444	function setNext() {
3445		var songEnded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3446
3447		/*
3448  	Initializes the next index variable. This will be the
3449  	index of the song that is next.
3450  */
3451		var nextIndex = 0;
3452		/*
3453    Ensure we don't loop in the playlist if config.repeat is not true
3454  */
3455		var endOfList = false;
3456
3457		if (_config2.default.repeat_song) {
3458			/*
3459   	If the playlist is shuffled, get the now playing index.
3460   */
3461			if (_config2.default.shuffle_on) {
3462				nextIndex = _config2.default.shuffle_active_index;
3463			} else {
3464				nextIndex = _config2.default.active_index;
3465			}
3466		} else {
3467
3468			/*
3469   	If the shuffle is on, we use the shuffled list of
3470   	songs to determine our next song.
3471   */
3472			if (_config2.default.shuffle_on) {
3473				/*
3474    	If the active shuffle index + 1 is less than the length, then
3475    	we use the next shuffle otherwise we go to the beginning
3476    	of the shuffle list.
3477    */
3478				if (parseInt(_config2.default.shuffle_active_index) + 1 < _config2.default.shuffle_list.length) {
3479					_config2.default.shuffle_active_index = parseInt(_config2.default.shuffle_active_index) + 1;
3480
3481					/*
3482     	Set the next index to be the index of the song in the shuffle list.
3483     */
3484					nextIndex = _config2.default.shuffle_list[parseInt(_config2.default.shuffle_active_index)].original_index;
3485				} else {
3486					_config2.default.shuffle_active_index = 0;
3487					nextIndex = 0;
3488					endOfList = true;
3489				}
3490			} else {
3491				/*
3492    	If the active index + 1 is less than the length of the songs, then
3493    	we use the next song otherwise we go to the beginning of the
3494    	song list.
3495    */
3496				if (parseInt(_config2.default.active_index) + 1 < _config2.default.songs.length) {
3497					_config2.default.active_index = parseInt(_config2.default.active_index) + 1;
3498				} else {
3499					_config2.default.active_index = 0;
3500					endOfList = true;
3501				}
3502
3503				/*
3504    	Sets the next index.
3505    */
3506				nextIndex = _config2.default.active_index;
3507			}
3508		}
3509
3510		/*
3511  	Stops the active song.
3512  */
3513		_core2.default.stop();
3514
3515		/*
3516  	Change the song to the index we need.
3517  */
3518		_helpers2.default.changeSong(nextIndex);
3519
3520		/*
3521  	If it's the end of the list and repeat is not on, do nothing.
3522  */
3523		if (endOfList && !_config2.default.repeat) {} else {
3524			/*
3525   	If the song has ended and repeat is on, play the song.
3526   */
3527			if (!(songEnded && !_config2.default.repeat && endOfList)) {
3528				_core2.default.play();
3529			}
3530		}
3531
3532		/*
3533  	Syncs the main play pause button, playlist play pause button and
3534  	song play pause.
3535  */
3536		_visual2.default.syncMainPlayPause();
3537		_visual2.default.syncSongPlayPause(null, nextIndex);
3538
3539		/*
3540  	Call after next callback
3541  */
3542		_helpers2.default.runCallback('after_next');
3543
3544		/*
3545  	If we are repeating the song, call the song repeated callback
3546  */
3547		if (_config2.default.repeat_song) {
3548			_helpers2.default.runCallback('song_repeated');
3549		}
3550	}
3551
3552	/**
3553  * Sets the next song in a playlist
3554  *
3555  * @param {string} playlist - The playlist being shuffled
3556  * @param {boolean} [songEnded=false] - If the song ended, this is set to true
3557  * so we take into effect the repeat setting.
3558  */
3559	function setNextPlaylist(playlist) {
3560		var songEnded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3561
3562		/*
3563  	Initializes the next index
3564  */
3565		var nextIndex = 0;
3566
3567		/*
3568    Used to determine whether the playlist looped over
3569    If it did, only play if repeat is allowed, end otherwise
3570    @TODO: Different settings for song loop, in-playlist loop and global loop
3571  */
3572		var endOfList = false;
3573
3574		/*
3575  	If we are repeating the song, then we just start the song over.
3576  */
3577
3578		if (_config2.default.repeat_song) {
3579			/*
3580   	If the playlist is shuffled, get the now playing index.
3581   */
3582			if (_config2.default.shuffled_statuses[playlist]) {
3583				nextIndex = _config2.default.shuffled_playlists[playlist][_config2.default.shuffled_active_indexes[playlist]].original_index;
3584			} else {
3585				nextIndex = _config2.default.active_index;
3586			}
3587		} else {
3588			/*
3589   	If the playlist is shuffled we get the next index of the playlist.
3590   */
3591			if (_config2.default.shuffled_statuses[playlist]) {
3592				/*
3593    	Gets the shuffled playlist's active song index.
3594    */
3595				var shuffledPlaylistActiveSongIndex = parseInt(_config2.default.shuffled_active_indexes[playlist]);
3596
3597				/*
3598    	If the index + 1 is less than the length of the playlist, we increment
3599    	the next index otherwise we take the first index of 0.
3600    */
3601				if (shuffledPlaylistActiveSongIndex + 1 < _config2.default.shuffled_playlists[playlist].length) {
3602					/*
3603     	Set the shuffled playlist active song index.
3604     */
3605					_config2.default.shuffled_active_indexes[playlist] = shuffledPlaylistActiveSongIndex + 1;
3606					/*
3607     	Get the index of the song that we will be switching to.
3608     */
3609					nextIndex = _config2.default.shuffled_playlists[playlist][_config2.default.shuffled_active_indexes[playlist]].original_index;
3610				} else {
3611					/*
3612     	Sets the active shuffled playlist active index to 0 and gets the original index of
3613     	the song at the shuffled index of 0.
3614     */
3615					_config2.default.shuffled_active_indexes[playlist] = 0;
3616					nextIndex = _config2.default.shuffled_playlists[playlist][0].original_index;
3617					endOfList = true;
3618				}
3619			} else {
3620				/*
3621    	Gets the index of the active song within the scope
3622    	of the playlist.
3623    */
3624				var playlistActiveSongIndex = _config2.default.playlists[playlist].indexOf(parseInt(_config2.default.active_index));
3625
3626				/*
3627    	Checks to see if the next index is still less than the length of the playlist.
3628    	If it is, use the next index othwerwise get the first song in the playlist.
3629    */
3630				if (playlistActiveSongIndex + 1 < _config2.default.playlists[playlist].length) {
3631					_config2.default.active_index = parseInt(_config2.default.playlists[playlist][playlistActiveSongIndex + 1]);
3632				} else {
3633					_config2.default.active_index = parseInt(_config2.default.playlists[playlist][0]);
3634					endOfList = true;
3635				}
3636
3637				/*
3638    	Sets the next inex to the active index in the config.
3639    */
3640				nextIndex = _config2.default.active_index;
3641			}
3642		}
3643
3644		/*
3645  	Stops the active song playing.
3646  */
3647
3648		_core2.default.stop();
3649
3650		/*
3651  	Changes the song to the next song in the playlist.
3652  */
3653		_helpers2.default.changeSong(nextIndex);
3654
3655		/*
3656  	If it's the end of the song in the playlist, and repeat for
3657  	the playlist is not on, do nothing.
3658  */
3659		if (endOfList && !_config2.default.repeat_statuses[playlist]) {} else {
3660			/*
3661   	If the song has ended and repeat is on, play the song.
3662   */
3663			if (!(songEnded && !_config2.default.repeat_statuses[playlist] && endOfList)) {
3664				_core2.default.play();
3665			}
3666		}
3667
3668		_helpers2.default.setActivePlaylist(playlist);
3669
3670		/*
3671  	Syncs the main play pause button, playlist play pause button and
3672  	song play pause.
3673  */
3674		_visual2.default.syncMainPlayPause();
3675		_visual2.default.syncPlaylistPlayPause(playlist);
3676		_visual2.default.syncSongPlayPause(playlist, nextIndex);
3677
3678		/*
3679  	Call after next callback
3680  */
3681		_helpers2.default.runCallback('after_next');
3682
3683		/*
3684  	If we are repeating the song, call the song repeated callback
3685  */
3686		if (_config2.default.repeat_song) {
3687			_helpers2.default.runCallback('song_repeated');
3688		}
3689	}
3690
3691	/**
3692  * Sets the previous song
3693  * @access public
3694  *
3695 /*--------------------------------------------------------------------------
3696 	Sets the previous song
3697 --------------------------------------------------------------------------*/
3698	function setPrev() {
3699		/*
3700  	Initializes the prev index variable. This will be the
3701  	index of the song that is next.
3702  */
3703		var prevIndex = 0;
3704
3705		/*
3706  	If the shuffle is on for the individual songs, we get the previous
3707  	song.
3708  */
3709		if (_config2.default.shuffle_on) {
3710			/*
3711   	If the previous index is greater than or equal to 0, we use the active
3712   	index - 1.
3713   */
3714			if (parseInt(_config2.default.shuffle_active_index) - 1 >= 0) {
3715				/*
3716    	Sets the new active to be 1 less than the current active index.
3717    */
3718				_config2.default.shuffle_active_index = parseInt(_config2.default.shuffle_active_index) - 1;
3719
3720				/*
3721    	Gets the index of the song in the song array for the new index.
3722    */
3723				prevIndex = _config2.default.shuffle_list[parseInt(_config2.default.shuffle_active_index)].original_index;
3724			} else {
3725				/*
3726    	Set the active index and previous index.
3727    */
3728				_config2.default.shuffle_active_index = _config2.default.shuffle_list.length - 1;
3729				prevIndex = _config2.default.shuffle_list[parseInt(_config2.default.shuffle_list.length) - 1].original_index;
3730			}
3731		} else {
3732			/*
3733   	If the active index - 1 is greater than or equal to 0, we subtract 1 from the
3734   	active index otherwise we set the active index to the end of the songs array index.
3735   */
3736			if (parseInt(_config2.default.active_index) - 1 >= 0) {
3737				_config2.default.active_index = parseInt(_config2.default.active_index) - 1;
3738			} else {
3739				_config2.default.active_index = _config2.default.songs.length - 1;
3740			}
3741
3742			/*
3743   	Set the previous index.
3744   */
3745			prevIndex = _config2.default.active_index;
3746		}
3747
3748		/*
3749  	Stops the active song.
3750  */
3751		_core2.default.stop();
3752
3753		/*
3754  	Change the song to the index we need.
3755  */
3756		_helpers2.default.changeSong(prevIndex);
3757
3758		/*
3759  	Play the next song.
3760  */
3761		_core2.default.play();
3762
3763		/*
3764  	Sync the play/pause buttons to the current state of the player.
3765  */
3766		_visual2.default.syncMainPlayPause('playing');
3767		_visual2.default.syncSongPlayPause(null, prevIndex, 'playing');
3768
3769		/*
3770  	Call after prev callback
3771  */
3772		_helpers2.default.runCallback('after_prev');
3773	}
3774
3775	/**
3776  * Sets the previous song in a playlist
3777  *
3778  * @access public
3779  * @param {string} playlist 	- The playlist we are setting the previous for.
3780  */
3781	function setPrevPlaylist(playlist) {
3782		/*
3783  	Initializes the prev index variable. This will be the
3784  	index of the song that is next.
3785  */
3786		var prevIndex = 0;
3787
3788		/*
3789  	If the shuffle is on for the playlist, we get the previous
3790  	song.
3791  */
3792		if (_config2.default.shuffled_statuses[playlist]) {
3793			/*
3794   	Gets the active song index for the shuffled playlist
3795   */
3796			var shuffledPlaylistActiveSongIndex = parseInt(_config2.default.shuffled_active_indexes[playlist]);
3797
3798			/*
3799   	If the shuffled song active index is greater than or equal to 0,
3800   	we use the active index - 1.
3801   */
3802			if (shuffledPlaylistActiveSongIndex - 1 >= 0) {
3803				/*
3804    	Sets the active index to the active song index - 1
3805    */
3806				_config2.default.shuffled_active_indexes[playlist] = shuffledPlaylistActiveSongIndex - 1;
3807
3808				/*
3809    	Gets the index of the song in the song array for the new index.
3810    */
3811				prevIndex = _config2.default.shuffled_playlists[playlist][_config2.default.shuffled_active_indexes[playlist]].original_index;
3812			} else {
3813				/*
3814    	Set the active index and previous index.
3815    */
3816				_config2.default.shuffled_active_indexes[playlist] = _config2.default.shuffled_playlists[playlist].length - 1;
3817				prevIndex = _config2.default.shuffled_playlists[playlist][_config2.default.shuffled_playlists[playlist].length - 1].original_index;
3818			}
3819		} else {
3820			/*
3821   	Gets the active song index for the playlist
3822   */
3823			var playlistActiveSongIndex = _config2.default.playlists[playlist].indexOf(parseInt(_config2.default.active_index));
3824
3825			/*
3826   	If the active song index in the playlist - 1 is greater than
3827   	or equal to 0, then we use the active song index - 1.
3828   */
3829			if (playlistActiveSongIndex - 1 >= 0) {
3830				_config2.default.active_index = parseInt(_config2.default.playlists[playlist][playlistActiveSongIndex - 1]);
3831			} else {
3832				_config2.default.active_index = parseInt(_config2.default.playlists[playlist][_config2.default.playlists[playlist].length - 1]);
3833			}
3834
3835			/*
3836   	Set the previous index to the active index for use later.
3837   */
3838			prevIndex = _config2.default.active_index;
3839		}
3840
3841		/*
3842  	Stops the active song.
3843  */
3844		_core2.default.stop();
3845
3846		/*
3847  	Changes the song to the prev song in the playlist.
3848  */
3849		_helpers2.default.changeSong(prevIndex);
3850		_helpers2.default.setActivePlaylist(playlist);
3851
3852		/*
3853  	Plays the song
3854  */
3855		_core2.default.play();
3856
3857		/*
3858  	Syncs the main play pause button, playlist play pause button and
3859  	song play pause.
3860  */
3861		_visual2.default.syncMainPlayPause('playing');
3862		_visual2.default.syncPlaylistPlayPause(playlist, 'playing');
3863		_visual2.default.syncSongPlayPause(playlist, prevIndex, 'playing');
3864
3865		/*
3866  	Call after prev callback
3867  */
3868		_helpers2.default.runCallback('after_prev');
3869	}
3870
3871	/**
3872  * Runs an event on key down
3873  *
3874  * @access public
3875  * @param {number} key 	- The key code the event is bound to.
3876  */
3877	function runKeyEvent(key) {
3878		/*
3879  	Checks to see if the user bound an event to the code pressed.
3880  */
3881		if (_config2.default.bindings[key] != undefined) {
3882			/*
3883   	Determine which event should be run if bound.
3884   */
3885			switch (_config2.default.bindings[key]) {
3886				/*
3887    	Fires a play pause event.
3888    */
3889				case 'play_pause':
3890					setSongPlayPause(_config2.default.active_playlist, _config2.default.active_index);
3891					break;
3892
3893				/*
3894    	Fires a next event.
3895    */
3896				case 'next':
3897					/*
3898     	Check to see if the current state of the player
3899     	is in playlist mode or not playlist mode.
3900     */
3901					if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
3902						setNext();
3903					} else {
3904						setNextPlaylist(_config2.default.active_playlist);
3905					}
3906					break;
3907
3908				/*
3909    	Fires a previous event.
3910    */
3911				case 'prev':
3912					/*
3913     	Check to see if the current playlist has been set
3914     	or null and set the previous song.
3915     */
3916					if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
3917						AmplitudeEventsHelpers.setPrev();
3918					} else {
3919						AmplitudeEventsHelpers.setPrevPlaylist(_config2.default.active_playlist);
3920					}
3921					break;
3922
3923				/*
3924    	Fires a stop event.
3925    */
3926				case 'stop':
3927					/*
3928     	Sets all of the play/pause buttons to pause
3929     */
3930					_visual2.default.setPlayPauseButtonsToPause();
3931
3932					/*
3933     	Stops the active song.
3934     */
3935					_core2.default.stop();
3936					break;
3937
3938				/*
3939    	Fires a shuffle event.
3940    */
3941				case 'shuffle':
3942					/*
3943     	Check to see if the current playlist has been set
3944     	or null and set the previous song.
3945     */
3946					if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
3947						AmplitudesEventHelpers.setShuffle(null);
3948					} else {
3949						AmplitudeEvenstHelpers.setShuffle(_config2.default.active_playlist);
3950					}
3951					break;
3952
3953				/*
3954    	Fires a repeat event.
3955    */
vendor: 4,503 bytes, lines 3956-4115
3956				case 'repeat':
3957					/*
3958     	Sets repeat to the opposite of what it was set to
3959     */
3960					AmplitudeEventsHelpers.setRepeat(!_config2.default.repeat);
3961
3962					/*
3963     	Visually sync repeat
3964     */
3965					_visual2.default.syncRepeat();
3966					break;
3967			}
3968		}
3969	}
3970
3971	/*
3972 	Return the publically scoped functions
3973 */
3974	return {
3975		computeCurrentTimes: computeCurrentTimes,
3976		computeSongDuration: computeSongDuration,
3977		computeSongCompletionPercentage: computeSongCompletionPercentage,
3978		setPlaybackSpeed: setPlaybackSpeed,
3979		setRepeat: setRepeat,
3980		setRepeatSong: setRepeatSong,
3981		setMainPlayPause: setMainPlayPause,
3982		setPlaylistPlayPause: setPlaylistPlayPause,
3983		setSongPlayPause: setSongPlayPause,
3984		setShuffle: setShuffle,
3985		setNext: setNext,
3986		setNextPlaylist: setNextPlaylist,
3987		setPrev: setPrev,
3988		setPrevPlaylist: setPrevPlaylist,
3989		runKeyEvent: runKeyEvent
3990	};
3991}();
3992
3993/**
3994 * Imports the Amplitude Core Helpers module
3995 * @module core/AmplitudeCoreHelpers
3996 */
3997
3998
3999/**
4000 * Imports the Amplitude Visual Sync module
4001 * @module visual/AmplitudeVisualSync
4002 */
4003exports.default = AmplitudeEventsHelpers;
4004module.exports = exports['default'];
4005
4006/***/ }),
4007/* 6 */
4008/***/ (function(module, exports, __webpack_require__) {
4009
4010"use strict";
4011
4012
4013Object.defineProperty(exports, "__esModule", {
4014	value: true
4015});
4016
4017var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /**
4018                                                                                                                                                                                                                                                                               * Imports the config module
4019                                                                                                                                                                                                                                                                               * @module config
4020                                                                                                                                                                                                                                                                               */
4021
4022
4023/**
4024 * AmplitudeJS Core Module
4025 * @module core/AmplitudeCore
4026 */
4027
4028
4029/**
4030 * AmplitudeJS Core Helpers
4031 * @module core/AmplitudeHelpers
4032 */
4033
4034
4035/**
4036 * AmplitudeJS Events
4037 * @module events/AmplitudeEvents
4038 */
4039
4040
4041/**
4042 * AmplitudeJS Soundcloud
4043 * @module soundcloud/AmplitudeSoundcloud
4044 */
4045
4046
4047/**
4048 * AmplitudeJS Visual Sync
4049 * @module visual/AmplitudeVisualSync
4050*/
4051
4052
4053var _config = __webpack_require__(0);
4054
4055var _config2 = _interopRequireDefault(_config);
4056
4057var _core = __webpack_require__(3);
4058
4059var _core2 = _interopRequireDefault(_core);
4060
4061var _helpers = __webpack_require__(1);
4062
4063var _helpers2 = _interopRequireDefault(_helpers);
4064
4065var _events = __webpack_require__(4);
4066
4067var _events2 = _interopRequireDefault(_events);
4068
4069var _soundcloud = __webpack_require__(9);
4070
4071var _soundcloud2 = _interopRequireDefault(_soundcloud);
4072
4073var _visual = __webpack_require__(2);
4074
4075var _visual2 = _interopRequireDefault(_visual);
4076
4077function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4078
4079/**
4080 * AmplitudeJS Initializer Module. Helps with the handling of all of the
4081 * initialization for AmplitudeJS.
4082 *
4083 * @module init/AmplitudeInitializer
4084 */
4085var AmplitudeInitializer = function () {
4086
4087	/**
4088   * The main init function.  The user will call this through
4089  * Amplitude.init({}) and pass in their settings.
4090  *
4091  * Public Accessor: Amplitude.init( user_config_json )
4092  * @access public
4093   * @param {object} userConfig - A JSON object of user defined values that help configure and initialize AmplitudeJS.
4094   */
4095	function initialize(userConfig) {
4096		var ready = false;
4097
4098		/*
4099  	Reset the config on init so we have a clean slate. This is if the
4100  	user has to re-init.
4101  */
4102		_helpers2.default.resetConfig();
4103
4104		/*
4105  	Initialize event handlers on init. This will clear any old
4106  	event handlers on the amplitude element and re-bind what is
4107  	necessary.
4108  */
4109		_events2.default.initializeEvents();
4110
4111		/*
4112  	Initializes debugging right away so we can use it for the rest
4113  	of the configuration.
4114  */
4115		_config2.default.debug = userConfig.debug != undefined ? userConfig.debug : false;
4116
4117		/*
4118  	Checks to see if the user has songs defined.
4119  */
4120		if (userConfig.songs) {
4121			/*
4122   	Checks to see if the user has some songs in the songs array.
4123   */
4124			if (userConfig.songs.length != 0) {
4125				/*
4126    	Copies over the user defined songs. and prepares
4127    	Amplitude for the rest of the configuration.
4128    */
4129				_config2.default.songs = userConfig.songs;
4130				/*
4131    	Flag amplitude as ready.
4132    */
4133				ready = true;
4134			} else {
4135				_helpers2.default.writeDebugMessage('Please add some songs, to your songs object!');
4136			}
4137		} else {
4138			_helpers2.default.writeDebugMessage('Please provide a songs object for AmplitudeJS to run!');
4139		}
4140
4141		/**
4142   * Initializes the audio context. In this method it checks to see if the
4143   * user wants to use visualizations or not before proceeding.
4144   * @todo MAKE HANDLED BY AMPLITUDE FX.
4145   */
4146		//privateHelpInitializeAudioContext();
4147
4148		/*
4149  	Checks if the user has any playlists defined. If they do
4150  	we have to initialize the functionality for the playlists.
4151  */
4152		if (userConfig.playlists && countPlaylists(userConfig.playlists) > 0) {
4153			/*
4154   	Copy the playlists over to Amplitude
4155   */
4156			_config2.default.playlists = userConfig.playlists;
4157
4158			/*
4159   	Initialize default live settings
4160   */
4161			initializeDefaultLiveSettings();
4162
4163			/*
4164   	Check to see if the user has valid song indexes in their playlist.
4165   */
4166			checkValidSongsInPlaylists();
4167
4168			/*
4169   	Initialize the shuffle status of the playlists.
4170   */
4171			initializePlaylistShuffleStatuses();
4172
4173			/*
4174   	Initialize the repeat status for the playlits.
4175   */
4176			initializePlaylistsRepeatStatuses();
4177
4178			/*
4179   	Initialize temporary place holders for shuffle lists.
4180   */
4181			initializePlaylistShuffleLists();
4182
4183			/*
4184   	Initializes the active shuffled indexes for shuffled playlists.
4185   */
4186			initializePlaylistShuffleIndexes();
4187
4188			/*
4189   	Initializes the first song in the playlist
4190   */
4191			initializeFirstSongInPlaylistMetaData();
4192		}
4193
4194		/*
4195  	When the preliminary config is ready, we are ready to proceed.
4196  */
4197		if (ready) {
4198			/*
4199   	Copies over the soundcloud information to the global config
4200   	which will determine where we go from there.
4201   */
4202			_config2.default.soundcloud_client = userConfig.soundcloud_client != undefined ? userConfig.soundcloud_client : '';
4203
4204			/*
4205   	Checks if we want to use the art loaded from soundcloud.
4206   */
4207			_config2.default.soundcloud_use_art = userConfig.soundcloud_use_art != undefined ? userConfig.soundcloud_use_art : '';
4208
4209			/*
4210   	If the user provides a soundcloud client then we assume that
4211   	there are URLs in their songs that will reference SoundcCloud.
4212   	We then copy over the user config they provided to the
4213   	temp_user_config so we don't mess up the global or their configs
4214   	and load the soundcloud information.
4215   */
4216			var tempUserConfig = {};
4217
4218			if (_config2.default.soundcloud_client != '') {
4219				tempUserConfig = userConfig;
4220
4221				/*
4222    	Load up SoundCloud for use with AmplitudeJS.
4223    */
4224				_soundcloud2.default.loadSoundCloud(tempUserConfig);
4225			} else {
4226				/*
4227    	The user is not using Soundcloud with Amplitude at this point
4228    	so we just finish the configuration with the users's preferences.
4229    */
4230				setConfig(userConfig);
4231			}
4232		}
4233
4234		/*
4235  	Debug out what was initialized with AmplitudeJS.
4236  */
4237		_helpers2.default.writeDebugMessage('Initialized With: ');
4238		_helpers2.default.writeDebugMessage(_config2.default);
4239	}
4240
4241	/**
4242  * Rebinds all of the elements in the display.
4243  *
4244  * Public Accessor: Amplitude.rebindDisplay()
4245  * @access public
4246  */
4247	function rebindDisplay() {
4248		_events2.default.initializeEvents();
4249		_visual2.default.displaySongMetadata();
4250	}
4251
4252	/**
4253  * Finishes the initalization of the config. Takes all of the user defined
4254  * parameters and makes sure they override the defaults. The important
4255  * config information is assigned in the publicInit() function.
4256  *
4257  * This function can be called from 2 different locations:
4258  * 	1. Right away on init after the important settings are defined.
4259  *
4260  * 	2. After all of the Soundcloud URLs are resolved properly and
4261  *	 	soundcloud is configured.  We will need the proper URLs from Soundcloud
4262  * 		to stream through Amplitude so we get those right away before we
4263  * 		set the information and the active song
4264  *
4265  * @access public
4266  * @param {object} userConfig - A JSON object of user defined values that help configure and initialize AmplitudeJS.
4267  */
4268	function setConfig(userConfig) {
4269		/*
4270  	Check to see if the user entered a start song
4271  */
4272		if (userConfig.start_song != undefined) {
4273			/*
4274   	Ensure what has been entered is an integer.
4275   */
4276			if (_helpers2.default.isInt(userConfig.start_song)) {
4277				_helpers2.default.changeSong(userConfig.start_song);
4278			} else {
4279				_helpers2.default.writeDebugMessage("You must enter an integer index for the start song.");
4280			}
4281		} else {
4282			_helpers2.default.changeSong(0);
4283		}
4284
4285		/*
4286  	Initialize a sh
4287  */
4288		if (userConfig.shuffle_on != undefined && userConfig.shuffle_on) {
4289			_config2.default.shuffle_on = true;
4290			_helpers2.default.shuffleSongs();
4291
4292			/*
4293   	Visually sync the shuffle statuses
4294   */
4295			_visual2.default.syncShuffle(_config2.default.shuffle_on);
4296
4297			_helpers2.default.changeSong(_config2.default.shuffle_list[0].original_index);
4298		}
4299
4300		/*
4301  	Allows the user to set whether they want to continue to the next song
4302  	when the current song finishes or not. In any scenario that's not a playlist,
4303  	contining to the next song may not be desired.
4304  */
4305		_config2.default.continue_next = userConfig.continue_next != undefined ? userConfig.continue_next : true;
4306
4307		/*
4308  	If the user defined a playback speed, we copy over their
4309  	preference here, otherwise we default to normal playback
4310  	speed of 1.0.
4311  */
4312		_config2.default.playback_speed = userConfig.playback_speed != undefined ? userConfig.playback_speed : 1.0;
4313
4314		/*
4315  	Sets the audio playback speed.
4316  */
4317		_core2.default.setPlaybackSpeed(_config2.default.playback_speed);
4318
4319		/*
4320  	If the user wants the song to be pre-loaded for instant
4321  	playback, they set it to true. By default it's set to just
4322  	load the metadata.
4323  */
4324		_config2.default.active_song.preload = userConfig.preload != undefined ? userConfig.preload : "auto";
4325
4326		/*
4327  	Initializes the user defined callbacks. This should be a JSON
4328  	object that contains a key->value store of the callback name
4329  	and the name of the function the user needs to call.
4330  */
4331		_config2.default.callbacks = userConfig.callbacks != undefined ? userConfig.callbacks : {};
4332
4333		/*
4334  	Initializes the user defined key bindings. This should be a JSON
4335  	object that contains a key->value store of the key event number
4336  	pressed and the method to be run.
4337  */
4338		_config2.default.bindings = userConfig.bindings != undefined ? userConfig.bindings : {};
4339
4340		/*
4341  	The user can define a starting volume in a range of 0-100 with
4342  	0 being muted and 100 being the loudest. After the config is set
4343  	Amplitude sets the active song's volume to the volume defined
4344  	by the user.
4345  */
4346		_config2.default.volume = userConfig.volume != undefined ? userConfig.volume : 50;
4347
4348		/*
4349  	Sets the delay between songs if the user has it set. This should be in MS.
4350  */
4351		_config2.default.delay = userConfig.delay != undefined ? userConfig.delay : 0;
4352
4353		/*
4354  	The user can set the volume increment and decrement values between 1 and 100
4355  	for when the volume up or down button is pressed.  The default is an increase
4356  	or decrease of 5.
4357  */
4358		_config2.default.volume_increment = userConfig.volume_increment != undefined ? userConfig.volume_increment : 5;
4359
4360		_config2.default.volume_decrement = userConfig.volume_decrement != undefined ? userConfig.volume_decrement : 5;
4361
4362		/*
4363  	Set the volume to what is defined in the config. The user can define this,
4364  	so we should set it up that way.
4365  */
4366		_core2.default.setVolume(_config2.default.volume);
4367
4368		/*
4369  	Since the user can define a start volume, we want our volume
4370  	sliders to sync with the user defined start value.
4371  */
4372		_visual2.default.syncVolumeSliders();
4373
4374		/*
4375  	If the user defines default album art, this image will display if the active
4376  	song doesn't have album art defined.
4377  */
4378		if (userConfig.default_album_art != undefined) {
4379			_config2.default.default_album_art = userConfig.default_album_art;
4380		} else {
4381			_config2.default.default_album_art = '';
4382		}
4383
4384		/*
4385  	Syncs all of the visual time elements to 00.
4386  */
4387		_visual2.default.resetTimes();
4388
4389		/*
4390  	Sets all of the play pause buttons to pause.
4391  */
4392		_visual2.default.setPlayPauseButtonsToPause();
4393
4394		/*
4395  	Sets the meta data for the songs automatically.
4396  */
4397		_visual2.default.syncSongsMetaData();
4398
4399		/*
4400  	If the user has autoplay enabled, then begin playing the song. Everything should
4401  	be configured for this to be ready to play.
4402  */
4403		if (userConfig.autoplay) {
4404			/*
4405   	If the user hasn't set a starting playlist, set it to null otherwise initialize to the
4406   	starting playlist selected by the user.
4407   */
4408			if (userConfig.starting_playlist == '') {
4409				_config2.default.active_playlist = null;
4410			} else {
4411				_config2.default.active_playlist = userConfig.starting_playlist;
4412			}
4413
4414			/*
4415   	Sync the main and song play pause buttons.
4416   */
4417			_visual2.default.syncMainPlayPause('playing');
4418			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, 0, 'playing');
4419
4420			/*
4421   	Start playing the song
4422   */
4423			_core2.default.play();
4424		}
4425
4426		/*
4427  	If the user has selected a starting playlist, we need to set the starting playlist
4428  	and sync the visuals
4429  */
4430		if (userConfig.starting_playlist != undefined && userConfig.starting_playlist != '') {
4431			/*
4432   	Set the active playlist to the starting playlist by the user
4433   */
4434			_config2.default.active_playlist = userConfig.starting_playlist;
4435
4436			/*
4437   	Check if the user defined a song to start with in the playlist.
4438   */
4439			if (userConfig.starting_playlist_song != undefined && userConfig.starting_playlist_song != '') {
4440				/*
4441    	Ensure the song is a valid index.
4442    */
4443				if (_typeof(userConfig.playlists[userConfig.starting_playlist][parseInt(userConfig.starting_playlist_song)]) != undefined) {
4444					/*
4445     	Set the player to the song defined by the user.
4446     */
4447					_helpers2.default.changeSong(userConfig.playlists[userConfig.starting_playlist][parseInt(userConfig.starting_playlist_song)]);
4448				} else {
4449					/*
4450     	Set the player to the first song in the playlist
4451     */
4452					_helpers2.default.changeSong(userConfig.playlists[userConfig.starting_playlist][0]);
4453					/*
4454     	Debug that the song index doesn't exist
4455     */
4456					_helpers2.default.writeDebugMessage('The index of ' + userConfig.starting_playlist_song + ' does not exist in the playlist ' + userConfig.starting_playlist);
4457				}
4458			} else {
4459				/*
4460    	Set the player to the first song in the playlist
4461    */
4462				_helpers2.default.changeSong(userConfig.playlists[userConfig.starting_playlist][0]);
4463			}
4464
4465			/*
4466   	Sync the main and song play pause buttons.
4467   */
4468			_visual2.default.syncMainPlayPause('paused');
4469			_visual2.default.syncSongPlayPause(_config2.default.active_playlist, 0, 'paused');
4470		}
4471
4472		/*
4473  	Run after init callback
4474  */
4475		_helpers2.default.runCallback('after_init');
4476	}
4477
4478	/**
4479  * Counts the number of playlists the user has configured. This ensures
4480  * that the user has at least 1 playlist so we can validate the songs
4481  * defined in the playlist are correct and they didn't enter an invalid
4482  * ID.
4483  *
4484  * @access private
4485  * @param {object} playlists 	-
4486  */
4487	function countPlaylists(playlists) {
4488		/*
4489  	Initialize the placeholders to iterate through the playlists
4490  	and find out how many we have to account for.
4491  */
4492		var size = 0,
4493		    key = void 0;
4494
4495		/*
4496  	Iterate over playlists and if the user has the playlist defined,
4497  	increment the size of playlists.
4498  */
4499		for (key in playlists) {
4500			if (playlists.hasOwnProperty(key)) {
4501				size++;
4502			}
4503		}
4504
4505		/*
4506  	Debug how many playlists are in the config.
4507  */
4508		_helpers2.default.writeDebugMessage('You have ' + size + ' playlist(s) in your config');
4509
4510		/*
4511  	Return the number of playlists in the config.
4512  */
4513		return size;
4514	}
4515
4516	/**
4517 * Ensures the indexes in the playlists are valid indexes. The song has
4518 * to exist in the Amplitude config to be played correctly.
4519 *
4520 * @access private
4521 */
4522	function checkValidSongsInPlaylists() {
4523		/*
4524  	Iterate over all of the config's playlists
4525  */
4526		for (var key in _config2.default.playlists) {
4527			/*
4528   	Checks if the playlist key is accurate.
4529   */
4530			if (_config2.default.playlists.hasOwnProperty(key)) {
4531				/*
4532    	Checks if the playlist has songs.
4533    */
4534				if (_config2.default.playlists[key].songs) {
4535					/*
4536     	Iterate over all of the songs in the playlist
4537     */
4538					for (var i = 0; i < _config2.default.playlists[key].songs.length; i++) {
4539						/*
4540      	Check to see if the index for the song in the playlist
4541      	exists in the songs config.
4542      */
4543						if (!_config2.default.songs[_config2.default.playlists[key].songs[i]]) {
4544							_helpers2.default.writeDebugMessage('The song index: ' + _config2.default.playlists[key].songs[i] + ' in playlist with key: ' + key + ' is not defined in your songs array!');
4545						}
4546					}
4547				}
4548			}
4549		}
4550	}
4551
4552	/**
4553  * Initializes the shuffle statuses for each of the playlists. These will
4554  * be referenced when we shuffle individual playlists.
4555  *
4556  * @access private
4557  */
4558	function initializePlaylistShuffleStatuses() {
4559		/*
4560  	Iterate over all of the playlists the user defined adding
4561  	the playlist key to the shuffled playlist array and creating
4562  	and empty object to house the statuses.
4563  */
4564		for (var key in _config2.default.playlists) {
4565			_config2.default.shuffled_statuses[key] = false;
4566		}
4567	}
4568
4569	/**
4570  * Initializes the repeat statuses for each of the playlists.  These will
4571  * be referenced when we repeat individual playlits.
4572  *
4573  * @access private
4574  */
4575	function initializePlaylistsRepeatStatuses() {
4576		/*
4577  	Iterate over all of the playlists the user defined adding
4578  	the playlist key to the repeated playlist array and creating
4579  	and empty object to house the statuses.
4580  */
4581		for (var key in _config2.default.playlists) {
4582			_config2.default.repeat_statuses[key] = false;
4583		}
4584	}
4585
4586	/**
4587  * Initializes the shuffled playlist placeholders. These will be set for
4588  * playlists that are shuffled and contain the shuffled songs.
4589  *
4590  * @access private
4591 	 */
4592	function initializePlaylistShuffleLists() {
4593		/*
4594  	Iterate over all of the playlists the user defined adding
4595  	the playlist key to the shuffled playlists array and creating
4596  	and empty object to house the shuffled playlists
4597  */
4598		for (var key in _config2.default.playlists) {
4599			_config2.default.shuffled_playlists[key] = [];
4600		}
4601	}
4602
4603	/**
4604  * Initializes the shuffled playlist indexes array. These will be set for
4605  * playlists that are shuffled and contain the active shuffled index.
4606  *
4607  * @access private
4608  */
4609	function initializePlaylistShuffleIndexes() {
4610		/*
4611  	Iterates over all of the playlists adding a key
4612  	to the shuffled_active_indexes array that contains
4613  	the active shuffled index.
4614  */
4615		for (var key in _config2.default.playlists) {
4616			_config2.default.shuffled_active_indexes[key] = 0;
4617		}
4618	}
4619
4620	/**
4621  * Intializes the display for the first song in the playlist meta data.
4622  *
4623  * @access private
4624  */
4625	function initializeFirstSongInPlaylistMetaData() {
4626		/*
4627  	Iterates over all of the playlists setting the meta data for the
4628  	first song.
4629  */
4630		for (var key in _config2.default.playlists) {
4631			_visual2.default.setFirstSongInPlaylist(_config2.default.songs[_config2.default.playlists[key][0]], key);
4632		}
4633	}
4634
4635	/**
4636  * Intializes the default live settings for all of the songs.
4637  *
4638  * @access priavet
4639  */
4640	function initializeDefaultLiveSettings() {
4641		for (var i = 0; i < _config2.default.songs.length; i++) {
4642			if (_config2.default.songs[i].live == undefined) {
4643				_config2.default.songs[i].live = false;
4644			}
4645		}
4646	}
4647
4648	/*
4649 	Returns the publicly accessible methods
4650 */
4651	return {
4652		initialize: initialize,
4653		setConfig: setConfig,
4654		rebindDisplay: rebindDisplay
4655	};
4656}();
4657
4658exports.default = AmplitudeInitializer;
4659module.exports = exports['default'];
4660
4661/***/ }),
4662/* 7 */
4663/***/ (function(module, exports, __webpack_require__) {
4664
4665"use strict";
4666
4667
4668Object.defineProperty(exports, "__esModule", {
4669	value: true
4670});
4671
4672var _config = __webpack_require__(0);
4673
4674var _config2 = _interopRequireDefault(_config);
4675
4676var _helpers = __webpack_require__(5);
4677
4678var _helpers2 = _interopRequireDefault(_helpers);
4679
4680var _visual = __webpack_require__(2);
4681
4682var _visual2 = _interopRequireDefault(_visual);
4683
4684var _core = __webpack_require__(3);
4685
4686var _core2 = _interopRequireDefault(_core);
4687
4688var _helpers3 = __webpack_require__(1);
4689
4690var _helpers4 = _interopRequireDefault(_helpers3);
4691
4692function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
4693
4694/**
4695 * These functions handle the events that we bound to each element and
4696 * prepare for a function to be called. These kind of act like filters/middleware.
4697 *
4698 * @module events/AmplitudeHandlers
4699 */
4700
4701
4702/**
4703 * Imports the core module of Amplitude which handles the basic functions
4704 * @module core/AmplitudeCore
4705 */
4706
4707
4708/**
4709 * Imports the helpers for the event handlers.
4710 * @module events/AmplitudeEventsHelpers
4711 */
4712exports.default = {
4713	/**
4714  * When the time updates on the active song, we sync the current time displays
4715  *
4716  * HANDLER FOR: timeupdate
4717  *
4718  * @access public
4719  */
4720	updateTime: function updateTime() {
4721		/*
4722  	Help from: http://jsbin.com/badimipi/1/edit?html,js,output
4723  */
4724		if (_config2.default.active_song.buffered.length - 1 >= 0) {
4725			var bufferedEnd = _config2.default.active_song.buffered.end(_config2.default.active_song.buffered.length - 1);
4726			var duration = _config2.default.active_song.duration;
4727
4728			_config2.default.buffered = bufferedEnd / duration * 100;
4729		}
4730
4731		/*
4732  	Sync the buffered progress bars.
4733  */
4734		_visual2.default.syncBufferedProgressBars();
4735
4736		/*
4737  	If the current song is not live, then
4738  	we can update the time information. Otherwise the
4739  	current time updates wouldn't mean much since the time
4740  	is infinite.
4741  */
4742		if (!_config2.default.active_metadata.live) {
4743			/*
4744   	Compute the current time
4745   */
4746			var currentTime = _helpers2.default.computeCurrentTimes();
4747
4748			/*
4749   	Compute the song completion percentage
4750   */
4751			var songCompletionPercentage = _helpers2.default.computeSongCompletionPercentage();
4752
4753			/*
4754   	Computes the song duration
4755   */
4756			var songDuration = _helpers2.default.computeSongDuration();
4757
4758			/*
4759   	Sync the current time elements with the current
4760   	location of the song and the song duration elements with
4761   	the duration of the song.
4762   */
4763			_visual2.default.syncCurrentTime(currentTime, songCompletionPercentage);
4764			_visual2.default.syncSongDuration(currentTime, songDuration);
4765
4766			/*
4767   	Runs the callback defined for the time update.
4768   */
4769			_helpers4.default.runCallback('time_update');
4770		}
4771	},
4772
4773	/**
4774  * When the keydown event is fired, we determine which function should be run
4775  * based on what was passed in.
4776  *
4777  * HANDLER FOR: keydown
4778  *
4779  * @access public
4780  */
4781	keydown: function keydown(event) {
4782		_helpers2.default.runKeyEvent(event.which);
4783	},
4784
4785	/**
4786  * When the song has ended, handles what to do next
4787  *
4788  * HANDLER FOR: ended
4789  *
4790  * @access public
4791  */
4792	songEnded: function songEnded() {
4793		setTimeout(function () {
4794			if (_config2.default.continue_next) {
4795				/*
4796    	If the active playlist is not set, we set the
4797    	next song that's in the songs array.
4798    */
4799				if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
4800					_helpers2.default.setNext(true);
4801				} else {
4802					/*
4803     	Set the next song in the playlist
4804     */
4805					_helpers2.default.setNextPlaylist(_config2.default.active_playlist, true);
4806				}
4807			} else {
4808				if (!_config2.default.is_touch_moving) {
4809					/*
4810     	Sets all of the play/pause buttons to pause
4811     */
4812					_visual2.default.setPlayPauseButtonsToPause();
4813
4814					/*
4815     	Stops the active song.
4816     */
4817					_core2.default.stop();
4818				}
4819			}
4820		}, _config2.default.delay);
4821	},
4822
4823	/**
4824  * As the song is buffered, we can display the buffered percentage in
4825  * a progress bar.
4826  *
4827  * HANDLER FOR: ended
4828  *
4829  * @access public
4830  */
4831	progress: function progress() {
4832		/*
4833  	Help from: http://jsbin.com/badimipi/1/edit?html,js,output
4834  */
4835		if (_config2.default.active_song.buffered.length - 1 >= 0) {
4836			var bufferedEnd = _config2.default.active_song.buffered.end(_config2.default.active_song.buffered.length - 1);
4837			var duration = _config2.default.active_song.duration;
4838
4839			_config2.default.buffered = bufferedEnd / duration * 100;
4840		}
4841
4842		/*
4843  	Sync the buffered progress bars.
4844  */
4845		_visual2.default.syncBufferedProgressBars();
4846	},
4847
4848	/**
4849  * Handles an event on a play button in Amplitude.
4850  *
4851  * HANDLER FOR: 'amplitude-play'
4852  *
4853  * @access public
4854  * @TODO Finish commenting and re-structure
4855  */
4856	play: function play() {
4857		if (!_config2.default.is_touch_moving) {
4858			/*
4859   	Gets the attribute for song index so we can check if
4860   	there is a need to change the song.  In some scenarios
4861   	there might be multiple play classes on the page. In that
4862   	case it is possible the user could click a different play
4863   	class and change the song.
4864   */
4865			var playButtonSongIndex = this.getAttribute('amplitude-song-index');
4866			var playButtonPlaylistIndex = this.getAttribute('amplitude-playlist');
4867
4868			if (playButtonPlaylistIndex == null && playButtonSongIndex == null) {
4869				_helpers2.default.setSongPlayPause(_config2.default.active_playlist, _config2.default.active_index);
4870			}
4871
4872			/*
4873   	*/
4874			if (playButtonPlaylistIndex != null && playButtonPlaylistIndex != '') {
4875				if (_helpers4.default.checkNewPlaylist(playButtonPlaylistIndex)) {
4876					_helpers4.default.setActivePlaylist(playButtonPlaylistIndex);
4877
4878					if (playButtonSongIndex != null) {
4879						_helpers4.default.changeSong(playButtonSongIndex);
4880						_helpers2.default.setPlaylistPlayPause(playButtonPlaylistIndex);
4881					} else {
4882						_helpers4.default.changeSong(_config2.default.playlists[playButtonPlaylistIndex][0]);
4883						_helpers2.default.setPlaylistPlayPause(playButtonPlaylistIndex);
4884					}
4885				} else {
4886					if (playButtonSongIndex != null) {
4887						_helpers4.default.changeSong(playButtonSongIndex);
4888						_helpers2.default.setPlaylistPlayPause(playButtonPlaylistIndex);
4889					} else {
4890						_helpers4.default.changeSong(_config2.default.active_index);
4891						_helpers2.default.setPlaylistPlayPause(playButtonPlaylistIndex);
4892					}
4893				}
4894			}
4895
4896			/*
4897   	*/
4898			if ((playButtonPlaylistIndex == null || playButtonPlaylistIndex == '') && playButtonSongIndex != null && playButtonSongIndex != '') {
4899
4900				if (_helpers4.default.checkNewSong(playButtonSongIndex) || _config2.default.active_playlist != playButtonPlaylistIndex) {
4901					_helpers4.default.changeSong(playButtonSongIndex);
4902				}
4903
4904				_helpers2.default.setSongPlayPause(playButtonPlaylistIndex, playButtonSongIndex);
4905			}
4906
4907			/*
4908   	Start the visualizations for the song.
4909   	AMPFX-TODO: MAKE HANDLED BY AMPLITUDE FX
4910   */
4911			//privateStartVisualization();
4912		}
4913	},
4914
4915	/**
4916  * Handles an event on a pause button
4917  *
4918  * HANDLER FOR: 'amplitude-pause'
4919  *
4920  * @access public
4921  * @TODO Finish commenting and optimize
4922  */
4923	pause: function pause() {
4924		if (!_config2.default.is_touch_moving) {
4925			var pauseButtonSongIndex = this.getAttribute('amplitude-song-index');
4926			var pauseButtonPlaylistIndex = this.getAttribute('amplitude-playlist');
4927
4928			if (pauseButtonSongIndex == null && pauseButtonPlaylistIndex == null) {
4929				_helpers2.default.setSongPlayPause(_config2.default.active_playlist, _c
4929onfig2.default.active_index);
4930				_core2.default.pause();
4931			}
4932
4933			if (pauseButtonPlaylistIndex != null || pauseButtonPlaylistIndex != '' && _config2.default.active_playlist == pauseButtonPlaylistIndex) {
4934				/*
4935    	The song was playing so we sync visually for the song
4936    	to be paused and we pause the song.
4937    */
4938				_visual2.default.syncMainPlayPause('paused');
4939
4940				/*
4941    	If there is an active playlist, then
4942    	we need to sync that playlist's play pause
4943    	button to the state of paused.
4944    */
4945				_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'paused');
4946
4947				/*
4948    	Sync the song play pause buttons
4949    */
4950				_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'paused');
4951
4952				_core2.default.pause();
4953			}
4954
4955			if ((pauseButtonPlaylistIndex == null || pauseButtonPlaylistIndex == '') && pauseButtonSongIndex == _config2.default.active_index) {
4956				/*
4957    	The song was playing so we sync visually for the song
4958    	to be paused and we pause the song.
4959    */
4960				_visual2.default.syncMainPlayPause('paused');
4961
4962				/*
4963    	If there is an active playlist, then
4964    	we need to sync that playlist's play pause
4965    	button to the state of paused.
4966    */
4967				_visual2.default.syncPlaylistPlayPause(_config2.default.active_playlist, 'paused');
4968
4969				/*
4970    	Sync the song play pause buttons
4971    */
4972				_visual2.default.syncSongPlayPause(_config2.default.active_playlist, _config2.default.active_index, 'paused');
4973
4974				_core2.default.pause();
4975			}
4976		}
4977	},
4978
4979	/**
4980  * Handles an event on a play/pause button
4981  *
4982  * HANDLER FOR: 'amplitude-play-pause'
4983  *
4984  * @access public
4985  */
4986	playPause: function playPause() {
4987		if (!_config2.default.is_touch_moving) {
4988			/*
4989   	Checks to see if the element has an attribute for amplitude-main-play-pause
4990   	and syncs accordingly
4991   */
4992			if (this.getAttribute('amplitude-main-play-pause') != null) {
4993				_helpers2.default.setMainPlayPause();
4994
4995				/*
4996    	Syncs playlist main play pause buttons
4997    */
4998			} else if (this.getAttribute('amplitude-playlist-main-play-pause') != null) {
4999				var playlist = this.getAttribute('amplitude-playlist');
5000
5001				_helpers2.default.setPlaylistPlayPause(playlist);
5002
5003				/*
5004    	Syncs amplitude individual song buttons
5005    */
5006			} else {
5007				var _playlist = this.getAttribute('amplitude-playlist');
5008				var songIndex = this.getAttribute('amplitude-song-index');
5009
5010				_helpers2.default.setSongPlayPause(_playlist, songIndex);
5011			}
5012		}
5013	},
5014
5015	/**
5016  * Handles an event on a stop element.
5017  *
5018  * HANDLER FOR: 'amplitude-stop'
5019  *
5020  * @access public
5021  * @TODO: AMP-FX Before stopping, make sure that AmplitudeFX visualization is stopped as well.
5022  */
5023	stop: function stop() {
5024		if (!_config2.default.is_touch_moving) {
5025			/*
5026   	Sets all of the play/pause buttons to pause
5027   */
5028			_visual2.default.setPlayPauseButtonsToPause();
5029
5030			/*
5031   	Stops the active song.
5032   */
5033			_core2.default.stop();
5034		}
5035	},
5036
5037	/**
5038  * Handles an event for a mute element
5039  *
5040  * HANDLER FOR: 'amplitude-mute'
5041  *
5042  * @access public
5043  */
5044	mute: function mute() {
5045		if (!_config2.default.is_touch_moving) {
5046			/*
5047   	If the current volume in the config is 0, we set the volume to the
5048   	pre_mute level.  This means that the audio is already muted and
5049   	needs to be restored to the pre_mute level.
5050   		Otherwise, we set pre_mute volume to the current volume
5051   	and set the config volume to 0, muting the audio.
5052   */
5053			if (_config2.default.volume == 0) {
5054				_config2.default.active_song.muted = false;
5055				_config2.default.volume = _config2.default.pre_mute_volume;
5056				_visual2.default.syncMute(false);
5057			} else {
5058				_config2.default.active_song.muted = true;
5059				_config2.default.pre_mute_volume = _config2.default.volume;
5060				_config2.default.volume = 0;
5061				_visual2.default.syncMute(true);
5062			}
5063
5064			/*
5065   	Calls the core function to set the volume to the computed value
5066   	based on the user's intent.
5067   */
5068			_core2.default.setVolume(_config2.default.volume);
5069
5070			/*
5071   	Syncs the volume sliders so the visuals align up with the functionality.
5072   	If the volume is at 0, then the sliders should represent that so the user
5073   	has the right starting point.
5074   */
5075			_visual2.default.syncVolumeSliders(_config2.default.volume);
5076		}
5077	},
5078
5079	/**
5080  * Handles a click on a volume up element.
5081  *
5082  * HANDLER FOR: 'amplitude-volume-up'
5083  *
5084  * @access public
5085  */
5086	volumeUp: function volumeUp() {
5087		if (!_config2.default.is_touch_moving) {
5088			/*
5089   	The volume range is from 0 to 1 for an audio element. We make this
5090   	a base of 100 for ease of working with.
5091   		If the new value is less than 100, we use the new calculated
5092   	value which gets converted to the proper unit for the audio element.
5093   		If the new value is greater than 100, we set the volume to 1 which
5094   	is the max for the audio element.
5095   */
5096			if (_config2.default.volume + _config2.default.volume_increment <= 100) {
5097				_config2.default.volume = _config2.default.volume + _config2.default.volume_increment;
5098			} else {
5099				_config2.default.volume = 100;
5100			}
5101
5102			/*
5103   	Calls the core function to set the volume to the computed value
5104   	based on the user's intent.
5105   */
5106			_core2.default.setVolume(_config2.default.volume);
5107
5108			/*
5109   	Syncs the volume sliders so the visuals align up with the functionality.
5110   	If the volume is at 0, then the sliders should represent that so the user
5111   	has the right starting point.
5112   */
5113			_visual2.default.syncVolumeSliders(_config2.default.volume);
5114		}
5115	},
5116
5117	/**
5118  * Handles a click on a volume down element.
5119  *
5120  * HANDLER FOR: 'amplitude-volume-down'
5121  *
5122  * @access public
5123  */
5124	volumeDown: function volumeDown() {
5125		if (!_config2.default.is_touch_moving) {
5126			/*
5127   	The volume range is from 0 to 1 for an audio element. We make this
5128   	a base of 100 for ease of working with.
5129   		If the new value is less than 100, we use the new calculated
5130   	value which gets converted to the proper unit for the audio element.
5131   		If the new value is greater than 100, we set the volume to 1 which
5132   	is the max for the audio element.
5133   */
5134			if (_config2.default.volume - _config2.default.volume_increment > 0) {
5135				_config2.default.volume = _config2.default.volume - _config2.default.volume_increment;
5136			} else {
5137				_config2.default.volume = 0;
5138			}
5139
5140			/*
5141   	Calls the core function to set the volume to the computed value
5142   	based on the user's intent.
5143   */
5144			_core2.default.setVolume(_config2.default.volume);
5145
5146			/*
5147   	Syncs the volume sliders so the visuals align up with the functionality.
5148   	If the volume is at 0, then the sliders should represent that so the user
5149   	has the right starting point.
5150   */
5151			_visual2.default.syncVolumeSliders(_config2.default.volume);
5152		}
5153	},
5154
5155	/**
5156  * Handles a change on the song slider
5157  *
5158  * HANDLER FOR: 'amplitude-song-slider'
5159  *
5160  * @access public
5161  */
5162	songSlider: function songSlider() {
5163		/*
5164  	Gets the percentage of the song we will be setting the location for.
5165  */
5166		var locationPercentage = this.value;
5167
5168		/*
5169  	Checks to see if the element has an attribute for amplitude-main-play-pause
5170  	and syncs accordingly
5171  */
5172		if (this.getAttribute('amplitude-main-song-slider') != null) {
5173			/*
5174   	If the active song is not live, set the current time
5175   */
5176			if (!_config2.default.active_metadata.live) {
5177				var currentTime = _config2.default.active_song.duration * (locationPercentage / 100);
5178
5179				if (isFinite(currentTime)) {
5180					_config2.default.active_song.currentTime = currentTime;
5181				}
5182			}
5183
5184			_visual2.default.syncMainSliderLocation(locationPercentage);
5185
5186			if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null) {
5187				_visual2.default.syncPlaylistSliderLocation(_config2.default.active_playlist, locationPercentage);
5188			}
5189		}
5190
5191		/*
5192  	Syncs playlist main play pause buttons
5193  */
5194		if (this.getAttribute('amplitude-playlist-song-slider') != null) {
5195			var playlist = this.getAttribute('amplitude-playlist');
5196
5197			/*
5198   	We don't want to song slide a playlist that's not the
5199   	active placylist.
5200   */
5201			if (_config2.default.active_playlist == playlist) {
5202				/*
5203    	If the active song is not live, set the current time
5204    */
5205				if (!_config2.default.active_metadata.live) {
5206					_config2.default.active_song.currentTime = _config2.default.active_song.duration * (locationPercentage / 100);
5207				}
5208				_visual2.default.syncMainSliderLocation(locationPercentage);
5209				_visual2.default.syncPlaylistSliderLocation(playlist, locationPercentage);
5210			}
5211		}
5212
5213		/*
5214  	Syncs amplitude individual song buttons
5215  */
5216		if (this.getAttribute('amplitude-playlist-song-slider') == null && this.getAttribute('amplitude-main-song-slider') == null) {
5217
5218			var _playlist2 = this.getAttribute('amplitude-playlist');
5219			var songIndex = this.getAttribute('amplitude-song-index');
5220
5221			if (_config2.default.active_index == songIndex) {
5222				/*
5223    	If the active song is not live, set the current time
5224    */
5225				if (!_config2.default.active_metadata.live) {
5226					_config2.default.active_song.currentTime = _config2.default.active_song.duration * (locationPercentage / 100);
5227				}
5228
5229				_visual2.default.syncMainSliderLocation();
5230
5231				if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && _config2.default.active_playlist == _playlist2) {
5232					_visual2.default.syncPlaylistSliderLocation(_playlist2, location);
5233				}
5234
5235				_visual2.default.syncSongSliderLocation(_playlist2, songIndex, location);
5236			}
5237		}
5238	},
5239
5240	/**
5241  * Handles a change on the volume slider
5242  *
5243  * HANDLER FOR: 'amplitude-volume-slider'
5244  *
5245  * @access public
5246  */
5247	volumeSlider: function volumeSlider() {
5248		/*
5249  	Calls the core function to set the volume to the computed value
5250  	based on the user's intent.
5251  */
5252		_core2.default.setVolume(this.value);
5253
5254		/*
5255  	Sync the volume slider locations
5256  */
5257		_visual2.default.syncVolumeSliderLocation(this.value);
5258	},
5259
5260	/**
5261  * Handles an event on the next button
5262  *
5263  * HANDLER FOR: 'amplitude-next'
5264  *
5265  * @access public
5266  */
5267	next: function next() {
5268		if (!_config2.default.is_touch_moving) {
5269			/*
5270   	Checks to see if the button is a playlist next button or
5271   	if it's a global playlist button.
5272   */
5273			if (this.getAttribute('amplitude-playlist') == '' || this.getAttribute('amplitude-playlist') == null) {
5274
5275				/*
5276    	Check to see if the current state of the player
5277    	is in playlist mode or not playlist mode.
5278    */
5279				if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
5280					_helpers2.default.setNext();
5281				} else {
5282					_helpers2.default.setNextPlaylist(_config2.default.active_playlist);
5283				}
5284			} else {
5285				/*
5286    	Gets the playlist of the next button.
5287    */
5288				var playlist = this.getAttribute('amplitude-playlist');
5289
5290				/*
5291    	Sets the next playlist
5292    */
5293				_helpers2.default.setNextPlaylist(playlist);
5294			}
5295		}
5296	},
5297
5298	/**
5299  * Handles an event on the previous button
5300  *
5301  * HANDLER FOR: 'amplitude-prev'
5302  *
5303  * @access public
5304  */
5305	prev: function prev() {
5306		if (!_config2.default.is_touch_moving) {
5307			/*
5308   	Checks to see if the previous button is a playlist previous
5309   	button or if it's a global playlist button.
5310   */
5311			if (this.getAttribute('amplitude-playlist') == '' || this.getAttribute('amplitude-playlist') == null) {
5312
5313				/*
5314    	Check to see if the current playlist has been set
5315    	or null and set the previous song.
5316    */
5317				if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null) {
5318					_helpers2.default.setPrev();
5319				} else {
5320					_helpers2.default.setPrevPlaylist(_config2.default.active_playlist);
5321				}
5322			} else {
5323				/*
5324    	Gets the playlist of the previous button.
5325    */
5326				var playlist = this.getAttribute('amplitude-playlist');
5327
5328				/*
5329    	Sets the previous playlist
5330    */
5331				_helpers2.default.setPrevPlaylist(playlist);
5332			}
5333		}
5334	},
5335
5336	/**
5337  * Handles an event on the shuffle button
5338  *
5339  * HANDLER FOR: 'amplitude-shuffle'
5340  *
5341  * @access public
5342  */
5343	shuffle: function shuffle() {
5344		if (!_config2.default.is_touch_moving) {
5345			/*
5346   	Check to see if the shuffle button belongs to a playlist
5347   */
5348			if (this.getAttribute('amplitude-playlist') == '' || this.getAttribute('amplitude-playlist') == null) {
5349				/*
5350    	Sets the shuffle button to null
5351    */
5352				_helpers2.default.setShuffle(null);
5353			} else {
5354				/*
5355    	Gets the playlist attribute of the shuffle button and
5356    	set shuffle to on for the playlist.
5357    */
5358				var playlist = this.getAttribute('amplitude-playlist');
5359				_helpers2.default.setShuffle(playlist);
5360			}
5361		}
5362	},
5363
5364	/**
5365  * Handles an event on the repeat button
5366  *
5367  * HANDLER FOR: 'amplitude-repeat'
5368  *
5369  * @access private
5370  */
5371	repeat: function repeat() {
5372		if (!_config2.default.is_touch_moving) {
5373			/*
5374   	Check to see if the repeat button belongs to a playlist
5375   */
5376			if (this.getAttribute('amplitude-playlist') == '' || this.getAttribute('amplitude-playlist') == null) {
5377				/*
5378    	Sets repeat to the opposite of what it was set to
5379    */
5380				_helpers2.default.setRepeat(!_config2.default.repeat, null);
5381			} else {
5382				/*
5383    	Gets the playlist attribute of the repeat button and
5384    	set repeat to on for the playlist.
5385    */
5386				var playlist = this.getAttribute('amplitude-playlist');
5387				_helpers2.default.setRepeat(!_config2.default.repeat_statuses[playlist], playlist);
5388			}
5389		}
5390	},
5391
5392	/**
5393  * Handles an event on the repeat song button
5394  *
5395  * HANDLER FOR: 'amplitude-repeat-song'
5396  *
5397  * @access private
5398  */
5399	repeatSong: function repeatSong() {
5400		if (!_config2.default.is_touch_moving) {
5401			/*
5402   	Sets repeat song to the opposite of what it was set to
5403   */
5404			_helpers2.default.setRepeatSong(!_config2.default.repeat_song);
5405
5406			/*
5407   	Visually sync repeat song
5408   */
5409			_visual2.default.syncRepeatSong();
5410		}
5411	},
5412
5413	/**
5414  * Handles an event on the playback speed button
5415  *
5416  * HANDLER FOR: 'amplitude-playback-speed'
5417  *
5418  * @access private
5419  */
5420	playbackSpeed: function playbackSpeed() {
5421		if (!_config2.default.is_touch_moving) {
5422			/*
5423   	We increment the speed by .5 everytime we click
5424   	the button to change the playback speed. Once we are
5425   	actively playing back at 2, we start back at 1 which
5426   	is normal speed.
5427   */
5428			switch (_config2.default.playback_speed) {
5429				case 1:
5430					_helpers2.default.setPlaybackSpeed(1.5);
5431					break;
5432				case 1.5:
5433					_helpers2.default.setPlaybackSpeed(2);
5434					break;
5435				case 2:
5436					_helpers2.default.setPlaybackSpeed(1);
5437					break;
5438			}
5439
5440			/*
5441   	Visually sync the playback speed.
5442   */
5443			_visual2.default.syncPlaybackSpeed();
5444		}
5445	},
5446
5447	/**
5448  * Handles an event on a skip to button.
5449  *
5450  * HANDLER FOR: 'amplitude-skip-to'
5451  *
5452  * @access private
5453  */
5454	skipTo: function skipTo() {
5455		if (!_config2.default.is_touch_moving) {
5456			/*
5457   	Determines if the skip to button is in the scope of a playlist.
5458   */
5459			if (this.hasAttribute('amplitude-playlist')) {
5460				var playlist = this.getAttribute('amplitude-playlist');
5461
5462				if (_helpers4.default.checkNewPlaylist(playlist)) {
5463					_helpers4.default.setActivePlaylist(playlist);
5464				}
5465				/*
5466    	Gets the location, playlist and song index that is being skipped
5467    	to.
5468    */
5469				var seconds = parseInt(this.getAttribute('amplitude-location'));
5470				var songIndex = parseInt(this.getAttribute('amplitude-song-index'));
5471
5472				/*
5473    	Changes the song to where it's being skipped and then
5474    	play the song.
5475    */
5476				_helpers4.default.changeSong(songIndex);
5477				_core2.default.play();
5478
5479				_visual2.default.syncMainPlayPause('playing');
5480				_visual2.default.syncPlaylistPlayPause(playlist, 'playing');
5481				_visual2.default.syncSongPlayPause(playlist, songIndex, 'playing');
5482
5483				/*
5484    	Skip to the location in the song.
5485    */
5486				_core2.default.skipToLocation(seconds);
5487			} else {
5488				/*
5489    	Gets the location and song index that is being skipped
5490    	to.
5491    */
5492				var _seconds = parseInt(this.getAttribute('amplitude-location'));
5493				var _songIndex = parseInt(this.getAttribute('amplitude-song-index'));
5494
5495				/*
5496    	Changes the song to where it's being skipped and then
5497    	play the song.
5498    */
5499				_helpers4.default.changeSong(_songIndex);
5500				_core2.default.play();
5501
5502				_visual2.default.syncMainPlayPause('playing');
5503				_visual2.default.syncSongPlayPause(null, _songIndex, 'playing');
5504
5505				/*
5506    	Skip to the location in the song.
5507    */
5508				_core2.default.skipToLocation(_seconds);
5509			}
5510		}
5511	}
5512};
5513
5514/**
5515 * Imports the core helpers for Amplitude which help run some of AmplitudeJS functions
5516 * @module core/AmplitudeHelpers
5517 */
5518
5519
5520/**
5521 * Imports the visual sync module to keep the display in sync with AmplitudeJS
5522 * @module visual/AmplitudeVisualSync
5523 */
5524/**
5525 * Imports the config module
5526 * @module config
5527 */
5528
5529module.exports = exports['default'];
5530
5531/***/ }),
5532/* 8 */
5533/***/ (function(module, exports, __webpack_require__) {
5534
5535"use strict";
5536
5537
5538Object.defineProperty(exports, "__esModule", {
5539	value: true
5540});
5541
5542var _init = __webpack_require__(6);
5543
5544var _init2 = _interopRequireDefault(_init);
5545
5546var _core = __webpack_require__(3);
5547
5548var _core2 = _interopRequireDefault(_core);
5549
5550var _helpers = __webpack_require__(1);
5551
5552var _helpers2 = _interopRequireDefault(_helpers);
5553
5554var _events = __webpack_require__(4);
5555
5556var _events2 = _interopRequireDefault(_events);
5557
5558var _helpers3 = __webpack_require__(5);
5559
5560var _helpers4 = _interopRequireDefault(_helpers3);
5561
5562var _visual = __webpack_require__(2);
5563
5564var _visual2 = _interopRequireDefault(_visual);
5565
5566var _config = __webpack_require__(0);
5567
5568var _config2 = _interopRequireDefault(_config);
5569
5570function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5571
5572/**
5573 * Amplitude should just be an interface to the public functions.
5574 * Everything else should be handled by other objects
5575 *
5576 * @module Amplitude
5577 */
5578
5579/**
5580 * AmplitudeJS Visual Sync Module
5581 *
5582 * @module visual/AmplitudeVisualSync
5583 */
5584
5585
5586/**
5587 * AmplitudeJS Events Module
5588 *
5589 * @module events/AmplitudeEvents
5590 */
5591
5592
5593/**
5594 * AmplitudeJS Core Module
5595 *
5596 * @module core/AmplitudeCore
5597 */
5598var Amplitude = function () {
5599	/**
5600  * The main init function.  The user will call this through
5601  * Amplitude.init({}) and pass in their settings.
5602  *
5603  * Public Accessor: Amplitude.init( user_config_json );
5604  *
5605  * @access public
5606  * @param {object} userConfig 	- A JSON object of user defined values that helps configure and initialize AmplitudeJS.
5607  */
5608	function init(userConfig) {
5609		_init2.default.initialize(userConfig);
5610	}
5611
5612	/**
5613  * Binds new elements that were added to the page.
5614  *
5615  * Public Accessor: Amplitude.bindNewElements()
5616  *
5617  * @access public
5618  */
5619	function bindNewElements() {
5620		_init2.default.rebindDisplay();
5621	}
5622
5623	/**
5624  * Returns the active playlist.
5625  *
5626  * Public Accessor: Amplitude.getActivePlaylist()
5627  *
5628  * @access public
5629  */
5630	function getActivePlaylist() {
5631		return _config2.default.active_playlist;
5632	}
5633
5634	/**
5635  * Returns the current playback speed.
5636  *
5637  * Public Accessor: Amplitude.getPlaybackSpeed()
5638  *
5639  * @access public
5640  */
5641	function getPlaybackSpeed() {
5642		return _config2.default.playback_speed;
5643	}
5644
5645	/**
5646  * Gets the repeat state of the player.
5647  *
5648  * Public Accessor: Amplitude.getRepeat()
5649  *
5650  * @access public
5651  */
5652	function getRepeat() {
5653		return _config2.default.repeat;
5654	}
5655
5656	/**
5657  * Gets the repeat state for a playlist
5658  *
5659  * Public Accessor: Amplitude.getRepeatPlaylist()
5660  *
5661  * @access public
5662  */
5663	function getRepeatPlaylist(playlistKey) {
5664		return _config2.default.repeat_statuses[playlistKey];
5665	}
5666
5667	/**
5668  * Returns the shuffle state of the player.
5669  *
5670  * Public Accessor: Amplitude.getShuffle()
5671  *
5672  * @access public
5673  */
5674	function getShuffle() {
5675		return _config2.default.shuffle_on;
5676	}
5677
5678	/**
5679  * Returns the shuffle state of the playlist.
5680  *
5681  * Public Accessor: Amplitude.getShufflePlaylist( playlist )
5682  *
5683  * @access public
5684  * @param {string} playlist 	- The key representing the playlist ID to see if it's shuffled or not.
5685  */
5686	function getShufflePlaylist(playlist) {
5687		return _config2.default.shuffled_statuses[playlist];
5688	}
5689
5690	/**
5691  * Sets the shuffle state for the player.
5692  *
5693  * Public Accessor: Amplitude.setShuffle()
5694  *
5695  * @access public
5696  */
5697	function setShuffle() {
5698		_helpers4.default.setShuffle(null);
5699	}
5700
5701	/**
5702  * Sets the shuffle state for the playlist
5703  *
5704  * Public Accessor: Amplitude.setShufflePlaylist( playlistKey )
5705  *
5706  * @access public
5707 * @param {string} playlistKey 	- The key representing the playlist ID to to shuffle the playlist.
5708  */
5709	function setShufflePlaylist(playlistKey) {
5710		_helpers4.default.setShuffle(playlistKey);
5711	}
5712
5713	/**
5714 * Sets the repeat state for the player.
5715 *
5716 * Public Accessor: Amplitude.setRepeat()
5717 *
5718 * @access public
5719 */
5720	function setRepeat() {
5721		if (!_config2.default.is_touch_moving) {
5722			/*
5723   	Sets repeat to the opposite of what it was set to
5724   */
5725			_helpers4.default.setRepeat(!_config2.default.repeat);
5726
5727			/*
5728   	Visually sync repeat
5729   */
5730			_visual2.default.syncRepeat();
5731		}
5732	}
5733
vendor: 5,623 bytes, lines 5734-5946
5734	/**
5735  * Sets the repeat state for a playlist.
5736  *
5737  * Public Accessor: Amplitude.setRepeatPlaylist( playlistKey )
5738  *
5739  * @access public
5740  * @param {string} playlistKey 	- The key representing the playlist ID to to shuffle the playlist.
5741  */
5742	function setRepeatPlaylist(playlistKey) {
5743		if (!_config2.default.is_touch_moving) {
5744			/*
5745   	Sets repeat for the playlist to the opposite of what it was set to.
5746   */
5747			_helpers4.default.setRepeat(!_config2.default.repeat_statuses[playlistKey], playlistKey);
5748		}
5749	}
5750
5751	/**
5752  * Sets the repeat state for the song.
5753  *
5754  * Public Accessor: Amplitude.setRepeatSong()
5755  *
5756  * @access public
5757  */
5758	function setRepeatSong() {
5759		if (!_config2.default.is_touch_moving) {
5760			/*
5761    Sets repeat to the opposite of what it was set to
5762   */
5763			_helpers4.default.setRepeatSong(!_config2.default.repeat_song);
5764
5765			/*
5766    Visually sync repeat song
5767   */
5768			_visual2.default.syncRepeatSong();
5769		}
5770	}
5771
5772	/**
5773  * Gets the default album art for the player
5774  *
5775  * Public Accessor: Amplitude.getDefaultAlbumArt()
5776  *
5777  * @access public
5778  */
5779	function getDefaultAlbumArt() {
5780		return _config2.default.default_album_art;
5781	}
5782
5783	/**
5784  * Sets the default album art for the player
5785  *
5786  * Public Accessor: Amplitude.setDefaultAlbumArt( url )
5787  *
5788  * @access public
5789  * @param {string} url 	- A string representing the URL of the new default album art.
5790  */
5791	function setDefaultAlbumArt(url) {
5792		_config2.default.default_album_art = url;
5793	}
5794
5795	/**
5796  * Allows the user to get the percentage of the song played.
5797  *
5798  * Public Accessor: Amplitude.getSongPlayedPercentage();
5799  *
5800  * @access public
5801  */
5802	function getSongPlayedPercentage() {
5803		/*
5804  	Returns the percentage of the song played.
5805  */
5806		return _config2.default.active_song.currentTime / _config2.default.active_song.duration * 100;
5807	}
5808
5809	/**
5810  * Allows the user to get the amount of seconds the song has played.
5811  *
5812  * Public Accessor: Amplitude.getSongPlayed();
5813  *
5814  * @access public
5815  */
5816	function getSongPlayedSeconds() {
5817		/*
5818  	Returns the amount of seconds the song has played.
5819  */
5820		return _config2.default.active_song.currentTime;
5821	}
5822
5823	/**
5824  * Allows the user to get the duration of the current song
5825  *
5826  * Public Accessor: Amplitude.getSongPlayed();
5827  *
5828  * @access public
5829  */
5830	function getSongDuration() {
5831		/*
5832  	Returns the duration of the current song
5833  */
5834		return _config2.default.active_song.duration;
5835	}
5836
5837	/**
5838  * Allows the user to set how far into the song they want to be. This is
5839  * helpful for implementing custom range sliders. Only works on the current song.
5840  *
5841  * Public Accessor: Amplitude.setSongPlayedPercentage( float );
5842  *
5843  * @access public
5844  * @param {number} percentage 	- The percentage of the song played
5845  */
5846	function setSongPlayedPercentage(percentage) {
5847		/*
5848  	Ensures the percentage is a number and is between 0 and 100.
5849  */
5850		if (typeof percentage == 'number' && percentage > 0 && percentage < 100) {
5851			/*
5852   	Sets the current time of the song to the percentage.
5853   */
5854			_config2.default.active_song.currentTime = _config2.default.active_song.duration * (percentage / 100);
5855		}
5856	}
5857
5858	/**
5859  * Allows the user to turn on debugging.
5860  *
5861  * Public Accessor: Amplitude.setDebug( bool );
5862  *
5863  * @access public
5864  * @param {boolean} state 		- Turns debugging on and off.
5865  */
5866	function setDebug(state) {
5867		/*
5868  	Sets the global config debug on or off.
5869  */
5870		_config2.default.debug = state;
5871	}
5872
5873	/**
5874  * Returns the active song meta data for the user to do what is
5875  * needed.
5876  *
5877  * Public Accessor: Amplitude.getActiveSongMetadata();
5878  *
5879  * @access public
5880  * @returns {object} JSON Object with the active song information
5881  */
5882	function getActiveSongMetadata() {
5883		return _config2.default.active_metadata;
5884	}
5885
5886	/**
5887  * Returns a song in the songs array at that index
5888  *
5889  * Public Accessor: Amplitude.getSongByIndex( song_index )
5890  *
5891  * @access public
5892  * @param {number} index 	- The integer for the index of the song in the songs array.
5893  * @returns {object} JSON representation for the song at a specific index.
5894  */
5895	function getSongByIndex(index) {
5896		return _config2.default.songs[index];
5897	}
5898
5899	/**
5900  * Returns a song at a playlist index
5901  *
5902  * Public Accessor: Amplitude.getSongAtPlaylistIndex( playlist, index
5903  *
5904  * @access public
5905  * @param {number} index 			- The integer for the index of the song in the playlist.
5906  * @param {string} playlist		- The key of the playlist we are getting the song at the index for
5907  * @returns {object} JSON representation for the song at a specific index.
5908  */
5909	function getSongAtPlaylistIndex(playlist, index) {
5910		var songIndex = _config2.default.playlists[playlist][index];
5911
5912		return _config2.default.songs[songIndex];
5913	}
5914
5915	/**
5916  * Adds a song to the end of the config array.  This will allow Amplitude
5917  * to play the song in a playlist type setting.
5918  *
5919  * Public Accessor: Amplitude.addSong( song_json )
5920  *
5921  * @access public
5922  * @param {object} song 	- JSON representation of a song.
5923  * @returns {number} New index of the song.
5924  */
5925	function addSong(song) {
5926		/*
5927  	Ensures we have a songs array to push to.
5928  */
5929		if (_config2.default.songs == undefined) {
5930			_config2.default.songs = [];
5931		}
5932
5933		_config2.default.songs.push(song);
5934		_helpers4.default.setNext();
5935		return _config2.default.songs.length - 1;
5936	}
5937
5938	/**
5939  * Adds a song to a playlist. This will allow Amplitude to play the song in the
5940  * playlist
5941  *
5942  * Public Accessor: Amplitude.addSongToPlaylist( song_json, playlist_key )
5943  *
5944  * @access public
5945  * @param {object} song 			- JSON representation of a song.
5946  * @param {string} playlist		- Playlist we are adding the song to.
5947  * @returns {mixed} New index of song in playlist or null if no playlist exists
5948  */
5949	function addSongToPlaylist(song, playlist) {
5950		/*
5951  	Ensures we have a songs array to push to. This is step 1.
5952  */
5953		if (_config2.default.songs == undefined) {
5954			_config2.default.songs = [];
5955		}
5956
5957		_config2.default.songs.push(song);
5958
5959		var songIndex = _config2.default.songs.length - 1;
5960
5961		/*
5962  	Ensures the playlist is valid to push the song on to.
5963  */
5964		if (_config2.default.playlists[playlist] != undefined) {
5965			_config2.default.playlists[playlist].push(songIndex);
5966
5967			_helpers4.default.setNextPlaylist(playlist);
5968
5969			return _config2.default.playlists[playlist].length - 1;
5970		} else {
5971			return null;
5972		}
5973	}
5974
5975	/**
5976  * Removes a song from the song array
5977  *
5978  * Public Accessor: Amplitude.removeSong( index )
5979  *
5980  * @access public
5981  * @param {integer} index 			- Index of the song being removed
5982  * @returns {boolean} True if removed false if not.
5983  */
5984	function removeSong(index) {
5985		if (_config2.default.songs[index] != undefined) {
5986			_config2.default.songs.splice(index, 1);
5987			return true;
5988		} else {
5989			return false;
5990		}
5991	}
5992
5993	/**
5994  * Removes a song from the playlist
5995  *
5996  * Public Accessor: Amplitude.removeSongFromPlaylist( index, playlist )
5997  *
5998  * @access public
5999  * @param {integer} index 			- Index of the song being removed from the playlist.
6000  * @param {string} playlist			- Playlist we are removing the song from.
6001  * @returns {boolean} True if removed false if not.
6002  */
6003	function removeSongFromPlaylist(index, playlist) {
6004		if (_config2.default.playlists[playlist] != undefined) {
6005			_config2.default.playlists[playlist].splice(index, 1);
6006		} else {
6007			return false;
6008		}
6009	}
6010
6011	/**
6012  * When you pass a song object it plays that song right awawy.  It sets
6013  * the active song in the config to the song you pass in and synchronizes
6014  * the visuals.
6015  *
6016  * Public Accessor: Amplitude.playNow( song )
6017  *
6018  * @access public
6019  * @param {object} song 	- JSON representation of a song.
6020  */
6021	function playNow(song) {
6022		_core2.default.playNow(song);
6023	}
6024
6025	/**
6026  * Plays a song at the index passed in from the songs array.
6027  *
6028  * Public Accessor: Amplitude.playSongAtIndex( index )
6029  *
6030  * @access public
6031  * @param {number} index 	- The number representing the song in the songs array.
6032  */
6033	function playSongAtIndex(index) {
6034		_core2.default.playSongAtIndex(index);
6035	}
6036
6037	/**
6038  * Plays a song at the index passed in for the playlist provided. The index passed
6039  * in should be the index of the song in the playlist and not the songs array.
6040  *
6041  * @access public
6042  * @param {number} index 		- The number representing the song in the playlist array.
6043  * @param {string} playlist - The key string representing the playlist we are playing the song from.
6044  *
6045  */
6046	function playPlaylistSongAtIndex(index, playlist) {
6047		_core2.default.playPlaylistSongAtIndex(index, playlist);
6048	}
6049
6050	/**
6051  * @TODO: Implement Add Song To Playlist Functionality
6052  */
6053	function addSongToPlaylist(song, playlist) {}
6054
6055	/**
6056  * Allows the user to play whatever the active song is directly
6057  * through Javascript. Normally ALL of Amplitude functions that access
6058  * the core features are called through event handlers.
6059  *
6060  * Public Accessor: Amplitude.play();
6061  *
6062  * @access public
6063  */
6064	function play() {
6065		_core2.default.play();
6066	}
6067
6068	/**
6069  * Allows the user to pause whatever the active song is directly
6070  * through Javascript. Normally ALL of Amplitude functions that access
6071  * the core features are called through event handlers.
6072  *
6073  * Public Accessor: Amplitude.pause();
6074  *
6075  * @access public
6076  */
6077	function pause() {
6078		_core2.default.pause();
6079	}
6080
6081	/**
6082  * Returns the audio object used to play the audio
6083  *
6084  * Public Accessor: Amplitude.getAudio();
6085  *
6086  * @access public
6087  */
6088	function getAudio() {
6089		return _config2.default.active_song;
6090	}
6091
6092	/**
6093  * Plays the next song either in the playlist or globally.
6094  *
6095  * Public Accessor: Amplitude.next( playlist );
6096  *
6097  * @access public
6098  * @param {string} [playlist = null] 	- The playlist key
6099  */
6100	function next() {
6101		var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
6102
6103		/*
6104  	If the playlist is empty or null, then we check the active
6105  	playlist
6106  */
6107		if (playlist == '' || playlist == null) {
6108			/*
6109   	If the active playlist is null, then we set the next global
6110   	song or we set the next in the playlist.
6111   */
6112			if (_config2.default.active_playlist == null || _config2.default.active_playlist == '') {
6113				_helpers4.default.setNext();
6114			} else {
6115				_helpers4.default.setNextPlaylist(_config2.default.active_playlist);
6116			}
6117		} else {
6118			/*
6119   	Set the next in the playlist for the key provided.
6120   */
6121			_helpers4.default.setNextPlaylist(playlist);
6122		}
6123	}
6124
6125	/**
6126  * Plays the prev song either in the playlist or globally.
6127  *
6128  * Public Accessor: Amplitude.prev( playlist );
6129  *
6130  * @access public
6131  * @param {string} [playlist = null] 	- The playlist key
6132  */
6133	function prev() {
6134		var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
6135
6136		/*
6137  	If the playlist is empty or null, then we check the active
6138  	playlist
6139  */
6140		if (playlist == '' || playlist == null) {
6141			/*
6142   	If the active playlist is null, then we set the prev global
6143   	song or we set the prev in the playlist.
6144   */
6145			if (_config2.default.active_playlist == null || _config2.default.active_playlist == '') {
6146				_helpers4.default.setPrev();
6147			} else {
6148				_helpers4.default.setPrevPlaylist(_config2.default.active_playlist);
6149			}
6150		} else {
6151			/*
6152   	Set the prev in the playlist for the key provided.
6153   */
6154			_helpers4.default.setPrevPlaylist(playlist);
6155		}
6156	}
6157
6158	/**
6159  * Gets all of the songs in the songs array
6160  *
6161  * Public Accessor: Amplitude.getSongs( );
6162  *
6163  * @access public
6164  */
6165	function getSongs() {
6166		return _config2.default.songs;
6167	}
6168
6169	/**
6170  * Gets all of the songs in a playlist
6171  *
6172  * Public Accessor: Amplitude.getSongsInPlaylist( playlist );
6173  *
6174  * @access public
6175  * @param {string} playlist 	- The playlist key
6176  */
6177	function getSongsInPlaylist(playlist) {
6178		var songsArray = [];
6179
6180		for (var i = 0; i < _config2.default.playlists[playlist].length; i++) {
6181			var songIndex = _config2.default.playlists[playlist][i];
6182			songsArray.push(_config2.default.songs[songIndex]);
6183		}
6184
6185		return songsArray;
6186	}
6187
6188	/**
6189  * Get current state of songs. If shuffled, this will return the shuffled
6190  * songs.
6191  *
6192  * Public Accessor: Amplitude.getSongsState();
6193  *
6194  * @access public
6195  */
6196	function getSongsState() {
6197		if (_config2.default.shuffle_on) {
6198			return _config2.default.shuffle_list;
6199		} else {
6200			return _config2.default.songs;
6201		}
6202	}
6203
6204	/**
6205  * Get current state of songs in playlist. If shuffled, this will return the
6206  * shuffled songs.
6207  *
6208  * Public Accessor: Amplitude.getSongsStatePlaylist( playlist );
6209  *
6210  * @access public
6211  * @param {string} playlist 	- The playlist key
6212  * @todo Finish commenting
6213  */
6214	function getSongsStatePlaylist(playlist) {
6215		var songsArray = [];
6216
6217		if (_config2.default.shuffled_status[playlist]) {
6218
6219			for (var i = 0; i < _config2.default.shuffled_playlists[playlist].length; i++) {
6220				songsArray.push(_config2.default.songs[i]);
6221			}
6222		} else {
6223
6224			for (var _i = 0; _i < _config2.default.playlists[playlist].length; _i++) {
6225				songsArray.push(_config2.default.songs[_i]);
6226			}
6227		}
6228
6229		return songsArray;
6230	}
6231
6232	/**
6233  * Gets the active index of the player
6234  *
6235  * Public Accessor: Amplitude.getActiveIndex()
6236  *
6237  * @access public
6238  */
6239	function getActiveIndex() {
6240		return parseInt(_config2.default.active_index);
6241	}
6242
6243	/**
6244  * Gets the active index with respect to the state of the player whether it is
6245  * shuffled or not.
6246  *
6247  * Public Accessor: Amplitude.getActiveIndexState()
6248  *
6249  * @access public
6250  */
6251	function getActiveIndexState() {
6252		if (_config2.default.shuffle_on) {
6253			return parseInt(_config2.default.shuffle_active_index);
6254		} else {
6255			return parseInt(_config2.default.active_index);
6256		}
6257	}
6258
6259	/**
6260  * Get the version of AmplitudeJS
6261  *
6262  * Public Accessor: Amplitude.getVersion()
6263  *
6264  * @access public
6265  */
6266	function getVersion() {
6267		return _config2.default.version;
6268	}
6269
6270	/**
6271  * Get the buffered amount for the current song
6272  *
6273  * Public Accessor: Amplitude.getBuffered()
6274  *
6275  * @access public
6276  */
6277	function getBuffered() {
6278		return _config2.default.buffered;
6279	}
6280
6281	/**
6282  * Skip to a certain location in a selected song.
6283  *
6284  * Public Accessor: Amplitude.getBuffered()
6285  *
6286  * @access public
6287  * @param {number} seconds 						- The amount of seconds we should skip to in the song.
6288  * @param {number} songIndex 					- The index of the song in the songs array.
6289  * @param {string} [playlist = null]	- The playlist the song we are skipping to belogns to.
6290  */
6291	function skipTo(seconds, songIndex) {
6292		var playlist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6293
6294		if (playlist != null) {
6295			if (_helpers2.default.checkNewPlaylist(playlist)) {
6296				_helpers2.default.setActivePlaylist(playlist);
6297			}
6298		}
6299
6300		seconds = parseInt(seconds);
6301
6302		/*
6303  	Changes the song to where it's being skipped and then
6304  	play the song.
6305  */
6306		_helpers2.default.changeSong(songIndex);
6307		_core2.default.play();
6308
6309		_visual2.default.syncMainPlayPause('playing');
6310
6311		if (playlist != null) {
6312			_visual2.default.syncPlaylistPlayPause(playlist, 'playing');
6313		}
6314
6315		_visual2.default.syncSongPlayPause(playlist, songIndex, 'playing');
6316
6317		/*
6318  	Skip to the location in the song.
6319  */
6320		_core2.default.skipToLocation(seconds);
6321	}
6322
6323	/**
6324  * Sets the meta data for a song in the songs array. This will set any
6325  * meta data for a song besides the URL. The URL could cause issues if the
6326  * song was playing.
6327  *
6328  * Public Accessor: Amplitude.setMetaData()
6329  *
6330  * @access public
6331  * @param {number} index					- The index of the song in the songs array.
6332  * @param {object}
vendor: 6,017 bytes, lines 6332-6575
6332 metaData 			- The object containing the meta data we are updating.
6333  */
6334	function setMetaData(index, metaData) {
6335		for (var key in metaData) {
6336			if (metaData.hasOwnProperty(key)) {
6337				if (key != 'url' && key != 'URL') {
6338					_config2.default.songs[index][key] = metaData[key];
6339				}
6340			}
6341		}
6342
6343		_visual2.default.displaySongMetadata();
6344	}
6345
6346	/**
6347  * Sets the delay between the songs when they are finished.
6348 *
6349 * Public Accessor: Amplitude.setDelay()
6350 *
6351 * @access public
6352 * @param {number} delay 	- The millisecond delay time between songs
6353  */
6354	function setDelay(time) {
6355		_config2.default.delay = time;
6356	}
6357
6358	/*
6359 	Returns all of the publically accesible methods.
6360 */
6361	return {
6362		init: init,
6363		bindNewElements: bindNewElements,
6364		getActivePlaylist: getActivePlaylist,
6365		getPlaybackSpeed: getPlaybackSpeed,
6366		getRepeat: getRepeat,
6367		getRepeatPlaylist: getRepeatPlaylist,
6368		getShuffle: getShuffle,
6369		getShufflePlaylist: getShufflePlaylist,
6370		setShuffle: setShuffle,
6371		setShufflePlaylist: setShufflePlaylist,
6372		setRepeat: setRepeat,
6373		setRepeatSong: setRepeatSong,
6374		setRepeatPlaylist: setRepeatPlaylist,
6375		getDefaultAlbumArt: getDefaultAlbumArt,
6376		setDefaultAlbumArt: setDefaultAlbumArt,
6377		getSongPlayedPercentage: getSongPlayedPercentage,
6378		setSongPlayedPercentage: setSongPlayedPercentage,
6379		getSongPlayedSeconds: getSongPlayedSeconds,
6380		getSongDuration: getSongDuration,
6381		setDebug: setDebug,
6382		getActiveSongMetadata: getActiveSongMetadata,
6383		getSongByIndex: getSongByIndex,
6384		getSongAtPlaylistIndex: getSongAtPlaylistIndex,
6385		addSong: addSong,
6386		addSongToPlaylist: addSongToPlaylist,
6387		removeSong: removeSong,
6388		removeSongFromPlaylist: removeSongFromPlaylist,
6389		playNow: playNow,
6390		playSongAtIndex: playSongAtIndex,
6391		playPlaylistSongAtIndex: playPlaylistSongAtIndex,
6392		play: play,
6393		pause: pause,
6394		audio: getAudio,
6395		next: next,
6396		prev: prev,
6397		getSongs: getSongs,
6398		getSongsInPlaylist: getSongsInPlaylist,
6399		getSongsState: getSongsState,
6400		getSongsStatePlaylist: getSongsStatePlaylist,
6401		getActiveIndex: getActiveIndex,
6402		getActiveIndexState: getActiveIndexState,
6403		getVersion: getVersion,
6404		getBuffered: getBuffered,
6405		skipTo: skipTo,
6406		setMetaData: setMetaData,
6407		setDelay: setDelay
6408	};
6409}();
6410
6411/**
6412 * Imports the config module
6413 * @module config
6414 */
6415
6416
6417/**
6418 * AmplitudeJS Events Helpers Module
6419 *
6420 * @module events/AmplitudeEventsHelpers
6421 */
6422
6423
6424/**
6425 * AmplitudeJS Core Helpers Module
6426 *
6427 * @module core/AmplitudeCoreHelpers
6428 */
6429/**
6430 * @name 		Amplitude.js
6431 * @version 3.3.1
6432 * @author 	Dan Pastori (521 Dimensions) <[email protected]>
6433*/
6434
6435/**
6436 * AmplitudeJS Initializer Module
6437 *
6438 * @module init/AmplitudeInitializer
6439 */
6440exports.default = Amplitude;
6441module.exports = exports['default'];
6442
6443/***/ }),
6444/* 9 */
6445/***/ (function(module, exports, __webpack_require__) {
6446
6447"use strict";
6448
6449
6450Object.defineProperty(exports, "__esModule", {
6451	value: true
6452});
6453
6454var _config = __webpack_require__(0);
6455
6456var _config2 = _interopRequireDefault(_config);
6457
6458var _helpers = __webpack_require__(1);
6459
6460var _helpers2 = _interopRequireDefault(_helpers);
6461
6462var _init = __webpack_require__(6);
6463
6464var _init2 = _interopRequireDefault(_init);
6465
6466function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6467
6468/**
6469 * These helpers wrap around the basic methods of the Soundcloud API
6470 * and get the information we need from SoundCloud to make the songs
6471 * streamable through Amplitude
6472 *
6473 * @module soundcloud/AmplitudeSoundcloud
6474 */
6475
6476
6477/**
6478 * Imports the helper functions for the core module
6479 * @module core/AmplitudeHelers
6480 */
6481var AmplitudeSoundcloud = function () {
6482
6483	/**
6484  * Defines the temporary user config used while we configure soundcloud
6485  * @type {object}
6486  */
6487	var tempUserConfig = {};
6488
6489	/**
6490  * Loads the soundcloud SDK for use with Amplitude so the user doesn't have
6491  * to load it themselves.
6492  * With help from: http://stackoverflow.com/questions/950087/include-a-javascript-file-in-another-javascript-file
6493  *
6494  * @access public
6495  * @param {object} userConfig 	- The config defined by the user for AmplitudeJS
6496  */
6497	function loadSoundCloud(userConfig) {
6498		/*
6499  	Sets the temporary config to the config passed by the user so we can make changes
6500  	and not break the actual config.
6501  */
6502		tempUserConfig = userConfig;
6503
6504		/*
6505  	Gets the head tag for the document and create a script element.
6506  */
6507		var head = document.getElementsByTagName('head')[0];
6508		var script = document.createElement('script');
6509
6510		script.type = 'text/javascript';
6511
6512		/*
6513  	URL to the remote soundcloud SDK
6514  */
6515		script.src = 'https://connect.soundcloud.com/sdk.js';
6516		script.onreadystatechange = initSoundcloud;
6517		script.onload = initSoundcloud;
6518
6519		/*
6520  	Add the script to the head of the document.
6521  */
6522		head.appendChild(script);
6523	}
6524
6525	/**
6526  * Initializes soundcloud with the key provided.
6527  *
6528  * @access private
6529  */
6530	function initSoundcloud() {
6531		/*
6532  	Calls the SoundCloud initialize function
6533  	from their API and sends it the client_id
6534  	that the user passed in.
6535  */
6536		SC.initialize({
6537			client_id: _config2.default.soundcloud_client
6538		});
6539
6540		/*
6541  	Gets the streamable URLs to run through Amplitue. This is
6542  	VERY important since Amplitude can't stream the copy and pasted
6543  	link from the SoundCloud page, but can resolve the streaming
6544  	URLs from the link.
6545  */
6546		getStreamableURLs();
6547	}
6548
6549	/**
6550  * Gets the streamable URL from the URL provided for
6551  * all of the soundcloud links.  This will loop through
6552  * and set all of the information for the soundcloud
6553  * urls.
6554  *
6555  * @access private
6556  */
6557	function getStreamableURLs() {
6558		/*
6559  	Define the regex to find the soundcloud URLs
6560  */
6561		var soundcloud_regex = /^https?:\/\/(soundcloud.com|snd.sc)\/(.*)$/;
6562
6563		for (var i = 0; i < _config2.default.songs.length; i++) {
6564			/*
6565   	If the URL matches soundcloud, we grab
6566   	that url and get the streamable link
6567   	if there is one.
6568   */
6569			if (_config2.default.songs[i].url.match(soundcloud_regex)) {
6570				_config2.default.soundcloud_song_count++;
6571				resolveStreamable(_config2.default.songs[i].url, i);
6572			}
6573		}
6574	}
6575
6576	/**
6577  * Due to Soundcloud SDK being asynchronous, we need to scope the
6578  * index of the song in another function. The privateGetSoundcloudStreamableURLs
6579  * function does the actual iteration and scoping.
6580  *
6581  * @access private
6582  * @param {string} url 		- URL of the soundcloud song
6583  * @param {number} index 	- The index of the soundcloud song in the songs array.
6584  */
6585	function resolveStreamable(url, index) {
6586		SC.get('/resolve/?url=' + url, function (sound) {
6587			/*
6588   	If streamable we get the url and bind the client ID to the end
6589   	so Amplitude can just stream the song normally. We then overwrite
6590   	the url the user provided with the streamable URL.
6591   */
6592			if (sound.streamable) {
6593				_config2.default.songs[index].url = sound.stream_url + '?client_id=' + _config2.default.soundcloud_client;
6594
6595				/*
6596    	If the user want's to use soundcloud art, we overwrite the
6597    	cover_art_url with the soundcloud artwork url.
6598    */
6599				if (_config2.default.soundcloud_use_art) {
6600					_config2.default.songs[index].cover_art_url = sound.artwork_url;
6601				}
6602
6603				/*
6604    	Grab the extra metadata from soundcloud and bind it to the
6605    	song.  The user can get this through the public function:
6606    	getActiveSongMetadata
6607    */
6608				_config2.default.songs[index].soundcloud_data = sound;
6609			} else {
6610				/*
6611    	If not streamable, then we print a message to the user stating
6612    	that the song with name X and artist X is not streamable. This
6613    	gets printed ONLY if they have debug turned on.
6614    */
6615				_helpers2.default.writeDebugMessage(_config2.default.songs[index].name + ' by ' + _config2.default.songs[index].artist + ' is not streamable by the Soundcloud API');
6616			}
6617			/*
6618   	Increments the song ready counter.
6619   */
6620			_config2.default.soundcloud_songs_ready++;
6621
6622			/*
6623   	When all songs are accounted for, then amplitude is ready
6624   	to rock and we set the rest of the config.
6625   */
6626			if (_config2.default.soundcloud_songs_ready == _config2.default.soundcloud_song_count) {
6627				_init2.default.setConfig(tempUserConfig);
6628			}
6629		});
6630	}
6631
6632	/*
6633 	Returns the publically accessible methods
6634 */
6635	return {
6636		loadSoundCloud: loadSoundCloud
6637	};
6638}();
6639
6640/**
6641 * Imports the initializer
6642 * @module init/AmplitudeInitializer
6643 */
6644/**
6645 * Imports the config module
6646 * @module config
6647 */
6648exports.default = AmplitudeSoundcloud;
6649module.exports = exports['default'];
6650
6651/***/ }),
6652/* 10 */
6653/***/ (function(module, exports, __webpack_require__) {
6654
6655"use strict";
6656
6657
6658Object.defineProperty(exports, "__esModule", {
6659	value: true
6660});
6661
6662var _config = __webpack_require__(0);
6663
6664var _config2 = _interopRequireDefault(_config);
6665
6666function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6667
6668/**
6669 * These methods help sync visual displays. They essentially make the visual sync
6670 * methods smaller and more maintainable.
6671 *
6672 * @module visual/AmplitudeVisualSyncHelpers
6673 */
6674var AmplitudeVisualSyncHelpers = function () {
6675	/**
6676  * Updates any elements that display the current hour for the song.
6677  *
6678  * @access public
6679  * @param {number} hours 	- An integer conaining how many hours into the song.
6680  */
6681	function syncCurrentHours(hours) {
6682		/*
6683  	Gets all of the song hour selectors.
6684  */
6685		var hourSelectors = [];
6686
6687		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
6688			hourSelectors = ['.amplitude-current-hours[amplitude-main-current-hours="true"]', '.amplitude-current-hours[amplitude-playlist-current-hours="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-current-hours[amplitude-song-index="' + _config2.default.active_index + '"]'];
6689		} else {
6690			hourSelectors = ['.amplitude-current-hours[amplitude-main-current-hours="true"]', '.amplitude-current-hours[amplitude-song-index="' + _config2.default.active_index + '"]'];
6691		}
6692
6693		/*
6694  	Ensures that there are some hour selectors.
6695  */
6696		if (document.querySelectorAll(hourSelectors.join()).length > 0) {
6697			/*
6698   	Get all of the hour selectors
6699   */
6700			var currentHourSelectors = document.querySelectorAll(hourSelectors.join());
6701
6702			/*
6703   	Set the current hour selector's inner html to hours passed in.
6704   */
6705			for (var i = 0; i < currentHourSelectors.length; i++) {
6706				/*
6707    	If the selector is a main selector, we set the hours.
6708    */
6709				if (currentHourSelectors[i].getAttribute('amplitude-main-current-hours') == 'true') {
6710					currentHourSelectors[i].innerHTML = hours;
6711				} else {
6712					/*
6713     	If the active playlist is not null or empty
6714     	and the attribute of the playlist is equal to the
6715     	active playlist, then we set the inner html.
6716     */
6717					if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && currentHourSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
6718						currentHourSelectors[i].innerHTML = hours;
6719						/*
6720      	If the active playlist is not set and the selector
6721      	does not have a playlist then we set the hours. This
6722      	means that the current selector is an individual song
6723      	selector.
6724      */
6725					} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !currentHourSelectors[i].hasAttribute('amplitude-playlist')) {
6726						currentHourSelectors[i].innerHTML = hours;
6727						/*
6728      	If nothing else matches, set the selector's inner HTML to '00'
6729      */
6730					} else {
6731						currentHourSelectors[i].innerHTML = '0';
6732					}
6733				}
6734			}
6735		}
6736	}
6737
6738	/*--------------------------------------------------------------------------
6739 	Resets the current hours displays to 0
6740 --------------------------------------------------------------------------*/
6741	function resetCurrentHours() {
6742		/*
6743  	Gets the hour display elements
6744  */
6745		var hourSelectors = document.querySelectorAll('.amplitude-current-hours');
6746
6747		/*
6748  	Iterates over all of the hour selectors and sets the inner HTML
6749  	to 00.
6750  */
6751		for (var i = 0; i < hourSelectors.length; i++) {
6752			hourSelectors[i].innerHTML = '0';
6753		}
6754	}
6755
6756	/**
6757  * Updates any elements that display the current minutes for the song.
6758  *
6759  * @access public
6760  * @param {number} minutes 	- An integer conaining how many minutes into the song.
6761  */
6762	function syncCurrentMinutes(minutes) {
6763		/*
6764  	Gets all of the song minute selectors.
6765  */
6766		var minuteSelectors = [];
6767
6768		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
6769			minuteSelectors = ['.amplitude-current-minutes[amplitude-main-current-minutes="true"]', '.amplitude-current-minutes[amplitude-playlist-current-minutes="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-current-minutes[amplitude-song-index="' + _config2.default.active_index + '"]'];
6770		} else {
6771			minuteSelectors = ['.amplitude-current-minutes[amplitude-main-current-minutes="true"]', '.amplitude-current-minutes[amplitude-song-index="' + _config2.default.active_index + '"]'];
6772		}
6773
6774		/*
6775  	Grabs the current minute selectors
6776  */
6777		var currentMinuteSelectors = document.querySelectorAll(minuteSelectors.join());
6778
6779		/*
6780  	Set the current minute selector's inner html to minutes passed in.
6781  */
6782		for (var i = 0, l = currentMinuteSelectors.length; i < l; i++) {
6783			/*
6784   	If the selector is a main selector, we set the seconds.
6785   */
6786			if (currentMinuteSelectors[i].getAttribute('amplitude-main-current-minutes') == 'true') {
6787				currentMinuteSelectors[i].innerHTML = minutes;
6788			} else {
6789				/*
6790    	If the active playlist is not null or empty
6791    	and the attribute of the playlist is equal to the
6792    	active playlist, then we set the inner html.
6793    */
6794				if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && currentMinuteSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
6795					currentMinuteSelectors[i].innerHTML = minutes;
6796					/*
6797     	If the active playlist is not set and the selector
6798     	does not have a playlist then we set the minutes. This
6799     	means that the current selector is an individual song
6800     	selector.
6801     */
6802				} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !currentMinuteSelectors[i].hasAttribute('amplitude-playlist')) {
6803					currentMinuteSelectors[i].innerHTML = minutes;
6804					/*
6805     	If nothing else matches, set the selector's inner HTML to '00'
6806     */
6807				} else {
6808					currentMinuteSelectors[i].innerHTML = '00';
6809				}
6810			}
6811		}
6812	}
6813
6814	/**
6815  * Resets the current minutes displays to 00
6816  *
6817  * @access public
6818  */
6819	function resetCurrentMinutes() {
6820		/*
6821  	Gets the minutes display elements
6822  */
6823		var minuteSelectors = document.querySelectorAll('.amplitude-current-minutes');
6824
6825		/*
6826  	Iterates over all of the minute selectors and sets the inner HTML
6827  	to 00.
6828  */
6829		for (var i = 0; i < minuteSelectors.length; i++) {
6830			minuteSelectors[i].innerHTML = '00';
6831		}
6832	}
6833
6834	/**
6835  * Updates any elements that display the current seconds for the song.
6836  *
6837  * @access public
6838  * @param {number}
6838 seconds	- An integer conaining how many seconds into the song.
6839  */
6840	function syncCurrentSeconds(seconds) {
6841		/*
6842  	Gets all of the song second selectors. If the active playlist
6843  	is not null, then we get the playlist selectors.
6844  */
6845		var secondSelectors = [];
6846
6847		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
6848			secondSelectors = ['.amplitude-current-seconds[amplitude-main-current-seconds="true"]', '.amplitude-current-seconds[amplitude-playlist-current-seconds="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-current-seconds[amplitude-song-index="' + _config2.default.active_index + '"]'];
6849		} else {
6850			secondSelectors = ['.amplitude-current-seconds[amplitude-main-current-seconds="true"]', '.amplitude-current-seconds[amplitude-song-index="' + _config2.default.active_index + '"]'];
6851		}
6852
6853		/*
6854  	Get all of the second selectors
6855  */
6856		var currentSecondSelectors = document.querySelectorAll(secondSelectors.join());
6857
6858		/*
6859  	Iterate over all of the second selectors.
6860  */
6861		for (var i = 0, l = currentSecondSelectors.length; i < l; i++) {
6862			/*
6863   	If the selector is a main selector, we set the seconds.
6864   */
6865			if (currentSecondSelectors[i].getAttribute('amplitude-main-current-seconds') == 'true') {
6866				currentSecondSelectors[i].innerHTML = seconds;
6867			} else {
6868				/*
6869    	If the active playlist is not null or empty
6870    	and the attribute of the playlist is equal to the
6871    	active playlist, then we set the inner html.
6872    */
6873				if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && currentSecondSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
6874					currentSecondSelectors[i].innerHTML = seconds;
6875					/*
6876     	If the active playlist is not set and the selector
6877     	does not have a playlist then we set the seconds. This
6878     	means that the current selector is an individual song
6879     	selector.
6880     */
6881				} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !currentSecondSelectors[i].hasAttribute('amplitude-playlist')) {
6882					currentSecondSelectors[i].innerHTML = seconds;
6883					/*
6884     	If nothing else matches, set the selector's inner HTML to '00'
6885     */
6886				} else {
6887					currentSecondSelectors[i].innerHTML = '00';
6888				}
6889			}
6890		}
6891	}
6892
6893	/**
6894  * Resets the current seconds displays to 00
6895  *
6896  * @access public
6897  */
6898	function resetCurrentSeconds() {
6899		/*
6900  	Gets the seconds display elements
6901  */
6902		var secondSelectors = document.querySelectorAll('.amplitude-current-seconds');
6903
6904		/*
6905  	Iterates over all of the seconds selectors and sets the inner HTML
6906  	to 00.
6907  */
6908		for (var i = 0; i < secondSelectors.length; i++) {
6909			secondSelectors[i].innerHTML = '00';
6910		}
6911	}
6912
6913	/**
6914  * Updates any elements that display the current time for the song. This
6915  * is a computed field that will be commonly used.
6916  *
6917  * @access public
6918  * @param {object} currentTime 	- A json object conaining the parts for the current time for the song.
6919  */
6920	function syncCurrentTime(currentTime) {
6921		/*
6922  	Gets all of the song time selectors.
6923  */
6924		var timeSelectors = ['.amplitude-current-time[amplitude-main-current-time="true"]', '.amplitude-current-time[amplitude-playlist-main-current-time="' + _config2.default.active_playlist + '"]', '.amplitude-current-time[amplitude-song-index="' + _config2.default.active_index + '"]'];
6925
6926		/*
6927  	Get all of the time selectors.
6928  */
6929		var currentTimeSelectors = document.querySelectorAll(timeSelectors.join());
6930
6931		/*
6932  	Set the time selector's inner html to the current time for the song. The current
6933  	time is computed by joining minutes and seconds.
6934  */
6935		var timeText = currentTime.minutes + ':' + currentTime.seconds;
6936		if (currentTime.hours > 0) {
6937			timeText = currentTime.hours + ':' + timeText;
6938		}
6939		for (var i = 0, l = currentTimeSelectors.length; i < l; i++) {
6940			currentTimeSelectors[i].innerHTML = timeText;
6941		}
6942	}
6943
6944	/**
6945  * Resets the current time displays to 00:00
6946  *
6947  * @access public
6948  */
6949	function resetCurrentTime() {
6950		/*
6951  	Gets the time selector display elements
6952  */
6953		var timeSelectors = document.querySelectorAll('.amplitude-current-time');
6954
6955		/*
6956  	Iterates over all of the time selectors and sets the inner HTML
6957  	to 00.
6958  */
6959		for (var i = 0; i < timeSelectors.length; i++) {
6960			timeSelectors[i].innerHTML = '00:00';
6961		}
6962	}
6963
6964	/**
6965  * Syncs the song played progress bars. These are HTML5 progress elements.
6966  *
6967  * @access private
6968  * @param {number} songPlayedPercentage  	- The percentage of the song that has been played.
6969  */
6970	function syncSongPlayedProgressBar(songPlayedPercentage) {
6971		syncMainSongPlayedProgressBars(songPlayedPercentage);
6972		syncPlaylistSongPlayedProgressBars(songPlayedPercentage);
6973		syncIndividualSongPlayedProgressBars(songPlayedPercentage);
6974	}
6975
6976	/**
6977  * Sync how much has been played with a progress bar. This is the main progress bar.
6978  *
6979  * @access private
6980  * @param {number} songPlayedPercentage 	- The percent of the song completed.
6981  */
6982	function syncMainSongPlayedProgressBars(songPlayedPercentage) {
6983		/*
6984  	Ensure that the song completion percentage is a number
6985  */
6986		if (!isNaN(songPlayedPercentage)) {
6987			/*
6988   	Get all of the song progress bars
6989   */
6990			var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[amplitude-main-song-played-progress="true"]');
6991
6992			for (var i = 0; i < songPlayedProgressBars.length; i++) {
6993				var max = songPlayedProgressBars[i].max;
6994
6995				songPlayedProgressBars[i].value = songPlayedPercentage / 100 * max;
6996			}
6997		}
6998	}
6999
7000	/**
7001  * Sync how much has been played with a progress bar. This is the playlist progress bar.
7002  *
7003  * @access public
7004  * @param {number} songPlayedPercentage 	- The percent of the song completed.
7005  */
7006	function syncPlaylistSongPlayedProgressBars(songPlayedPercentage) {
7007		/*
7008  	Ensure that the song completion percentage is a number
7009  */
7010		if (!isNaN(songPlayedPercentage)) {
7011			/*
7012   	Get all of the song progress bars
7013   */
7014			var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[amplitude-playlist-song-played-progress="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]');
7015
7016			for (var i = 0; i < songPlayedProgressBars.length; i++) {
7017				var max = songPlayedProgressBars[i].max;
7018
7019				songPlayedProgressBars[i].value = songPlayedPercentage / 100 * max;
7020			}
7021		}
7022	}
7023
7024	/**
7025  * Sync how much has been played with a progress bar. This is for an individual song.
7026  *
7027  * @access private
7028  * @param {number} songPlayedPercentage 	- The percent of the song completed.
7029  */
7030	function syncIndividualSongPlayedProgressBars(songPlayedPercentage) {
7031		/*
7032  	Ensure that the song completion percentage is a number
7033  */
7034		if (!isNaN(songPlayedPercentage)) {
7035			/*
7036   	If the active playlist is not null, we get the individual song
7037   	played progress for the playlist.
7038   */
7039			if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null) {
7040				/*
7041    	Get all of the song progress bars
7042    */
7043				var songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[amplitude-playlist="' + _config2.default.active_playlist + '"][amplitude-song-index="' + _config2.default.active_index + '"]');
7044
7045				for (var i = 0; i < songPlayedProgressBars.length; i++) {
7046					var max = songPlayedProgressBars[i].max;
7047
7048					songPlayedProgressBars[i].value = songPlayedPercentage / 100 * max;
7049				}
7050			} else {
7051				/*
7052    	Get all of the song progress bars
7053    */
7054				var _songPlayedProgressBars = document.querySelectorAll('.amplitude-song-played-progress[amplitude-song-index="' + _config2.default.active_index + '"]');
7055
7056				for (var _i = 0; _i < _songPlayedProgressBars.length; _i++) {
7057					var _max = _songPlayedProgressBars[_i].max;
7058
7059					_songPlayedProgressBars[_i].value = songPlayedPercentage / 100 * _max;
7060				}
7061			}
7062		}
7063	}
7064
7065	/**
7066  * Sets an element to be playing by removing the 'amplitude-paused' class
7067  * and adding the 'amplitude-playing' class
7068  *
7069  * @access public
7070  * @param {element} element 	- The element getting the playing class added.
7071  */
7072	function setElementPlay(element) {
7073		element.classList.add('amplitude-playing');
7074		element.classList.remove('amplitude-paused');
7075	}
7076
7077	/**
7078  * Sets an element to be paused by adding the 'amplitude-paused' class
7079  * and removing the 'amplitude-playing' class
7080  *
7081  * @access public
7082  * @param {element} element 	- The element getting the paused class added.
7083  */
7084	function setElementPause(element) {
7085		element.classList.remove('amplitude-playing');
7086		element.classList.add('amplitude-paused');
7087	}
7088
7089	/**
7090  * Updates any elements that display the duration hour for the song.
7091  *
7092  * @access public
7093  * @param {number} hours 		- An integer conaining how many hours are in the song
7094  */
7095	function syncDurationHours(hours) {
7096		/*
7097  	Gets all of the song hour selectors.
7098  */
7099		var hourSelectors = [];
7100
7101		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
7102			hourSelectors = ['.amplitude-duration-hours[amplitude-main-duration-hours="true"]', '.amplitude-duration-hours[amplitude-playlist-duration-hours="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-duration-hours[amplitude-song-index="' + _config2.default.active_index + '"]'];
7103		} else {
7104			hourSelectors = ['.amplitude-duration-hours[amplitude-main-duration-hours="true"]', '.amplitude-duration-hours[amplitude-song-index="' + _config2.default.active_index + '"]'];
7105		}
7106
7107		/*
7108  	Ensures that there are some hour selectors.
7109  */
7110		if (document.querySelectorAll(hourSelectors.join()).length > 0) {
7111			/*
7112   	Get all of the hour selectors
7113   */
7114			var durationHourSelectors = document.querySelectorAll(hourSelectors.join());
7115
7116			/*
7117   	Set the duration hour selector's inner html to hours passed in.
7118   */
7119			for (var i = 0; i < durationHourSelectors.length; i++) {
7120				/*
7121    	If the selector is a main selector, we set the hours.
7122    */
7123				if (durationHourSelectors[i].getAttribute('amplitude-main-duration-hours') == 'true') {
7124					durationHourSelectors[i].innerHTML = hours;
7125				} else {
7126					/*
7127     	If the active playlist is not null or empty
7128     	and the attribute of the playlist is equal to the
7129     	active playlist, then we set the inner html.
7130     */
7131					if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && durationHourSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
7132						durationHourSelectors[i].innerHTML = hours;
7133						/*
7134      	If the active playlist is not set and the selector
7135      	does not have a playlist then we set the hours. This
7136      	means that the duration selector is an individual song
7137      	selector.
7138      */
7139					} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !durationHourSelectors[i].hasAttribute('amplitude-playlist')) {
7140						durationHourSelectors[i].innerHTML = hours;
7141						/*
7142      	If nothing else matches, set the selector's inner HTML to '00'
7143      */
7144					} else {
7145						durationHourSelectors[i].innerHTML = '0';
7146					}
7147				}
7148			}
7149		}
7150	}
7151
7152	/**
7153  * Updates any elements that display the duration minutes for the song.
7154  *
7155  * @access public
7156  * @param {number} minutes 	- An integer conaining how many minutes into the song.
7157  */
7158	function syncDurationMinutes(minutes) {
7159		/*
7160  	Gets all of the song minute selectors.
7161  */
7162		var minuteSelectors = [];
7163
7164		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
7165			minuteSelectors = ['.amplitude-duration-minutes[amplitude-main-duration-minutes="true"]', '.amplitude-duration-minutes[amplitude-playlist-duration-minutes="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-duration-minutes[amplitude-song-index="' + _config2.default.active_index + '"]'];
7166		} else {
7167			minuteSelectors = ['.amplitude-duration-minutes[amplitude-main-duration-minutes="true"]', '.amplitude-duration-minutes[amplitude-song-index="' + _config2.default.active_index + '"]'];
7168		}
7169
7170		/*
7171  	Get all of the minute selectors
7172  */
7173		var durationMinuteSelectors = document.querySelectorAll(minuteSelectors.join());
7174
7175		/*
7176  	Set the duration minute selector's inner html to minutes passed in.
7177  */
7178		for (var i = 0; i < durationMinuteSelectors.length; i++) {
7179			/*
7180   	If the selector is a main selector, we set the seconds.
7181   */
7182			if (durationMinuteSelectors[i].getAttribute('amplitude-main-duration-minutes') == 'true') {
7183				durationMinuteSelectors[i].innerHTML = minutes;
7184			} else {
7185				/*
7186    	If the active playlist is not null or empty
7187    	and the attribute of the playlist is equal to the
7188    	active playlist, then we set the inner html.
7189    */
7190				if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && durationMinuteSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
7191					durationMinuteSelectors[i].innerHTML = minutes;
7192					/*
7193     	If the active playlist is not set and the selector
7194     	does not have a playlist then we set the minutes. This
7195     	means that the duration selector is an individual song
7196     	selector.
7197     */
7198				} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !durationMinuteSelectors[i].hasAttribute('amplitude-playlist')) {
7199					durationMinuteSelectors[i].innerHTML = minutes;
7200					/*
7201     	If nothing else matches, set the selector's inner HTML to '00'
7202     */
7203				} else {
7204					durationMinuteSelectors[i].innerHTML = '00';
7205				}
7206			}
7207		}
7208	}
7209
7210	/**
7211  * Updates any elements that display the duration seconds for the song.
7212  *
7213  * @access private
7214  * @param {number}
7214 seconds 	- An integer conaining how many seconds into the song.
7215  */
7216	function syncDurationSeconds(seconds) {
7217		/*
7218  	Gets all of the song second selectors. If the active playlist
7219  	is not null, then we get the playlist selectors.
7220  */
7221		var secondSelectors = [];
7222
7223		if (_config2.default.active_playlist != null && _config2.default.active_playlist != '') {
7224			secondSelectors = ['.amplitude-duration-seconds[amplitude-main-duration-seconds="true"]', '.amplitude-duration-seconds[amplitude-playlist-duration-seconds="true"][amplitude-playlist="' + _config2.default.active_playlist + '"]', '.amplitude-duration-seconds[amplitude-song-index="' + _config2.default.active_index + '"]'];
7225		} else {
7226			secondSelectors = ['.amplitude-duration-seconds[amplitude-main-duration-seconds="true"]', '.amplitude-duration-seconds[amplitude-song-index="' + _config2.default.active_index + '"]'];
7227		}
7228
7229		/*
7230  	Get all of the second selectors
7231  */
7232		var durationSecondSelectors = document.querySelectorAll(secondSelectors.join());
7233
7234		/*
7235  	Iterate over all of the second selectors.
7236  */
7237		for (var i = 0; i < durationSecondSelectors.length; i++) {
7238			/*
7239   	If the selector is a main selector, we set the seconds.
7240   */
7241			if (durationSecondSelectors[i].getAttribute('amplitude-main-duration-seconds') == 'true') {
7242				durationSecondSelectors[i].innerHTML = seconds;
7243			} else {
7244				/*
7245    	If the active playlist is not null or empty
7246    	and the attribute of the playlist is equal to the
7247    	active playlist, then we set the inner html.
7248    */
7249				if (_config2.default.active_playlist != '' && _config2.default.active_playlist != null && durationSecondSelectors[i].getAttribute('amplitude-playlist') == _config2.default.active_playlist) {
7250					durationSecondSelectors[i].innerHTML = seconds;
7251					/*
7252     	If the active playlist is not set and the selector
7253     	does not have a playlist then we set the seconds. This
7254     	means that the duration selector is an individual song
7255     	selector.
7256     */
7257				} else if (_config2.default.active_playlist == '' || _config2.default.active_playlist == null && !durationSecondSelectors[i].hasAttribute('amplitude-playlist')) {
7258					durationSecondSelectors[i].innerHTML = seconds;
7259					/*
7260     	If nothing else matches, set the selector's inner HTML to '00'
7261     */
7262				} else {
7263					durationSecondSelectors[i].innerHTML = '00';
7264				}
7265			}
7266		}
7267	}
7268
7269	/**
7270  * Updates any elements that display the duration time for the song. This
7271  * is a computed field that will be commonly used.
7272  *
7273  * @access public
7274  * @param {object} durationTime 	- A json object conaining the parts for the duration time for the song.
7275  */
7276	function syncDurationTime(durationTime) {
7277		/*
7278  	Gets all of the song time selectors.
7279  */
7280		var timeSelectors = ['.amplitude-duration-time[amplitude-main-duration-time="true"]', '.amplitude-duration-time[amplitude-playlist-main-duration-time="' + _config2.default.active_playlist + '"]', '.amplitude-duration-time[amplitude-song-index="' + _config2.default.active_index + '"]'];
7281
7282		/*
7283  	Get all of the time selectors.
7284  */
7285		var durationTimeSelectors = document.querySelectorAll(timeSelectors.join());
7286
7287		/*
7288  	Set the time selector's inner html to the duration time for the song. The duration
7289  	time is computed by joining minutes and seconds.
7290  */
7291		var durationText = '00:00';
7292		if (!isNaN(durationTime.minutes) && !isNaN(durationTime.seconds)) {
7293			durationText = durationTime.minutes + ':' + durationTime.seconds;
7294			if (!isNaN(durationTime.hours) && durationTime.hours > 0) {
7295				durationText = durationTime.hours + ':' + durationText;
7296			}
7297		}
7298		for (var i = 0; i < durationTimeSelectors.length; i++) {
7299			durationTimeSelectors[i].innerHTML = durationText;
7300		}
7301	}
7302
7303	/**
7304  * Updates the elements that show how much time is remaining in the song.
7305  *
7306  * @access public
7307  * @param {object} currentTime 	- A json object containing the parts for the current time for the song.
7308  * @param {object} durationTime - A json object conaining the parts for the duration time for the song.
7309  */
7310	function syncCountDownTime(currentTime, songDuration) {
7311		/*
7312  	Initialize time remaining.
7313  */
7314		var timeRemaining = '00:00';
7315
7316		/*
7317  	Ensure that all values are defined.
7318  */
7319		if (currentTime != undefined && songDuration != undefined) {
7320			/*
7321   	Initialize the total current seconds and total duration seconds
7322   */
7323			var totalCurrentSeconds = parseInt(currentTime.seconds) + parseInt(currentTime.minutes) * 60 + parseInt(currentTime.hours) * 60 * 60;
7324			var totalDurationSeconds = parseInt(songDuration.seconds) + parseInt(songDuration.minutes) * 60 + parseInt(songDuration.hours) * 60 * 60;
7325
7326			/*
7327   	If the two variables are numbers we continue the computing.
7328   */
7329			if (!isNaN(totalCurrentSeconds) && !isNaN(totalDurationSeconds)) {
7330				/*
7331    	Find the total remaining seconds.
7332    */
7333				var timeRemainingTotalSeconds = totalDurationSeconds - totalCurrentSeconds;
7334
7335				var remainingHours = Math.floor(timeRemainingTotalSeconds / 3600);
7336				var remainingMinutes = Math.floor((timeRemainingTotalSeconds - remainingHours * 3600) / 60);
7337				var remainingSeconds = timeRemainingTotalSeconds - remainingHours * 3600 - remainingMinutes * 60;
7338
7339				timeRemaining = (remainingMinutes < 10 ? '0' + remainingMinutes : remainingMinutes) + ':' + (remainingSeconds < 10 ? '0' + remainingSeconds : remainingSeconds);
7340
7341				if (remainingHours > 0) {
7342					timeRemaining = remainingHours + ':' + timeRemaining;
7343				}
7344			}
7345		}
7346
7347		/*
7348  	Gets all of the song time selectors.
7349  */
7350		var timeSelectors = ['.amplitude-time-remaining[amplitude-main-time-remaining="true"]', '.amplitude-time-remaining[amplitude-playlist-main-time-remaining="' + _config2.default.active_playlist + '"]', '.amplitude-time-remaining[amplitude-song-index="' + _config2.default.active_index + '"]'];
7351
7352		/*
7353  	Get all of the time selectors.
7354  */
7355		var timeRemainingSelectors = document.querySelectorAll(timeSelectors.join());
7356
7357		/*
7358  	Set the time selector's inner html to the duration time for the song. The duration
7359  	time is computed by joining minutes and seconds.
7360  */
7361		for (var i = 0; i < timeRemainingSelectors.length; i++) {
7362			timeRemainingSelectors[i].innerHTML = timeRemaining;
7363		}
7364	}
7365
7366	/*
7367 	Return the publically available functions.
7368 */
7369	return {
7370		syncCurrentHours: syncCurrentHours,
7371		syncCurrentMinutes: syncCurrentMinutes,
7372		syncCurrentSeconds: syncCurrentSeconds,
7373		syncCurrentTime: syncCurrentTime,
7374		resetCurrentHours: resetCurrentHours,
7375		resetCurrentMinutes: resetCurrentMinutes,
7376		resetCurrentSeconds: resetCurrentSeconds,
7377		resetCurrentTime: resetCurrentTime,
7378		syncSongPlayedProgressBar: syncSongPlayedProgressBar,
7379		setElementPlay: setElementPlay,
7380		setElementPause: setElementPause,
7381		syncDurationHours: syncDurationHours,
7382		syncDurationMinutes: syncDurationMinutes,
7383		syncDurationSeconds: syncDurationSeconds,
7384		syncDurationTime: syncDurationTime,
7385		syncCountDownTime: syncCountDownTime
7386	};
7387}(); /**
7388      * Imports the config module
7389      * @module config
7390      */
7391exports.default = AmplitudeVisualSyncHelpers;
7392module.exports = exports['default'];
7393
7394/***/ })
7395/******/ ]);
7396});
7397//# sourceMappingURL=amplitude.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.