diff options
Diffstat (limited to 'public/assets/javascripts/ui/editor')
4 files changed, 45 insertions, 11 deletions
diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js index 3773366..4a2f712 100644 --- a/public/assets/javascripts/ui/editor/EditorView.js +++ b/public/assets/javascripts/ui/editor/EditorView.js @@ -50,7 +50,7 @@ var EditorView = View.extend({ readyLayout: function(data){ data.isNew = true - $('#help-button').trigger("click") + // $('#help-button').trigger("click") this.ready(data) }, diff --git a/public/assets/javascripts/ui/editor/MediaEditor.js b/public/assets/javascripts/ui/editor/MediaEditor.js index de93f6e..6068c48 100644 --- a/public/assets/javascripts/ui/editor/MediaEditor.js +++ b/public/assets/javascripts/ui/editor/MediaEditor.js @@ -51,7 +51,7 @@ var MediaEditor = FormView.extend({ }, pick: function(scenery) { - if (this.scenery) { + if (this.scenery && scenery !== this.scenery) { this.unbind() } @@ -67,22 +67,24 @@ var MediaEditor = FormView.extend({ // console.log(media) - this.$name.val(media.title || filenameFromUrl(media.url) ) + this.$name.val(media.title) // || filenameFromUrl(media.url) ) this.$description.val(media.description) this.setDimensions() this.$units.val( "ft" ) switch (media.type) { case "image": - this.$(".image").show() this.$(".video").hide() + this.$(".audio").hide() + this.$(".image").show() break 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.$autoplay.prop('checked', !! media.autoplay) @@ -90,6 +92,15 @@ var MediaEditor = FormView.extend({ this.$mute.prop('checked', !! media.mute) this.$keyframe.val( Number(media.keyframe || 0) ) break + + case "soundcloud": + this.$(".image").hide() + this.$(".video").hide() + this.$(".audio").show() + this.$playButton.toggleClass("paused", ! this.scenery.paused()) + this.$autoplay.prop('checked', !! media.autoplay) + this.$loop.prop('checked', !! media.loop) + break } }, @@ -161,6 +172,7 @@ var MediaEditor = FormView.extend({ unbind: function(){ if (this.scenery) { + this.scenery.focused = false if (this.tainted && this.scenery.media) { this.scenery.media.title = this.$name.val() this.scenery.media.description = this.$description.val() diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js index 9593ab7..029252d 100644 --- a/public/assets/javascripts/ui/editor/MediaViewer.js +++ b/public/assets/javascripts/ui/editor/MediaViewer.js @@ -16,13 +16,14 @@ var MediaViewer = ModalView.extend({ 'click #randomize': "randomize", 'click .mediaContainer': "pick", 'click .viewMore': "load", + 'keydown #tumblr-url': 'enterTumblrUrl', }, initialize: function(opt){ this.__super__.initialize.call(this) this.parent = opt.parent - this.$myMedia = this.$(".myMedia") + this.$myMedia = this.$(".myMedia").addClass('active') this.$myMediaContainer = this.$(".myMedia > .container") this.$userToggle = this.$(".userToggle") @@ -37,12 +38,14 @@ var MediaViewer = ModalView.extend({ this.$deleteMedia = this.$("#deleteMedia") this.$viewMore = this.$(".viewMore") this.$noMedia = this.$(".noMedia") + + this.$tumblrUrl = this.$("#tumblr-url") }, wallpaperToggle: function(){ this.$wallpaperMedia.addClass("active") this.$foundMedia.addClass("inactive") - this.$myMedia.addClass("inactive") + this.$myMedia.addClass("inactive").removeClass('active') this.$("a").removeClass("active") this.$foundToggle.addClass("active") }, @@ -50,7 +53,7 @@ var MediaViewer = ModalView.extend({ foundToggle: function(){ this.$wallpaperMedia.removeClass("active") this.$foundMedia.addClass("active") - this.$myMedia.addClass("inactive") + this.$myMedia.addClass("inactive").removeClass('active') this.$("a").removeClass("active") this.$foundToggle.addClass("active") }, @@ -58,7 +61,7 @@ var MediaViewer = ModalView.extend({ userToggle: function(){ this.$wallpaperMedia.removeClass("active") this.$foundMedia.removeClass("active") - this.$myMedia.removeClass("inactive") + this.$myMedia.removeClass("inactive").addClass('active') this.$("a").removeClass("active") this.$userToggle.addClass("active") }, @@ -120,7 +123,7 @@ var MediaViewer = ModalView.extend({ }, randomize: function(){ - var $divs = this.$myMediaContainer.find(".mediaContainer").toArray() + var $divs = this.$(".active .container").find(".mediaContainer").toArray() if ($divs.length < 3) { $divs = $divs.concat( this.$foundMediaContainer.find(".mediaContainer").toArray() ) } @@ -190,6 +193,10 @@ var MediaViewer = ModalView.extend({ image.src = media.url image.load() break + + case 'soundcloud': + image.src = media.thumbnail + break } $span.data("media", media) @@ -250,6 +257,7 @@ var MediaViewer = ModalView.extend({ switch (media.type) { case "video": + case "soundcloud": $floatingImg.attr('src', '/assets/img/playbutton.png') break @@ -285,4 +293,17 @@ var MediaViewer = ModalView.extend({ $ants.addClass('edit') _followCursor(e) }, + + enterTumblrUrl: function(e){ + e.stopPropagation() + if (e.keyCode !== 13) { return } + var url = this.$tumblrUrl.val() + Parser.tumblr(url, function(media_list){ + console.log(media_list) + this.$foundMediaContainer.empty() + media_list.reverse().forEach(function(media){ + this.add(media, this.$foundMediaContainer) + }.bind(this)) + }.bind(this)) + }, }) diff --git a/public/assets/javascripts/ui/editor/TextEditor.js b/public/assets/javascripts/ui/editor/TextEditor.js index d897f91..53d5b9f 100644 --- a/public/assets/javascripts/ui/editor/TextEditor.js +++ b/public/assets/javascripts/ui/editor/TextEditor.js @@ -96,6 +96,7 @@ var TextEditor = FormView.extend({ unbind: function(){ if (this.scenery) { + this.scenery.focused = false if (this.tainted) { Minotaur.watch( app.router.editorView.settings ) } @@ -119,7 +120,7 @@ var TextEditor = FormView.extend({ }, pick: function(scenery){ - if (this.scenery) { + if (this.scenery && scenery !== this.scenery) { this.unbind() } |
