Skip to content

Commit

Permalink
Captions and credits now show up when the media is loaded, not before
Browse files Browse the repository at this point in the history
  • Loading branch information
zachwise committed Dec 20, 2013
1 parent 92e18b3 commit bee456a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 38 deletions.
12 changes: 6 additions & 6 deletions compiled/js/storymap-min.js

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions compiled/js/storymap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4605,6 +4605,24 @@ VCO.Media = VCO.Class.extend({
if (this.message) {
this.message.hide();
}
this.showMeta();
},

showMeta: function() {

// Credit
if (this.data.credit && this.data.credit != "") {
this._el.credit = VCO.Dom.create("div", "vco-credit", this._el.content_container);
this._el.credit.innerHTML = this.data.credit;
this.options.credit_height = this._el.credit.offsetHeight;
}

// Caption
if (this.data.caption && this.data.caption != "") {
this._el.caption = VCO.Dom.create("div", "vco-caption", this._el.content_container);
this._el.caption.innerHTML = this.data.caption;
this.options.caption_height = this._el.caption.offsetHeight;
}
},

onAdd: function() {
Expand Down Expand Up @@ -4643,20 +4661,6 @@ VCO.Media = VCO.Class.extend({
this._el.content = VCO.Dom.create("div", "vco-media-content", this._el.content_container);
}

// Credit
if (this.data.credit && this.data.credit != "") {
this._el.credit = VCO.Dom.create("div", "vco-credit", this._el.content_container);
this._el.credit.innerHTML = this.data.credit;
this.options.credit_height = this._el.credit.offsetHeight;
}

// Caption
if (this.data.caption && this.data.caption != "") {
this._el.caption = VCO.Dom.create("div", "vco-caption", this._el.content_container);
this._el.caption.innerHTML = this.data.caption;
this.options.caption_height = this._el.caption.offsetHeight;
}


},

Expand Down Expand Up @@ -5540,8 +5544,6 @@ VCO.Media.Wikipedia = VCO.Media.extend({
self.createMedia(d);
});

// After Loaded
this.onLoaded();
},
createMedia: function(d) {
var wiki = "";
Expand Down
32 changes: 18 additions & 14 deletions source/js/media/VCO.Media.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,24 @@ VCO.Media = VCO.Class.extend({
if (this.message) {
this.message.hide();
}
this.showMeta();
},

showMeta: function() {

// Credit
if (this.data.credit && this.data.credit != "") {
this._el.credit = VCO.Dom.create("div", "vco-credit", this._el.content_container);
this._el.credit.innerHTML = this.data.credit;
this.options.credit_height = this._el.credit.offsetHeight;
}

// Caption
if (this.data.caption && this.data.caption != "") {
this._el.caption = VCO.Dom.create("div", "vco-caption", this._el.content_container);
this._el.caption.innerHTML = this.data.caption;
this.options.caption_height = this._el.caption.offsetHeight;
}
},

onAdd: function() {
Expand Down Expand Up @@ -202,20 +220,6 @@ VCO.Media = VCO.Class.extend({
this._el.content = VCO.Dom.create("div", "vco-media-content", this._el.content_container);
}

// Credit
if (this.data.credit && this.data.credit != "") {
this._el.credit = VCO.Dom.create("div", "vco-credit", this._el.content_container);
this._el.credit.innerHTML = this.data.credit;
this.options.credit_height = this._el.credit.offsetHeight;
}

// Caption
if (this.data.caption && this.data.caption != "") {
this._el.caption = VCO.Dom.create("div", "vco-caption", this._el.content_container);
this._el.caption.innerHTML = this.data.caption;
this.options.caption_height = this._el.caption.offsetHeight;
}


},

Expand Down
2 changes: 0 additions & 2 deletions source/js/media/types/VCO.Media.Wikipedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ VCO.Media.Wikipedia = VCO.Media.extend({
self.createMedia(d);
});

// After Loaded
this.onLoaded();
},
createMedia: function(d) {
var wiki = "";
Expand Down

0 comments on commit bee456a

Please sign in to comment.