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() }, })