<commit_before>goog.provide('mirosubs.VideoPlayer');

mirosubs.VideoPlayer = function(videoElem) {
    this.videoElem_ = videoElem;
    this.videoDiv_ = videoElem.parentNode;
    this.captionElem_ = null;
};

mirosubs.VideoPlayer.wrap = function(video_elem_id) {
    // in the future can be used to abstract flash player, etc.
    return new mirosubs.VideoPlayer(goog.dom.$(video_elem_id));
};

mirosubs.VideoPlayer.prototype.getPlayheadTime = function() {
    return this.videoElem_["currentTime"];
};

mirosubs.VideoPlayer.prototype.setPlayheadTime = function(playheadTime) {
    this.videoElem_["currentTime"] = playheadTime;
};

/**
 *
 * @param {String} text Caption text to display in video. null for blank.
 */
mirosubs.VideoPlayer.prototype.showCaptionText = function(text) {
    if (text == null || text == "") {
        if (this.captionElem_ != null) {
            this.videoDiv_.removeChild(this.captionElem_);
            this.captionElem_ = null;
        }
    }
    else {
        if (this.captionElem_ == null) {
            this.captionElem_ = document.createElement("div");
            this.captionElem_.setAttribute("class", "mirosubs-captionDiv");
            this.videoDiv_.appendChild(this.captionElem_);
        }
        goog.dom.setTextContent(this.captionElem_, text);
    }
};<commit_msg>Positioning caption div based on video height<commit_after>goog.provide('mirosubs.VideoPlayer');

mirosubs.VideoPlayer = function(videoElem) {
    this.videoElem_ = videoElem;
    this.videoDiv_ = videoElem.parentNode;
    this.captionElem_ = null;
};

mirosubs.VideoPlayer.wrap = function(video_elem_id) {
    // in the future can be used to abstract flash player, etc.
    return new mirosubs.VideoPlayer(goog.dom.$(video_elem_id));
};

mirosubs.VideoPlayer.prototype.getPlayheadTime = function() {
    return this.videoElem_["currentTime"];
};

mirosubs.VideoPlayer.prototype.setPlayheadTime = function(playheadTime) {
    this.videoElem_["currentTime"] = playheadTime;
};

/**
 *
 * @param {String} text Caption text to display in video. null for blank.
 */
mirosubs.VideoPlayer.prototype.showCaptionText = function(text) {
    if (text == null || text == "") {
        if (this.captionElem_ != null) {
            this.videoDiv_.removeChild(this.captionElem_);
            this.captionElem_ = null;
        }
    }
    else {
        if (this.captionElem_ == null) {
            this.captionElem_ = document.createElement("div");
            this.captionElem_.setAttribute("class", "mirosubs-captionDiv");
            var videoSize = goog.style.getSize(this.videoElem_);
            this.captionElem_.style.top = (videoSize.height - 60) + "px";
            this.videoDiv_.appendChild(this.captionElem_);
        }
        goog.dom.setTextContent(this.captionElem_, text);
    }
};
{'fraction_non_alphanumeric': 0.12754555198285103, 'fraction_numerical': 0.0007145409074669524, 'mean_word_length': 3.229607250755287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1861018', 'n_tokens_mistral': 862, 'n_tokens_neox': 856, 'n_words': 149}