<commit_before>$.widget("uce.activity", {
    options: {
        ucemeeting          : null,
        start               : 0
    },
    _create: function() {
        this.element.addClass('ui-widget ui-activity');
        if (this.options.ucemeeting) {
            var that = this;
            this.options.ucemeeting.bind("internal.search.result", function(event) {
                that.handleSearchResultsEvent(event.metadata.events);
            });
        }
    },
    handleSearchResultsEvent: function(results) {
        var uce   = this.options.ucemeeting;
        var values = [];
        var timebox = 60 * 1000; // 1 min

        if (results.length > 0) {
            var start = results[0].datetime;
            var end = results[results.length - 1].datetime;
            var nb_slices = (end - start) / timebox + 1;

            /* initialize */
            for (var slice = 0; slice < nb_slices; slice++) {
                values[slice] = 0;
            }
            /* fill */
            $.each(results, function(i, event) {
                values[parseInt((event.datetime - start) / timebox)]++;
            });

        }

        var max_slice = 0;
        for (var slice = 0; slice < nb_slices; slice++) {
            if (values[slice] > max_slice) {
                max_slice = slice;
            }
        }

        this.clear();
        var id = $(this.element).attr('id')
        graph = Raphael(id, 600, 180).g;
        fin = function () {
            this.flag = graph.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
        },
        fout = function () {
            this.flag.animate({opacity: 0}, 100, function () {this.remove();});
        },

        graph.barchart(10, 10, 600, 180, [values]).hover(fin, fout).click(function(event) {

        });
        $('<div>').attr('class', 'ui-search-elem-title').text("Activity chart").prependTo(this.element);
        var rec_scene = $('<div>').attr('class', 'ui-search-elem-title').text("Go to the recommended scene");
        var that = this;<commit_msg>Fix global leak in activity widgets.<commit_after>$.widget("uce.activity", {
    options: {
        ucemeeting          : null,
        start               : 0
    },
    _create: function() {
        this.element.addClass('ui-widget ui-activity');
        if (this.options.ucemeeting) {
            var that = this;
            this.options.ucemeeting.bind("internal.search.result", function(event) {
                that.handleSearchResultsEvent(event.metadata.events);
            });
        }
    },
    handleSearchResultsEvent: function(results) {
        var uce   = this.options.ucemeeting;
        var values = [];
        var timebox = 60 * 1000; // 1 min

        if (results.length > 0) {
            var start = results[0].datetime;
            var end = results[results.length - 1].datetime;
            var nb_slices = (end - start) / timebox + 1;

            /* initialize */
            for (var slice = 0; slice < nb_slices; slice++) {
                values[slice] = 0;
            }
            /* fill */
            $.each(results, function(i, event) {
                values[parseInt((event.datetime - start) / timebox)]++;
            });

        }

        var max_slice = 0;
        for (var slice = 0; slice < nb_slices; slice++) {
            if (values[slice] > max_slice) {
                max_slice = slice;
            }
        }

        this.clear();
        var id = $(this.element).attr('id');
        var graph = Raphael(id, 600, 180).g;
        var fin = function () {
            this.flag = graph.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
        };
        var fout = function () {
            this.flag.animate({opacity: 0}, 100, function () {this.remove();});
        };

        graph.barchart(10, 10, 600, 180, [values]).hover(fin, fout);
        $('<div>').attr('class', 'ui-search-elem-title').text("Activity chart").prependTo(this.element);
        var rec_scene = $('<div>').attr('class', 'ui-search-elem-title').text("Go to the recommended scene");
        var that = this;
{'fraction_non_alphanumeric': 0.1533041788143829, 'fraction_numerical': 0.017978620019436346, 'mean_word_length': 1.704993429697766, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7232011', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1188, 'n_words': 249}