summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/reader/MediaPlayer.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/reader/MediaPlayer.js')
-rw-r--r--public/assets/javascripts/ui/reader/MediaPlayer.js28
1 files changed, 21 insertions, 7 deletions
diff --git a/public/assets/javascripts/ui/reader/MediaPlayer.js b/public/assets/javascripts/ui/reader/MediaPlayer.js
index df2d075..8e65976 100644
--- a/public/assets/javascripts/ui/reader/MediaPlayer.js
+++ b/public/assets/javascripts/ui/reader/MediaPlayer.js
@@ -1,5 +1,5 @@
-var MediaPlayer = FormView.extend({
+var MediaPlayer = View.extend({
el: "#mediaPlayer",
events: {
@@ -44,22 +44,26 @@ var MediaPlayer = FormView.extend({
this.unbind()
}
if (media.type == "image") {
- if ((! media.title || ! media.title.length) && (! media.description || ! media.description.length)) {
+ if ( ! media.description && (! media.title || media.title == filenameFromUrl(media.url)) ) {
this.hide()
- return
+ return false
}
}
+ else if (media.type == "text") {
+ return false
+ }
this.bind(scenery)
this.$el.addClass("active")
- this.$name.html(media.title)
- this.$description.html(media.description)
+ this.$name.html( sanitize(media.title) )
+ this.$description.html( marked(media.description) )
switch (media.type) {
case "image":
- this.$(".image").show()
this.$(".video").hide()
+ this.$(".audio").hide()
+ this.$(".image").show()
// this.$widthDimension.html( Number(media.widthDimension) || "" )
// this.$heightDimension.html( Number(media.heightDimension) || "" )
@@ -70,14 +74,24 @@ var MediaPlayer = FormView.extend({
case "youtube":
case "vimeo":
case "video":
- this.$(".video").show()
this.$(".image").hide()
+ this.$(".audio").hide()
+ this.$(".video").show()
this.$playButton.toggleClass("paused", ! this.scenery.paused())
this.$muteButton.toggleClass("muted", this.scenery.muted())
break
+
+ case "soundcloud":
+ this.$(".image").hide()
+ this.$(".video").hide()
+ this.$(".audio").show()
+
+ this.$playButton.toggleClass("paused", ! this.scenery.paused())
+ break
}
+ return true
},
hide: function(scenery){