From e6cac4737904750a80173ba8e7745d2b41370bd6 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 6 Nov 2014 15:48:27 -0500 Subject: share vvbox comes up when clicking save --- public/assets/javascripts/ui/reader/ShareView.js | 38 ++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'public/assets/javascripts/ui/reader/ShareView.js') diff --git a/public/assets/javascripts/ui/reader/ShareView.js b/public/assets/javascripts/ui/reader/ShareView.js index 4e5f832..8a205ba 100644 --- a/public/assets/javascripts/ui/reader/ShareView.js +++ b/public/assets/javascripts/ui/reader/ShareView.js @@ -2,31 +2,59 @@ var ShareView = View.extend({ el: ".share", events: { + "keydown": "stopPropagation", "click #share_facebook": "facebook", "click #share_twitter": "twitter", + "click #share_embed": "embed", }, initialize: function(opt){ this.parent = opt.parent + this.$link = this.$("#share_link") + }, + + toggle: function(state){ + if (typeof state == "boolean") { + this.$el.toggleClass("active", state) + } + else { + this.$el.toggleClass("active") + } + }, + show: function(){ + this.toggle(true) + }, + hide: function(){ + this.toggle(false) + }, + + setLink: function(url){ + this.$link.val( url ) + }, + getLink: function(){ + var link = window.location.origin + window.location.pathname + link = link.replace(/\/edit\/?$/, "") + return link }, facebook: function (e) { e.preventDefault() - var msg = $(".roomName").html() + " on VValls" - var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(window.location.origin + window.location.pathname) + "&t=" + encodeURIComponent(msg); + var link = this.getLink() + var msg = app.controller.data.name + " on VValls" + var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(link) + "&t=" + encodeURIComponent(msg) window.open(url, "_blank") }, twitter: function (e) { e.preventDefault() - var msg = $(".roomName").html() + " on VValls" - var url = "https://twitter.com/home?status=" + encodeURIComponent(window.location.origin + window.location.pathname + " " + msg); + var link = this.getLink() + var msg = app.controller.data.name + " on VValls" + var url = "https://twitter.com/home?status=" + encodeURIComponent(link + " " + msg) window.open(url, "_blank") }, embed: function (e) { e.preventDefault() - }, }) -- cgit v1.2.3-70-g09d2 From 5a35d057453f82aad1097f1a90e9bdd341018a17 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 7 Nov 2014 13:22:36 -0500 Subject: embed modal --- public/assets/javascripts/ui/reader/EmbedView.js | 50 ++++++++++++++++++++++++ public/assets/javascripts/ui/reader/ShareView.js | 2 + public/assets/javascripts/util.js | 13 ++++++ public/assets/stylesheets/app.css | 32 +++++++++++++-- views/controls/editor/share.ejs | 3 -- views/controls/reader/about-room.ejs | 1 + views/controls/reader/embed.ejs | 25 ++++++++++++ views/editor.ejs | 1 + views/partials/footer.ejs | 2 +- views/partials/scripts.ejs | 3 +- views/reader.ejs | 1 + 11 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 public/assets/javascripts/ui/reader/EmbedView.js create mode 100644 views/controls/reader/embed.ejs (limited to 'public/assets/javascripts/ui/reader/ShareView.js') diff --git a/public/assets/javascripts/ui/reader/EmbedView.js b/public/assets/javascripts/ui/reader/EmbedView.js new file mode 100644 index 0000000..a0b3c6f --- /dev/null +++ b/public/assets/javascripts/ui/reader/EmbedView.js @@ -0,0 +1,50 @@ +var EmbedView = ModalView.extend({ + el: ".embedView", + + events: { + "keydown": "stopPropagation", + "input [name=width]": "build", + "input [name=height]": "build", + "click [name=mute]": "build", + "click textarea": "selectAll", + }, + + defaultWidth: 600, + defaultHeight: 450, + + initialize: function(opt){ + this.parent = opt.parent + this.$embedCode = this.$("#embedCode") + this.$width = this.$("[name=width]") + this.$height = this.$("[name=height]") + this.$mute = this.$("[name=mute]") + + this.$width.val(this.defaultWidth) + this.$height.val(this.defaultHeight) + }, + + show: function(){ + this.build() + this.__super__.show.call(this) + }, + + build: function(){ + var mute = this.$mute.prop('checked') ? 1 : 0 + var width = clamp( this.$width.int(), 0, 2000) || this.defaultWidth + var height = clamp( this.$height.int(), 0, 2000) || this.defaultHeight + var link = this.parent.getLink() + link += "?mute=" + mute +// link += "&noui=1" + var kode = "" + + this.$embedCode.val( kode ) + }, + + selectAll: function(){ + this.$embedCode[0].select() + }, + +}) diff --git a/public/assets/javascripts/ui/reader/ShareView.js b/public/assets/javascripts/ui/reader/ShareView.js index 8a205ba..dbe6f64 100644 --- a/public/assets/javascripts/ui/reader/ShareView.js +++ b/public/assets/javascripts/ui/reader/ShareView.js @@ -10,6 +10,7 @@ var ShareView = View.extend({ initialize: function(opt){ this.parent = opt.parent + this.embedView = new EmbedView ({ parent: this }) this.$link = this.$("#share_link") }, @@ -55,6 +56,7 @@ var ShareView = View.extend({ embed: function (e) { e.preventDefault() + this.embedView.show() }, }) diff --git a/public/assets/javascripts/util.js b/public/assets/javascripts/util.js index 2fa994a..1749836 100644 --- a/public/assets/javascripts/util.js +++ b/public/assets/javascripts/util.js @@ -239,4 +239,17 @@ if (!Function.prototype.bind) { }()); +function selectElementContents(el) { + if (window.getSelection && document.createRange) { + var sel = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(el); + sel.removeAllRanges(); + sel.addRange(range); + } else if (document.selection && document.body.createTextRange) { + var textRange = document.body.createTextRange(); + textRange.moveToElementText(el); + textRange.select(); + } +} diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 3fe9741..32fc817 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -2566,13 +2566,13 @@ a[data-role="forgot-password"] { /* COLLABORATORS */ -.collaborators .rap { +.mediaDrawer .rap { display: table; width: 100%; height: 100%; } -.collaborators .rap .holder .inner { +.mediaDrawer .rap .holder .inner { width: 480px; margin: 0 auto; text-align: left; @@ -2607,7 +2607,7 @@ a[data-role="forgot-password"] { background-color: black; border-color: black; } -.collaborators p { +.mediaDrawer .rap p { margin: 10px 0 20px; font-weight: 300; } @@ -2615,7 +2615,7 @@ a[data-role="forgot-password"] { font-size: 16px; width: 300px; } -.collaborators h2 { +.mediaDrawer .rap h2 { margin: 20px auto 0; } #collaborator-list { @@ -2672,6 +2672,30 @@ a[data-role="forgot-password"] { display: block; } +/* EMBED CODE GENERATOR */ + +.embedView textarea { + border: 1px solid black; + width: 100%; + height: 100px; + font-family: 'Menlo', 'Monaco', 'Lucida Sans Console', monospace; + padding: 5px; + line-height: 15px; +} +.embedView input[type=text] { + border: 1px solid black; + width: 40px; + padding: 2px; + font-size: 14px; + margin: 5px; +} +.embedView label { + font-size: 14px; +} +.embedView { + font-weight: 300; +} + /* MARCHING ANTS ANIMATION */ @-webkit-keyframes borderanimation { diff --git a/views/controls/editor/share.ejs b/views/controls/editor/share.ejs index 97f4ceb..7e7ad3c 100644 --- a/views/controls/editor/share.ejs +++ b/views/controls/editor/share.ejs @@ -14,6 +14,3 @@ - - \ No newline at end of file diff --git a/views/controls/reader/about-room.ejs b/views/controls/reader/about-room.ejs index c9ad626..eba8c98 100644 --- a/views/controls/reader/about-room.ejs +++ b/views/controls/reader/about-room.ejs @@ -13,6 +13,7 @@

Share on–

Facebook Twitter + Embed [[ if (canEdit) { ]] diff --git a/views/controls/reader/embed.ejs b/views/controls/reader/embed.ejs new file mode 100644 index 0000000..a897fbe --- /dev/null +++ b/views/controls/reader/embed.ejs @@ -0,0 +1,25 @@ +
+ X + +
+
+
+

Embed Vvalls

+ +

+ This code generates an iframe which will embed this room in your website or blog. +

+ + + dimensions: x + + + +
+
+
+
diff --git a/views/editor.ejs b/views/editor.ejs index b031759..efc4b9d 100755 --- a/views/editor.ejs +++ b/views/editor.ejs @@ -21,6 +21,7 @@ [[ include controls/editor/text-editor ]] [[ include controls/editor/collaborators ]] [[ include controls/editor/share ]] + [[ include controls/reader/embed ]] [[ include controls/editor/settings ]] [[ include controls/editor/presets ]] diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index f44b611..a94acb1 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -5,7 +5,7 @@ Terms Privacy - ©2014 VVALLS Inc. + ©2014 Dot Dash 3, Inc. [[ if (logged_in) { ]]

diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 3e61a5a..70c3b27 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -7,7 +7,7 @@ - + @@ -115,6 +115,7 @@ + diff --git a/views/reader.ejs b/views/reader.ejs index e86bab1..b9b53d2 100644 --- a/views/reader.ejs +++ b/views/reader.ejs @@ -15,6 +15,7 @@
[[ include controls/reader/about-room ]] [[ include controls/reader/media-player ]] + [[ include controls/reader/embed ]]