Soundcloud app
This file has been truncated, but you can view the full file.
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
webpackJsonp([2], { | |
0: function(e, t, n) { | |
n(1220), e.exports = n(1187) | |
}, | |
6: function(e, t) { | |
e.exports = function() { | |
var e = []; | |
return e.toString = function() { | |
for (var e = [], t = 0; t < this.length; t++) { | |
var n = this[t]; | |
n[2] ? e.push("@media " + n[2] + "{" + n[1] + "}") : e.push(n[1]) | |
} | |
return e.join("") | |
}, e | |
} | |
}, | |
7: function(e, t, n) { | |
function i(e, t) { | |
for (var n = 0; n < e.length; n++) { | |
var i = e[n], | |
r = c[i.id]; | |
if (r) { | |
r.refs++; | |
for (var o = 0; o < r.parts.length; o++) r.parts[o](i.parts[o]); | |
for (; o < i.parts.length; o++) r.parts.push(s(i.parts[o], t)) | |
} else { | |
for (var a = [], o = 0; o < i.parts.length; o++) a.push(s(i.parts[o], t)); | |
c[i.id] = { | |
id: i.id, | |
refs: 1, | |
parts: a | |
} | |
} | |
} | |
} | |
function r(e) { | |
for (var t = [], n = {}, i = 0; i < e.length; i++) { | |
var r = e[i], | |
o = r[0], | |
s = r[1], | |
a = r[2], | |
l = r[3], | |
u = { | |
css: s, | |
media: a, | |
sourceMap: l | |
}; | |
n[o] ? n[o].parts.push(u) : t.push(n[o] = { | |
id: o, | |
parts: [u] | |
}) | |
} | |
return t | |
} | |
function o() { | |
var e = document.createElement("style"), | |
t = p(); | |
return e.type = "text/css", t.appendChild(e), e | |
} | |
function s(e, t) { | |
var n, i, r; | |
if (t.singleton) { | |
var s = g++; | |
n = f || (f = o()), i = l.bind(null, n, s, !1), r = l.bind(null, n, s, !0) | |
} else n = o(), i = u.bind(null, n), r = function() { | |
n.parentNode.removeChild(n) | |
}; | |
return i(e), | |
function(t) { | |
if (t) { | |
if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap) return; | |
i(e = t) | |
} else r() | |
} | |
} | |
function a(e, t, n) { | |
var i = ["/** >>" + t + " **/", "/** " + t + "<< **/"], | |
r = e.lastIndexOf(i[0]), | |
o = n ? i[0] + n + i[1] : ""; | |
if (e.lastIndexOf(i[0]) >= 0) { | |
var s = e.lastIndexOf(i[1]) + i[1].length; | |
return e.slice(0, r) + o + e.slice(s) | |
} | |
return e + o | |
} | |
function l(e, t, n, i) { | |
var r = n ? "" : i.css; | |
if (e.styleSheet) e.styleSheet.cssText = a(e.styleSheet.cssText, t, r); | |
else { | |
var o = document.createTextNode(r), | |
s = e.childNodes; | |
s[t] && e.removeChild(s[t]), s.length ? e.insertBefore(o, s[t]) : e.appendChild(o) | |
} | |
} | |
function u(e, t) { | |
var n = t.css, | |
i = t.media, | |
r = t.sourceMap; | |
if (r && "function" == typeof btoa) try { | |
n += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(r)) + " */", n = '@import url("data:stylesheet/css;base64,' + btoa(n) + '")' | |
} catch (o) {} | |
if (i && e.setAttribute("media", i), e.styleSheet) e.styleSheet.cssText = n; | |
else { | |
for (; e.firstChild;) e.removeChild(e.firstChild); | |
e.appendChild(document.createTextNode(n)) | |
} | |
} | |
var c = {}, | |
d = function(e) { | |
var t; | |
return function() { | |
return "undefined" == typeof t && (t = e.apply(this, arguments)), t | |
} | |
}, | |
h = d(function() { | |
return /msie 9\b/.test(window.navigator.userAgent.toLowerCase()) | |
}), | |
p = d(function() { | |
return document.head || document.getElementsByTagName("head")[0] | |
}), | |
f = null, | |
g = 0; | |
e.exports = function(e, t) { | |
t = t || {}, "undefined" == typeof t.singleton && (t.singleton = h()); | |
var n = r(e); | |
return i(n, t), | |
function(e) { | |
for (var o = [], s = 0; s < n.length; s++) { | |
var a = n[s], | |
l = c[a.id]; | |
l.refs--, o.push(l) | |
} | |
if (e) { | |
var u = r(e); | |
i(u, t) | |
} | |
for (var s = 0; s < o.length; s++) { | |
var l = o[s]; | |
if (0 === l.refs) { | |
for (var d = 0; d < l.parts.length; d++) l.parts[d](); | |
delete c[l.id] | |
} | |
} | |
} | |
} | |
}, | |
45: function(e, t, n) { | |
e.exports = n.p + "assets/images/statistics/jumpmonth-a98e52.png" | |
}, | |
48: function(e, t, n) { | |
"use strict"; | |
function i(e) { | |
return e && e.__esModule ? e : { | |
"default": e | |
} | |
} | |
function r(e) { | |
s["default"](e) | |
} | |
t.__esModule = !0, t.registerDefaultDecorators = r; | |
var o = n(2782), | |
s = i(o) | |
}, | |
49: function(e, t, n) { | |
"use strict"; | |
function i(e) { | |
return e && e.__esModule ? e : { | |
"default": e | |
} | |
} | |
function r(e) { | |
s["default"](e), l["default"](e), c["default"](e), h["default"](e), f["default"](e), m["default"](e), _["default"](e) | |
} | |
t.__esModule = !0, t.registerDefaultHelpers = r; | |
var o = n(2783), | |
s = i(o), | |
a = n(2784), | |
l = i(a), | |
u = n(2785), | |
c = i(u), | |
d = n(2786), | |
h = i(d), | |
p = n(2787), | |
f = i(p), | |
g = n(2788), | |
m = i(g), | |
v = n(2789), | |
_ = i(v) | |
}, | |
50: function(e, t, n) { | |
"use strict"; | |
t.__esModule = !0; | |
var i = n(4), | |
r = { | |
methodMap: ["debug", "info", "warn", "error"], | |
level: "info", | |
lookupLevel: function(e) { | |
if ("string" == typeof e) { | |
var t = i.indexOf(r.methodMap, e.toLowerCase()); | |
e = t >= 0 ? t : parseInt(e, 10) | |
} | |
return e | |
}, | |
log: function(e) { | |
if (e = r.lookupLevel(e), "undefined" != typeof console && r.lookupLevel(r.level) <= e) { | |
var t = r.methodMap[e]; | |
console[t] || (t = "log"); | |
for (var n = arguments.length, i = Array(n > 1 ? n - 1 : 0), o = 1; n > o; o++) i[o - 1] = arguments[o]; | |
console[t].apply(console, i) | |
} | |
} | |
}; | |
t["default"] = r, e.exports = t["default"] | |
}, | |
51: function(e, t, n) { | |
function i(e, t) { | |
return o.t(e, t.hash, { | |
comment: t.hash._comment, | |
context: t.hash._context | |
}) | |
} | |
function r(e) { | |
return o.t(s.cleanBlockText(e.fn()), e.hash, { | |
comment: e.hash._comment, | |
context: e.hash._context | |
}) | |
} | |
var o = n(52), | |
s = n(933); | |
e.exports = function() { | |
var e = arguments.length; | |
if (2 === e) return i.apply(this, arguments); | |
if (1 === e) return r.apply(this, arguments); | |
throw new Error("Invalid signature to t helper, expected 1 or 2 arguments, got " + e) | |
} | |
}, | |
53: function(e, t, n) { | |
var i = n(20), | |
r = n(539); | |
e.exports = function() { | |
return new i.SafeString(r.handlebarHelper.apply(this, arguments)) | |
} | |
}, | |
55: function(e, t, n) { | |
"use strict"; | |
var i = e.exports = new(n(259)); | |
n(958).applyTo(i), n(3).each({ | |
app_id: 1e3 * String(Date.now()).substr(-8) + Math.floor(1e3 * Math.random()), | |
app_version: null, | |
public_api_host: "https://api.soundcloud.com/", | |
api_v2_host: "https://api-v2.soundcloud.com/", | |
client_application_id: 46941, | |
client_id: "fDoItMDbsbZz8dY16ZzARCZmzgHBPotA", | |
eventlogger_tracking_url: "https://l9bjkkhaycw6f8f4.soundcloud.com", | |
experiments: null, | |
geoip: null, | |
fb_app_id: "19507961798", | |
google_client_id: "984739005367.apps.googleusercontent.com", | |
recaptcha_public_key: "6LeABsUSAAAAABLOEF92U0unfhlGLynYlhvJRFue", | |
adyen_url: "https://test.adyen.com/hpp/cse/js/7814235253800464.shtml", | |
playHistoryLength: 50, | |
maxComments: 200, | |
me: null, | |
mixi_api_key: "1403ed11563185e9cff6cfeedf4f2ecf77fa459e", | |
notifications: null, | |
notificationsUri: "wss://pushers.soundcloud.com/", | |
oauth_token: null, | |
preferFlashAudio: !0, | |
promotedContentServer: "https://promoted.soundcloud.com/promo", | |
promotedContentAccessToken: "web", | |
restoreToSound: null, | |
rollouts: null, | |
router: null, | |
songkick_api_key: "ZWsLr2h7FF5sHG54", | |
facebook_api_key: "a7309b9a9a85963579f7e8bcffd36d2a", | |
versionUpdateInterval: 36e5, | |
visualsQueueHost: "https://visuals-queue.soundcloud.com/visuals", | |
wisHost: "https://wis.sndcdn.com", | |
systemUserId: 193 | |
}, function(e, t) { | |
i.set(t, e, { | |
silent: !0 | |
}) | |
}), i.finalize() | |
}, | |
57: function(e, t, n) { | |
"use strict"; | |
var i, r, o = new(n(104))("broadcast"), | |
s = n(55).get("app_id"); | |
o.on("broadcast", function(e) { | |
var t = e.current; | |
t && t.appId !== s && r.call(a, t) | |
}); | |
var a = e.exports = n(3).assign({}, n(22).Events, { | |
broadcast: function(e, t) { | |
var n, s; | |
return "string" == typeof e ? (n = [].slice.call(arguments, 1), t = e, e = {}) : n = [].slice.call(arguments, 2), s = i(t, n), o.set("broadcast", s), e.excludeThis || r.call(this, s), this | |
} | |
}); | |
i = function(e, t) { | |
return { | |
type: e, | |
timestamp: Date.now(), | |
appId: s, | |
args: t | |
} | |
}, r = function(e) { | |
this.trigger.apply(this, ["broadcast:" + e.type].concat(e.args || [])) | |
} | |
}, | |
58: function(e, t, n) { | |
var i = n(62); | |
e.exports = function() { | |
var e = Array.prototype.slice.call(arguments, 0, -1); | |
return i.getRoute.apply(i, e) | |
} | |
}, | |
61: function(e, t, n) { | |
(function(t) { | |
"use strict"; | |
function i(e, t) { | |
return e.get ? e.get(t) : e[t] | |
} | |
function r(e, t) { | |
this.has(e) && this.set(e, Math.max(0, this.get(e) + (t ? 1 : -1))) | |
} | |
function o(e, t) { | |
r.call(this, e.isPrivate() ? "private_tracks_count" : "track_count", t) | |
} | |
function s(e) { | |
n(3).each({ | |
follow: e.onFollow, | |
like: e.onLikesChanged, | |
repost: e.onReposted, | |
comment: e.onComment, | |
destroy: e.onDeleteResource, | |
createPlaylist: e.onPlaylistCreate | |
}, function(t, i) { | |
e.listenTo(n(74), i + ":origin:user:" + e.id, t) | |
}) | |
} | |
function a(e) { | |
r.call(this, "followers_count", e.state) | |
} | |
function l() { | |
return { | |
product: { | |
id: p, | |
name: "" | |
}, | |
recurring: !1 | |
} | |
} | |
function u() { | |
return { | |
product: { | |
id: g, | |
name: "Free" | |
}, | |
recurring: !1 | |
} | |
} | |
function c() { | |
var e = this.isCPPEnabled() && this.get("cpp").rightsholder_links; | |
if (!e || !e.length) return !0; | |
var t = e[0].rightsholder_urn; | |
return n(3).every(e, { | |
rightsholder_urn: t | |
}) | |
} | |
function d() { | |
for (var e = arguments.length, t = Array(e), n = 0; e > n; n++) t[n] = arguments[n]; | |
return function() { | |
return t.some(this.get, this) | |
} | |
} | |
var h = n(73).productIds, | |
p = h.CONSUMER_SUBSCRIPTION_FREE, | |
f = h.CONSUMER_SUBSCRIPTION_HIGH_TIER, | |
g = h.CREATOR_SUBSCRIPTION_FREE, | |
m = [{ | |
emitter: n(74), | |
event: "follow", | |
getInstance: function(e, t) { | |
var n = t.target; | |
return e.id === n | |
}, | |
handler: a | |
}]; | |
e.exports = n(66).extend(n(954), n(955), n(956).withOptions({ | |
types: n(1784).user | |
}), n(254).withOptions({ | |
attr: "username" | |
}), n(253).withOptions({ | |
read: "avatar_url", | |
write: "avatar_data" | |
}), n(522), n(199).withOptions({ | |
events: m | |
}), { | |
resource_type: "user", | |
urnPrefix: "soundcloud:users", | |
saveFormat: "json", | |
saveWithWrapper: !1, | |
_connections: null, | |
setup: function() { | |
var e = this; | |
this.has("subscriptions") && !this.has("creator_subscriptions") && this.set("creator_subscriptions", this.get("subscriptions")), this.options.isMe && (this.id ? s(this) : this.once("change:id", function() { | |
s(e) | |
})) | |
}, | |
baseUrl: function() { | |
var e = this.id; | |
return e ? this.getEndpointUrl("user", { | |
id: e | |
}) : "you" === this.get("permalink") ? this.getEndpointUrl("me") : void 0 | |
}, | |
ownerUrl: function() { | |
return this.getEndpointUrl("userAsOwner", { | |
urn: this.getUrn() | |
}) | |
}, | |
getImageSaveUrl: function() { | |
return this.getEndpointUrl("userImageUpdate", { | |
id: this.id | |
}) | |
}, | |
ownerAttributes: ["default_tracks_feedable", "cpp", "downloads_disabled", "hidden_tracks_count", "blocked_tracks_count", "default_license", "primary_email", "primary_email_confirmed", "date_of_birth", "gender"], | |
parse: function(e) { | |
var t = n(3).clone(e); | |
return t.primary_email_confirmed = t.primary_email_confirmed !== !1, t.subscriptions && !t.creator_subscriptions && (t.creator_subscriptions = t.subscriptions), "undefined" == typeof t.country_code && "undefined" != typeof t.country && (t.country_code = n(85).countryToCode(t.country)), t | |
}, | |
onLikesChanged: function(e) { | |
r.call(this, "likes_count", e.state) | |
}, | |
onFollow: function(e) { | |
r.call(this, "followings_count", e.state) | |
}, | |
onReposted: function(e) { | |
r.call(this, "reposts_count", e.state) | |
}, | |
onComment: function(e) { | |
e.state && r.call(this, "comments_count", !0) | |
}, | |
onDeleteResource: function(e) { | |
var t = e.targetModel; | |
switch (t.resource_type) { | |
case "sound": | |
this.adjustUploadSeconds(t), this.owns("sound", t) && o.call(this, t, !1); | |
break; | |
case "comment": | |
this.owns("comment", t) && r.call(this, "comments_count", !1) | |
} | |
}, | |
onPlaylistCreate: function(e) { | |
var t = "private" === e.object.get("sharing") ? "private_playlists_count" : "playlist_count"; | |
this.set(t, (this.get(t) || 0) + 1) | |
}, | |
owns: function(e, t) { | |
void 0 === t && (t = e, e = t.resource_type); | |
var n = this.id; | |
if (!n) return !1; | |
switch (e) { | |
case "comment": | |
case "playlist": | |
case "sound": | |
return n === i(t, "user_id"); | |
case "user": | |
return n === i(t, "id"); | |
case "sound-upload-edit": | |
case "playlist-upload": | |
case "playlist-edit": | |
case "profile-settings": | |
return !0 | |
} | |
return !1 | |
}, | |
canDownload: function(e) { | |
return "sound" === e.resource_type && e.get("downloadable") && e.get("has_downloads_left") !== !1 | |
}, | |
getCountry: function() { | |
var e = this.get("country_code"); | |
return e ? n(85).codeToCountry(e) : this.get("country") | |
}, | |
getCountryCode: function() { | |
var e = this.get("country"); | |
return e ? n(85).countryToCode(e) : this.get("country_code") | |
}, | |
getPlan: function() { | |
return this.getCreatorSubscription().product.id | |
}, | |
getConsumerPlan: function() { | |
return this.getConsumerSubscription().product.id | |
}, | |
getPlanName: function() { | |
return this.getCreatorSubscription().product.name | |
}, | |
isCPPEnabled: function() { | |
return !!this.get("cpp") | |
}, | |
canRequestISRCGeneration: function() { | |
return this.getCPPOption("indie", !1) === !0 && this.hasMonetization() === !0 | |
}, | |
canBulkUploadAsPlaylist: function() { | |
return !this.isCPPEnabled() || c.call(this) | |
}, | |
hasOnlyOneRightsholderLink: function() { | |
return c.call(this) | |
}, | |
getCPPOption: function(e, t) { | |
var n = this.get("cpp"); | |
return null != (n && n.config && n.config[e]) ? n.config[e] : t | |
}, | |
canEditMonetization: function() { | |
return this.getCPPOption("can_edit_monetization", !0) | |
}, | |
canEditDownloadable: function() { | |
return this.getCPPOption("can_edit_downloadable", !0) | |
}, | |
canEditRssEnabled: function() { | |
return this.getCPPOption("can_edit_rss_enabled", !0) | |
}, | |
hasGeoblocking: function() { | |
return this.isCPPEnabled() || n(55).get("rollouts").get("geo_blocking_settings") | |
}, | |
hasMonetization: function() { | |
return this.getCPPOption("has_monetization_form") | |
}, | |
hasFullScheduling: function() { | |
return this.isCPPEnabled() || n(55).get("rollouts").get("scheduled_publishings") | |
}, | |
hasToPublicScheduling: function() { | |
return this.isCPPEnabled() || n(55).get("rollouts").get("scheduled_publishings_only_sunrise_to_public") | |
}, | |
hasAnyScheduling: function() { | |
return this.hasFullScheduling() || this.hasToPublicScheduling() | |
}, | |
hasMonthlyPlan: function() { | |
return this.getCreatorSubscription().recurring | |
}, | |
hasCreatorSubHug: function() { | |
var e = this.get("creator_subscription"); | |
return !(!e || !e.hug) | |
}, | |
isPremium: function() { | |
var e = this.getPlan(); | |
return e && e !== g | |
}, | |
hasHighTier: function() { | |
return this.getConsumerPlan() === f | |
}, | |
hasProPlanLevel: function() { | |
return 1 === this.getPerk("planLevel") | |
}, | |
getConsumerSubscription: function() { | |
return this.get("consumer_subscription") || l() | |
}, | |
getCreatorSubscription: function() { | |
var e = this.get("creator_subscription"), | |
t = this.get("creator_subscriptions"); | |
return e ? e : t && t[0] ? t[0] : u() | |
}, | |
getPerk: function(e) { | |
return n(1762).get(this.getPlan(), this.getConsumerPlan(), e) | |
}, | |
getPermalink: function() { | |
return this.get("permalink_url").replace(/^https?:.+?\w\//, "/") | |
}, | |
isMe: function() { | |
return this === n(55).get("me") && !!this.id | |
}, | |
isSystemUser: function() { | |
return this.id === n(55).get("systemUserId") | |
}, | |
hasConnection: function(e) { | |
var i = this, | |
r = n(56).defer(), | |
o = this.isMe(); | |
return this._connections || !o ? r.resolve(o && this._connections.indexOf(e) > -1) : t.ajax({ | |
url: this.getEndpointUrl("meConnections"), | |
dataType: "json" | |
}).done(function(t) { | |
i._connections = t.map(function(e) { | |
return e.type | |
}), r.resolve(i._connections.indexOf(e) > -1) | |
}).fail(r.resolve.bind(r, !1)), r | |
}, | |
getNumTracks: function(e) { | |
var t = this.get("track_count") || 0, | |
n = this.get("private_tracks_count") || 0, | |
i = this.get("blocked_tracks_count") || 0, | |
r = this.get("hidden_tracks_count") || 0; | |
switch (e) { | |
case "public": | |
return t; | |
case "private": | |
return n; | |
case "hidden": | |
return r; | |
case "blocked": | |
return i; | |
default: | |
return t + n + r + i | |
} | |
}, | |
getNumPlaylists: function(e) { | |
var t = this.get("playlist_count") || 0, | |
n = this.get("private_playlists_count") || 0; | |
switch (e) { | |
case "public": | |
return t; | |
case "private": | |
return n; | |
default: | |
return t + n | |
} | |
}, | |
hasPlaylists: d("playlist_count", "private_playlists_count"), | |
hasLikes: d("likes_count", "public_favorites_count"), | |
hasFollowings: d("followings_count"), | |
hasPublicSounds: d("track_count", "playlist_count", "reposts_count"), | |
hasTracks: d("track_count", "private_tracks_count"), | |
hasOwnSounds: d("track_count", "private_tracks_count", "playlist_count", "private_playlists_count"), | |
hasSounds: d("track_count", "private_tracks_count", "playlist_count", "private_playlists_count", "reposts_count"), | |
adjustUploadSeconds: function(e, t) { | |
var n, i, r, o = e.get("duration"); | |
o && (n = Math.round(o / 1e3) * (t ? -1 : 1), i = this.getUploadSecondsLeft() + n, r = this.getUploadSecondsUsed() - n, this.setUploadSeconds(i, r)) | |
}, | |
setUploadSeconds: function(e, t) { | |
var i = n(3).clone(this.get("quota")); | |
i && (i.upload_seconds_used = t, i.unlimited_upload_quota || (i.upload_seconds_left = e), this.set("quota", i)) | |
}, | |
getUploadSecondsLeft: function() { | |
var e = this.get("quota"); | |
return e ? e.unlimited_upload_quota ? 1 / 0 : e.upload_seconds_left : void 0 | |
}, | |
getUploadSecondsUsed: function() { | |
var e = this.get("quota"); | |
return e ? e.upload_seconds_used : 0 | |
}, | |
getUploadSeconds: function() { | |
var e = this.getUploadSecondsLeft(); | |
return e === 1 / 0 ? e : e + this.getUploadSecondsUsed() | |
}, | |
hasUnlimitedUpload: function() { | |
return this.getUploadSecondsLeft() === 1 / 0 | |
}, | |
getUploadMinutesLeft: function() { | |
var e = this.getUploadSecondsLeft(); | |
return (0 > e ? Math.floor : Math.ceil)(e / 60) | |
}, | |
getUploadMinutesUsed: function() { | |
return Math.round(this.getUploadSecondsUsed() / 60) | |
}, | |
isOverQuota: function() { | |
return this.getUploadSecondsLeft() < 0 | |
}, | |
getRSSFeedUrl: function() { | |
return "http://feeds.soundcloud.com/users/" + this.getUrn() + "/sounds.rss" | |
} | |
}, { | |
normalize: function(e) { | |
return e.avatar_url && (e.avatar_url = e.avatar_url.replace("http:", "https:").replace(/\?.*/, "")), e | |
}, | |
resolve: function(e) { | |
return "you" === e ? n(56).resolve(n(55).get("me")) : n(66)._resolve(this, e, function(t) { | |
return t.hasPermalink(e) | |
}) | |
} | |
}) | |
}).call(t, n(1)) | |
}, | |
62: function(e, t, n) { | |
(function(t) { | |
"use strict"; | |
function i(e, i) { | |
var r, o; | |
this.currentLayout && (e !== this.currentLayout && this.currentLayout.dispose(), n(57).trigger("layout:beforeChange", this._currentLayoutInfo)), this.currentLayout = e, o = this._currentLayoutInfo = e.getChangeEventData(i), r = t("#content"), e.render(), r.children()[0] !== e.el && r.empty()[0].appendChild(e.el), n(57).trigger("layout:change", o) | |
} | |
function r(e) { | |
return e._navigationBlocks.filter(o).map(function(e) { | |
return e.callback | |
}).filter(n(3).identity).reduce(function(e, t) { | |
return t(e) !== !1 && e | |
}, !0) | |
} | |
function o(e) { | |
return !e.condition || e.condition() | |
} | |
function s() { | |
return n(98).pushState ? window.location.href : "https://" + window.location.hostname + "/" + window.location.hash.replace(/^[#\/]/, "") | |
} | |
function a(e, t) { | |
("popstate" !== t.type || r(e)) && n(22).History.prototype.checkUrl.call(this, t) | |
} | |
var l, u, c, d = 300, | |
h = e.exports = n(22).Router.extend({ | |
currentLayout: null, | |
_currentLayoutInfo: null, | |
_navigationBlocks: null, | |
_navCount: 0, | |
initialize: function() { | |
this._navigationBlocks = [], n(3).bindAll(this, "onBeforeUnload", "detachCurrentLayout"), n(22).history.checkUrl = a.bind(n(22).history, this) | |
}, | |
setRoutes: function(e, t) { | |
var n = this; | |
l = e, u = t, c = l.slice(0).reverse(), e.forEach(function(e) { | |
var t = e.route, | |
i = e.name, | |
r = e.handler; | |
n.route(t, i, r) | |
}) | |
}, | |
setLoader: function(e) { | |
this.loader = e | |
}, | |
reload: function() { | |
this.match(window.location.href.replace(/^https?:\/\/[^\/]+\//, "")) | |
}, | |
addNavigationBlock: function(e, i, r) { | |
var o, s = n(3).uniqueId(); | |
return o = this._navigationBlocks.unshift({ | |
id: s, | |
exitSiteMessage: e, | |
callback: i, | |
condition: r | |
}), 1 === o && t(window).on("beforeunload", this.onBeforeUnload), s | |
}, | |
removeNavigationBlock: function(e) { | |
var n, i = this._navigationBlocks; | |
for (n = i.length; n--;) | |
if (i[n].id === e) { | |
i.splice(n, 1); | |
break | |
} | |
i.length || t(window).off("beforeunload", this.onBeforeUnload) | |
}, | |
isNavigationBlocked: function() { | |
return this._navigationBlocks.some(o) | |
}, | |
onBeforeUnload: function() { | |
var e = n(3).find(this._navigationBlocks, o); | |
return e && e.exitSiteMessage | |
}, | |
navigateToRoute: function(e, t, n) { | |
var i, r = [e]; | |
t && t.length && (r = r.concat(t)), i = h.getRoute.apply(h, r), this.navigate(i, n) | |
}, | |
navigate: function(e, t) { | |
r(this) && (t && t.hard ? window.location.href = e : n(22).Router.prototype.navigate.call(this, e, t)) | |
}, | |
match: function(e) { | |
return n(22).history.loadUrl(e) | |
}, | |
getUrlInfo: function(e) { | |
var t, i, r, o = n(63).parse(e); | |
return o.path ? (t = o.path.substring(1), r = n(3).find(c, function(e) { | |
return e.route.test(t) | |
}), r && (i = { | |
name: r.name, | |
params: this._extractParameters(r.route, t) | |
}), i) : void 0 | |
}, | |
getLocation: function() { | |
return s() | |
}, | |
apply: function(e, t) { | |
var r, o, s = this, | |
a = "layouts/" + e; | |
t = t || {}, ++this._navCount, this.setupDeferred && this.setupDeferred.reject(), this.setupDeferred = o = n(56).defer(), r = window.setTimeout(this.detachCurrentLayout, d), this.loader.loadLayout(a).always(window.clearTimeout.bind(window, r)).done(function(n) { | |
if ("rejected" !== o.state()) { | |
var r = s.currentLayout instanceof n ? s.currentLayout : new n; | |
r.setArgs(t), s.setupDeferred = r.setup(t).done(i.bind(s, r, e, t)) | |
} | |
}) | |
}, | |
notImplemented: function(e) { | |
var t = s(); | |
e && (t = e(t)), window.open(t), window.history.go(-1) | |
}, | |
isLoggedIn: function() { | |
return n(64).isLoggedIn() | |
}, | |
getRolloutValue: function(e) { | |
return n(55).get("rollouts").get(e) | |
}, | |
getExperimentValue: function(e, t) { | |
return n(55).get("experiments").get(e, t) | |
}, | |
getCurrentUserPermalink: function() { | |
return n(55).get("me").get("permalink") | |
}, | |
getQueryParams: function(e) { | |
return n(63).getQueryParams(e) | |
}, | |
getQueryString: function(e) { | |
return n(63).getQueryString(e) | |
}, | |
getLayoutInfo: function() { | |
return this._currentLayoutInfo | |
}, | |
getRouteInfo: function(e) { | |
return n(3).find(l, function(t) { | |
return t.name === e | |
}) | |
}, | |
getNavCount: function() { | |
return this._navCount | |
}, | |
unauthenticated: function() { | |
n(59).trackAuthEvent(n(105).initiate, { | |
target: "implicit:navigate" | |
}); | |
var e = n(63).parse(window.location.href).relative; | |
this.navigateToRoute("signin", e, { | |
replace: !0, | |
trigger: !0 | |
}) | |
}, | |
detachCurrentLayout: function() { | |
this.currentLayout && this.currentLayout.$el.detach() | |
} | |
}, { | |
getRoute: function(e) { | |
var t = u[e]; | |
if (t) { | |
for (var n = arguments.length, i = Array(n > 1 ? n - 1 : 0), r = 1; n > r; r++) i[r - 1] = arguments[r]; | |
return t.apply(this, i) | |
} | |
}, | |
includeSecretTokenForSound: function(e) { | |
var t = n(55).get("me"); | |
return !(!e.secret_token || t.owns("sound", e)) | |
}, | |
includeSecretTokenForPlaylist: function(e) { | |
var t = n(55).get("me"); | |
return !(!e.secret_token || t.owns("playlist", e)) | |
}, | |
removeFragmentParams: function() { | |
if (n(98).pushState) { | |
for (var e = window.location.href, t = e, i = arguments.length, r = Array(i), o = 0; i > o; o++) r[o] = arguments[o]; | |
t = r.length ? r.reduce(function(e, t) { | |
return n(63).removeFragmentParam(t, e) | |
}, e) : n(63).modify(e, { | |
fragment: null | |
}), t !== e && window.history.replaceState(null, null, t) | |
} | |
} | |
}) | |
}).call(t, n(1)) | |
}, | |
65: function(e, t, n) { | |
"use strict"; | |
function i() { | |
this._visuals || (this._visuals = new(n(897))(null, { | |
resource_id: this.id | |
})), this._visuals.reset(this.get("visuals"), { | |
parse: !0 | |
}), this._visuals.lastFetchTime = Date.now() | |
} | |
function r() { | |
var e = !this.isBlocked() && this._streamsExist; | |
e !== this._playable && (this._playable = e, this.trigger("change:playable", e)) | |
} | |
function o(e) { | |
return e && (e.currentMetadata = n(68).getCurrentMetadata()), e | |
} | |
var s = n(3).constant(1), | |
a = function() { | |
return this | |
}, | |
l = n(3).constant(void 0), | |
u = .25, | |
c = "BLOCK", | |
d = "SNIP", | |
h = "MONETIZE", | |
p = "ALLOW", | |
f = function(e, t) { | |
var n = t.target, | |
i = t.targetType; | |
return e.id === n && "sound" === i | |
}, | |
g = [{ | |
emitter: n(74), | |
event: "like", | |
getInstance: f, | |
handler: function(e) { | |
this.onLike(e) | |
} | |
}, { | |
emitter: n(74), | |
event: "repost", | |
getInstance: f, | |
handler: function(e) { | |
this.onRepost(e) | |
} | |
}, { | |
emitter: n(74), | |
event: "comment", | |
getInstance: f, | |
handler: function(e) { | |
this.onComment(e) | |
} | |
}], | |
m = n(953).withOptions({ | |
batchEndpoint: "trackBatch", | |
getBatchParams: function(e) { | |
var t = e.playlist; | |
return t && "public" !== t.get("sharing") && !n(55).get("me").owns(t) ? { | |
playlistId: t.id, | |
playlistSecretToken: t.get("secret_token") | |
} : null | |
} | |
}), | |
v = (e.exports = n(66).extend(m, n(952), n(954), n(955), n(1304), n(254).withOptions({ | |
attr: "title" | |
}), n(253).withOptions({ | |
read: "artwork_url", | |
write: "artwork_data" | |
}), n(522), n(957), n(199).withOptions({ | |
events: g | |
}), { | |
resource_type: "sound", | |
urnPrefix: "soundcloud:tracks", | |
getEndpointForMethod: function(e) { | |
return "read" === e ? "track" : null | |
}, | |
audio: null, | |
_visuals: null, | |
submodelMap: { | |
user: n(61), | |
created_with: n(977) | |
}, | |
timeOffset: 0, | |
playlist: null, | |
originalSound: null, | |
ownerAttributes: ["scheduled_public_date", "scheduled_private_date", "scheduled_timezone", "geo_blockings", "managed_by_feeds", "reveal_comments", "reveal_stats"], | |
_streamsExist: !0, | |
_playable: !0, | |
_preloadingCounter: 0, | |
setup: function(e, t) { | |
var o = !(!t || !t.suppressGlobalEvents); | |
this.on("play", v("play", o), this).on("pause", v("pause", o), this).on("seeked", v("seeked", o), this).on("finish", v("finish", o), this).on("playStart", v("playStart", !0), this), this.getSounds = n(3).memoize(this.getSounds), this.listenTo(this, "change:visuals", i).listenTo(this, "change:policy", r), this.attrExists("visuals") && i.call(this), r.call(this) | |
}, | |
getSubmodelOptions: function(e) { | |
return "user" === e ? { | |
parse: !0 | |
} : null | |
}, | |
ownerUrl: function() { | |
return this.getEndpointUrl("trackAsOwner", { | |
urn: this.getUrn() | |
}) | |
}, | |
parse: function(e) { | |
var t = e.schedule; | |
return e.scheduled_timezone = t && t.timezone, e.scheduled_public_date = t && Date.parse(t.sunrise), e.scheduled_private_date = t && Date.parse(t.sunset), e | |
}, | |
baseUrl: function() { | |
return this.getEndpointUrl("track", { | |
urn: this.getUrn() | |
}) | |
}, | |
destroyUrl: function() { | |
return this.getEndpointUrl("trackDelete", { | |
id: this.id | |
}) | |
}, | |
streamsUrl: function() { | |
return this.getEndpointUrl("trackStreams", { | |
id: this.id | |
}) | |
}, | |
getImageSaveUrl: function() { | |
return this.getEndpointUrl("trackPatchUpdate", { | |
id: this.id | |
}) | |
}, | |
extractSecretToken: function(e) { | |
return n(63).parse(e.uri).query.secret_token | |
}, | |
play: function(e) { | |
this.playlist ? (this.playlist.setCurrentSound(this), this.playlist.play(e)) : this.createAudio().play(e) | |
}, | |
pause: function(e) { | |
this.playlist ? this.playlist.pause(e) : this.audio && this.audio.pause(e) | |
}, | |
seek: function(e) { | |
this.createAudio().seek(e) | |
}, | |
seekRelative: function(e) { | |
this.createAudio().seekRelative(e) | |
}, | |
getSounds: function() { | |
return [this] | |
}, | |
getCurrentSound: a, | |
getFirstSound: a, | |
getLastSound: a, | |
getNumSounds: s, | |
getPrevSound: l, | |
getNextSound: l, | |
getSoundIndex: function(e) { | |
return e === this ? 0 : -1 | |
}, | |
containsSound: function(e) { | |
return e === this | |
}, | |
isBuffering: function() { | |
return !!this.audio && this.audio.isBuffering() | |
}, | |
isPlaying: function() { | |
return !!this.audio && this.audio.isPlaying() | |
}, | |
loadProgress: function() { | |
return this.audio ? this.audio.loadProgress() : 0 | |
}, | |
currentTime: function() { | |
return this.audio ? this.audio.currentTime() : 0 | |
}, | |
getListenTime: function() { | |
return this.audio ? this.audio.getListenTime() : 0 | |
}, | |
isNowPlaying: function() { | |
return n(68).getCurrentSound() === this | |
}, | |
progress: function() { | |
return this.currentTime() / this.duration() | |
}, | |
duration: function() { | |
return this.get("full_duration") || this.get("duration") | |
}, | |
getMediaDuration: function() { | |
return this.get("duration") | |
}, | |
isPlayable: function() { | |
return this._playable | |
}, | |
setHasStreamInfo: function(e) { | |
this._streamsExist !== e && (this._streamsExist = e, r.call(this)) | |
}, | |
isProcessing: function() { | |
var e = this.get("state"); | |
return "finished" !== e && null != e | |
}, | |
isEditing: function() { | |
return !1 | |
}, | |
isCommentable: function() { | |
return this.get("commentable") !== !1 | |
}, | |
isManagedByFeeds: function() { | |
return !!this.get("managed_by_feeds") | |
}, | |
isMonetizable: function() { | |
return !!this.get("monetization_enabled") | |
}, | |
isMonetizablePending: function() { | |
var e = this.get("monetization"); | |
return !this.isMonetizable() && !!(e && e.territories && e.territories.length > 0) | |
}, | |
hasScheduledPrivacy: function() { | |
return !(!this.get("scheduled_public_date") && !this.get("scheduled_private_date")) | |
}, | |
isGeoblocked: function() { | |
var e = this.get("geo_blockings"); | |
return !(!e || !e.length) | |
}, | |
isBlocked: function() { | |
return this.get("policy") === c | |
}, | |
isSnippetized: function() { | |
return this.get("policy") === d | |
}, | |
isMonetized: function() { | |
return this.get("policy") === h | |
}, | |
isAllowed: function() { | |
return this.get("policy") === p | |
}, | |
isAd: function() { | |
return !!this.get("ad_type") | |
}, | |
isExternal: function() { | |
return "external" === this.get("ad_type") | |
}, | |
getOriginalSound: function() { | |
return this.originalSound || this | |
}, | |
hasMinPlayTime: function() { | |
return this.getListenTime() >= u * this.getMediaDuration() | |
}, | |
createAudio: function() { | |
return this.audio || (this.audio = n(503).createAudioFromSound(this)), this.audio | |
}, | |
initAudio: function() { | |
this.createAudio().initAudio() | |
}, | |
requestPreloading: function() { | |
this._preloadingCounter++ || (this.initAudio(), this.audio.enablePreloading()) | |
}, | |
unrequestPreloading: function() { | |
--this._preloadingCounter || this.createAudio().disablePreloading() | |
}, | |
disposeAudio: function() { | |
this.audio && (this.audio.dispose(), this.audio = null) | |
}, | |
toJSON: function() { | |
var e = n(66).prototype.toJSON.apply(this, arguments); | |
return e._playlist = {}, this.playlist && n(3).each(["id", "permalink", "permalink_url", "secret_token", "user_id"], function(t) { | |
e._playlist[t] = this.playlist.get(t) | |
}, this), e | |
}, | |
saveUrl: function(e) { | |
return e ? this.getEndpointUrl("trackPatchUpdate", { | |
id: this.id | |
}) : this.isNew() ? this.getEndpointUrl("trackCreate") : this.getEndpointUrl("trackUpdate", { | |
urn: this.getUrn() | |
}) | |
}, | |
saveFormat: "json", | |
getAttributesToBeSaved: function() { | |
var e = ["api_streamable", "commentable", "description", "downloadable", "embeddable", "feedable", "genre", "isrc", "isrc_generate", "label_name", "license", "monetization", "original_filename", "permalink", "purchase_title", "purchase_url", "release_date", "replacing_uid", "replacing_original_filename", "reveal_comments", "reveal_stats", "sharing", "shared_to", "tag_list", "title", "uid", "geo_blockings", "publisher_metadata", "restrictions", "rightsholders"].reduce(function(e, t) { | |
return null != this[t] && (e[t] = this[t]), e | |
}.bind(this.attributes), {}); | |
return n(3).assign(e, n(3).pick(this.attributes, ["scheduled_private_date", "scheduled_public_date", "scheduled_timezone", "scheduled_public_timezone"])), e | |
}, | |
setMonetizableTrack: function(e) { | |
e.hold(), this.addSubmodel(e), this._monetizableTrack = e | |
}, | |
getMonetizableTrack: function() { | |
return this._monetizableTrack | |
} | |
}, { | |
states: { | |
READY: "ready", | |
PROCESSING: "processing", | |
FAILED: "failed", | |
FINISHED: "finished" | |
}, | |
hashFn: function(e) { | |
var t = e.resource_id; | |
if (t) { | |
if ("object" == typeof t) { | |
if ("playlist_id" in t) return [t.playlist_id, t.sound_id].join("_"); | |
if ("ad_target_id" in t) return ["ad", t.ad_target_id, t.sound_id].join("_") | |
} | |
return t | |
} | |
return e.id || null | |
}, | |
resolve: function(e, t, i) { | |
return n(66)._resolve(this, [e, t, i], function(n) { | |
var i = n.get("user"); | |
return i && n.get("permalink") === t && i.permalink === e | |
}) | |
}, | |
normalize: function(e) { | |
var t = e.waveform_url; | |
return t && t.indexOf("/w1.") > -1 && (e.waveform_url = t.replace(/\/w1\./, "/wis.")), e | |
}, | |
onCleanup: function(e) { | |
return e._visuals && (e._visuals.release(), e._visuals = null), e.disposeAudio(), n(66).onCleanup.apply(this, arguments) | |
} | |
}), n(3).memoize(function(e, t) { | |
return function(i) { | |
var r = n(3).toArray(arguments); | |
switch (i && i.sound === n(92).getCurrentSound() && (i.ad = n(92).getCurrentAd()), t || n(57).trigger.apply(n(57), ["audio:" + e].concat(r)), e) { | |
case "playStart": | |
n(59).trackPlayStart(o(i)); | |
break; | |
case "pause": | |
n(59).trackPause(o(i)) | |
} | |
} | |
}, function(e, t) { | |
return e + (t ? "" : "-global") | |
})) | |
}, | |
75: function(e, t, n) { | |
"use strict"; | |
var i = e.exports = function(e, t) { | |
var r = i.getClass(e); | |
return e = n(3).omit(e, "resource_type"), new r(e, t) | |
}; | |
i.getClass = function(e) { | |
var t = e.resource_type || e.kind; | |
return n("playlist" === t ? 84 : "sound" === t || "track" === t ? 65 : 65) | |
} | |
}, | |
82: function(e, t, n) { | |
"use strict"; | |
function i(e) { | |
switch (e) { | |
case u: | |
return "consumer-subscription"; | |
case p: | |
case f: | |
case g: | |
return "creator-gift"; | |
case c: | |
case d: | |
case h: | |
return "creator-subscription" | |
} | |
} | |
function r(e) { | |
switch (e) { | |
case u: | |
return "consumer-high-tier"; | |
case p: | |
case c: | |
return "free"; | |
case f: | |
case d: | |
return "pro"; | |
case g: | |
case h: | |
return "pro-unlimited" | |
} | |
} | |
function o() { | |
n(57).off("connect:hasUserData", s), a = n(3).once(function() { | |
n(64).isLoggedIn() || n(57).once("connect:hasUserData", s) | |
}) | |
} | |
function s() { | |
m.clearRequestCache(), m.instances.invoke("fetch") | |
} | |
var a = void 0, | |
l = n(73).productIds, | |
u = l.CONSUMER_SUBSCRIPTION_HIGH_TIER, | |
c = l.CREATOR_SUBSCRIPTION_FREE, | |
d = l.CREATOR_SUBSCRIPTION_PRO, | |
h = l.CREATOR_SUBSCRIPTION_PRO_UNLIMITED, | |
p = l.CREATOR_GIFT_FREE, | |
f = l.CREATOR_GIFT_PRO, | |
g = l.CREATOR_GIFT_PRO_UNLIMITED; | |
o(); | |
var m = e.exports = n(66).extend({ | |
resource_type: "product", | |
setup: function() { | |
a() | |
}, | |
fetch: function(e) { | |
var t = this; | |
return v(i(this.id), this.options.ref).then(function(n) { | |
var i = n.body.plans; | |
t.lastFetchTime = Date.now(), t.populateFromPlans(i, e) | |
}) | |
}, | |
populateFromPlans: function(e, t) { | |
var i = n(3).findWhere(e, { | |
id: r(this.id) | |
}); | |
i ? this.set(this.parse(i, t), t) : this.set("active", !1) | |
}, | |
parse: function(e) { | |
return n(3).extend({ | |
active: !0 | |
}, n(3).omit(e, "id")) | |
}, | |
isActive: function() { | |
return !!this.get("active") | |
}, | |
isPromoAvailable: function() { | |
var e = "soundcloud:payments:promotions:consumer-subscription", | |
t = this.getPromotion(); | |
return t.urn && 0 === t.urn.indexOf(e) || !1 | |
}, | |
isAvailable: function() { | |
return this.isFree() || !!this.get("preselected_term") | |
}, | |
isGift: function() { | |
return this.id.indexOf("gift") > -1 | |
}, | |
isPro: function() { | |
return -1 === this.id.indexOf("unlimited") && !this.isFree() | |
}, | |
isProUnlimited: function() { | |
return this.id.indexOf("unlimited") > -1 | |
}, | |
isRenewal: function() { | |
return "renewal" === this.get("use_case") | |
}, | |
isFree: function() { | |
return this.id.indexOf("free") > -1 | |
}, | |
isCurrency: function(e) { | |
return this.getCurrency() === e | |
}, | |
isTrial: function() { | |
return !!this.get("trial") | |
}, | |
getPromotion: function() { | |
return this.get("promotion") || {} | |
}, | |
getPromotionDurationInMonths: function() { | |
var e = this.get("promotion"); | |
return e ? e.duration_in_days / 30 : 0 | |
}, | |
getTrialDuration: function() { | |
var e = this.get("trial"); | |
return e ? e.duration_in_days : 0 | |
}, | |
getTrackingUseCase: function() { | |
var e = this.get("use_case"); | |
return (e === m.useCases.REGULAR || e === m.useCases.MONEY_BACK) && (e = "new"), e | |
}, | |
getCurrency: function() { | |
return this.getPrice().currency | |
}, | |
getTitle: function() { | |
return this.isPro() ? n(52).t("Pro") : this.isProUnlimited() ? n(52).t("Pro Unlimited") : n(52).t("Free") | |
}, | |
getPrice: function(e) { | |
return this.getTermData(e).price || { | |
currency: "EUR" | |
} | |
}, | |
getDisplayPrice: function() { | |
var e = this.getPrice(), | |
t = e.display, | |
i = e.currency, | |
r = n(52).numberHelper.format(t, { | |
precision: 2 | |
}); | |
return t ? n(93).format(r, i) : "" | |
}, | |
getPackagePrice: function(e) { | |
var t = this.getTermData(e)["package"]; | |
return t && (t.price || { | |
currency: "EUR" | |
}) | |
}, | |
getPromoPrice: function() { | |
var e = arguments.length <= 0 || void 0 === arguments[0] ? 2 : arguments[0], | |
t = this.getPromotion().price || { | |
currency: "EUR" | |
}, | |
i = t.display, | |
r = t.currency, | |
o = n(52).numberHelper.format(i, { | |
precision: e | |
}); | |
return i ? n(93).format(o, r) : "" | |
}, | |
getPromoCode: function() { | |
var e = this.getPromotion(), | |
t = e.urn; | |
return t && t.split(":").pop() | |
}, | |
getDiscount: function(e) { | |
var t = this.getTermData(e).discount; | |
return t && t.price | |
}, | |
getTermData: function(e) { | |
return e = e || this.getPreselectedTerm(), this.get(e) || {} | |
}, | |
getPreselectedTerm: function() { | |
return this.get("preselected_term") | |
}, | |
getUrn: function() { | |
return this.getTermData()["package"].urn | |
} | |
}, { | |
useCases: { | |
DISABLED: "disabled", | |
REGULAR: "regular", | |
MONEY_BACK: "money_back", | |
RENEWAL: "renewal", | |
DOWNGRADE: "downgrade", | |
UPGRADE: "upgrade" | |
}, | |
resetLoginListener: o, | |
clearRequestCache: function() { | |
v.cache = {} | |
} | |
}), | |
v = n(3).memoize(function(e, t) { | |
return n(23).callEndpoint("paymentQuotations", { | |
category: e | |
}, { | |
ref: t | |
}).fail(function() { | |
delete v.cache[e] | |
}) | |
}, function(e, t) { | |
return e | |
}) | |
}, | |
84: function(e, t, n) { | |
"use strict"; | |
function i(e, t) { | |
e.originalSound.set(e.attributes, t) | |
} | |
function r(e, t) { | |
this.set(e.attributes, t) | |
} | |
function o() { | |
s.call(this) | |
} | |
function s(e) { | |
var t = this.soundsCollection.pluck("duration").reduce(function(e, t) { | |
return e + (t || 0) | |
}, 0); | |
this.set("duration", t, e) | |
} | |
function a(e) { | |
var t = this, | |
i = e.filter(function(e) { | |
return !t.findSoundById(e) | |
}), | |
r = this.soundsCollection.filter(function(t) { | |
var n = t.id; | |
return -1 === e.indexOf(n) | |
}); | |
r.forEach(function(e) { | |
return t.removeSound(e) | |
}), i.forEach(function(e) { | |
var i = new(n(65))({ | |
id: e | |
}); | |
t.addSound(i), i.release() | |
}), this.reorder(e) | |
} | |
var l, u = n(3).constant(!1), | |
c = "tracklistChange", | |
d = 500; | |
l = n(22).Collection.extend({ | |
model: n(65), | |
fetch: function() { | |
return this.playlist.fetch.apply(this.playlist, arguments) | |
}, | |
initialize: function(e, t) { | |
this.playlist = t.playlist | |
}, | |
hasDataForView: function() { | |
return !!this.playlist.attributes.tracks | |
}, | |
isFullyPopulated: n(3).constant(!0), | |
_usageCount: n(3).constant(1), | |
hold: n(3).noop, | |
release: n(3).noop | |
}); | |
var h = function(e, t) { | |
var n = t.target, | |
i = t.targetType; | |
return e.id === n && "playlist" === i | |
}, | |
p = [{ | |
emitter: n(57), | |
event: "broadcast:" + c, | |
getInstance: function(e, t) { | |
var n = e.id, | |
i = t.id; | |
return n === i | |
}, | |
handler: function(e) { | |
var t = e.trackIds; | |
a.call(this, t) | |
} | |
}, { | |
emitter: n(74), | |
event: "like", | |
getInstance: h, | |
handler: function(e) { | |
this.onLike(e) | |
} | |
}, { | |
emitter: n(74), | |
event: "repost", | |
getInstance: h, | |
handler: function(e) { | |
this.onRepost(e) | |
} | |
}], | |
f = (e.exports = n(66).extend(n(442), n(952), n(444), n(335), n(254).withOptions({ | |
attr: "title" | |
}), n(253).withOptions({ | |
read: "artwork_url", | |
write: "artwork_data" | |
}), n(522), n(957), n(199).withOptions({ | |
events: p | |
}), { | |
resource_type: "playlist", | |
urnPrefix: "soundcloud:playlists", | |
saveFormat: "json", | |
submodelMap: { | |
tracks: n(65), | |
user: n(61) | |
}, | |
states: { | |
shuffling: function(e) { | |
var t = this.getSoundIndex(this.getCurrentSound()), | |
n = e && this.isPlaying() ? t : null, | |
i = e ? 0 : t; | |
this.currentSoundCursor = i, this.setPlayOrder(n), this.toggleState("repeating", e) | |
}, | |
repeating: { | |
initial: !1 | |
} | |
}, | |
soundsCollection: null, | |
currentSoundCursor: 0, | |
_isPlayActionQueued: !1, | |
_playOrder: null, | |
_internalNavigation: !1, | |
getSubmodelOptions: function(e) { | |
return "user" === e ? { | |
parse: !0 | |
} : null | |
}, | |
setup: function() { | |
this.soundsCollection = new l(null, { | |
playlist: this | |
}), this.listenTo(this.soundsCollection, "error", function(e, t, i) { | |
t instanceof n(511) && this.removeSound(e) | |
}), this._playOrder || (this._playOrder = []) | |
}, | |
baseUrl: function() { | |
return this.getEndpointUrl("playlist", { | |
id: this.id | |
}, { | |
representation: "full" | |
}) | |
}, | |
destroyUrl: function() { | |
return this.getEndpointUrl("playlistDelete", { | |
id: this.id | |
}) | |
}, | |
saveUrl: function() { | |
return this.isNew() ? this.getEndpointUrl("playlistCreate") : this.getEndpointUrl("playlistUpdate", { | |
id: this.id | |
}) | |
}, | |
getImageSaveUrl: function() { | |
return this.getEndpointUrl("playlistArtworkUpdate", { | |
id: this.id | |
}) | |
}, | |
createSubmodel: function(e, t) { | |
"tracks" === t ? this.prepareSounds() : n(66).prototype.createSubmodel.apply(this, arguments) | |
}, | |
prepareSounds: function() { | |
var e = this, | |
t = []; | |
this.get("tracks").forEach(function(i) { | |
if (!e.containsSoundId(i.id)) { | |
var r = new(n(65))(i); | |
e.addSubmodel(r); | |
var o = n(3).defaults({ | |
resource_id: { | |
playlist_id: e.id, | |
sound_id: i.id | |
} | |
}, i), | |
s = new(n(65))(o, { | |
suppressGlobalEvents: !0 | |
}); | |
s.playlist = e, s.originalSound = r, t.push(s), e.toggleListeners(s, !0) | |
} | |
}), 0 === this.soundsCollection.length ? this.soundsCollection.reset(t) : this.soundsCollection.add(t, { | |
silent: !0 | |
}), t.length && this.setPlayOrder() | |
}, | |
getSoundsCollection: function() { | |
return this.soundsCollection | |
}, | |
getSoundsCollectionClone: function() { | |
return new l(this.soundsCollection.models.slice(), { | |
playlist: this | |
}) | |
}, | |
toggleListeners: function(e, t) { | |
var n = t ? "on" : "off", | |
s = t ? "listenTo" : "stopListening"; | |
e[n]("play", this.onSoundPlay, this)[n]("pause", this.onSoundPause, this)[n]("buffering:start buffering:end", this.onSoundBuffering, this)[n]("finish", this.onSoundFinish, this)[n]("time", this.onSoundTime, this)[n]("seeked", this.onSoundSeeked, this)[n]("change:duration", o, this), e[n]("change", i)[s](e.originalSound, "change", r) | |
}, | |
onSoundBuffering: function(e) { | |
this.trigger(e.type, e) | |
}, | |
onSoundPlay: function(e) { | |
e.playlist = this, this.trigger("internal:play", e), this._internalNavigation || (this.trigger("play", e), n(57).trigger("audio:play", e), this._internalNavigation = !0) | |
}, | |
onSoundPause: function(e) { | |
this._internalNavigation || (e.playlist = this, this.trigger("pause", e), n(57).trigger("audio:pause", e), this._internalNavigation = !0) | |
}, | |
onSoundFinish: function(e) { | |
e.sound === this.getLastSound() && (e.playlist = this, this.trigger("pause finish", e), n(57).trigger("audio:pause audio:finish", e)) | |
}, | |
onSoundTime: function(e) { | |
e.playlist = this, this.trigger("time", e) | |
}, | |
onSoundSeeked: function(e) { | |
e.playlist = this, this.trigger("seeked", e) | |
}, | |
getPrevSound: function() { | |
return this.soundsCollection.at(this._playOrder[this.currentSoundCursor - 1]) | |
}, | |
getCurrentSound: function() { | |
return this.soundsCollection.at(this._playOrder[this.currentSoundCursor]) | |
}, | |
getNextSound: function() { | |
return this.soundsCollection.at(this._playOrder[this.currentSoundCursor + 1]) | |
}, | |
getFirstSound: function() { | |
return this.soundsCollection.at(this._playOrder[0]) | |
}, | |
getLastSound: function() { | |
return this.soundsCollection.at(this._playOrder[this.soundsCollection.length - 1]) | |
}, | |
findSound: function(e) { | |
return this.findSoundById(e.id) | |
}, | |
findSoundById: function(e) { | |
return this.soundsCollection.get(e) | |
}, | |
getSounds: function() { | |
return this.soundsCollection.models | |
}, | |
getSoundIndex: function(e) { | |
return this.soundsCollection.indexOf(e) | |
}, | |
containsSound: function(e) { | |
return this.getSoundIndex(e) > -1 | |
}, | |
containsSoundId: function(e) { | |
return !!this.findSoundById(e) | |
}, | |
isManagedByFeeds: function() { | |
return !!this.get("managed_by_feeds") | |
}, | |
getNumSounds: function() { | |
return this.soundsCollection.length || this.get("track_count") || 0 | |
}, | |
isGeoblocked: u, | |
isMonetizable: u, | |
isMonetizablePending: u, | |
hasScheduledPrivacy: u, | |
play: function(e) { | |
var t = this; | |
e = e || {}, e.audible && e.audible.playlist && e.userInitiated && (this.setPlayOrder(this.getSoundIndex(e.audible)), this.getState("shuffling") ? this.currentSoundCursor = 0 : this.setCurrentSound(e.audible)), this.soundsCollection.length ? (this._internalNavigation = !1, this.getCurrentSound().createAudio().play(e)) : this.lastFetchTime || (this._isPlayActionQueued = !0, this.fetch().done(function() { | |
t._isPlayActionQueued && (t._isPlayActionQueued = !1, t.play(e)) | |
})) | |
}, | |
pause: function(e) { | |
if (this._isPlayActionQueued = !1, this.soundsCollection && this.soundsCollection.length) { | |
this._internalNavigation = !1; | |
var t = this.getCurrentSound().audio; | |
t && t.pause(e) | |
} | |
}, | |
rewind: function() { | |
this.currentSoundCursor = 0 | |
}, | |
setCurrentSound: function(e) { | |
e && (this.currentSoundCursor = this._playOrder.indexOf(this.getSoundIndex(e))) | |
}, | |
hasDataForPlay: function() { | |
return this.attributes.hasOwnProperty("tracks") | |
}, | |
isNowPlaying: function() { | |
return this.getSoundIndex(n(68).getCurrentSound()) > -1 | |
}, | |
isBuffering: function() { | |
return this.soundsCollection.some(f("isBuffering")) | |
}, | |
isPlaying: function() { | |
return this.soundsCollection.some(f("isPlaying")) | |
}, | |
isProcessing: function() { | |
return this.soundsCollection.some(f("isProcessing")) | |
}, | |
isPlayable: function() { | |
return !this.get("tracks") || this.soundsCollection.some(f("isPlayable")) | |
}, | |
isAlbum: function() { | |
return !!this.get("is_album") | |
}, | |
setPlayOrder: function(e) { | |
var t = n(3).range(this.soundsCollection.length); | |
this.getState("shuffling") && (t = n(3).shuffle(t), "number" == typeof e && (t.splice(t.indexOf(e), 1), t.unshift(e))), this._playOrder = t | |
}, | |
parse: function(e, t) { | |
return e = n(66).prototype.parse.apply(this, arguments), t = t || {}, t.isSavingOrder && (e.tracks || e.track_count) && (delete e.tracks, delete e.track_count), e.secret_token && e.tracks && e.tracks.forEach(function(t) { | |
"public" === t.sharing || t.secret_token || (t.secret_token = e.secret_token) | |
}), e | |
}, | |
extractSecretToken: function(e) { | |
return n(63).parse(e.uri).query.secret_token | |
}, | |
duration: function() { | |
return this.get("duration") | |
}, | |
removeSound: function(e) { | |
if (e = this.findSound(e)) { | |
var t = this.getSoundIndex(e), | |
n = this.get("tracks").slice(); | |
return this.currentSoundCursor > t && --this.currentSoundCursor, e.isPlaying() && e.pause(), this.toggleListeners(e, !1), n.splice(t, 1), this.soundsCollection.remove(e), s.call(this), this.set("tracks", n), e.playlist = null, e.release(), !0 | |
} | |
return !1 | |
}, | |
addSound: function(e) { | |
var t, i, r; | |
return this.findSound(e) ? !1 : (t = n(3).defaults({ | |
resource_id: { | |
playlist_id: this.id, | |
sound_id: e.id | |
} | |
}, e.attributes), i = new(n(65))(t, { | |
suppressGlobalEvents: !0 | |
}), i.playlist = this, i.originalSound = e, this.addSubmodel(e), this.toggleListeners(i, !0), r = this.get("tracks"), r || (this.set("tracks", [], { | |
silent: !0 | |
}), r = this.get("tracks")), this._playOrder.push(this.soundsCollection.length), r.push(i.attributes), this.soundsCollection.add(i), s.call(this, { | |
silent: !0 | |
}), this.forceChange("tracks"), !0) | |
}, | |
getCurrentOrder: function() { | |
return this.soundsCollection.pluck("id") | |
}, | |
reorder: function(e) { | |
var t = this.soundsCollection, | |
n = this.getCurrentSound(), | |
i = n && n.id; | |
t.sort({ | |
silent: !0, | |
comparator: function(t) { | |
return e.indexOf(t.id) | |
} | |
}), this.currentSoundCursor = Math.max(0, e.indexOf(i)), this.set({ | |
tracks: this.soundsCollection.toJSON(), | |
track_count: this.soundsCollection.length | |
}) | |
}, | |
hasCapacity: function(e) { | |
return n(3).union(this.soundsCollection.pluck("id"), e).length <= d | |
}, | |
saveOrder: function(e) { | |
var t = this, | |
i = this.soundsCollection.pluck("id"), | |
r = { | |
playlist: { | |
tracks: i | |
} | |
}; | |
return n(22).Model.prototype.save.call(this, {}, n(3).assign({ | |
url: this.saveUrl(), | |
data: JSON.stringify(r), | |
contentType: "application/json", | |
isSavingOrder: !0 | |
}, e)).done(function() { | |
n(57).broadcast({ | |
excludeThis: !0 | |
}, c, { | |
id: t.id, | |
trackIds: i | |
}) | |
}) | |
}, | |
getAttributesToBeSaved: function() { | |
var e = n(66).prototype.getAttributesToBeSaved.call(this); | |
return e.tracks && (e.tracks = n(3).pluck(e.tracks, "id")), e | |
}, | |
resetOrder: function() { | |
var e = this; | |
return this.fetch().done(function() { | |
e.soundsCollection.each(function(e) { | |
e.playlist = null, e.release() | |
}), e.soundsCollection.reset([], { | |
silent: !0 | |
}), e.prepareSounds() | |
}) | |
}, | |
hasDifferentCreators: function() { | |
var e, t = this.get("user_id"), | |
n = !1; | |
return e = !this.soundsCollection.every(function(e) { | |
var i = e.get("user_id"); | |
return null == i ? (n = !0, !0) : i === t | |
}), e || (n ? null : e) | |
}, | |
hasVisuals: function() { | |
return !1 | |
} | |
}, { | |
onCleanup: function(e) { | |
e.soundsCollection.each(function(e) { | |
e.playlist = null, e.release() | |
}), e.soundsCollection.off(), delete e.soundsCollection, n(66).onCleanup(e) | |
}, | |
resolve: function(e, t, i) { | |
return n(66)._resolve(this, [e, "sets", t, i], function(n) { | |
var i = n.get("user"); | |
return i && n.get("permalink") === t && i.permalink === e | |
}) | |
} | |
}), n(3).memoize(function(e) { | |
return function(t) { | |
return t[e]() | |
} | |
})) | |
}, | |
96: function(e, t, n) { | |
var i = n(513), | |
r = n(20); | |
e.exports = function(e) { | |
return new r.SafeString(i.getAccessibleMarkup(e.hash)) | |
} | |
}, | |
107: function(e, t, n) { | |
(function(t) { | |
"use strict"; | |
var i = 1 / 0; | |
e.exports = n(66).extend(n(442), { | |
resource_type: "comment", | |
urnPrefix: "soundcloud:comments", | |
parse: function(e) { | |
return null === e.timestamp && (e.timestamp = i), e | |
}, | |
submodelMap: { | |
track: n(65), | |
user: n(61) | |
}, | |
baseUrl: function() { | |
return this.getEndpointUrl("comment", { | |
id: this.id | |
}) | |
}, | |
saveUrl: function() { | |
var e = this.getSound(), | |
t = ["tracks", e.id, "comments"].join("/"), | |
i = e.get("secret_token"); | |
return i && e.isPrivate() ? n(63).modify(t, { | |
query: { | |
secret_token: i | |
} | |
}) : t | |
}, | |
destroyUrl: function() { | |
return ["tracks", this.getSoundId(), "comments", this.id].join("/") | |
}, | |
getAttributesToBeSaved: function() { | |
return this.pick("body", "timestamp") | |
}, | |
setReplyTo: function(e) { | |
this.set("replyTo", e.id), this.trigger("change:recipient", e.get("user").permalink) | |
}, | |
hasDataForView: function(e) { | |
return n(66).prototype.hasDataForView.call(this, n(3).without(e, "id")) | |
}, | |
getSound: function() { | |
var e = this.getSoundId(), | |
t = n(65).hashFn({ | |
id: e, | |
resource_type: "sound" | |
}), | |
i = n(65).instances.get(t); | |
return !i && e && (i = new(n(65))(this.get("track") || { | |
id: e | |
}), this.addSubmodel(i)), i | |
}, | |
destroy: function(e) { | |
return this.isNew() || n(74).notify("comment", { | |
object: this, | |
target: this.getSoundId(), | |
targetType: "sound", | |
state: !1 | |
}), n(66).prototype.destroy.call(this, e) | |
}, | |
getSoundId: function() { | |
return this.get("track_id") || (this.get("track") || {}).id | |
}, | |
reportAsSpam: function() { | |
var e = this; | |
t.post("i1/comments/" + this.id + "/spam", function() { | |
e.trigger("destroy", e, e.collection) | |
}) | |
} | |
}, { | |
EMPTY_TIMESTAMP: i | |
}) | |
}).call(t, n(1)) | |
}, | |
116: function(e, t, n) { | |
"use strict"; | |
var i = "track", | |
r = "artist", | |
o = { | |
ARTIST: r, | |
TRACK: i | |
}, | |
s = n(953).withOptions({ | |
batchEndpoint: "stationBatch", | |
paramName: "urns" | |
}); | |
e.exports = n(66).extend(s, n(253).withOptions({ | |
read: "artwork_url" | |
}), n(254).withOptions({ | |
attr: "title" | |
}), { | |
resource_type: "station", | |
baseUrl: function() { | |
return this.getEndpointUrl("station", { | |
urn: this.id | |
}) | |
}, | |
getUrn: function() { | |
return this.id | |
}, | |
getImageResourceInfo: function() { | |
var e = n(100).getAsAttributes(this.id), | |