<commit_before>(function () {
    var id;
    var element;
    var list;
    var activeIndex = 0;

    function Jump(size) {
        id = 'jumper';
        element = document.getElementById(id);

        list = new List(id, {
            valueNames: ['index'],
            page: size
        });

        bind();
    }

    function bind() {
        Mousetrap.bind(['command+k', 'ctrl+k', 'command+j', 'ctrl+j'], function (e) {
            deactivateAll();
            show();
            return false;
        });

        Mousetrap(element).bind(['backspace'], function (e) {
            deactivateAll();
        });

        Mousetrap(element).bind(['esc', '`'], function (e) {
            hide();
            return false;
        });

        Mousetrap(element).bind(['up'], function (e) {
            var numberOfResults = size();
            var previousIndex = activeIndex;
            if (activeIndex === 0) {
                activeIndex = numberOfResults - 1;
            } else {
                activeIndex--;
            }
            deactive(previousIndex);
            activate(activeIndex);
            return false;
        });

        Mousetrap(element).bind(['down', 'tab'], function (e) {
            var numberOfResults = size();
            var previousIndex = activeIndex;
            if ((activeIndex + 1) >= numberOfResults) {
                activeIndex = 0;
            } else {
                activeIndex++;
            }
            deactive(previousIndex);
            activate(activeIndex);
            return false;
        });

        Mousetrap(element).bind(['enter'], function (e) {
            element.getElementsByTagName('a')[activeIndex].click();
            return false;
        });

        list.on('searchComplete', function () {
            deactivateAll();
        });
    }

    function show() {
        element = document.getElementById('jumper');
        activeIndex = 0;
        element.style.display = 'block';
        element.getElementsByClassName('mousetrap')[0].focus();
        element.getElementsByTagName('a')[0].classList.add('active');
        document.body.classList.add('do-not-scroll');
    }

    function hide() {
        document.body.classList.remove('do-not-scroll');
        var elementById = document.getElementById('jumper');
        elementById.style.display = 'none';
        activeIndex = 0;
    }
<commit_msg>Add global quit keys if someone isn't in search box<commit_after>(function () {
    var id;
    var element;
    var list;
    var activeIndex = 0;

    function Jump(size) {
        id = 'jumper';
        element = document.getElementById(id);

        list = new List(id, {
            valueNames: ['index'],
            page: size
        });

        bind();
    }

    function bind() {
        Mousetrap.bind(['command+k', 'ctrl+k', 'command+j', 'ctrl+j'], function (e) {
            deactivateAll();
            show();
            return false;
        });

        Mousetrap(element).bind(['backspace'], function (e) {
            deactivateAll();
        });

        Mousetrap(element).bind(['esc', '`'], function (e) {
            hide();
            return false;
        });

        Mousetrap(element).bind(['up'], function (e) {
            var numberOfResults = size();
            var previousIndex = activeIndex;
            if (activeIndex === 0) {
                activeIndex = numberOfResults - 1;
            } else {
                activeIndex--;
            }
            deactive(previousIndex);
            activate(activeIndex);
            return false;
        });

        Mousetrap(element).bind(['down', 'tab'], function (e) {
            var numberOfResults = size();
            var previousIndex = activeIndex;
            if ((activeIndex + 1) >= numberOfResults) {
                activeIndex = 0;
            } else {
                activeIndex++;
            }
            deactive(previousIndex);
            activate(activeIndex);
            return false;
        });

        Mousetrap(element).bind(['enter'], function (e) {
            element.getElementsByTagName('a')[activeIndex].click();
            return false;
        });

        list.on('searchComplete', function () {
            deactivateAll();
        });
    }

    function show() {
        Mousetrap.bind(['esc', '`'], function (e) {
            hide();
            return false;
        });
        element = document.getElementById('jumper');
        activeIndex = 0;
        element.style.display = 'block';
        element.getElementsByClassName('mousetrap')[0].focus();
        element.getElementsByTagName('a')[0].classList.add('active');
        document.body.classList.add('do-not-scroll');
    }

    function hide() {
        Mousetrap.unbind(['esc', '`']);
        document.body.classList.remove('do-not-scroll');
        var elementById = document.getElementById('jumper');
        elementById.style.display = 'none';
        activeIndex = 0;
    }

{'fraction_non_alphanumeric': 0.14141821112006447, 'fraction_numerical': 0.0036261079774375505, 'mean_word_length': 1.6852352623039482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3537606', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1304, 'n_words': 254}