<commit_before>﻿function endsWith(str, suffix) {
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

$(function () {
    $("#browserTree").click(
        function (e) {
            var target = e.originalEvent.target.href;
            if (!(endsWith(target, "#"))) {
                window.location.href = target;
            }
        }
    );
});

$(document).ready(function () {
    var path = window.location.pathname;
    expandTreeView(path);
});

function expandTreeView(path) {
    var parts = path.split("/");
    var pathToDate = "";

    // Ignore the first three elements from the path:
    // Browse/UserName/RepoName/Folder1/Folder2/FileName
    for (var partNumber = 4; partNumber < parts.length; partNumber++)
    {
        pathToDate = pathToDate + "/" + parts[partNumber];
        expandNode(pathToDate);
    }
}

function expandNode(path) {
    //console.log(path);
    var selector = "li[id*='" + path + "']";
    //console.log("Looking for " + selector);
    var node = $(selector);
    if (node.length) {
        console.log("Found " + path);
        node.removeClass("collapsed");
    }
}<commit_msg>Fixes the Tree View js<commit_after>﻿function endsWith(str, suffix) {
    return str.indexOf(suffix, str.length - suffix.length) !== -1;
}

$(function () {
    $("#browserTree").click(
        function (e) {
            var target = e.originalEvent.target.href;
            if (!(endsWith(target, "#"))) {
                window.location.href = target;
            }
        }
    );
});

$(document).ready(function () {
    var path = window.location.pathname;
    expandTreeView(path);
});

function expandTreeView(path) {
    var parts = path.split("/");
    var pathToDate = "";

    // Ignore the first three elements from the path:
    // Browse/UserName/RepoName/Folder1/Folder2/FileName
    for (var partNumber = 4; partNumber < parts.length; partNumber++)
    {
        pathToDate = pathToDate + "/" + parts[partNumber];
        expandNode(pathToDate);
    }
}

function expandNode(path) {
    //console.log(path);
    var selector = "li[id='" + path + "']";
    //console.log("Looking for " + selector);
    var node = $(selector);
    var child = $(selector + " > ul");
    if (node.length) {
        console.log("Found node " + path);
        node.removeClass("collapsed");
    }
    if (child.length) {
        console.log("Found child " + path);
        child.show();
    }
}
{'fraction_non_alphanumeric': 0.1646090534979424, 'fraction_numerical': 0.0032921810699588477, 'mean_word_length': 2.419127988748242, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '4885750', 'n_tokens_mistral': 754, 'n_tokens_neox': 748, 'n_words': 153}