Skip to content

Commit

Permalink
Fixd how the display is populated.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Jun 21, 2012
1 parent 24a210e commit e1add05
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/youtube.teaser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@ youtube.teaser.prototype.constructor = youtube.teaser;
/** Override the create method. */
youtube.teaser.prototype.create = function(context) {
youtube.display.prototype.create.call(this, context);
var display = jQuery('<li><a href="' + this.options.link + '">\
<img src="' + this.options.thumbnail + '" />\
<h3>' + this.options.title + '</h3>\
<p>' + this.options.description + '</p>\
</a></li>');
var display = jQuery(document.createElement('li'));
this.link = jQuery(document.createElement('a'));
this.title = jQuery(document.createElement('h3'));
this.thumbnail = jQuery(document.createElement('img'));
this.description = jQuery(document.createElement('p'));

// Build the display.
display.append(this.link.append(this.thumbnail).append(this.title).append(this.description));
context.append(display);
return display;
};

/** Override the init method. */
youtube.teaser.prototype.init = function(options) {
youtube.display.prototype.init.call(this, options);
this.link.attr({href: options.link});
this.title.text(options.title);
this.thumbnail.attr({src: options.thumbnail});
this.description.text(options.description);
};

0 comments on commit e1add05

Please sign in to comment.