<commit_before>var samples = {

    langs: function () {
        if (!this._langs) {
            this._langs = [];
            var self = this;
            $("li.lang a").each(function () {
                self._langs.push($(this).attr("id"));
            });
        }
        return this._langs;
    },

    sections: function () {
        if (!this._sections) {
            this._sections = [];
            var hasAllLangs = "";
            for (var i = 0; i < this.langs().length; i++) {
                hasAllLangs += ":has(div.highlight-" +
                    this.langs()[i] + ")";
            }
            this._sections = $("div.body div.section").children();
        }
        return this._sections;
    },

    hide: function () {
        for (var i = 0; i < this.langs().length; i++) {
            var id = this.langs()[i];
            this.hideSamples(id);
        }
    },

    show: function () {
        this.change($.cookie('samples_code_language') || 'bash');
    },

    change: function (to, from) {
        from = from || this.current;

        // grab random element in body for scrolltop comparison
        var some_elem = $('p:in-viewport')[0];
        var old_top = $(some_elem).offset().top;

        this.hide();
        this.showSamples(to || 'bash');

        // calculate change in offset and scroll the difference
        // (for better user experience)
        var new_top = $(some_elem).offset().top;
        var changed_top = new_top - old_top;
        var current_top = $(window).scrollTop();
        $(window).scrollTop(current_top + changed_top);

        var date = new Date();
        date.setDate(date.getDate() + 365);
        $.cookie('samples_code_language', to,
                 { expires: date});
    },<commit_msg>fixed jump around lang clicked undefined element bug<commit_after>var samples = {

    langs: function () {
        if (!this._langs) {
            this._langs = [];
            var self = this;
            $("li.lang a").each(function () {
                self._langs.push($(this).attr("id"));
            });
        }
        return this._langs;
    },

    sections: function () {
        if (!this._sections) {
            this._sections = [];
            var hasAllLangs = "";
            for (var i = 0; i < this.langs().length; i++) {
                hasAllLangs += ":has(div.highlight-" +
                    this.langs()[i] + ")";
            }
            this._sections = $("div.body div.section").children();
        }
        return this._sections;
    },

    hide: function () {
        for (var i = 0; i < this.langs().length; i++) {
            var id = this.langs()[i];
            this.hideSamples(id);
        }
    },

    show: function () {
        this.change($.cookie('samples_code_language') || 'bash');
    },

    change: function (to, from) {
        from = from || this.current;

        // grab random element in body for scrolltop comparison
        var some_elem = $('p:in-viewport')[0];
        if (!some_elem) {
            some_elem = document.elementFromPoint(
            $('div.bodywrapper').offset().left + 20,
            $('section.subnav').height() + 30);
        }
        var old_top = $(some_elem).offset().top;

        this.hide();
        this.showSamples(to || 'bash');

        // calculate change in offset and scroll the difference
        // (for better user experience)
        var new_top = $(some_elem).offset().top;
        var changed_top = new_top - old_top;
        var current_top = $(window).scrollTop();
        $(window).scrollTop(current_top + changed_top);

        var date = new Date();
        date.setDate(date.getDate() + 365);
        $.cookie('samples_code_language', to,
                 { expires: date});
    },
{'fraction_non_alphanumeric': 0.15622500666488937, 'fraction_numerical': 0.004265529192215409, 'mean_word_length': 1.681915654038599, 'pattern_counts': {'":': 2, '<': 7, '<?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': '3918168', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1060, 'n_words': 239}