<commit_before>//! Toggling of grid and overlays

function toggleGrid() {
    
    if (document.getElementById('toggle_grid').checked) {
        state = 'block';
    } else {
        state = 'none';
    }
    
    var content = document.getElementsByClassName('gridline');
    for (var i = 0 ; i < content.length ; i++) {
        content[i].style.display = state;
    }
}

function toggleBlown() {
    if (document.getElementById('toggle_blown').checked) {
        opacity = 100;
    } else {
        opacity = 0;
    }
    
    for (var i = 0; i < myDragon.overlays.length; i++) {
        var id = myDragon.overlays[i].id;
        if ( id == 'black' || id == 'white' ) {
            OpenSeadragon.setElementOpacity(id, opacity, false);
        }
    }

    if (document.getElementById('toggle_blown').checked) {
        state = 'block';
    } else {
        state = 'none';
    }
    
    var content = document.getElementsByClassName('whiteoverlay');
    for (var i = 0 ; i < content.length ; i++) {
        if (content[i].style.backgroundImage == '' && state == 'block') {
            content[i].style.backgroundImage = "url('" + whiteoverlayurl + "')";
        }
        content[i].style.display = state;
    }
    var content = document.getElementsByClassName('blackoverlay');
    for (var i = 0 ; i < content.length ; i++) {
        if (content[i].style.backgroundImage == '' && state == 'block') {
            content[i].style.backgroundImage = "url('" + blackoverlayurl + "')";
        }
        content[i].style.display = state;
    }
}

function toggleTextBlock() {
    if (document.getElementById('toggle_textblock').checked) {
        opacity = 100;
    } else {
        opacity = 0;
    }
    
    for (var i = 0; i < myDragon.overlays.length; i++) {
        var id = myDragon.overlays[i].id;
        if ( id == 'black' || id == 'white' ) {
            continue;
        }
        OpenSeadragon.setElementOpacity(id, opacity, false);
    }
}

var ocrs = {};
var nexts = {};
var prevs = {};

// Fill in OCR for blocks with
// ocrs["BLOCK1"] = "MyOCR";
// On the preview page

function addForward(overlay, className) {
    if (!document.getElementById(overlay)) return;
    document.getElementById(overlay).className = document.getElementById(overlay).className + ' ' + className;
//    console.log("Overlay " + overlay + " now has className " + document.getElementById(overlay).className);
    if (overlay in nexts) {
//    console.log("Adding to next " + nexts[overlay] + " for " + overlay);
        addForward(nexts[overlay], className);
    }
}
function addBackward(overlay, className) {
    if (!document.getElementById(overlay)) return;<commit_msg>Closes #51 (Crop box should be visible even when TextBlocks are disabled)<commit_after>//! Toggling of grid and overlays

function toggleGrid() {
    
    if (document.getElementById('toggle_grid').checked) {
        state = 'block';
    } else {
        state = 'none';
    }
    
    var content = document.getElementsByClassName('gridline');
    for (var i = 0 ; i < content.length ; i++) {
        content[i].style.display = state;
    }
}

function toggleBlown() {
    if (document.getElementById('toggle_blown').checked) {
        opacity = 100;
    } else {
        opacity = 0;
    }
    
    for (var i = 0; i < myDragon.overlays.length; i++) {
        var id = myDragon.overlays[i].id;
        if ( id == 'black' || id == 'white' ) {
            OpenSeadragon.setElementOpacity(id, opacity, false);
        }
    }

    if (document.getElementById('toggle_blown').checked) {
        state = 'block';
    } else {
        state = 'none';
    }
    
    var content = document.getElementsByClassName('whiteoverlay');
    for (var i = 0 ; i < content.length ; i++) {
        if (content[i].style.backgroundImage == '' && state == 'block') {
            content[i].style.backgroundImage = "url('" + whiteoverlayurl + "')";
        }
        content[i].style.display = state;
    }
    var content = document.getElementsByClassName('blackoverlay');
    for (var i = 0 ; i < content.length ; i++) {
        if (content[i].style.backgroundImage == '' && state == 'block') {
            content[i].style.backgroundImage = "url('" + blackoverlayurl + "')";
        }
        content[i].style.display = state;
    }
}

function toggleTextBlock() {
    if (document.getElementById('toggle_textblock').checked) {
        opacity = 100;
    } else {
        opacity = 0;
    }
    
    for (var i = 0; i < myDragon.overlays.length; i++) {
        var id = myDragon.overlays[i].id;
        if ( id == 'black' || id == 'white' || id == 'cropbox') {
            continue;
        }
        OpenSeadragon.setElementOpacity(id, opacity, false);
    }
}

var ocrs = {};
var nexts = {};
var prevs = {};

// Fill in OCR for blocks with
// ocrs["BLOCK1"] = "MyOCR";
// On the preview page

function addForward(overlay, className) {
    if (!document.getElementById(overlay)) return;
    document.getElementById(overlay).className = document.getElementById(overlay).className + ' ' + className;
//    console.log("Overlay " + overlay + " now has className " + document.getElementById(overlay).className);
    if (overlay in nexts) {
//    console.log("Adding to next " + nexts[overlay] + " for " + overlay);
        addForward(nexts[overlay], className);
    }
}
function addBackward(overlay, className) {
    if (!document.getElementById(overlay)) return;
{'fraction_non_alphanumeric': 0.15403106508875739, 'fraction_numerical': 0.005547337278106509, 'mean_word_length': 2.528375733855186, 'pattern_counts': {'":': 0, '<': 13, '<?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': '2072869', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1632, 'n_words': 368}