<commit_before>// VIEW

/**
 * @class
 */
function Track(name, key, loaded, changeCallback) {
    this.name = name;
    this.key = key;
    this.loaded = loaded;
    this.changed = changeCallback;
    this.height = 0;
    this.shown = true;
    this.empty = false;
}

Track.prototype.load = function(url) {
    var curTrack = this;
    dojo.xhrGet({url: url,
                 handleAs: "json",
                 load: function(o) { curTrack.loadSuccess(o, url); },
                 error: function(o) { curTrack.loadFail(o, url); }
	        });
};

Track.prototype.loadSuccess = function(error) {
    this.setLoaded();
};

Track.prototype.loadFail = function(error) {
    this.empty = true;
    this.setLoaded();
};

Track.prototype.setViewInfo = function(heightUpdate, numBlocks,
                                       trackDiv, labelDiv,
                                       widthPct, widthPx, scale) {
    var track = this;
    this.heightUpdate = function(height, blockIndex) {
        if (!this.shown) {
            heightUpdate(0);
            return;
        }
        if (blockIndex !== undefined) track.blockHeights[blockIndex] = height;

        track.height = Math.max(track.height, height);
        if (!track.inShowRange) {
            heightUpdate(Math.max(track.labelHeight, track.height));
        }
    };
    this.div = trackDiv;
    this.label = labelDiv;
    this.widthPct = widthPct;
    this.widthPx = widthPx;

    this.leftBlank = document.createElement("div");
    this.leftBlank.className = "blank-block";
    this.rightBlank = document.createElement("div");
    this.rightBlank.className = "blank-block";
    this.div.appendChild(this.rightBlank);
    this.div.appendChild(this.leftBlank);

    this.sizeInit(numBlocks, widthPct);
    this.labelHTML = "";
    this.labelHeight = 0;
};

Track.prototype.hide = function() {
    if (this.shown) {
        this.div.style.display = "none";<commit_msg>take Track.heightUpdate out of setViewInfo, make it overridable<commit_after>// VIEW

/**
 * @class
 */
function Track(name, key, loaded, changeCallback) {
    this.name = name;
    this.key = key;
    this.loaded = loaded;
    this.changed = changeCallback;
    this.height = 0;
    this.shown = true;
    this.empty = false;
}

Track.prototype.load = function(url) {
    var curTrack = this;
    dojo.xhrGet({url: url,
                 handleAs: "json",
                 load: function(o) { curTrack.loadSuccess(o, url); },
                 error: function(o) { curTrack.loadFail(o, url); }
	        });
};

Track.prototype.loadSuccess = function(error) {
    this.setLoaded();
};

Track.prototype.loadFail = function(error) {
    this.empty = true;
    this.setLoaded();
};


Track.prototype.heightUpdate = function(height, blockIndex) {
    if (!this.shown) {
        this.heightUpdateCallback(0);
        return;
    }

    if (blockIndex !== undefined)
        this.blockHeights[blockIndex] = height;

    this.height = Math.max( this.height, height );
    if ( ! this.inShowRange ) {
        this.heightUpdateCallback( Math.max( this.labelHeight, this.height ) );
    }
};

Track.prototype.setViewInfo = function(heightUpdate, numBlocks,
                                       trackDiv, labelDiv,
                                       widthPct, widthPx, scale) {

    this.heightUpdateCallback = heightUpdate;
    this.div = trackDiv;
    this.label = labelDiv;
    this.widthPct = widthPct;
    this.widthPx = widthPx;

    this.leftBlank = document.createElement("div");
    this.leftBlank.className = "blank-block";
    this.rightBlank = document.createElement("div");
    this.rightBlank.className = "blank-block";
    this.div.appendChild(this.rightBlank);
    this.div.appendChild(this.leftBlank);

    this.sizeInit(numBlocks, widthPct);
    this.labelHTML = "";
    this.labelHeight = 0;
};

Track.prototype.hide = function() {
    if (this.shown) {
        this.div.style.display = "none";
{'fraction_non_alphanumeric': 0.13435114503816795, 'fraction_numerical': 0.0015267175572519084, 'mean_word_length': 2.4034632034632035, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3890406', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1202, 'n_words': 220}