diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/assets/javascripts/ui/reader/EmbedView.js | 50 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/reader/ShareView.js | 2 | ||||
| -rw-r--r-- | public/assets/javascripts/util.js | 13 | ||||
| -rwxr-xr-x | public/assets/stylesheets/app.css | 32 |
4 files changed, 93 insertions, 4 deletions
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 = "<iframe src='" + encodeURI(link) + "' width='" + width + "' height='" + height + "'" + + " seamless scrolling='no' style='border: 0'" + + " webkitAllowFullScreen mozallowfullscreen allowfullscreen" + + "></iframe>" + + 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 { |
