(function ($) {
AblePlayer.prototype.updateMeta = function (time) {
if (this.hasMeta) {
if (this.metaType === 'text') {
this.$metaDiv.show();
this.showMeta(time || this.getElapsed());
}
else {
this.showMeta(time || this.getElapsed());
}
}
};
AblePlayer.prototype.showMeta = function(now) {
var tempSelectors, m, thisMeta,
cues, cueText, cueLines, i, line,
showDuration, focusTarget;
tempSelectors = [];
if (this.meta.length >= 1) {
cues = this.meta;
}
else {
cues = [];
}
for (m = 0; m < cues.length; m++) {
if ((cues[m].start <= now) && (cues[m].end > now)) {
thisMeta = m;
break;
}
}
if (typeof thisMeta !== 'undefined') {
if (this.currentMeta !== thisMeta) {
if (this.metaType === 'text') {
// it's time to load the new metadata cue into the container div
this.$metaDiv.html(this.flattenCueForMeta(cues[thisMeta]).replace('\n', '
'));
}
else if (this.metaType === 'selector') {
// it's time to show content referenced by the designated selector(s)
cueText = this.flattenCueForMeta(cues[thisMeta]);
cueLines = cueText.split('\n');
for (i=0; i=0; i--) {
if ($.inArray(this.visibleSelectors[i],tempSelectors) == -1) {
$(this.visibleSelectors[i]).hide();
this.visibleSelectors.splice(i,1);
}
}
}
}
}
this.currentMeta = thisMeta;
}
}
else {
// there is currently no metadata. Empty stale content
if (typeof this.$metaDiv !== 'undefined') {
this.$metaDiv.html('');
}
if (this.visibleSelectors && this.visibleSelectors.length) {
for (i=0; i