<commit_before>var hashchange = (function () {

var exports = {};

var expected_hash;
var changing_hash = false;

// Some browsers zealously URI-decode the contents of
// window.location.hash.  So we hide our URI-encoding
// by replacing % with . (like MediaWiki).

function encodeHashComponent(str) {
    return encodeURIComponent(str)
        .replace(/\./g, '%2E')
        .replace(/%/g,  '.');
}

function decodeHashComponent(str) {
    return decodeURIComponent(str.replace(/\./g, '%'));
}

exports.changehash = function (newhash) {
    if (changing_hash) {
        return;
    }
    $(document).trigger($.Event('hashchange'));
    expected_hash = newhash;
    // Some browsers reset scrollTop when changing the hash to "",
    // so we save and restore it.
    // http://stackoverflow.com/questions/4715073/window-location-hash-prevent-scrolling-to-the-top
    var scrolltop = viewport.scrollTop();
    window.location.hash = newhash;
    util.reset_favicon();
    if (newhash === "" || newhash === "#") {
        viewport.scrollTop(scrolltop);
    }
};

exports.save_narrow = function (operators) {
    if (changing_hash) {
        return;
    }
    if (operators === undefined) {
        exports.changehash('#');
    } else {
        var new_hash = '#narrow';
        $.each(operators, function (idx, elem) {
            new_hash += '/' + encodeHashComponent(elem[0])
                      + '/' + encodeHashComponent(elem[1]);
        });
        exports.changehash(new_hash);
    }
};

function parse_narrow(hash) {<commit_msg>Fix name of hashchange.zephyr event in changehash<commit_after>var hashchange = (function () {

var exports = {};

var expected_hash;
var changing_hash = false;

// Some browsers zealously URI-decode the contents of
// window.location.hash.  So we hide our URI-encoding
// by replacing % with . (like MediaWiki).

function encodeHashComponent(str) {
    return encodeURIComponent(str)
        .replace(/\./g, '%2E')
        .replace(/%/g,  '.');
}

function decodeHashComponent(str) {
    return decodeURIComponent(str.replace(/\./g, '%'));
}

exports.changehash = function (newhash) {
    if (changing_hash) {
        return;
    }
    $(document).trigger($.Event('hashchange.zephyr'));
    expected_hash = newhash;
    // Some browsers reset scrollTop when changing the hash to "",
    // so we save and restore it.
    // http://stackoverflow.com/questions/4715073/window-location-hash-prevent-scrolling-to-the-top
    var scrolltop = viewport.scrollTop();
    window.location.hash = newhash;
    util.reset_favicon();
    if (newhash === "" || newhash === "#") {
        viewport.scrollTop(scrolltop);
    }
};

exports.save_narrow = function (operators) {
    if (changing_hash) {
        return;
    }
    if (operators === undefined) {
        exports.changehash('#');
    } else {
        var new_hash = '#narrow';
        $.each(operators, function (idx, elem) {
            new_hash += '/' + encodeHashComponent(elem[0])
                      + '/' + encodeHashComponent(elem[1]);
        });
        exports.changehash(new_hash);
    }
};

function parse_narrow(hash) {
{'fraction_non_alphanumeric': 0.15014436958614052, 'fraction_numerical': 0.006416426050689766, 'mean_word_length': 2.7252090800477897, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4987450', 'n_tokens_mistral': 967, 'n_tokens_neox': 956, 'n_words': 202}