<commit_before>/*jslint browser: true*/
/*global $*/

(function () {
    "use strict";

    var sample_data = ["string", "test", "data", "string2"];

    function fuzzyMatcher(entries) {
        return function (q, cb) {
            var matches, regex;
            matches = [];
            regex = new RegExp(q, "i");

            /*jslint unparam: true*/
            $.each(entries, function (i, str) {
                if (regex.test(str)) {
                    matches.push({ value: str });
                }
            });

            cb(matches);
        };
    }

    $(document).ready(function () {
        function search() {
            $.get(
                'search',
                {"string": $("#search-field").val()},
                function (response) {
                    $("#content").html("");
                    $("#content").append(response);
                }
            );
        }

        $('.typeahead').typeahead({
            minLength: 3,
            highlight: true,
        }, {
            name: 'topic-dataset',
            source: fuzzyMatcher(sample_data)
        });

        $("#content").on("click", ".shownote-heading-div",
            function () {
                $(this).next().toggle(200);
            });

        $("#content").on("mouseenter", ".shownote-heading-div",
            function () {
                $(this).removeClass("bg-info");
                $(this).addClass("bg-primary");
            });

        $("#content").on("mouseleave", ".shownote-heading-div",
            function () {
                $(this).removeClass("bg-primary");
                $(this).addClass("bg-info");
            });

        $("#search-button").click(search);

        $("#search-field").keypress(function (e) {
            if (e.which === 13) {
                search();
            }
        });
    });
}());<commit_msg>TopicPopupView started<commit_after>/*jslint browser: true*/
/*global $, Mustache*/

(function () {
    "use strict";

    function TopicPopupView() {
        this.template = $('#topic-list-template').html();

        this.render = function (view) {
            var rendered = Mustache.render(this.template, view);
            $('#topic-field').after(rendered);
        };

        this.getTopics = function () {
            //TODO: do ajax, fake it for now
            var view = {
                topics: ["topic1", "topic2", "topic3"]
            };
            this.render(view);
        };

        this.filter = function () {
            return null;
        };

        // register event handlers

        // initialise data and render
        this.getTopics();
    }

    function fuzzyMatcher(entries) {
        return function (q, cb) {
            var matches, regex;
            matches = [];
            regex = new RegExp(q, "i");

            /*jslint unparam: true*/
            $.each(entries, function (i, str) {
                if (regex.test(str)) {
                    matches.push({ value: str });
                }
            });
            cb(matches);
        };
    }

    $(document).ready(function () {
        Mustache.tags = ["[[", "]]"];
        var topicPopupView = new TopicPopupView();

        function search() {
            $.get(
                'search',
                {"string": $("#search-field").val()},
                function (response) {
                    $("#content").html("");
                    $("#content").append(response);
                }
            );
        }

        $("#content").on("click", ".shownote-heading-div",
            function () {
                $(this).next().toggle(200);
            });

        $("#content").on("mouseenter", ".shownote-heading-div",
            function () {
                $(this).removeClass("bg-info");
                $(this).addClass("bg-primary");
            });

        $("#content").on("mouseleave", ".shownote-heading-div",
            function () {
                $(this).removeClass("bg-primary");
                $(this).addClass("bg-info");
            });

        $("#search-button").click(search);

        $("#search-field").keypress(function (e) {
            if (e.which === 13) {
                search();
            }
        });
    });
}());
{'fraction_non_alphanumeric': 0.1777044543954749, 'fraction_numerical': 0.003535234503888758, 'mean_word_length': 1.3267543859649122, 'pattern_counts': {'":': 2, '<': 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': '7309236', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1089, 'n_words': 194}