<commit_before>// resizing
function resize_main() {
    $('main').css('height', ($(window).height() - $('footer').height()))
}

$(document).ready(function() {
    resize_main();
});

$(window).resize(function() {
    resize_main();
});


// clock
function update_clock() {
    var date_obj = new Date();
    var timestring = ('0' + date_obj.getHours()).slice(-2) + ':' + ('0' + date_obj.getMinutes()).slice(-2) + ':' + ('0' + date_obj.getSeconds()).slice(-2);

    $('span#clock').html(timestring);
}

update_clock();
var clock_interval = setInterval(update_clock, 1000);


// room_state
function update_room_state() {
    $.getJSON('https://freieslabor.org/api/room/', function(data) {
        if(data.open != room_open) {
            $('span#room-state').removeClass('open close');

            if(data.open) {
                $('span#room-state').addClass('open').html('OPEN');
            } else {
                $('span#room-state').addClass('close').html('CLOSED');
            }

            room_open = data.open;
        }
    });
}

var room_open;
update_room_state();
var room_state_interval = setInterval(update_room_state, 10000);


// screen info
function update_screen_state() {
    var screens = get_info();

    $('span#screen-state').html('Screen ' + String(screens[1]+1) + '/' + String(screens[0]));
}

update_screen_state();


// screen cycling
// var screen_cycle_interval = setInterval(function() {
    // show_next_screen();
    // update_screen_state();
// }, 5000);

$(document).keydown(function(event) {
    switch(event.which) {
        case 37: // left
            show_previous_screen();
            update_screen_state();
            break;

        case 38: // up
            break;

        case 39: // right
            show_next_screen();
            update_screen_state();
            break;

        case 40: // down
            break;

        default:
            return;
    }

    event.preventDefault();
});<commit_msg>main_screen: improve cycle timeouts on keypress<commit_after>// resizing
function resize_main() {
    $('main').css('height', ($(window).height() - $('footer').height()))
}

$(document).ready(function() {
    resize_main();
});

$(window).resize(function() {
    resize_main();
});


// clock
function update_clock() {
    var date_obj = new Date();
    var timestring = ('0' + date_obj.getHours()).slice(-2) + ':' + ('0' + date_obj.getMinutes()).slice(-2) + ':' + ('0' + date_obj.getSeconds()).slice(-2);

    $('span#clock').html(timestring);
}

update_clock();
var clock_interval = setInterval(update_clock, 1000);


// room_state
function update_room_state() {
    $.getJSON('https://freieslabor.org/api/room/', function(data) {
        if(data.open != room_open) {
            $('span#room-state').removeClass('open close');

            if(data.open) {
                $('span#room-state').addClass('open').html('OPEN');
            } else {
                $('span#room-state').addClass('close').html('CLOSED');
            }

            room_open = data.open;
        }
    });
}

var room_open;
update_room_state();
var room_state_interval = setInterval(update_room_state, 10000);


// screen info
function update_screen_state() {
    var screens = get_info();

    $('span#screen-state').html('Screen ' + String(screens[1]+1) + '/' + String(screens[0]));
}

update_screen_state();


// screen cycling
var screen_cycle_timeout;

function setup_screen_cycle() {
    screen_cycle_timeout = setTimeout(function() {
        show_next_screen();
        update_screen_state();
        setup_screen_cycle();
    }, 5000);
}

setup_screen_cycle();


$(document).keydown(function(event) {
    switch(event.which) {
        case 37: // left
            clearTimeout(screen_cycle_timeout);
            show_previous_screen();
            update_screen_state();
            setup_screen_cycle();
            break;

        case 38: // up
            break;

        case 39: // right
            clearTimeout(screen_cycle_timeout);
            show_next_screen();
            update_screen_state();
            setup_screen_cycle();
            break;

        case 40: // down
            break;

        default:
            return;
    }

    event.preventDefault();
});
{'fraction_non_alphanumeric': 0.172454523978266, 'fraction_numerical': 0.014174344436569808, 'mean_word_length': 2.5107794361525704, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2494600', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1283, 'n_words': 210}