(function() {
  var cs;

  cs = window.CS || (window.CS = {});

  cs.Data || (cs.Data = {});

  cs.Views || (cs.Views = {});

  cs.Views.VideoPostView = Backbone.View.extend({
    initialize: function() {
      this.extractVideo();
    },
    extractVideo: function() {
      var $el, embedCode, h, ratio, w;
      var _this = this;
      embedCode = '';
      _.each(this.$('iframe'), function(el, index) {
        var $el;
        $el = $(el);
        if (index > 0) {
          $el.remove();
        } else {
          embedCode = el;
        }
      });
      $el = $(embedCode);
      w = $el.width();
      h = $el.height();
      ratio = w / h;
      $el.height(464);
      $el.width(Math.round(464 * ratio));
      this.$('.video').append($el);
    }
  });

}).call(this);

