Created
February 8, 2020 16:44
-
-
Save evikza/c09b35001cfe11cbe310ca3b54ec681b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!(function() { | |
'use strict'; | |
var e = function() { | |
this.init(); | |
}; | |
e.prototype = { | |
init: function() { | |
var e = this || _; | |
return ( | |
(e._counter = 1e3), | |
(e._codecs = {}), | |
(e._howls = []), | |
(e._muted = !1), | |
(e._volume = 1), | |
(e._canPlayEvent = 'canplaythrough'), | |
(e._navigator = | |
'undefined' != typeof window && window.navigator | |
? window.navigator | |
: null), | |
(e.masterGain = null), | |
(e.noAudio = !1), | |
(e.usingWebAudio = !0), | |
(e.autoSuspend = !0), | |
(e.ctx = null), | |
(e.mobileAutoEnable = !0), | |
e._setup(), | |
e | |
); | |
}, | |
volume: function(e) { | |
var t = this || _; | |
if ( | |
((e = parseFloat(e)), t.ctx || d(), void 0 !== e && 0 <= e && e <= 1) | |
) { | |
if (((t._volume = e), t._muted)) return t; | |
t.usingWebAudio && | |
t.masterGain.gain.setValueAtTime(e, _.ctx.currentTime); | |
for (var a = 0; a < t._howls.length; a++) | |
if (!t._howls[a]._webAudio) | |
for (var r = t._howls[a]._getSoundIds(), n = 0; n < r.length; n++) { | |
var o = t._howls[a]._soundById(r[n]); | |
o && o._node && (o._node.volume = o._volume * e); | |
} | |
return t; | |
} | |
return t._volume; | |
}, | |
mute: function(e) { | |
var t = this || _; | |
t.ctx || d(), | |
(t._muted = e), | |
t.usingWebAudio && | |
t.masterGain.gain.setValueAtTime( | |
e ? 0 : t._volume, | |
_.ctx.currentTime | |
); | |
for (var a = 0; a < t._howls.length; a++) | |
if (!t._howls[a]._webAudio) | |
for (var r = t._howls[a]._getSoundIds(), n = 0; n < r.length; n++) { | |
var o = t._howls[a]._soundById(r[n]); | |
o && o._node && (o._node.muted = !!e || o._muted); | |
} | |
return t; | |
}, | |
unload: function() { | |
for (var e = this || _, t = e._howls.length - 1; 0 <= t; t--) | |
e._howls[t].unload(); | |
return ( | |
e.usingWebAudio && | |
e.ctx && | |
void 0 !== e.ctx.close && | |
(e.ctx.close(), (e.ctx = null), d()), | |
e | |
); | |
}, | |
codecs: function(e) { | |
return (this || _)._codecs[e.replace(/^x-/, '')]; | |
}, | |
_setup: function() { | |
var t = this || _; | |
if ( | |
((t.state = (t.ctx && t.ctx.state) || 'running'), | |
t._autoSuspend(), | |
!t.usingWebAudio) | |
) | |
if ('undefined' != typeof Audio) | |
try { | |
void 0 === new Audio().oncanplaythrough && | |
(t._canPlayEvent = 'canplay'); | |
} catch (e) { | |
t.noAudio = !0; | |
} | |
else t.noAudio = !0; | |
try { | |
new Audio().muted && (t.noAudio = !0); | |
} catch (e) {} | |
return t.noAudio || t._setupCodecs(), t; | |
}, | |
_setupCodecs: function() { | |
var t = this || _, | |
e = null; | |
try { | |
e = 'undefined' != typeof Audio ? new Audio() : null; | |
} catch (e) { | |
return t; | |
} | |
if (!e || 'function' != typeof e.canPlayType) return t; | |
var a = e.canPlayType('audio/mpeg;').replace(/^no$/, ''), | |
r = t._navigator && t._navigator.userAgent.match(/OPR\/([0-6].)/g), | |
n = r && parseInt(r[0].split('/')[1], 10) < 33; | |
return ( | |
(t._codecs = { | |
mp3: !(n || (!a && !e.canPlayType('audio/mp3;').replace(/^no$/, ''))), | |
mpeg: !!a, | |
opus: !!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''), | |
ogg: !!e | |
.canPlayType('audio/ogg; codecs="vorbis"') | |
.replace(/^no$/, ''), | |
oga: !!e | |
.canPlayType('audio/ogg; codecs="vorbis"') | |
.replace(/^no$/, ''), | |
wav: !!e.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ''), | |
aac: !!e.canPlayType('audio/aac;').replace(/^no$/, ''), | |
caf: !!e.canPlayType('audio/x-caf;').replace(/^no$/, ''), | |
m4a: !!( | |
e.canPlayType('audio/x-m4a;') || | |
e.canPlayType('audio/m4a;') || | |
e.canPlayType('audio/aac;') | |
).replace(/^no$/, ''), | |
mp4: !!( | |
e.canPlayType('audio/x-mp4;') || | |
e.canPlayType('audio/mp4;') || | |
e.canPlayType('audio/aac;') | |
).replace(/^no$/, ''), | |
weba: !!e | |
.canPlayType('audio/webm; codecs="vorbis"') | |
.replace(/^no$/, ''), | |
webm: !!e | |
.canPlayType('audio/webm; codecs="vorbis"') | |
.replace(/^no$/, ''), | |
dolby: !!e | |
.canPlayType('audio/mp4; codecs="ec-3"') | |
.replace(/^no$/, ''), | |
flac: !!( | |
e.canPlayType('audio/x-flac;') || e.canPlayType('audio/flac;') | |
).replace(/^no$/, '') | |
}), | |
t | |
); | |
}, | |
_enableMobileAudio: function() { | |
var t = this || _, | |
e = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test( | |
t._navigator && t._navigator.userAgent | |
), | |
a = !!( | |
'ontouchend' in window || | |
(t._navigator && 0 < t._navigator.maxTouchPoints) || | |
(t._navigator && 0 < t._navigator.msMaxTouchPoints) | |
); | |
if (!t._mobileEnabled && t.ctx && (e || a)) { | |
(t._mobileEnabled = !1), | |
t._mobileUnloaded || | |
44100 === t.ctx.sampleRate || | |
((t._mobileUnloaded = !0), t.unload()), | |
(t._scratchBuffer = t.ctx.createBuffer(1, 1, 22050)); | |
var r = function() { | |
_._autoResume(); | |
var e = t.ctx.createBufferSource(); | |
(e.buffer = t._scratchBuffer), | |
e.connect(t.ctx.destination), | |
void 0 === e.start ? e.noteOn(0) : e.start(0), | |
'function' == typeof t.ctx.resume && t.ctx.resume(), | |
(e.onended = function() { | |
e.disconnect(0), | |
(t._mobileEnabled = !0), | |
(t.mobileAutoEnable = !1), | |
document.removeEventListener('touchstart', r, !0), | |
document.removeEventListener('touchend', r, !0); | |
}); | |
}; | |
return ( | |
document.addEventListener('touchstart', r, !0), | |
document.addEventListener('touchend', r, !0), | |
t | |
); | |
} | |
}, | |
_autoSuspend: function() { | |
var e = this; | |
if ( | |
e.autoSuspend && | |
e.ctx && | |
void 0 !== e.ctx.suspend && | |
_.usingWebAudio | |
) { | |
for (var t = 0; t < e._howls.length; t++) | |
if (e._howls[t]._webAudio) | |
for (var a = 0; a < e._howls[t]._sounds.length; a++) | |
if (!e._howls[t]._sounds[a]._paused) return e; | |
return ( | |
e._suspendTimer && clearTimeout(e._suspendTimer), | |
(e._suspendTimer = setTimeout(function() { | |
e.autoSuspend && | |
((e._suspendTimer = null), | |
(e.state = 'suspending'), | |
e.ctx.suspend().then(function() { | |
(e.state = 'suspended'), | |
e._resumeAfterSuspend && | |
(delete e._resumeAfterSuspend, e._autoResume()); | |
})); | |
}, 3e4)), | |
e | |
); | |
} | |
}, | |
_autoResume: function() { | |
var t = this; | |
if (t.ctx && void 0 !== t.ctx.resume && _.usingWebAudio) | |
return ( | |
'running' === t.state && t._suspendTimer | |
? (clearTimeout(t._suspendTimer), (t._suspendTimer = null)) | |
: 'suspended' === t.state | |
? (t.ctx.resume().then(function() { | |
t.state = 'running'; | |
for (var e = 0; e < t._howls.length; e++) | |
t._howls[e]._emit('resume'); | |
}), | |
t._suspendTimer && | |
(clearTimeout(t._suspendTimer), (t._suspendTimer = null))) | |
: 'suspending' === t.state && (t._resumeAfterSuspend = !0), | |
t | |
); | |
} | |
}; | |
var _ = new e(), | |
t = function(e) { | |
e.src && 0 !== e.src.length | |
? this.init(e) | |
: console.error( | |
'An array of source files must be passed with any new Howl.' | |
); | |
}; | |
t.prototype = { | |
init: function(e) { | |
var t = this; | |
return ( | |
_.ctx || d(), | |
(t._autoplay = e.autoplay || !1), | |
(t._format = 'string' != typeof e.format ? e.format : [e.format]), | |
(t._html5 = e.html5 || !1), | |
(t._muted = e.mute || !1), | |
(t._loop = e.loop || !1), | |
(t._pool = e.pool || 5), | |
(t._preload = 'boolean' != typeof e.preload || e.preload), | |
(t._rate = e.rate || 1), | |
(t._sprite = e.sprite || {}), | |
(t._src = 'string' != typeof e.src ? e.src : [e.src]), | |
(t._volume = void 0 !== e.volume ? e.volume : 1), | |
(t._xhrWithCredentials = e.xhrWithCredentials || !1), | |
(t._duration = 0), | |
(t._state = 'unloaded'), | |
(t._sounds = []), | |
(t._endTimers = {}), | |
(t._queue = []), | |
(t._playLock = !1), | |
(t._onend = e.onend ? [{ fn: e.onend }] : []), | |
(t._onfade = e.onfade ? [{ fn: e.onfade }] : []), | |
(t._onload = e.onload ? [{ fn: e.onload }] : []), | |
(t._onloaderror = e.onloaderror ? [{ fn: e.onloaderror }] : []), | |
(t._onplayerror = e.onplayerror ? [{ fn: e.onplayerror }] : []), | |
(t._onpause = e.onpause ? [{ fn: e.onpause }] : []), | |
(t._onplay = e.onplay ? [{ fn: e.onplay }] : []), | |
(t._onstop = e.onstop ? [{ fn: e.onstop }] : []), | |
(t._onmute = e.onmute ? [{ fn: e.onmute }] : []), | |
(t._onvolume = e.onvolume ? [{ fn: e.onvolume }] : []), | |
(t._onrate = e.onrate ? [{ fn: e.onrate }] : []), | |
(t._onseek = e.onseek ? [{ fn: e.onseek }] : []), | |
(t._onresume = []), | |
(t._webAudio = _.usingWebAudio && !t._html5), | |
void 0 !== _.ctx && | |
_.ctx && | |
_.mobileAutoEnable && | |
_._enableMobileAudio(), | |
_._howls.push(t), | |
t._autoplay && | |
t._queue.push({ | |
event: 'play', | |
action: function() { | |
t.play(); | |
} | |
}), | |
t._preload && t.load(), | |
t | |
); | |
}, | |
load: function() { | |
var e = this, | |
t = null; | |
if (_.noAudio) e._emit('loaderror', null, 'No audio support.'); | |
else { | |
'string' == typeof e._src && (e._src = [e._src]); | |
for (var a = 0; a < e._src.length; a++) { | |
var r, n; | |
if (e._format && e._format[a]) r = e._format[a]; | |
else { | |
if ('string' != typeof (n = e._src[a])) { | |
e._emit( | |
'loaderror', | |
null, | |
'Non-string found in selected audio sources - ignoring.' | |
); | |
continue; | |
} | |
(r = /^data:audio\/([^;,]+);/i.exec(n)) || | |
(r = /\.([^.]+)$/.exec(n.split('?', 1)[0])), | |
r && (r = r[1].toLowerCase()); | |
} | |
if ( | |
(r || | |
console.warn( | |
'No file extension was found. Consider using the "format" property or specify an extension.' | |
), | |
r && _.codecs(r)) | |
) { | |
t = e._src[a]; | |
break; | |
} | |
} | |
if (t) | |
return ( | |
(e._src = t), | |
(e._state = 'loading'), | |
'https:' === window.location.protocol && | |
'http:' === t.slice(0, 5) && | |
((e._html5 = !0), (e._webAudio = !1)), | |
new o(e), | |
e._webAudio && i(e), | |
e | |
); | |
e._emit( | |
'loaderror', | |
null, | |
'No codec support for selected audio sources.' | |
); | |
} | |
}, | |
play: function(a, r) { | |
var n = this, | |
e = null; | |
if ('number' == typeof a) (e = a), (a = null); | |
else { | |
if ('string' == typeof a && 'loaded' === n._state && !n._sprite[a]) | |
return null; | |
if (void 0 === a) { | |
a = '__default'; | |
for (var t = 0, o = 0; o < n._sounds.length; o++) | |
n._sounds[o]._paused && | |
!n._sounds[o]._ended && | |
(t++, (e = n._sounds[o]._id)); | |
1 === t ? (a = null) : (e = null); | |
} | |
} | |
var l = e ? n._soundById(e) : n._inactiveSound(); | |
if (!l) return null; | |
if ((e && !a && (a = l._sprite || '__default'), 'loaded' !== n._state)) { | |
(l._sprite = a), (l._ended = !1); | |
var i = l._id; | |
return ( | |
n._queue.push({ | |
event: 'play', | |
action: function() { | |
n.play(i); | |
} | |
}), | |
i | |
); | |
} | |
if (e && !l._paused) return r || n._loadQueue('play'), l._id; | |
n._webAudio && _._autoResume(); | |
var s = Math.max(0, 0 < l._seek ? l._seek : n._sprite[a][0] / 1e3), | |
u = Math.max(0, (n._sprite[a][0] + n._sprite[a][1]) / 1e3 - s), | |
c = (1e3 * u) / Math.abs(l._rate); | |
(l._paused = !1), | |
(l._ended = !1), | |
(l._sprite = a), | |
(l._seek = s), | |
(l._start = n._sprite[a][0] / 1e3), | |
(l._stop = (n._sprite[a][0] + n._sprite[a][1]) / 1e3), | |
(l._loop = !(!l._loop && !n._sprite[a][2])); | |
var d = l._node; | |
if (n._webAudio) { | |
var p = function() { | |
n._refreshBuffer(l); | |
var e = l._muted || n._muted ? 0 : l._volume; | |
d.gain.setValueAtTime(e, _.ctx.currentTime), | |
(l._playStart = _.ctx.currentTime), | |
void 0 === d.bufferSource.start | |
? l._loop | |
? d.bufferSource.noteGrainOn(0, s, 86400) | |
: d.bufferSource.noteGrainOn(0, s, u) | |
: l._loop | |
? d.bufferSource.start(0, s, 86400) | |
: d.bufferSource.start(0, s, u), | |
c !== 1 / 0 && | |
(n._endTimers[l._id] = setTimeout(n._ended.bind(n, l), c)), | |
r || | |
setTimeout(function() { | |
n._emit('play', l._id); | |
}, 0); | |
}; | |
'running' === _.state | |
? p() | |
: (n.once('resume', p), n._clearTimer(l._id)); | |
} else { | |
var g = function() { | |
(d.currentTime = s), | |
(d.muted = l._muted || n._muted || _._muted || d.muted), | |
(d.volume = l._volume * _.volume()), | |
(d.playbackRate = l._rate); | |
try { | |
var e = d.play(); | |
if ('undefined' != typeof Promise && e instanceof Promise) { | |
n._playLock = !0; | |
var t = function() { | |
(n._playLock = !1), r || n._emit('play', l._id); | |
}; | |
e.then(t, t); | |
} else r || n._emit('play', l._id); | |
if (((d.playbackRate = l._rate), d.paused)) | |
return void n._emit( | |
'playerror', | |
l._id, | |
'Playback was unable to start. This is most commonly an issue on mobile devices where playback was not within a user interaction.' | |
); | |
'__default' !== a || l._loop | |
? (n._endTimers[l._id] = setTimeout(n._ended.bind(n, l), c)) | |
: ((n._endTimers[l._id] = function() { | |
n._ended(l), | |
d.removeEventListener('ended', n._endTimers[l._id], !1); | |
}), | |
d.addEventListener('ended', n._endTimers[l._id], !1)); | |
} catch (e) { | |
n._emit('playerror', l._id, e); | |
} | |
}, | |
f = | |
(window && window.ejecta) || | |
(!d.readyState && _._navigator.isCocoonJS); | |
if (3 <= d.readyState || f) g(); | |
else { | |
var y = function() { | |
g(), d.removeEventListener(_._canPlayEvent, y, !1); | |
}; | |
d.addEventListener(_._canPlayEvent, y, !1), n._clearTimer(l._id); | |
} | |
} | |
return l._id; | |
}, | |
pause: function(e) { | |
var t = this; | |
if ('loaded' !== t._state || t._playLock) | |
return ( | |
t._queue.push({ | |
event: 'pause', | |
action: function() { | |
t.pause(e); | |
} | |
}), | |
t | |
); | |
for (var a = t._getSoundIds(e), r = 0; r < a.length; r++) { | |
t._clearTimer(a[r]); | |
var n = t._soundById(a[r]); | |
if ( | |
n && | |
!n._paused && | |
((n._seek = t.seek(a[r])), | |
(n._rateSeek = 0), | |
(n._paused = !0), | |
t._stopFade(a[r]), | |
n._node) | |
) | |
if (t._webAudio) { | |
if (!n._node.bufferSource) continue; | |
void 0 === n._node.bufferSource.stop | |
? n._node.bufferSource.noteOff(0) | |
: n._node.bufferSource.stop(0), | |
t._cleanBuffer(n._node); | |
} else | |
(isNaN(n._node.duration) && n._node.duration !== 1 / 0) || | |
n._node.pause(); | |
arguments[1] || t._emit('pause', n ? n._id : null); | |
} | |
return t; | |
}, | |
stop: function(e, t) { | |
var a = this; | |
if ('loaded' !== a._state) | |
return ( | |
a._queue.push({ | |
event: 'stop', | |
action: function() { | |
a.stop(e); | |
} | |
}), | |
a | |
); | |
for (var r = a._getSoundIds(e), n = 0; n < r.length; n++) { | |
a._clearTimer(r[n]); | |
var o = a._soundById(r[n]); | |
o && | |
((o._seek = o._start || 0), | |
(o._rateSeek = 0), | |
(o._paused = !0), | |
(o._ended = !0), | |
a._stopFade(r[n]), | |
o._node && | |
(a._webAudio | |
? o._node.bufferSource && | |
(void 0 === o._node.bufferSource.stop | |
? o._node.bufferSource.noteOff(0) | |
: o._node.bufferSource.stop(0), | |
a._cleanBuffer(o._node)) | |
: (isNaN(o._node.duration) && o._node.duration !== 1 / 0) || | |
((o._node.currentTime = o._start || 0), o._node.pause())), | |
t || a._emit('stop', o._id)); | |
} | |
return a; | |
}, | |
mute: function(e, t) { | |
var a = this; | |
if ('loaded' !== a._state) | |
return ( | |
a._queue.push({ | |
event: 'mute', | |
action: function() { | |
a.mute(e, t); | |
} | |
}), | |
a | |
); | |
if (void 0 === t) { | |
if ('boolean' != typeof e) return a._muted; | |
a._muted = e; | |
} | |
for (var r = a._getSoundIds(t), n = 0; n < r.length; n++) { | |
var o = a._soundById(r[n]); | |
o && | |
((o._muted = e), | |
o._interval && a._stopFade(o._id), | |
a._webAudio && o._node | |
? o._node.gain.setValueAtTime(e ? 0 : o._volume, _.ctx.currentTime) | |
: o._node && (o._node.muted = !!_._muted || e), | |
a._emit('mute', o._id)); | |
} | |
return a; | |
}, | |
volume: function() { | |
var e, | |
t, | |
a, | |
r = this, | |
n = arguments; | |
if (0 === n.length) return r._volume; | |
if ( | |
(1 === n.length || (2 === n.length && void 0 === n[1]) | |
? 0 <= r._getSoundIds().indexOf(n[0]) | |
? (t = parseInt(n[0], 10)) | |
: (e = parseFloat(n[0])) | |
: 2 <= n.length && ((e = parseFloat(n[0])), (t = parseInt(n[1], 10))), | |
!(void 0 !== e && 0 <= e && e <= 1)) | |
) | |
return (a = t ? r._soundById(t) : r._sounds[0]) ? a._volume : 0; | |
if ('loaded' !== r._state) | |
return ( | |
r._queue.push({ | |
event: 'volume', | |
action: function() { | |
r.volume.apply(r, n); | |
} | |
}), | |
r | |
); | |
void 0 === t && (r._volume = e), (t = r._getSoundIds(t)); | |
for (var o = 0; o < t.length; o++) | |
(a = r._soundById(t[o])) && | |
((a._volume = e), | |
n[2] || r._stopFade(t[o]), | |
r._webAudio && a._node && !a._muted | |
? a._node.gain.setValueAtTime(e, _.ctx.currentTime) | |
: a._node && !a._muted && (a._node.volume = e * _.volume()), | |
r._emit('volume', a._id)); | |
return r; | |
}, | |
fade: function(e, t, a, r) { | |
var n = this; | |
if ('loaded' !== n._state) | |
return ( | |
n._queue.push({ | |
event: 'fade', | |
action: function() { | |
n.fade(e, t, a, r); | |
} | |
}), | |
n | |
); | |
n.volume(e, r); | |
for (var o = n._getSoundIds(r), l = 0; l < o.length; l++) { | |
var i = n._soundById(o[l]); | |
if (i) { | |
if ((r || n._stopFade(o[l]), n._webAudio && !i._muted)) { | |
var s = _.ctx.currentTime, | |
u = s + a / 1e3; | |
(i._volume = e), | |
i._node.gain.setValueAtTime(e, s), | |
i._node.gain.linearRampToValueAtTime(t, u); | |
} | |
n._startFadeInterval(i, e, t, a, o[l], void 0 === r); | |
} | |
} | |
return n; | |
}, | |
_startFadeInterval: function(t, a, r, n, e, o) { | |
var l = this, | |
i = a, | |
s = r - a, | |
u = Math.abs(s / 0.01), | |
c = Math.max(4, 0 < u ? n / u : n), | |
d = Date.now(); | |
(t._fadeTo = r), | |
(t._interval = setInterval(function() { | |
var e = (Date.now() - d) / n; | |
(d = Date.now()), | |
(i += s * e), | |
(i = Math.max(0, i)), | |
(i = Math.min(1, i)), | |
(i = Math.round(100 * i) / 100), | |
l._webAudio ? (t._volume = i) : l.volume(i, t._id, !0), | |
o && (l._volume = i), | |
((r < a && i <= r) || (a < r && r <= i)) && | |
(clearInterval(t._interval), | |
(t._interval = null), | |
(t._fadeTo = null), | |
l.volume(r, t._id), | |
l._emit('fade', t._id)); | |
}, c)); | |
}, | |
_stopFade: function(e) { | |
var t = this, | |
a = t._soundById(e); | |
return ( | |
a && | |
a._interval && | |
(t._webAudio && a._node.gain.cancelScheduledValues(_.ctx.currentTime), | |
clearInterval(a._interval), | |
(a._interval = null), | |
t.volume(a._fadeTo, e), | |
(a._fadeTo = null), | |
t._emit('fade', e)), | |
t | |
); | |
}, | |
loop: function() { | |
var e, | |
t, | |
a, | |
r = this, | |
n = arguments; | |
if (0 === n.length) return r._loop; | |
if (1 === n.length) { | |
if ('boolean' != typeof n[0]) | |
return !!(a = r._soundById(parseInt(n[0], 10))) && a._loop; | |
(e = n[0]), (r._loop = e); | |
} else 2 === n.length && ((e = n[0]), (t = parseInt(n[1], 10))); | |
for (var o = r._getSoundIds(t), l = 0; l < o.length; l++) | |
(a = r._soundById(o[l])) && | |
((a._loop = e), | |
r._webAudio && | |
a._node && | |
a._node.bufferSource && | |
(a._node.bufferSource.loop = e) && | |
((a._node.bufferSource.loopStart = a._start || 0), | |
(a._node.bufferSource.loopEnd = a._stop))); | |
return r; | |
}, | |
rate: function() { | |
var e, | |
t, | |
a, | |
r = this, | |
n = arguments; | |
if (0 === n.length) t = r._sounds[0]._id; | |
else if (1 === n.length) { | |
0 <= r._getSoundIds().indexOf(n[0]) | |
? (t = parseInt(n[0], 10)) | |
: (e = parseFloat(n[0])); | |
} else | |
2 === n.length && ((e = parseFloat(n[0])), (t = parseInt(n[1], 10))); | |
if ('number' != typeof e) | |
return (a = r._soundById(t)) ? a._rate : r._rate; | |
if ('loaded' !== r._state) | |
return ( | |
r._queue.push({ | |
event: 'rate', | |
action: function() { | |
r.rate.apply(r, n); | |
} | |
}), | |
r | |
); | |
void 0 === t && (r._rate = e), (t = r._getSoundIds(t)); | |
for (var o = 0; o < t.length; o++) | |
if ((a = r._soundById(t[o]))) { | |
(a._rateSeek = r.seek(t[o])), | |
(a._playStart = r._webAudio ? _.ctx.currentTime : a._playStart), | |
(a._rate = e), | |
r._webAudio && a._node && a._node.bufferSource | |
? a._node.bufferSource.playbackRate.setValueAtTime( | |
e, | |
_.ctx.currentTime | |
) | |
: a._node && (a._node.playbackRate = e); | |
var l = r.seek(t[o]), | |
i = | |
(1e3 * | |
((r._sprite[a._sprite][0] + r._sprite[a._sprite][1]) / 1e3 - | |
l)) / | |
Math.abs(a._rate); | |
(!r._endTimers[t[o]] && a._paused) || | |
(r._clearTimer(t[o]), | |
(r._endTimers[t[o]] = setTimeout(r._ended.bind(r, a), i))), | |
r._emit('rate', a._id); | |
} | |
return r; | |
}, | |
seek: function() { | |
var e, | |
t, | |
a = this, | |
r = arguments; | |
if (0 === r.length) t = a._sounds[0]._id; | |
else if (1 === r.length) { | |
0 <= a._getSoundIds().indexOf(r[0]) | |
? (t = parseInt(r[0], 10)) | |
: a._sounds.length && | |
((t = a._sounds[0]._id), (e = parseFloat(r[0]))); | |
} else | |
2 === r.length && ((e = parseFloat(r[0])), (t = parseInt(r[1], 10))); | |
if (void 0 === t) return a; | |
if ('loaded' !== a._state) | |
return ( | |
a._queue.push({ | |
event: 'seek', | |
action: function() { | |
a.seek.apply(a, r); | |
} | |
}), | |
a | |
); | |
var n = a._soundById(t); | |
if (n) { | |
if (!('number' == typeof e && 0 <= e)) { | |
if (a._webAudio) { | |
var o = a.playing(t) ? _.ctx.currentTime - n._playStart : 0, | |
l = n._rateSeek ? n._rateSeek - n._seek : 0; | |
return n._seek + (l + o * Math.abs(n._rate)); | |
} | |
return n._node.currentTime; | |
} | |
var i = a.playing(t); | |
if ( | |
(i && a.pause(t, !0), | |
(n._seek = e), | |
(n._ended = !1), | |
a._clearTimer(t), | |
i && a.play(t, !0), | |
!a._webAudio && n._node && (n._node.currentTime = e), | |
i && !a._webAudio) | |
) { | |
var s = function() { | |
a._playLock ? setTimeout(s, 0) : a._emit('seek', t); | |
}; | |
setTimeout(s, 0); | |
} else a._emit('seek', t); | |
} | |
return a; | |
}, | |
playing: function(e) { | |
if ('number' == typeof e) { | |
var t = this._soundById(e); | |
return !!t && !t._paused; | |
} | |
for (var a = 0; a < this._sounds.length; a++) | |
if (!this._sounds[a]._paused) return !0; | |
return !1; | |
}, | |
duration: function(e) { | |
var t = this._duration, | |
a = this._soundById(e); | |
return a && (t = this._sprite[a._sprite][1] / 1e3), t; | |
}, | |
state: function() { | |
return this._state; | |
}, | |
unload: function() { | |
for (var e = this, t = e._sounds, a = 0; a < t.length; a++) { | |
if ((t[a]._paused || e.stop(t[a]._id), !e._webAudio)) | |
/MSIE |Trident\//.test(_._navigator && _._navigator.userAgent) || | |
(t[a]._node.src = | |
'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA'), | |
t[a]._node.removeEventListener('error', t[a]._errorFn, !1), | |
t[a]._node.removeEventListener(_._canPlayEvent, t[a]._loadFn, !1); | |
delete t[a]._node, e._clearTimer(t[a]._id); | |
} | |
var r = _._howls.indexOf(e); | |
0 <= r && _._howls.splice(r, 1); | |
var n = !0; | |
for (a = 0; a < _._howls.length; a++) | |
if (_._howls[a]._src === e._src) { | |
n = !1; | |
break; | |
} | |
return ( | |
l && n && delete l[e._src], | |
(_.noAudio = !1), | |
(e._state = 'unloaded'), | |
(e._sounds = []), | |
(e = null) | |
); | |
}, | |
on: function(e, t, a, r) { | |
var n = this['_on' + e]; | |
return ( | |
'function' == typeof t && | |
n.push(r ? { id: a, fn: t, once: r } : { id: a, fn: t }), | |
this | |
); | |
}, | |
off: function(e, t, a) { | |
var r = this, | |
n = r['_on' + e], | |
o = 0; | |
if (('number' == typeof t && ((a = t), (t = null)), t || a)) | |
for (o = 0; o < n.length; o++) { | |
var l = a === n[o].id; | |
if ((t === n[o].fn && l) || (!t && l)) { | |
n.splice(o, 1); | |
break; | |
} | |
} | |
else if (e) r['_on' + e] = []; | |
else { | |
var i = Object.keys(r); | |
for (o = 0; o < i.length; o++) | |
0 === i[o].indexOf('_on') && Array.isArray(r[i[o]]) && (r[i[o]] = []); | |
} | |
return r; | |
}, | |
once: function(e, t, a) { | |
return this.on(e, t, a, 1), this; | |
}, | |
_emit: function(e, t, a) { | |
for (var r = this, n = r['_on' + e], o = n.length - 1; 0 <= o; o--) | |
(n[o].id && n[o].id !== t && 'load' !== e) || | |
(setTimeout( | |
function(e) { | |
e.call(this, t, a); | |
}.bind(r, n[o].fn), | |
0 | |
), | |
n[o].once && r.off(e, n[o].fn, n[o].id)); | |
return r._loadQueue(e), r; | |
}, | |
_loadQueue: function(e) { | |
var t = this; | |
if (0 < t._queue.length) { | |
var a = t._queue[0]; | |
a.event === e && (t._queue.shift(), t._loadQueue()), e || a.action(); | |
} | |
return t; | |
}, | |
_ended: function(e) { | |
var t = this, | |
a = e._sprite; | |
if ( | |
!t._webAudio && | |
e._node && | |
!e._node.paused && | |
!e._node.ended && | |
e._node.currentTime < e._stop | |
) | |
return setTimeout(t._ended.bind(t, e), 100), t; | |
var r = !(!e._loop && !t._sprite[a][2]); | |
if ( | |
(t._emit('end', e._id), | |
!t._webAudio && r && t.stop(e._id, !0).play(e._id), | |
t._webAudio && r) | |
) { | |
t._emit('play', e._id), | |
(e._seek = e._start || 0), | |
(e._rateSeek = 0), | |
(e._playStart = _.ctx.currentTime); | |
var n = (1e3 * (e._stop - e._start)) / Math.abs(e._rate); | |
t._endTimers[e._id] = setTimeout(t._ended.bind(t, e), n); | |
} | |
return ( | |
t._webAudio && | |
!r && | |
((e._paused = !0), | |
(e._ended = !0), | |
(e._seek = e._start || 0), | |
(e._rateSeek = 0), | |
t._clearTimer(e._id), | |
t._cleanBuffer(e._node), | |
_._autoSuspend()), | |
t._webAudio || r || t.stop(e._id, !0), | |
t | |
); | |
}, | |
_clearTimer: function(e) { | |
var t = this; | |
if (t._endTimers[e]) { | |
if ('function' != typeof t._endTimers[e]) clearTimeout(t._endTimers[e]); | |
else { | |
var a = t._soundById(e); | |
a && | |
a._node && | |
a._node.removeEventListener('ended', t._endTimers[e], !1); | |
} | |
delete t._endTimers[e]; | |
} | |
return t; | |
}, | |
_soundById: function(e) { | |
for (var t = 0; t < this._sounds.length; t++) | |
if (e === this._sounds[t]._id) return this._sounds[t]; | |
return null; | |
}, | |
_inactiveSound: function() { | |
var e = this; | |
e._drain(); | |
for (var t = 0; t < e._sounds.length; t++) | |
if (e._sounds[t]._ended) return e._sounds[t].reset(); | |
return new o(e); | |
}, | |
_drain: function() { | |
var e = this, | |
t = e._pool, | |
a = 0, | |
r = 0; | |
if (!(e._sounds.length < t)) { | |
for (r = 0; r < e._sounds.length; r++) e._sounds[r]._ended && a++; | |
for (r = e._sounds.length - 1; 0 <= r; r--) { | |
if (a <= t) return; | |
e._sounds[r]._ended && | |
(e._webAudio && | |
e._sounds[r]._node && | |
e._sounds[r]._node.disconnect(0), | |
e._sounds.splice(r, 1), | |
a--); | |
} | |
} | |
}, | |
_getSoundIds: function(e) { | |
if (void 0 === e) { | |
for (var t = [], a = 0; a < this._sounds.length; a++) | |
t.push(this._sounds[a]._id); | |
return t; | |
} | |
return [e]; | |
}, | |
_refreshBuffer: function(e) { | |
return ( | |
(e._node.bufferSource = _.ctx.createBufferSource()), | |
(e._node.bufferSource.buffer = l[this._src]), | |
e._panner | |
? e._node.bufferSource.connect(e._panner) | |
: e._node.bufferSource.connect(e._node), | |
(e._node.bufferSource.loop = e._loop), | |
e._loop && | |
((e._node.bufferSource.loopStart = e._start || 0), | |
(e._node.bufferSource.loopEnd = e._stop)), | |
e._node.bufferSource.playbackRate.setValueAtTime( | |
e._rate, | |
_.ctx.currentTime | |
), | |
this | |
); | |
}, | |
_cleanBuffer: function(e) { | |
if (_._scratchBuffer && e.bufferSource) { | |
(e.bufferSource.onended = null), e.bufferSource.disconnect(0); | |
try { | |
e.bufferSource.buffer = _._scratchBuffer; | |
} catch (e) {} | |
} | |
return (e.bufferSource = null), this; | |
} | |
}; | |
var o = function(e) { | |
(this._parent = e), this.init(); | |
}; | |
o.prototype = { | |
init: function() { | |
var e = this, | |
t = e._parent; | |
return ( | |
(e._muted = t._muted), | |
(e._loop = t._loop), | |
(e._volume = t._volume), | |
(e._rate = t._rate), | |
(e._seek = 0), | |
(e._paused = !0), | |
(e._ended = !0), | |
(e._sprite = '__default'), | |
(e._id = ++_._counter), | |
t._sounds.push(e), | |
e.create(), | |
e | |
); | |
}, | |
create: function() { | |
var e = this, | |
t = e._parent, | |
a = _._muted || e._muted || e._parent._muted ? 0 : e._volume; | |
return ( | |
t._webAudio | |
? ((e._node = | |
void 0 === _.ctx.createGain | |
? _.ctx.createGainNode() | |
: _.ctx.createGain()), | |
e._node.gain.setValueAtTime(a, _.ctx.currentTime), | |
(e._node.paused = !0), | |
e._node.connect(_.masterGain)) | |
: ((e._node = new Audio()), | |
(e._errorFn = e._errorListener.bind(e)), | |
e._node.addEventListener('error', e._errorFn, !1), | |
(e._loadFn = e._loadListener.bind(e)), | |
e._node.addEventListener(_._canPlayEvent, e._loadFn, !1), | |
(e._node.src = t._src), | |
(e._node.preload = 'auto'), | |
(e._node.volume = a * _.volume()), | |
e._node.load()), | |
e | |
); | |
}, | |
reset: function() { | |
var e = this, | |
t = e._parent; | |
return ( | |
(e._muted = t._muted), | |
(e._loop = t._loop), | |
(e._volume = t._volume), | |
(e._rate = t._rate), | |
(e._seek = 0), | |
(e._rateSeek = 0), | |
(e._paused = !0), | |
(e._ended = !0), | |
(e._sprite = '__default'), | |
(e._id = ++_._counter), | |
e | |
); | |
}, | |
_errorListener: function() { | |
var e = this; | |
e._parent._emit( | |
'loaderror', | |
e._id, | |
e._node.error ? e._node.error.code : 0 | |
), | |
e._node.removeEventListener('error', e._errorFn, !1); | |
}, | |
_loadListener: function() { | |
var e = this._parent; | |
(e._duration = Math.ceil(10 * this._node.duration) / 10), | |
0 === Object.keys(e._sprite).length && | |
(e._sprite = { __default: [0, 1e3 * e._duration] }), | |
'loaded' !== e._state && | |
((e._state = 'loaded'), e._emit('load'), e._loadQueue()), | |
this._node.removeEventListener(_._canPlayEvent, this._loadFn, !1); | |
} | |
}; | |
var l = {}, | |
i = function(t) { | |
var e = t._src; | |
if (l[e]) return (t._duration = l[e].duration), void c(t); | |
if (/^data:[^;]+;base64,/.test(e)) { | |
for ( | |
var a = atob(e.split(',')[1]), r = new Uint8Array(a.length), n = 0; | |
n < a.length; | |
++n | |
) | |
r[n] = a.charCodeAt(n); | |
u(r.buffer, t); | |
} else { | |
var o = new XMLHttpRequest(); | |
o.open('GET', e, !0), | |
(o.withCredentials = t._xhrWithCredentials), | |
(o.responseType = 'arraybuffer'), | |
(o.onload = function() { | |
var e = (o.status + '')[0]; | |
'0' === e || '2' === e || '3' === e | |
? u(o.response, t) | |
: t._emit( | |
'loaderror', | |
null, | |
'Failed loading audio file with status: ' + o.status + '.' | |
); | |
}), | |
(o.onerror = function() { | |
t._webAudio && | |
((t._html5 = !0), | |
(t._webAudio = !1), | |
(t._sounds = []), | |
delete l[e], | |
t.load()); | |
}), | |
s(o); | |
} | |
}, | |
s = function(t) { | |
try { | |
t.send(); | |
} catch (e) { | |
t.onerror(); | |
} | |
}, | |
u = function(e, t) { | |
_.ctx.decodeAudioData( | |
e, | |
function(e) { | |
e && 0 < t._sounds.length && ((l[t._src] = e), c(t, e)); | |
}, | |
function() { | |
t._emit('loaderror', null, 'Decoding audio data failed.'); | |
} | |
); | |
}, | |
c = function(e, t) { | |
t && !e._duration && (e._duration = t.duration), | |
0 === Object.keys(e._sprite).length && | |
(e._sprite = { __default: [0, 1e3 * e._duration] }), | |
'loaded' !== e._state && | |
((e._state = 'loaded'), e._emit('load'), e._loadQueue()); | |
}, | |
d = function() { | |
try { | |
'undefined' != typeof AudioContext | |
? (_.ctx = new AudioContext()) | |
: 'undefined' != typeof webkitAudioContext | |
? (_.ctx = new webkitAudioContext()) | |
: (_.usingWebAudio = !1); | |
} catch (e) { | |
_.usingWebAudio = !1; | |
} | |
var e = /iP(hone|od|ad)/.test(_._navigator && _._navigator.platform), | |
t = | |
_._navigator && | |
_._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), | |
a = t ? parseInt(t[1], 10) : null; | |
if (e && a && a < 9) { | |
var r = /safari/.test( | |
_._navigator && _._navigator.userAgent.toLowerCase() | |
); | |
((_._navigator && _._navigator.standalone && !r) || | |
(_._navigator && !_._navigator.standalone && !r)) && | |
(_.usingWebAudio = !1); | |
} | |
_.usingWebAudio && | |
((_.masterGain = | |
void 0 === _.ctx.createGain | |
? _.ctx.createGainNode() | |
: _.ctx.createGain()), | |
_.masterGain.gain.setValueAtTime(_._muted ? 0 : 1, _.ctx.currentTime), | |
_.masterGain.connect(_.ctx.destination)), | |
_._setup(); | |
}; | |
'function' == typeof define && | |
define.amd && | |
define([], function() { | |
return { Howler: _, Howl: t }; | |
}), | |
'undefined' != typeof exports && ((exports.Howler = _), (exports.Howl = t)), | |
'undefined' != typeof window | |
? ((window.HowlerGlobal = e), | |
(window.Howler = _), | |
(window.Howl = t), | |
(window.Sound = o)) | |
: 'undefined' != typeof global && | |
((global.HowlerGlobal = e), | |
(global.Howler = _), | |
(global.Howl = t), | |
(global.Sound = o)); | |
})(), | |
(function(s) { | |
'use strict'; | |
var e, | |
l = {}, | |
i = s(), | |
a = null, | |
u = { | |
isMobile: | |
((e = navigator.userAgent || navigator.vendor || window.opera), | |
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test( | |
e | |
) || | |
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( | |
e.substr(0, 4) | |
)), | |
formatTime: function(e, t) { | |
if ('number' != typeof e) return e; | |
var a = (t ? Math.floor : Math.round)(e), | |
r = a % 60, | |
n = ((a - r) % 3600) / 60, | |
o = (a - r - 60 * n) / 3600; | |
return ( | |
(o ? o + ':' : '') + | |
(o && n < 10 ? '0' + n : n) + | |
':' + | |
(r < 10 ? '0' + r : r) | |
); | |
}, | |
makeSeconds: function(e) { | |
if ('number' == typeof e) return e; | |
if (null == e) return 0; | |
for (var t = e.split(':').reverse(), a = 0, r = 0; r < t.length; r++) | |
a += t[r] * Math.pow(60, r); | |
return +a; | |
}, | |
getSkinName: function(e) { | |
var t = '', | |
a = e.attr('class'), | |
r = a ? a.indexOf('jouele-skin-') : -1; | |
return ( | |
0 < r && | |
(t = a.substr( | |
r + 12, | |
0 < a.indexOf(' ', r) ? a.indexOf(' ', r) : a.length | |
)), | |
t | |
); | |
}, | |
getFirstJouele: function() { | |
var e, | |
t = s('.jouele') | |
.add('.jouele-control') | |
.filter('.jouele_first:not(.jouele_broken)') | |
.eq(0); | |
if (0 === t.length) | |
for (var a = 0; a < s.Jouele.playlist.length; a++) { | |
for (var r = 0; r < s.Jouele.playlist[a].length; r++) | |
if ( | |
s.Jouele.playlist[a][r] instanceof n && | |
s.Jouele.playlist[a][r].getTrack() && | |
!s.Jouele.playlist[a][r].getTrack().player.isBroken | |
) { | |
e = s.Jouele.playlist[a][r]; | |
break; | |
} | |
if (e) break; | |
} | |
else e = t.data('jouele'); | |
return e; | |
}, | |
getEventPoint: function(e) { | |
var t, a; | |
return ( | |
(t = | |
e.originalEvent.touches && | |
0 < e.originalEvent.touches.length && | |
void 0 !== e.originalEvent.touches[0] && | |
e.originalEvent.touches[0].clientX | |
? e.originalEvent.touches[0].clientX | |
: e.originalEvent.changedTouches && | |
0 < e.originalEvent.changedTouches.length && | |
void 0 !== e.originalEvent.changedTouches[0] && | |
e.originalEvent.changedTouches[0].clientX | |
? e.originalEvent.changedTouches[0].clientX | |
: e.pageX), | |
(a = | |
Math.round( | |
1e4 * parseFloat(((t - i.offset().left) / i.width()) * 100) | |
) / 1e4) < 0 | |
? (a = 0) | |
: 100 < a && (a = 100), | |
a | |
); | |
}, | |
getInstance: function() { | |
return 0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() | |
? s.Jouele.history[0] | |
: u.getFirstJouele(); | |
}, | |
showWarning: function(e) { | |
var t = !1; | |
return ( | |
'undefined' != typeof console && | |
'function' == typeof console.warn && | |
(console.warn(e), (t = !0)), | |
t | |
); | |
}, | |
showError: function(e) { | |
var t = !1; | |
return ( | |
'undefined' != typeof console && | |
'function' == typeof console.error && | |
(console.error(e), (t = !0)), | |
t | |
); | |
} | |
}, | |
t = function(e) { | |
if ( | |
32 !== e.keyCode || | |
'INPUT' === e.target.nodeName || | |
'TEXTAREA' === e.target.nodeName || | |
'SELECT' === e.target.nodeName || | |
'OPTION' === e.target.nodeName || | |
'BUTTON' === e.target.nodeName || | |
(void 0 !== s(e.target).attr('contenteditable') && | |
'false' !== s(e.target).attr('contenteditable')) | |
) | |
return !0; | |
if ( | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() && | |
!s.Jouele.history[0].getTrack().player.isPaused && | |
(s.Jouele.history[0].getTrack().player.isPlaying || | |
null !== s.Jouele.history[0].getTrack().player.seekTime || | |
null !== s.Jouele.history[0].getTrack().player.seekPosition || | |
(s.Jouele.history[0].getTrack().player.isStarted && | |
!s.Jouele.history[0].getTrack().player.isLoaded)) | |
) { | |
if (!s.Jouele.options.pauseOnSpace) return !1; | |
s.Jouele.options.scrollOnSpace || e.preventDefault(), | |
s.Jouele.history[0].pause(); | |
} else { | |
if (!s.Jouele.options.playOnSpace) return !1; | |
if ( | |
(s.Jouele.options.scrollOnSpace || e.preventDefault(), | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack()) | |
) | |
s.Jouele.history[0].play(); | |
else { | |
var t = u.getFirstJouele(); | |
t && t instanceof n && t.play(); | |
} | |
} | |
}, | |
r = function(e) { | |
if (0 === i.length) return !0; | |
var t, | |
a = i.parents('.jouele').eq(0); | |
if ( | |
!( | |
(t = a.data('jouele') | |
? a.data('jouele') | |
: a.data('jouele-destroyed') | |
? a.data('jouele-destroyed') | |
: u.getInstance()) instanceof n | |
) || | |
!t.getTrack() || | |
t.getTrack().player.isBroken | |
) | |
return (i = s()), !0; | |
if (i.data('jouele-destroyed')) | |
return t.$container.removeData('jouele-destroyed'), (i = s()), !0; | |
switch (e.type) { | |
case 'mouseup': | |
case 'touchend': | |
case 'touchcancel': | |
(t.getTrack().player.seekingOnTimeline.isSeeking = !1), | |
(t.getTrack().player.seekingOnTimeline.seekingInstance = !1); | |
var r = u.getEventPoint(e); | |
(t.getTrack().player.seekingOnTimeline.seekingPosition = r), | |
t.seek.call(t, r), | |
(t.getTrack().player.seekingOnTimeline.seekingPosition = null), | |
(i = s()); | |
break; | |
case 'mousemove': | |
case 'touchmove': | |
if (!t.getTrack().player.seekingOnTimeline.isSeeking) return !0; | |
(t.getTrack().player.seekingOnTimeline.seekingPosition = u.getEventPoint( | |
e | |
)), | |
d.updateState.call(t); | |
} | |
}, | |
c = { | |
show: function(e) { | |
var t = this; | |
if ( | |
t.getTrack().player.preloaderTimeout || | |
t.getTrack().player.seekingOnTimeline.isSeeking | |
) | |
return t; | |
var a = e || 50; | |
return ( | |
(t.getTrack().player.preloaderTimeout = setTimeout(function() { | |
if ( | |
t.getTrack().player.seekingOnTimeline.isSeeking || | |
t.isPaused() | |
) | |
return (t.getTrack().player.preloaderTimeout = null), t; | |
d.updateControlsClasses.call(t, 'jouele-is-buffering', 'add'); | |
}, a)), | |
t | |
); | |
}, | |
hide: function() { | |
var e = this; | |
return ( | |
e.getTrack().player.preloaderTimeout && | |
(clearTimeout(e.getTrack().player.preloaderTimeout), | |
(e.getTrack().player.preloaderTimeout = null), | |
d.updateControlsClasses.call(e, 'jouele-is-buffering', 'remove')), | |
e | |
); | |
} | |
}, | |
d = { | |
updateLength: function() { | |
var e = this, | |
t = null, | |
a = null; | |
return ( | |
e.getTotalTime() | |
? (t = e.getTotalTime()) | |
: e.getOptions().length && (t = e.getOptions().length), | |
e.getTrack().player.howler | |
? (a = e.getTrack().player.howler.duration()) | |
: 0 < u.makeSeconds(e.getOptions().length) && | |
(a = u.makeSeconds(e.getOptions().length)), | |
a && | |
(null !== t && | |
a !== t && | |
e.getTrack().player.seekTime === t && | |
(e.getTrack().player.seekTime = | |
Math.round(100 * parseFloat(a)) / 100), | |
(e.getTrack().player.totalTime = a), | |
(e.getTrack().player.remainingTime = | |
a - e.getTrack().player.elapsedTime)), | |
e.getTrack().player.isBroken && | |
((e.getTrack().player.totalTime = 0), | |
(e.getTrack().player.elapsedTime = 0), | |
(e.getTrack().player.remainingTime = 0)), | |
d.updateTimeDisplay.call(e), | |
e | |
); | |
}, | |
updateTitle: function() { | |
var e = this, | |
t = s.trim(e.getOptions().title); | |
t && | |
e.getTrack() && | |
t !== e.getTrack().player.title && | |
(e.getTrack().player.title = t); | |
for (var a = 0; a < e.getTrack().instances.length; a++) | |
e.getTrack() | |
.instances[a].$container.find('.jouele-info-control-text') | |
.html(e.getTrack().player.title); | |
return e; | |
}, | |
updateTimeline: function() { | |
var e = this, | |
t = 0; | |
!e.getTrack() || e.getTrack().player.isBroken | |
? (t = 0) | |
: null !== e.getTrack().player.seekingOnTimeline.seekingPosition | |
? (t = e.getTrack().player.seekingOnTimeline.seekingPosition) | |
: null !== e.getTrack().player.seekPosition | |
? (t = e.getTrack().player.seekPosition) | |
: null !== e.getTrack().player.seekTime | |
? e.getTotalTime() && | |
(t = e.getTrack().player.seekTime / (e.getTotalTime() / 100)) | |
: e.getTotalTime() && | |
(t = | |
e.getTrack().player.howler.seek() / (e.getTotalTime() / 100)), | |
(t = Math.round(100 * parseFloat(t)) / 100); | |
for (var a = 0; a < e.getTrack().instances.length; a++) | |
e | |
.getTrack() | |
.instances[a].$container.find('.jouele-progress-line-lift') | |
.css('left', t + '%'), | |
e | |
.getTrack() | |
.instances[a].$container.find('.jouele-progress-line-bar_play') | |
.css('width', t + '%'); | |
return e; | |
}, | |
updateTimeDisplay: function(a) { | |
var r = this, | |
n = '', | |
o = '', | |
e = '', | |
t = null; | |
return ( | |
r.getTrack() | |
? (r.getTotalTime() || r.getTrack().player.isBroken | |
? ((n = u.makeSeconds(r.getTotalTime())), | |
(t = | |
null !== | |
r.getTrack().player.seekingOnTimeline.seekingPosition | |
? r.getTotalTime() * | |
(r.getTrack().player.seekingOnTimeline | |
.seekingPosition / | |
100) | |
: null)) | |
: r.getOptions().length && | |
((n = u.makeSeconds(r.getOptions().length)), | |
(t = | |
null !== | |
r.getTrack().player.seekingOnTimeline.seekingPosition | |
? u.makeSeconds(r.getOptions().length) * | |
(r.getTrack().player.seekingOnTimeline | |
.seekingPosition / | |
100) | |
: null)), | |
(o = | |
null !== t | |
? u.makeSeconds(t) | |
: null !== r.getTrack().player.seekPosition | |
? r.getTotalTime() | |
? u.makeSeconds( | |
Math.round( | |
100 * | |
parseFloat( | |
r.getTotalTime() * | |
(r.getTrack().player.seekPosition / 100) | |
) | |
) / 100 | |
) | |
: 0 | |
: null !== r.getTrack().player.seekTime | |
? u.makeSeconds(r.getTrack().player.seekTime) | |
: r.getTrack().player.isPlaying | |
? null !== r.getTrack().player.howler && | |
'unloaded' !== r.getTrack().player.howler.state() && | |
'number' == typeof r.getTrack().player.howler.seek() | |
? u.makeSeconds(r.getTrack().player.howler.seek()) | |
: 0 | |
: u.makeSeconds( | |
null !== r.getTrack().player.howler && | |
'unloaded' !== r.getTrack().player.howler.state() && | |
'number' == typeof r.getTrack().player.howler.seek() | |
? r.getTrack().player.howler.seek() | |
: 0 | |
)), | |
(o = r.getTrack().player.isBroken | |
? 0 | |
: Math.round(100 * o) / 100), | |
(e = n ? Math.round(100 * (n - u.makeSeconds(o))) / 100 : 0), | |
(r.getTrack().player.remainingTime = e), | |
(r.getTrack().player.elapsedTime = o)) | |
: (n = 0), | |
0 < r.$container.length && | |
(n || | |
!r.getTrack() || | |
r.getTrack().player.isStarted || | |
r.getTrack().player.seekTime || | |
r.getTrack().player.seekingOnTimeline.isSeeking) && | |
(function() { | |
for ( | |
var e = | |
u.makeSeconds(u.formatTime(o, !a)) > n | |
? u.formatTime(o, !0) | |
: u.formatTime(o, !a), | |
t = 0; | |
t < r.getTrack().instances.length; | |
t++ | |
) | |
r.getTrack().player.isBroken | |
? (r | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-time__total' | |
) | |
.text(''), | |
r | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-time__current' | |
) | |
.text('')) | |
: (r | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-time__total' | |
) | |
.text(n ? u.formatTime(n, !0) : ''), | |
r | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-time__current' | |
) | |
.text(n ? u.formatTime(e) : '')); | |
})(), | |
r | |
); | |
}, | |
updateState: function(e) { | |
return ( | |
d.updateTimeline.call(this), d.updateTimeDisplay.call(this, e), this | |
); | |
}, | |
updateControlsClasses: function(e, t) { | |
for (var a = this, r = 0; r < a.getTrack().instances.length; r++) | |
'add' === t | |
? (a.getTrack().instances[r].$container.addClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find( | |
'.jouele-info-control-button-icon_play' | |
) | |
.addClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find('.jouele-progress-line') | |
.addClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find( | |
'.jouele-progress-line-bar_play' | |
) | |
.addClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find('.jouele-progress-line-lift') | |
.addClass(e)) | |
: 'remove' === t && | |
(a.getTrack().instances[r].$container.removeClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find( | |
'.jouele-info-control-button-icon_play' | |
) | |
.removeClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find('.jouele-progress-line') | |
.removeClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find( | |
'.jouele-progress-line-bar_play' | |
) | |
.removeClass(e), | |
a | |
.getTrack() | |
.instances[r].$container.find('.jouele-progress-line-lift') | |
.removeClass(e)); | |
return a; | |
} | |
}, | |
o = { | |
createJouele: function(e, t) { | |
var a = e.attr('href'), | |
r = e.html(); | |
return ( | |
new n( | |
e, | |
s.extend( | |
{}, | |
{ | |
length: 0, | |
repeat: !1, | |
hideTimelineOnPause: !1, | |
skin: '', | |
href: '', | |
title: '', | |
spaceControl: !1, | |
pauseOnSpace: !1, | |
playOnSpace: !1, | |
scrollOnSpace: !0 | |
}, | |
t, | |
e.data(), | |
{ skin: u.getSkinName(e), href: a, title: r } | |
) | |
), | |
e | |
); | |
}, | |
createTrack: function(e) { | |
return { | |
player: { | |
href: e, | |
howler: null, | |
title: '', | |
isPlaying: !1, | |
isPlayed: !1, | |
isPaused: !1, | |
isLoaded: !1, | |
isStarted: !1, | |
isBroken: !1, | |
isEnded: !1, | |
totalTime: 0, | |
elapsedTime: 0, | |
remainingTime: 0, | |
updateStateTimer: null, | |
seekTime: null, | |
seekPosition: null, | |
preloaderTimeout: null, | |
seekingOnTimeline: { | |
isSeeking: !1, | |
seekingPosition: null, | |
seekingInstance: !1 | |
}, | |
callbacks: {}, | |
play: function() { | |
var e = this; | |
if (!(e instanceof n)) { | |
if (!(0 < s.Jouele.tracks[e.href].instances.length)) | |
return !1; | |
e = s.Jouele.tracks[e.href].instances[0]; | |
} | |
return p.play.call(e); | |
}, | |
pause: function() { | |
var e = this; | |
if (!(e instanceof n)) { | |
if (!(0 < s.Jouele.tracks[e.href].instances.length)) | |
return !1; | |
e = s.Jouele.tracks[e.href].instances[0]; | |
} | |
return p.pause.call(e); | |
}, | |
playFrom: function(e) { | |
var t = this; | |
if (!(t instanceof n)) { | |
if (!(0 < s.Jouele.tracks[t.href].instances.length)) | |
return !1; | |
t = s.Jouele.tracks[t.href].instances[0]; | |
} | |
return p.playFrom.call(t, e); | |
}, | |
seek: function(e) { | |
var t = this; | |
if (!(t instanceof n)) { | |
if (!(0 < s.Jouele.tracks[t.href].instances.length)) | |
return !1; | |
t = s.Jouele.tracks[t.href].instances[0]; | |
} | |
return p.seek.call(t, e); | |
} | |
}, | |
instances: [] | |
}; | |
}, | |
getPlaylistIndex: function() { | |
var a, | |
r = this; | |
if ( | |
(s('.jouele-playlist') | |
.add( | |
'.jouele:not(.jouele-playlist .jouele):not(.jouele_destroyed)' | |
) | |
.each(function(e, t) { | |
if ( | |
(0 < r.getPlaylistDOM().length && | |
r.getPlaylistDOM()[0] === t) || | |
(r.$link && r.$link[0] === t) | |
) | |
return (a = e), !1; | |
}), | |
0 < r.getPlaylistDOM().length) | |
) { | |
var n, | |
o, | |
e, | |
t = r | |
.getPlaylistDOM() | |
.find('.jouele[href]:not(.jouele_destroyed)'), | |
l = r.getPlaylistDOM().find('.jouele_inited'); | |
if ( | |
(t.add(l).each(function(e, t) { | |
var a = s(t); | |
if ( | |
(a.hasClass('jouele_inited') && (o = a.data('jouele')), | |
t === r.$link[0]) | |
) | |
return (n = e), !1; | |
}), | |
s.isArray(s.Jouele.playlist[a])) | |
) | |
if ( | |
s.Jouele.playlist[a][0].getPlaylistDOM()[0] !== | |
r.getPlaylistDOM()[0] | |
) | |
s.Jouele.playlist.splice(a, 0, [r]); | |
else { | |
for (var i = 0; i < s.Jouele.playlist[a].length; i++) | |
if (s.Jouele.playlist[a][i] === o) { | |
e = i; | |
break; | |
} | |
void 0 === s.Jouele.playlist[a][e + 1] | |
? 0 === n | |
? s.Jouele.playlist[a].splice(0, 0, r) | |
: s.Jouele.playlist[a].push(r) | |
: s.Jouele.playlist[a].splice(e + 1, 0, r); | |
} | |
else s.Jouele.playlist[a] = [r]; | |
} else s.Jouele.playlist.splice(a, 0, [r]); | |
return a; | |
}, | |
checkOptions: function(e) { | |
var t = e; | |
return ( | |
parseInt(e.length) || (t.length = 0), | |
'boolean' != typeof e.repeat && (t.repeat = !1), | |
'boolean' != typeof e.hideTimelineOnPause && | |
(t.hideTimelineOnPause = !1), | |
'boolean' != typeof e.spaceControl && (t.spaceControl = !1), | |
'boolean' != typeof e.pauseOnSpace && (t.pauseOnSpace = !1), | |
'boolean' != typeof e.playOnSpace && (t.playOnSpace = !1), | |
'boolean' != typeof e.scrollOnSpace && (t.scrollOnSpace = !0), | |
t | |
); | |
}, | |
checkNewOptions: function(e, t) { | |
var a = t; | |
return ( | |
'' === s.trim(t.title) && (a.title = e.title), | |
parseInt(t.length) || (a.length = e.length), | |
'boolean' != typeof t.repeat && (a.repeat = e.repeat), | |
'boolean' != typeof t.hideTimelineOnPause && | |
(a.hideTimelineOnPause = e.hideTimelineOnPause), | |
'boolean' != typeof t.spaceControl && | |
(a.spaceControl = e.spaceControl), | |
'boolean' != typeof t.pauseOnSpace && | |
(a.pauseOnSpace = e.pauseOnSpace), | |
'boolean' != typeof t.playOnSpace && | |
(a.playOnSpace = e.playOnSpace), | |
'boolean' != typeof t.scrollOnSpace && | |
(a.scrollOnSpace = e.scrollOnSpace), | |
a | |
); | |
}, | |
checkGlobalOptions: function() { | |
var e = this; | |
return ( | |
(e.getOptions().pauseOnSpace || | |
e.getPlaylistDOM().attr('data-pause-on-space')) && | |
(s.Jouele.options.pauseOnSpace = !0), | |
(e.getOptions().playOnSpace || | |
e.getPlaylistDOM().attr('data-play-on-space')) && | |
(s.Jouele.options.playOnSpace = !0), | |
(e.getOptions().scrollOnSpace && | |
!e.getPlaylistDOM().attr('data-scroll-on-space')) || | |
(s.Jouele.options.scrollOnSpace = !1), | |
(e.getOptions().spaceControl || | |
e.getPlaylistDOM().attr('data-space-control')) && | |
((s.Jouele.options.pauseOnSpace = !0), | |
(s.Jouele.options.playOnSpace = !0), | |
(s.Jouele.options.scrollOnSpace = !1)), | |
e | |
); | |
}, | |
initInnerControls: function() { | |
var a = this; | |
return ( | |
a.$container | |
.find('.jouele-progress-line') | |
.off('mousedown.jouele touchstart.jouele') | |
.on('mousedown.jouele touchstart.jouele', function(e) { | |
if ('mousedown' === e.type && 1 !== e.which) return !1; | |
if (!(a instanceof n)) return !1; | |
var t = s(this); | |
if ( | |
((a.getTrack().player.seekingOnTimeline.isSeeking = !0), | |
(a.getTrack().player.seekingOnTimeline.seekingInstance = t), | |
(i = t), | |
!a.getTrack().player.howler) | |
) { | |
if (!p.createHowler.call(a)) return p.breakPlayer.call(a), !1; | |
a.getTrack().player.howler.load(), | |
(a.getTrack().player.isStarted = !0); | |
} | |
(a.getTrack().player.seekingOnTimeline.seekingPosition = u.getEventPoint( | |
e | |
)), | |
d.updateState.call(a), | |
d.updateTitle.call(a); | |
}) | |
.addClass('jouele-is-available'), | |
a.$container | |
.find( | |
'.jouele-info-control-button-icon_play, .jouele-info-control-text' | |
) | |
.off('click.jouele') | |
.on('click.jouele', function() { | |
if (!(a instanceof n)) return !1; | |
a.getTrack().player.isPaused | |
? a.getTrack().player.play.call(a) | |
: a.getTrack().player.isStarted | |
? a.getTrack().player.pause.call(a) | |
: a.getTrack().player.play.call(a); | |
}) | |
.addClass('jouele-is-available') | |
.hover(function() { | |
a.$container | |
.find('.jouele-svg-color') | |
.toggleClass('is-hover_under_text'); | |
}), | |
a.$container.addClass('jouele-is-available'), | |
a | |
); | |
}, | |
createJoueleDOM: function() { | |
var e = this, | |
t = s(document.createElement('div')), | |
a = s(document.createElement('div')), | |
r = s(document.createElement('div')); | |
return ( | |
(e.$container = t | |
.data('jouele', e) | |
.addClass( | |
'jouele jouele_inited' + | |
(!0 === e.$link.data('first') ? ' jouele_first' : '') + | |
(e.getOptions().hideTimelineOnPause | |
? ' jouele_timeline_hide' | |
: '') + | |
(e.getOptions().skin | |
? ' jouele-skin-' + e.getOptions().skin | |
: '') | |
)), | |
e.$container.append( | |
a.addClass('jouele-info').append([ | |
s(document.createElement('div')) | |
.addClass('jouele-info-time') | |
.append( | |
`<div class="loader" style="float: right; width: 18px; cursor: pointer; margin-left: 9px;"><a href="${e.getHref()}" style="text-decoration: none; border: none; color: #212121" download="${ | |
e.getOptions().title | |
}.mp3"><svg class="feather feather-download-cloud" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <polyline points="8 17 12 21 16 17"/> <line x1="12" x2="12" y1="12" y2="21"/> <path d="M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29"/></svg></a></div>` | |
) | |
.append( | |
s(document.createElement('div')) | |
.addClass('jouele-info-time__current') | |
.text(e.getTotalTime() ? '' : ''), | |
s(document.createElement('div')) | |
.addClass('jouele-info-time__total') | |
.text( | |
e.getTotalTime() | |
? u.formatTime(u.makeSeconds(e.getTotalTime()), !0) | |
: '' | |
) /* ! */ | |
), | |
s(document.createElement('div')) | |
.addClass('jouele-info-control') | |
.append( | |
s(document.createElement('div')) | |
.addClass('jouele-info-control-button') | |
.append( | |
s(document.createElement('span')) | |
.addClass( | |
'jouele-info-control-button-icon jouele-info-control-button-icon_unavailable' | |
) | |
.html( | |
'<svg class="jouele-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><g class="jouele-svg-color"><path d="m4 6.7l3.8 3.7-3.8 2.1z"/><path d="m.2 2.2l.6-.5 11 11.1-.5.5z"/><path d="m4 4.3v-.8l8 4.5-2.7 1.5z"/></g></svg>' | |
), | |
s(document.createElement('a')) | |
.attr('href', e.getHref()) | |
.addClass('jouele-info-control-link jouele-hidden') | |
.append( | |
s(document.createElement('span')) | |
.addClass( | |
'jouele-info-control-button-icon jouele-info-control-button-icon_play jouele-hidden' | |
) | |
.html( | |
'<svg class="jouele-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16"><path class="jouele-svg-color s-li" d="m4 3.5l8 4.5-8 4.5z"/></svg>' | |
) | |
) | |
), | |
s(document.createElement('div')).addClass( | |
'jouele-info-control-text s-li' | |
) | |
) | |
]), | |
r.addClass('jouele-progress').append( | |
s(document.createElement('div')) | |
.addClass('jouele-progress-line') | |
.append( | |
s(document.createElement('div')) | |
.addClass('jouele-progress-line-bar_base') | |
.css('cursor', 'pointer'), | |
s(document.createElement('div')).addClass( | |
'jouele-progress-line-bar_play' | |
), | |
s(document.createElement('div')).addClass( | |
'jouele-progress-line-lift jouele-hidden' | |
) | |
) | |
) | |
), | |
e | |
); | |
}, | |
insertJoueleDOM: function() { | |
var e = this; | |
return ( | |
0 < e.$container.length && | |
(e.$container.find('.jouele-hidden').removeClass('jouele-hidden'), | |
e.$container | |
.find('.jouele-info-control-button-icon_unavailable') | |
.addClass('jouele-hidden'), | |
e.$container | |
.find('.jouele-info-control-link') | |
.off('click.jouele') | |
.on('click.jouele', function(e) { | |
e.preventDefault(); | |
}), | |
e.$link.after(e.$container), | |
e.$link.detach()), | |
e | |
); | |
}, | |
findPlaylistInDOM: function() { | |
return this.$link.parents('.jouele-playlist').eq(0); | |
}, | |
pushToHistory: function() { | |
var e = this; | |
return ( | |
(0 === s.Jouele.history.length || | |
s.Jouele.history[0].getTrack() !== e.getTrack() || | |
(s.Jouele.history[0].getTrack() === e.getTrack() && | |
e.getTrack().player.isPaused && | |
s.Jouele.history[0] !== e)) && | |
s.Jouele.history.unshift(e), | |
e | |
); | |
} | |
}, | |
p = { | |
createHowler: function() { | |
var t = this; | |
return ( | |
(t.getTrack().player.howler = new Howl({ | |
src: [t.getHref()], | |
format: ['mp3'], | |
html5: !0, | |
preload: !1, | |
loop: t.getOptions().repeat, | |
onloaderror: function() { | |
function e() { | |
t.getTrack().player.isPlayed | |
? t.pause() | |
: p.breakPlayer.call(t); | |
} | |
t.getTrack() && | |
('object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onloaderror | |
? !1 !== t.getTrack().player.callbacks.onloaderror() && e() | |
: e()); | |
}, | |
onload: function() { | |
t.getTrack() && | |
('object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onload | |
? !1 !== t.getTrack().player.callbacks.onload() && | |
p.Events.onLoad.call(t) | |
: p.Events.onLoad.call(t)); | |
}, | |
onplay: function() { | |
t.getTrack() && | |
('object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onplay | |
? !1 !== t.getTrack().player.callbacks.onplay() && | |
p.Events.onPlay.call(t) | |
: p.Events.onPlay.call(t)); | |
}, | |
onpause: function() { | |
t.getTrack() && | |
('object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onpause | |
? !1 !== t.getTrack().player.callbacks.onpause() && | |
p.Events.onPause.call(t) | |
: p.Events.onPause.call(t)); | |
}, | |
onseek: function() { | |
if (t.getTrack()) { | |
if ( | |
t.getTrack().player.howler._sounds[0]._ended && | |
0 === t.getTrack().player.howler.seek() | |
) | |
return !0; | |
if (t.getTrack().player.isEnded) return !0; | |
'object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onseek | |
? !1 !== t.getTrack().player.callbacks.onseek() && | |
p.Events.onSeek.call(t) | |
: p.Events.onSeek.call(t); | |
} | |
}, | |
onend: function() { | |
t.getTrack() && | |
('object' == typeof t.getTrack().player.callbacks && | |
'function' == typeof t.getTrack().player.callbacks.onend | |
? !1 !== t.getTrack().player.callbacks.onend() && | |
p.Events.onEnd.call(t) | |
: p.Events.onEnd.call(t)); | |
} | |
})), | |
d.updateTimeDisplay.call(t), | |
t | |
); | |
}, | |
play: function() { | |
var e = this; | |
if (e.getTrack().player.isPlaying) return e; | |
if ( | |
(0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() && | |
s.Jouele.history[0].getTrack().player !== e.getTrack().player && | |
(s.Jouele.history[0].getTrack().player.isPaused || | |
s.Jouele.history[0].pause()), | |
!e.getTrack().player.howler && !p.createHowler.call(e)) | |
) | |
return p.breakPlayer.call(e), e; | |
if ( | |
(o.pushToHistory.call(e), | |
p.Interface.makeInterfacePlay.call(e), | |
e.getTrack().player.isLoaded | |
? e.getTrack().player.howler.play() | |
: e.getTrack().player.isStarted || | |
e.getTrack().player.howler.load(), | |
(e.getTrack().player.isStarted = !0), | |
c.show.call(e), | |
e.getTrack().player.howler._sounds.length < 1) | |
) | |
return e; | |
var t = | |
Math.round( | |
1e3 * | |
(Math.ceil(e.getTrack().player.howler.seek()) - | |
e.getTrack().player.howler.seek()) | |
) / 1e3; | |
return ( | |
setTimeout(function() { | |
d.updateState.call(e, !0), | |
e.getTrack().player.updateStateTimer && | |
clearInterval(e.getTrack().player.updateStateTimer), | |
e.getTrack().player.isPaused || | |
(e.getTrack().player.updateStateTimer = setInterval( | |
function() { | |
d.updateState.call(e, !0); | |
}, | |
1e3 | |
)); | |
}, 1e3 * t), | |
e | |
); | |
}, | |
pause: function() { | |
var e = this; | |
return ( | |
!e.getTrack().player.howler || | |
e.getTrack().player.isPaused || | |
(c.hide.call(e), | |
p.Interface.makeInterfacePause.call(e), | |
(e.getTrack().player.seekingOnTimeline.isSeeking = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingInstance = !1), | |
e.getTrack().player.howler && e.getTrack().player.howler.pause()), | |
e | |
); | |
}, | |
playFrom: function(e) { | |
var t = this; | |
if (!e) return t; | |
if ( | |
(t.getTotalTime() && | |
u.makeSeconds(e) > t.getTotalTime() && | |
(e = t.getTotalTime()), | |
u.makeSeconds(e) < 0 && (e = 0), | |
(t.getTrack().player.seekTime = u.makeSeconds(e)), | |
d.updateState.call(t), | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() && | |
s.Jouele.history[0].getTrack().player !== t.getTrack().player && | |
(s.Jouele.history[0].getTrack().player.isPaused || | |
s.Jouele.history[0].pause()), | |
!t.getTrack().player.howler && !p.createHowler.call(t)) | |
) | |
return p.breakPlayer.call(t), t; | |
if ( | |
((t.getTrack().player.isEnded = !1), | |
t.getTrack().player.isLoaded && t.getTotalTime() | |
? (c.show.call(t, 200), | |
t.getTrack().player.howler.seek(t.getTrack().player.seekTime)) | |
: (t.getTrack().player.isStarted || | |
t.getTrack().player.howler.load(), | |
c.show.call(t)), | |
o.pushToHistory.call(t), | |
p.Interface.makeInterfacePlay.call(t), | |
(t.getTrack().player.isStarted = !0), | |
t.getTrack().player.isLoaded) | |
) { | |
var a, | |
r = t.getTrack().player.howler.seek(); | |
setTimeout(function() { | |
t.getTrack() && | |
r === t.getTrack().player.howler.seek() && | |
c.show.call(t), | |
(a = setInterval(function() { | |
(t.getTrack() && r === t.getTrack().player.howler.seek()) || | |
(c.hide.call(t), clearTimeout(a)); | |
}, 50)); | |
}, 100), | |
d.updateState.call(t); | |
} | |
return t; | |
}, | |
seek: function(e) { | |
var t = this, | |
a = Math.round(100 * parseFloat(e)) / 100; | |
if (isNaN(a)) return t; | |
if ( | |
(100 < a && (a = 100), | |
a < 0 && (a = 0), | |
(t.getTrack().player.seekPosition = a), | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() && | |
s.Jouele.history[0].getTrack().player !== t.getTrack().player && | |
(s.Jouele.history[0].getTrack().player.isPaused || | |
s.Jouele.history[0].pause()), | |
!t.getTrack().player.howler && !p.createHowler.call(t)) | |
) | |
return p.breakPlayer.call(t), !1; | |
if ( | |
(o.pushToHistory.call(t), | |
p.Interface.makeInterfacePlay.call(t), | |
(t.getTrack().player.isEnded = !1), | |
t.getTotalTime() | |
? ((t.getTrack().player.seekTime = | |
Math.round(100 * parseFloat(t.getTotalTime() * (a / 100))) / | |
100), | |
t.getTrack().player.isLoaded | |
? (t | |
.getTrack() | |
.player.howler.seek(t.getTrack().player.seekTime), | |
t.getTrack().player.seekTime === t.getTotalTime() | |
? (setTimeout(function() { | |
t.getTrack().player.howler._playLock && | |
t | |
.getTrack() | |
.player.howler._emit.call( | |
t.getTrack().player.howler, | |
'seek', | |
t.getTrack().player.howler._sounds[0] | |
); | |
}, 500), | |
c.show.call(t, 500)) | |
: c.show.call(t, 200)) | |
: (t.getTrack().player.isStarted || | |
t.getTrack().player.howler.load(), | |
c.show.call(t))) | |
: (t.getTrack().player.isStarted || | |
t.getTrack().player.howler.load(), | |
c.show.call(t)), | |
(t.getTrack().player.isStarted = !0), | |
d.updateState.call(t), | |
t.getTrack().player.isLoaded && | |
t.getTrack().player.seekTime !== t.getTotalTime()) | |
) { | |
var r, | |
n = t.getTrack().player.howler.seek(); | |
setTimeout(function() { | |
t.getTrack() && | |
n === t.getTrack().player.howler.seek() && | |
c.show.call(t), | |
(r = setInterval(function() { | |
(t.getTrack() && n === t.getTrack().player.howler.seek()) || | |
(c.hide.call(t), clearTimeout(r)); | |
}, 50)); | |
}, 100), | |
d.updateState.call(t); | |
} | |
return t; | |
}, | |
playNext: function() { | |
var e = this; | |
if (e.getOptions().repeat) | |
return e.getTrack().player.isPlayed || e.play(), e; | |
/*if (u.isMobile) return e; */ | |
for (var t = 0; t < s.Jouele.history[0].getPlaylist().length; t++) | |
if ( | |
s.Jouele.history[0].getPlaylist()[t].getTrack() === | |
s.Jouele.history[0].getTrack() | |
) { | |
if ( | |
s.Jouele.history[0].getPlaylist()[t + 1] instanceof n && | |
s.Jouele.history[0].getPlaylist()[t + 1].getTrack() === | |
s.Jouele.history[0].getTrack() | |
) | |
continue; | |
break; | |
} | |
return ( | |
s.Jouele.history[0].getPlaylist()[t + 1] instanceof n | |
? s.Jouele.history[0].getPlaylist()[t + 1].play() | |
: s.Jouele.history[0].getPlaylistDOM().data('repeat') && | |
s.Jouele.history[0].getPlaylist()[0] instanceof n && | |
s.Jouele.history[0].getPlaylist()[0].play(), | |
e | |
); | |
}, | |
destroy: function() { | |
var e = this; | |
e.getTrack().player.seekingOnTimeline.seekingInstance[0] === | |
e.$container.find('.jouele-progress-line')[0] && | |
((e.getTrack().player.seekingOnTimeline.isSeeking = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingInstance = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingPosition = null), | |
e.getTrack().player.isLoaded || d.updateState.call(e), | |
!e.getTrack().player.isStarted || | |
e.getTrack().player.isPlaying || | |
e.getTrack().player.isPlayed || | |
p.Interface.makeInterfacePause.call(e)); | |
for (var t = 0; t < e.getTrack().instances.length; t++) | |
if (e.getTrack().instances[t] === e) { | |
e.getTrack().instances.splice(t, 1); | |
break; | |
} | |
0 < i.length && | |
i | |
.parents('.jouele') | |
.eq(0) | |
.data('jouele') === e && | |
e.$container.data('jouele-destroyed', e), | |
e.$container.find('.jouele-info-control-link').off('click.jouele'), | |
e.$container | |
.find('.jouele-info-control-button-icon_play') | |
.off('click.jouele'), | |
e.$container | |
.find('.jouele-progress-line') | |
.off('mousedown.jouele touchstart.jouele'); | |
for (var a = 0; a < e.getPlaylist().length; a++) | |
if (e.getPlaylist()[a] === e) { | |
e.getPlaylist().splice(a, 1); | |
break; | |
} | |
if (0 === e.getPlaylist().length) | |
for (var r = 0; r < s.Jouele.playlist.length; r++) | |
if (s.Jouele.playlist[r] === e.getPlaylist()) { | |
s.Jouele.playlist.splice(r, 1); | |
break; | |
} | |
function n() { | |
clearInterval(e.getTrack().player.updateStateTimer), | |
(e.getTrack().player.updateStateTimer = null), | |
c.hide.call(e), | |
0 === e.getTrack().instances.length && | |
(e.getTrack().player.howler && | |
(e.getTrack().player.howler.unload(), | |
(e.getTrack().player.howler = void 0)), | |
delete l[e.getTrack().player.href]); | |
} | |
if (e.getTrack().player.isPlaying) { | |
var o = e.getTrack().player.callbacks.onpause; | |
(e.getTrack().player.callbacks.onpause = function() { | |
return o && o(), n(), !1; | |
}), | |
e.pause(); | |
} else n(); | |
return ( | |
e.$container | |
.after(e.$link) | |
.removeData('jouele') | |
.detach(), | |
e.$link.removeData('jouele').addClass('jouele_destroyed'), | |
e.$link | |
); | |
}, | |
breakPlayer: function() { | |
var e = this; | |
(e.getTrack().player.isBroken = !0), | |
clearInterval(e.getTrack().player.updateStateTimer), | |
(e.getTrack().player.updateStateTimer = null), | |
c.hide.call(e), | |
d.updateTimeDisplay.call(e); | |
for (var t = 0; t < e.getTrack().instances.length; t++) | |
0 < e.getTrack().instances[t].$container.length && | |
(e.getTrack().instances[t].$container.addClass('jouele_broken'), | |
e | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-control-button-icon_unavailable' | |
) | |
.removeClass('jouele-hidden'), | |
e | |
.getTrack() | |
.instances[t].$container.find('.jouele-info-control-link') | |
.addClass('jouele-hidden') | |
.off('click.jouele'), | |
e | |
.getTrack() | |
.instances[t].$container.find( | |
'.jouele-info-control-button-icon_play' | |
) | |
.off('click.jouele'), | |
e | |
.getTrack() | |
.instances[t].$container.find('.jouele-progress-line') | |
.off('mousedown.jouele touchstart.jouele')); | |
for ( | |
d.updateControlsClasses.call(e, 'jouele-is-available', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-loaded', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-paused', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-buffering', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-within', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-playing', 'remove'), | |
d.updateControlsClasses.call(e, 'jouele-is-unavailable', 'add'), | |
t = 0; | |
t < s.Jouele.history.length; | |
t++ | |
) | |
s.Jouele.history[t].getTrack() === e.getTrack() && | |
(s.Jouele.history.splice(t, 1), t--); | |
for (var a = 0; a < s.Jouele.playlist.length; a++) { | |
for (var r = 0; r < s.Jouele.playlist[a].length; r++) | |
s.Jouele.playlist[a][r] instanceof n && | |
s.Jouele.playlist[a][r].getTrack() === e.getTrack() && | |
(s.Jouele.playlist[a].splice(r, 1), r--); | |
0 === s.Jouele.playlist[a].length && | |
(s.Jouele.playlist.splice(a, 1), a--); | |
} | |
return ( | |
d.updateState.call( | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() | |
? s.Jouele.history[0] | |
: e | |
), | |
d.updateLength.call( | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() | |
? s.Jouele.history[0] | |
: e | |
), | |
d.updateTitle.call( | |
0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() | |
? s.Jouele.history[0] | |
: e | |
), | |
e | |
); | |
}, | |
Interface: { | |
makeInterfacePause: function() { | |
var e = this; | |
return ( | |
(e.getTrack().player.isPaused = !0), | |
(e.getTrack().player.isPlaying = !1), | |
d.updateControlsClasses.call(e, 'jouele-is-paused', 'add'), | |
d.updateControlsClasses.call(e, 'jouele-is-playing', 'remove'), | |
e | |
); | |
}, | |
makeInterfacePlay: function() { | |
return ( | |
(this.getTrack().player.isPaused = !1), | |
d.updateControlsClasses.call(this, 'jouele-is-paused', 'remove'), | |
d.updateControlsClasses.call(this, 'jouele-is-playing', 'add'), | |
this | |
); | |
} | |
}, | |
Events: { | |
onPause: function() { | |
var e = this; | |
return ( | |
e.getTrack().player.updateStateTimer && | |
(clearInterval(e.getTrack().player.updateStateTimer), | |
(e.getTrack().player.updateStateTimer = null)), | |
p.Interface.makeInterfacePause.call(e), | |
(e.getTrack().player.seekingOnTimeline.isSeeking = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingInstance = !1), | |
(e.getTrack().player.seekTime = null), | |
(e.getTrack().player.seekPosition = null), | |
(a = null), | |
e | |
); | |
}, | |
onPlay: function() { | |
var e = this; | |
if ( | |
(0 < s.Jouele.history.length && | |
void 0 !== s.Jouele.history[0].getTrack() && | |
s.Jouele.history[0].getTrack().player !== e.getTrack().player && | |
(s.Jouele.history[0].getTrack().player.isPaused || | |
s.Jouele.history[0].pause()), | |
e.getTrack().player.isPaused) | |
) | |
return ( | |
e.getTrack().player.howler && | |
e.getTrack().player.howler.pause(), | |
e | |
); | |
p.Interface.makeInterfacePlay.call(e), | |
(e.getTrack().player.isPlaying = !0), | |
(e.getTrack().player.isPlayed = !0), | |
(e.getTrack().player.seekTime = null), | |
(e.getTrack().player.seekPosition = null), | |
(e.getTrack().player.isEnded = !1), | |
d.updateControlsClasses.call(e, 'jouele-is-playing', 'add'), | |
d.updateState.call(e), | |
c.hide.call(e); | |
var t = | |
Math.round( | |
1e3 * | |
(Math.ceil(e.getTrack().player.howler.seek()) - | |
e.getTrack().player.howler.seek()) | |
) / 1e3; | |
return ( | |
setTimeout(function() { | |
d.updateState.call(e, !0), | |
e.getTrack().player.updateStateTimer && | |
clearInterval(e.getTrack().player.updateStateTimer), | |
e.getTrack().player.isPaused || | |
(e.getTrack().player.updateStateTimer = setInterval( | |
function() { | |
e.getTrack().player.howler && | |
(a && a === e.getTrack().player.howler.seek() | |
? c.show.call(e, 200) | |
: c.hide.call(e), | |
(a = e.getTrack().player.howler.seek())), | |
d.updateState.call(e, !0); | |
}, | |
1e3 | |
)); | |
}, 1e3 * t), | |
e | |
); | |
}, | |
onSeek: function() { | |
var e = this; | |
if ( | |
null !== e.getTrack().player.seekTime && | |
e.getTrack().player.seekTime !== e.getTotalTime() && | |
100 !== e.getTrack().player.seekPosition && | |
0.01 < | |
Math.abs( | |
e.getTrack().player.howler.seek() - | |
e.getTrack().player.seekTime | |
) | |
) | |
return p.seek.call(e), e; | |
if ( | |
e.getTrack().player.isPaused && | |
e.getTrack().player.howler && | |
!e.getTrack().player.howler._sounds[0]._ended | |
) | |
return ( | |
e.getTrack().player.howler && | |
!e.getTrack().player.howler._sounds[0]._paused && | |
e.getTrack().player.howler.pause(), | |
e | |
); | |
if ( | |
(e.getTrack().player.isPlaying || c.show.call(e, 200), | |
e.getTrack().player.updateStateTimer && | |
clearInterval(e.getTrack().player.updateStateTimer), | |
e.getTrack().player.seekTime === e.getTotalTime()) | |
) | |
return ( | |
e.getTrack().player.isPlayed | |
? e.getTrack().player.isPlaying && | |
(e.getTrack().player.howler._sounds[0]._paused = !1) | |
: (e.getTrack().player.isPlayed = !0), | |
e | |
.getTrack() | |
.player.howler._ended.call( | |
e.getTrack().player.howler, | |
e.getTrack().player.howler._sounds[0] | |
), | |
e | |
); | |
d.updateState.call(e); | |
var t = | |
Math.round( | |
1e3 * | |
(Math.ceil(e.getTrack().player.howler.seek()) - | |
e.getTrack().player.howler.seek()) | |
) / 1e3; | |
return ( | |
setTimeout(function() { | |
d.updateState.call(e, !0), | |
e.getTrack().player.updateStateTimer && | |
clearInterval(e.getTrack().player.updateStateTimer), | |
e.getTrack().player.isPaused || | |
(e.getTrack().player.updateStateTimer = setInterval( | |
function() { | |
e.getTrack().player.howler && | |
(a && a === e.getTrack().player.howler.seek() | |
? c.show.call(e, 200) | |
: c.hide.call(e), | |
(a = e.getTrack().player.howler.seek())), | |
d.updateState.call(e, !0); | |
}, | |
1e3 | |
)); | |
}, 1e3 * t), | |
e.getTrack().player.isPlaying && | |
((e.getTrack().player.seekTime = null), | |
(e.getTrack().player.seekPosition = null)), | |
void 0 === s.Jouele.history[0].getTrack() || | |
s.Jouele.history[0].getTrack().player !== e.getTrack().player || | |
(e.getTrack().player.isPlaying && | |
e.getTrack().player.isStarted) || | |
p.play.call(e), | |
e | |
); | |
}, | |
onEnd: function() { | |
var e = this; | |
return ( | |
c.hide.call(e), | |
clearInterval(e.getTrack().player.updateStateTimer), | |
(e.getTrack().player.updateStateTimer = null), | |
(e.getTrack().player.seekingOnTimeline.seekingPosition = 100), | |
d.updateState.call(e), | |
e.getOptions().repeat || p.Interface.makeInterfacePause.call(e), | |
(e.getTrack().player.seekingOnTimeline.isSeeking = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingInstance = !1), | |
(e.getTrack().player.seekingOnTimeline.seekingPosition = null), | |
(e.getTrack().player.seekTime = null), | |
(e.getTrack().player.seekPosition = null), | |
(e.getTrack().player.isEnded = !0), | |
p.playNext.call(e), | |
e | |
); | |
}, | |
onLoad: function() { | |
var e = this; | |
return ( | |
(e.getTrack().player.isLoaded = !0), | |
d.updateLength.call(e), | |
d.updateControlsClasses.call(e, 'jouele-is-loaded', 'add'), | |
e.getTrack().player.seekingOnTimeline.isSeeking || | |
(0 < e.getTrack().player.seekPosition | |
? e.getTrack().player.isPaused | |
? ((e.getTrack().player.seekTime = | |
Math.round( | |
100 * | |
parseFloat( | |
e.getTotalTime() * | |
(e.getTrack().player.seekPosition / 100) | |
) | |
) / 100), | |
e | |
.getTrack() | |
.player.howler.seek(e.getTrack().player.seekTime)) | |
: p.seek.call(e, e.getTrack().player.seekPosition) | |
: e.getTrack().player.seekTime | |
? e.getTrack().player.isPaused | |
? e | |
.getTrack() | |
.player.howler.seek(e.getTrack().player.seekTime) | |
: p.playFrom.call(e, e.getTrack().player.seekTime) | |
: e.getTrack().player.isPaused || p.play.call(e)), | |
d.updateState.call(e), | |
e | |
); | |
} | |
} | |
}, | |
n = function(e, t) { | |
void 0 === l[t.href] && (l[t.href] = o.createTrack(t.href)), | |
(t = o.checkOptions(t)); | |
var a = s(), | |
r = []; | |
return ( | |
(this.getOptions = function() { | |
return t; | |
}), | |
(this.getHref = function() { | |
return this.getOptions().href; | |
}), | |
(this.getTrack = function() { | |
return l[this.getHref()]; | |
}), | |
(this.getTitle = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.title | |
: ''; | |
}), | |
(this.getTotalTime = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.totalTime | |
: 0; | |
}), | |
(this.getElapsedTime = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.elapsedTime | |
: 0; | |
}), | |
(this.getRemainingTime = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.remainingTime | |
: 0; | |
}), | |
(this.getPlaylistDOM = function() { | |
return a; | |
}), | |
(this.getPlaylist = function() { | |
return r; | |
}), | |
(this.isPlaying = function() { | |
return ( | |
void 0 !== this.getTrack() && this.getTrack().player.isPlaying | |
); | |
}), | |
(this.isPlayed = function() { | |
return ( | |
void 0 !== this.getTrack() && this.getTrack().player.isPlayed | |
); | |
}), | |
(this.isPaused = function() { | |
return ( | |
void 0 !== this.getTrack() && this.getTrack().player.isPaused | |
); | |
}), | |
(this.isBroken = function() { | |
return ( | |
void 0 !== this.getTrack() && this.getTrack().player.isBroken | |
); | |
}), | |
(this.setOptions = function(e) { | |
return ( | |
void 0 !== this.getTrack() || | |
((t = s.extend(t, o.checkNewOptions(t, e))), | |
this.getTrack().player.howler && | |
this.getTrack().player.howler.loop(t.repeat), | |
d.updateTitle.call(this)), | |
this | |
); | |
}), | |
(this.play = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.play.call(this) | |
: this; | |
}), | |
(this.pause = function() { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.pause.call(this) | |
: this; | |
}), | |
(this.playFrom = function(e) { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.playFrom.call(this, e) | |
: this; | |
}), | |
(this.seek = function(e) { | |
return void 0 !== this.getTrack() | |
? this.getTrack().player.seek.call(this, e) | |
: this; | |
}), | |
(this.destroy = function() { | |
return void 0 !== this.getTrack() ? p.destroy.call(this) : this; | |
}), | |
(this.$container = s()), | |
(this.$link = e), | |
(a = o.findPlaylistInDOM.call(this)), | |
(r = s.Jouele.playlist[o.getPlaylistIndex.call(this)]), | |
this.getTrack().instances.push(this), | |
d.updateLength.call(this), | |
o.createJoueleDOM.call(this), | |
d.updateTitle.call(this), | |
o.checkGlobalOptions.call(this), | |
o.initInnerControls.call(this), | |
o.insertJoueleDOM.call(this), | |
e.removeClass('jouele_destroyed'), | |
e.data('jouele', this), | |
this | |
); | |
}; | |
(s.Jouele = { | |
tracks: l, | |
playlist: [], | |
history: [], | |
options: { pauseOnSpace: !1, playOnSpace: !1, scrollOnSpace: !0 }, | |
helpers: { formatTime: u.formatTime, makeSeconds: u.makeSeconds }, | |
version: '3.0.6-free' | |
}), | |
s(document) | |
.off('keydown.jouele') | |
.on('keydown.jouele', t), | |
s(document) | |
.off( | |
'mouseup.jouele touchend.jouele touchcancel.jouele mousemove.jouele touchmove.jouele' | |
) | |
.on( | |
'mouseup.jouele touchend.jouele touchcancel.jouele mousemove.jouele touchmove.jouele', | |
r | |
), | |
(s.fn.jouele = function(t) { | |
var a; | |
return 'undefined' == typeof Howl | |
? (u.showError( | |
'Please include `howler.js 2.0.9+` into your page — it is necessary for Jouele' | |
), | |
this) | |
: 1 === this.length && (a = this.data('jouele')) instanceof n | |
? 'string' == typeof t && | |
void 0 !== a[t] && | |
'function' == typeof a[t] && | |
'number' != typeof a[t].nodeType | |
? a[t].call(a) | |
: this | |
: this.each(function() { | |
var e = s(this); | |
return ( | |
(a = e.data('jouele')), | |
e.hasClass('jouele') | |
? e.attr('href') | |
? void (e.data('jouele') || o.createJouele(e, t)) | |
: (u.showError( | |
'Please add `href` attribute to this element and specify URL to mp3-file' | |
), | |
this) | |
: (u.showError('Please add `jouele` class to this element'), | |
this) | |
); | |
}); | |
}); | |
s(function() { | |
if ($('.container-jouele-player').length == 0) return false; | |
if (typeof playlist === 'object' && Object.keys(playlist).length !== 0) { | |
var elementForAlbumTitle = '<p>'; | |
for (var i in playlist) { | |
$(elementForAlbumTitle, { | |
class: 'header-title-jouele-player', | |
html: '<strong>' + playlist[i]['header'] + '</strong>' | |
}) | |
.appendTo('.container-jouele-player') | |
.after( | |
'<div class="wrapper-for-playlist-non-static playlist-eq_' + | |
i + | |
'"></div>' | |
); | |
for (var j = 0; j < playlist[i]['tracks'].length; j++) { | |
$('.wrapper-for-playlist-non-static:eq(' + [i] + ')').append( | |
'<p><a href="' + | |
playlist[i]['tracks'][j]['mp3'] + | |
'"class="jouele" data-length="' + | |
playlist[i]['tracks'][j]['duration'] + | |
'">' + | |
playlist[i]['tracks'][j]['title'] + | |
'</a></p>' | |
); | |
} | |
} | |
} | |
s('a.jouele[href]').jouele(); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment