<commit_before>$(function() {
    "use strict";

    var preset_data = {
        'bird':     '0000000000000000000111000000000000100010000001100110101000011010111000100110001000111111100001000001000000001110001001000011001000100011110001000001000000011000000011111110000000000010010000000000001001000000000011101100000000000110011000000000101010100000',
        'boy':      '0000000011110000000011111111110000011111111111101111111111111110010000100011111100111100000011110001000000000111000100100010011000100010101000100010000000000010000100100010010000010001110001000000100000001000000001100011000000000101110100000000100000001000',
        'cherry':   '0000011111000000000010000010110000010001111100100000110001110010000000111010010000000001001100100000001000101110000001000010000000001000001000000011110000111000010011000101010010110010100110101001101010110010100000101000001001000100010001000011100000111000',
        'dog':      '0001100000110000001111000111100001111111111111001111110001111110111111000111111011111000001111101111000000011110011000000000110001001000001001000100101110100100010000010000010001000001000001000100010101000100001000101000100000010000000100000000111111100000',
        'fish':     '0000000000111100000000001100010000000011010010000000010101001000000010010101001100010001010101010010000101011001010010010101000101001001010100010010000101011001000100010101010100001001010100110000010101001000000000110100100000000000110001000000000000111100',
        'onepiece': '0001100000001100001111000001111000111111111111100001110010011100000011000001100000000110001100000000011101110000000001111111000000001000000010000001010101010100001010101010101001010101010101010110101010101011010101010101010100100110011001100001100110011000',
        'rabbit':   '0011000000011000010010000010010001001000001001000100010001000100001001000100100000010010100100000000101110100000000100000001000000100000000010000010010001001000001000010000100000100000000010000010001110001000000100000001000000001000001000000000011111000000'
    };

    var opt = {
        'title': null,
        'row': null,
        'noedit': false,
        'nofocus': false,
        'nomag': false,
        'load': false,
        'save': false,
        'export': false,
        'lock': false,
        'clear': false,
        'preset': [],
        'data': null
    };

    var current_row = null;
    var mouse_tracking;
    var touch_tracking = [];

    // http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript
    function is_touch_device() {
        return !!('ontouchstart' in window) // works on most browsers
            || !!('onmsgesturechange' in window); // works on ie10
    }

    function log(msg) {
        var li = $('<li/>');
        li.text(msg);
        li.appendTo('#log-panel');
        setTimeout(function() {
            li.addClass('hidden');
            li.on('webkitTransitionEnd oTransitionEnd transitionend', function() {
                $(this).addClass('disabled');
            });
        }, 0);
    }

    function get_data() {
        var data = "";
        for (var i = 1; i <= 16; ++i) {
            for (var j = 1; j <= 16; ++j) {
                var panel = $('#panel' + i + '-' + j);

                if (panel.hasClass('white')) {
                    data += '0';
                }
                else if (panel.hasClass('black')) {
                    data += '1';
                }
                else {
                    data += '.';
                }
            }
        }
        return data;
    }

    function set_data(data) {
        for (var i = 1; i <= 16; ++i) {
            for (var j = 1; j <= 16; ++j) {
                var panel = $('#panel' + i + '-' + j);

                var k = 16 * (i - 1) + (j - 1);
                if (data[k] === '0') {
                    panel.addClass("white invisible-text");
                    panel.removeClass("black");
                }
                else if (data[k] === '1') {
                    panel.addClass("black invisible-text");
                    panel.removeClass("white");
                }
                else {
                    panel.removeClass("white black invisible-text");
                }
            }
        }
    }

    function save_state() {
        localStorage['resume_data'] = JSON.stringify({
            'row': current_row,
            'locked': !$('#lock').hasClass('disabled'),
            'data': get_data()
        });
    }

    function toggle_panel_color(panel) {
        if ($(panel).hasClass("black") || $(panel).hasClass("white")) {
            $(panel).toggleClass("black white");
        }
        else {
            $(panel).addClass("white invisible-text");
        }
        save_state();
    }

    function unselect_row(i) {
        $('#row' + i).removeClass('selected');
    }

    function select_row(i) {
        $('#row' + i).addClass('selected');
    }

    function unmagnify_row(i) {
        $('#row' + i).removeClass('magnified');
    }

    function magnify_row(i) {
        $('#row' + i).addClass('magnified');
    }

    function move_masks(i) {
        var row = $('#row' + i);

        var focused_top = row.position().top;
        var focused_bottom = focused_top + row.outerHeight();

        var upper_mask = $('#upper-mask');
        var lower_mask = $('#lower-mask');
        upper_mask.css('transform', 'translate3d(0px, ' + (focused_top - upper_mask.outerHeight()) + 'px, 0px)');
        lower_mask.css('transform', 'translate3d(0px, ' + focused_bottom + 'px, 0px)');
    }

    function move_cursor_buttons(i) {
        var row = $('#row' + i);

        var focused_top = row.position().top;
        var focused_bottom = focused_top + row.outerHeight();
        var focused_left = 0;

        var scaled_top    = focused_top    - 0.3 * row.outerHeight() / 2;
        var scaled_bottom = focused_bottom + 0.3 * row.outerHeight() / 2;
        var scaled_left   = focused_left   - 0.3 * row.outerWidth()  / 2;

        var space = 0;

        var cursor_panel = $('#cursor-panel');
        cursor_panel.css('transform',
            'translate3d(' +
                (scaled_left - 1.3 * 80 / 2 - cursor_panel.outerWidth() / 2) + 'px, ' +
                (focused_top + row.outerHeight() / 2 - cursor_panel.outerHeight() / 2 - space) + 'px, ' +
                '0)');
        if (i === 1) {
            $('#prev-button').addClass('disabled');
        }
        else {
            $('#prev-button').removeClass('disabled');
        }
        if (i === 16) {
            $('#next-button').addClass('disabled');
        }
        else {
            $('#next-button').removeClass('disabled');
        }
    }
<commit_msg>Put cursor buttons nearer a row number in the case of 'nomag' mode.<commit_after>$(function() {
    "use strict";

    var preset_data = {
        'bird':     '0000000000000000000111000000000000100010000001100110101000011010111000100110001000111111100001000001000000001110001001000011001000100011110001000001000000011000000011111110000000000010010000000000001001000000000011101100000000000110011000000000101010100000',
        'boy':      '0000000011110000000011111111110000011111111111101111111111111110010000100011111100111100000011110001000000000111000100100010011000100010101000100010000000000010000100100010010000010001110001000000100000001000000001100011000000000101110100000000100000001000',
        'cherry':   '0000011111000000000010000010110000010001111100100000110001110010000000111010010000000001001100100000001000101110000001000010000000001000001000000011110000111000010011000101010010110010100110101001101010110010100000101000001001000100010001000011100000111000',
        'dog':      '0001100000110000001111000111100001111111111111001111110001111110111111000111111011111000001111101111000000011110011000000000110001001000001001000100101110100100010000010000010001000001000001000100010101000100001000101000100000010000000100000000111111100000',
        'fish':     '0000000000111100000000001100010000000011010010000000010101001000000010010101001100010001010101010010000101011001010010010101000101001001010100010010000101011001000100010101010100001001010100110000010101001000000000110100100000000000110001000000000000111100',
        'onepiece': '0001100000001100001111000001111000111111111111100001110010011100000011000001100000000110001100000000011101110000000001111111000000001000000010000001010101010100001010101010101001010101010101010110101010101011010101010101010100100110011001100001100110011000',
        'rabbit':   '0011000000011000010010000010010001001000001001000100010001000100001001000100100000010010100100000000101110100000000100000001000000100000000010000010010001001000001000010000100000100000000010000010001110001000000100000001000000001000001000000000011111000000'
    };

    var opt = {
        'title': null,
        'row': null,
        'noedit': false,
        'nofocus': false,
        'nomag': false,
        'load': false,
        'save': false,
        'export': false,
        'lock': false,
        'clear': false,
        'preset': [],
        'data': null
    };

    var current_row = null;
    var mouse_tracking;
    var touch_tracking = [];

    // http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript
    function is_touch_device() {
        return !!('ontouchstart' in window) // works on most browsers
            || !!('onmsgesturechange' in window); // works on ie10
    }

    function log(msg) {
        var li = $('<li/>');
        li.text(msg);
        li.appendTo('#log-panel');
        setTimeout(function() {
            li.addClass('hidden');
            li.on('webkitTransitionEnd oTransitionEnd transitionend', function() {
                $(this).addClass('disabled');
            });
        }, 0);
    }

    function get_data() {
        var data = "";
        for (var i = 1; i <= 16; ++i) {
            for (var j = 1; j <= 16; ++j) {
                var panel = $('#panel' + i + '-' + j);

                if (panel.hasClass('white')) {
                    data += '0';
                }
                else if (panel.hasClass('black')) {
                    data += '1';
                }
                else {
                    data += '.';
                }
            }
        }
        return data;
    }

    function set_data(data) {
        for (var i = 1; i <= 16; ++i) {
            for (var j = 1; j <= 16; ++j) {
                var panel = $('#panel' + i + '-' + j);

                var k = 16 * (i - 1) + (j - 1);
                if (data[k] === '0') {
                    panel.addClass("white invisible-text");
                    panel.removeClass("black");
                }
                else if (data[k] === '1') {
                    panel.addClass("black invisible-text");
                    panel.removeClass("white");
                }
                else {
                    panel.removeClass("white black invisible-text");
                }
            }
        }
    }

    function save_state() {
        localStorage['resume_data'] = JSON.stringify({
            'row': current_row,
            'locked': !$('#lock').hasClass('disabled'),
            'data': get_data()
        });
    }

    function toggle_panel_color(panel) {
        if ($(panel).hasClass("black") || $(panel).hasClass("white")) {
            $(panel).toggleClass("black white");
        }
        else {
            $(panel).addClass("white invisible-text");
        }
        save_state();
    }

    function unselect_row(i) {
        $('#row' + i).removeClass('selected');
    }

    function select_row(i) {
        $('#row' + i).addClass('selected');
    }

    function unmagnify_row(i) {
        $('#row' + i).removeClass('magnified');
    }

    function magnify_row(i) {
        $('#row' + i).addClass('magnified');
    }

    function move_masks(i) {
        var row = $('#row' + i);

        var focused_top = row.position().top;
        var focused_bottom = focused_top + row.outerHeight();

        var upper_mask = $('#upper-mask');
        var lower_mask = $('#lower-mask');
        upper_mask.css('transform', 'translate3d(0px, ' + (focused_top - upper_mask.outerHeight()) + 'px, 0px)');
        lower_mask.css('transform', 'translate3d(0px, ' + focused_bottom + 'px, 0px)');
    }

    function move_cursor_buttons(i) {
        var row = $('#row' + i);

        var focused_top = row.position().top;
        var focused_bottom = focused_top + row.outerHeight();
        var focused_left = 0;

        var space = 0;
        var cursor_panel = $('#cursor-panel');
        if (opt.nomag) {
            cursor_panel.css('transform',
                'translate3d(' +
                    (focused_left - 80 - cursor_panel.outerWidth()) + 'px, ' +
                    (focused_top + row.outerHeight() / 2 - cursor_panel.outerHeight() / 2 - space) + 'px, ' +
                    '0)');
        }
        else {
            var scaled_top    = focused_top    - 0.3 * row.outerHeight() / 2;
            var scaled_bottom = focused_bottom + 0.3 * row.outerHeight() / 2;
            var scaled_left   = focused_left   - 0.3 * row.outerWidth()  / 2;

            cursor_panel.css('transform',
                'translate3d(' +
                    (scaled_left - 1.3 * 80 / 2 - cursor_panel.outerWidth() / 2) + 'px, ' +
                    (focused_top + row.outerHeight() / 2 - cursor_panel.outerHeight() / 2 - space) + 'px, ' +
                    '0)');
        }

        if (i === 1) {
            $('#prev-button').addClass('disabled');
        }
        else {
            $('#prev-button').removeClass('disabled');
        }
        if (i === 16) {
            $('#next-button').addClass('disabled');
        }
        else {
            $('#next-button').removeClass('disabled');
        }
    }

{'fraction_non_alphanumeric': 0.12372918018602638, 'fraction_numerical': 0.2675030643882039, 'mean_word_length': 2.3373435996150143, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 122, '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': '384583', 'n_tokens_mistral': 6759, 'n_tokens_neox': 3887, 'n_words': 629}