<commit_before>/**
 * Created by msyk on 15/10/09.
 */

var slideNumber = 0;
var currentId = 0;
var slideNodes = null;

window.onload = function () {
    var nodeSlide = document.getElementsByClassName("slide")[0];
    slideNodes = nodeSlide.cloneNode(true);
    nodeSlide.parentNode.removeChild(nodeSlide);

    if (document.location.hash.length > 0) {
        slideNumber = parseInt(document.location.hash.substr(1)) - 1;
    }

    var headNode = document.getElementsByTagName("HEAD")[0];
    var linkNode = document.createElement("LINK");
    linkNode.setAttribute("rel", "stylesheet");
    linkNode.setAttribute("href", "projector/themes/" + config.theme + "/slidestyle.css");
    headNode.appendChild(linkNode);
    setTimeout(function () {
        adjust(loadSlide(true, document.body));
    }, 100);

    window.onclick = function (e) {
        if (e.clientX > window.innerWidth / 2) {
            moveSlide(+1);
        } else {
            moveSlide(-1);
        }
    };

    document.body.onkeydown = function (e) {
        var url;
        switch (e.keyCode) {
            case 37:
            case 38:
                if (!e.shiftKey) {
                    moveSlide(-1);
                } else {
                    moveSlide(0, true);
                }                break;
            case 39:
            case 40:
                if (!e.shiftKey) {
                    moveSlide(+1);
                } else {
                    moveSlide(-1, true);
                }                break;
            case 49:    // keyCode = 49 for "1"
                moveSlide(0, true);
                break;
            case 69:    // keyCode = 69 for "E"
                moveSlide(-1, true);
                break;
            case 70:    // keyCode = 70 for "F"
                var element = document.documentElement;
                if (element.requestFullscreen) {
                    element.requestFullscreen();
                } else if (element.msRequestFullscreen) {
                    element.msRequestFullscreen();
                } else if (element.mozRequestFullScreen) {
                    element.mozRequestFullScreen();
                } else if (element.webkitRequestFullscreen) {
                    element.webkitRequestFullscreen(element.ALLOW_KEYBOARD_INPUT);
                }
                break;
            case 82:    // keyCode = 82 for "R"
            case 13:    // keyCode = 13 for Return
                url = document.URL;
                if (url.match(/#/)) {
                    url = url.split(/#/)[0];
                }
                document.location.href = url + "#" + (slideNumber + 1);
                location.reload();
                break;
        }
        e.preventDefault();
    };

    window.onresize = function () {
        adjust();
    };

}
function moveSlide(bias, absolute) {
    var slide;
    if (absolute)   {
        slideNumber = bias;
        if (bias < 0)   {
            slideNumber = contents.length + bias;
        }
    }
    else {
        slideNumber += bias;
    }
    if (slideNumber >= contents.length) {
        slideNumber = contents.length - 1;
    } else if (slideNumber < 0) {
        slideNumber = 0;
    } else {
        slide = loadSlide(false, document.body);
        setTimeout(function () {
            adjust(slide);
        }, 100);
    }
}
<commit_msg>slide control updated<commit_after>/**
 * Created by msyk on 15/10/09.
 */

var slideNumber = 0;
var currentId = 0;
var slideNodes = null;

window.onload = function () {
    var nodeSlide = document.getElementsByClassName("slide")[0];
    slideNodes = nodeSlide.cloneNode(true);
    nodeSlide.parentNode.removeChild(nodeSlide);

    if (document.location.hash.length > 0) {
        slideNumber = parseInt(document.location.hash.substr(1)) - 1;
    }

    var headNode = document.getElementsByTagName("HEAD")[0];
    var linkNode = document.createElement("LINK");
    linkNode.setAttribute("rel", "stylesheet");
    linkNode.setAttribute("href", "projector/themes/" + config.theme + "/slidestyle.css");
    headNode.appendChild(linkNode);
    setTimeout(function () {
        adjust(loadSlide(true, document.body));
    }, 100);

    window.onclick = function (e) {
        if (e.clientX > window.innerWidth / 2) {
            moveSlide(+1);
        } else {
            moveSlide(-1);
        }
    };

    document.body.onkeydown = function (e) {
        var url;
        switch (e.keyCode) {
            case 37:
            case 38:
                if (!e.shiftKey) {
                    moveSlide(-1);
                } else {
                    moveSlide(0, true);
                }                break;
            case 39:
            case 40:
                if (!e.shiftKey) {
                    moveSlide(+1);
                } else {
                    moveSlide(-1, true);
                }                break;
            case 49:    // keyCode = 49 for "1"
                moveSlide(0, true);
                break;
            case 69:    // keyCode = 69 for "E"
                moveSlide(-1, true);
                break;
            case 70:    // keyCode = 70 for "F"
                var element = document.documentElement;
                if (element.requestFullscreen) {
                    element.requestFullscreen();
                } else if (element.msRequestFullscreen) {
                    element.msRequestFullscreen();
                } else if (element.mozRequestFullScreen) {
                    element.mozRequestFullScreen();
                } else if (element.webkitRequestFullscreen) {
                    element.webkitRequestFullscreen(element.ALLOW_KEYBOARD_INPUT);
                }
                break;
            case 82:    // keyCode = 82 for "R"
            case 13:    // keyCode = 13 for Return
                url = document.URL;
                if (url.match(/#/)) {
                    url = url.split(/#/)[0];
                }
                document.location.href = url + "#" + (slideNumber + 1);
                location.reload();
                break;
        }
        e.preventDefault();
    };

    window.onresize = function () {
        adjust();
    };
    
    window.onhashchange = function () {
		location.reload();
    };

}
function moveSlide(bias, absolute) {
    var slide;
    if (absolute)   {
        slideNumber = bias;
        if (bias < 0)   {
            slideNumber = contents.length + bias;
        }
    }
    else {
        slideNumber += bias;
    }
    if (slideNumber >= contents.length) {
        slideNumber = contents.length - 1;
    } else if (slideNumber < 0) {
        slideNumber = 0;
    } else {
        slide = loadSlide(false, document.body);
        
        url = document.URL;
        if (url.match(/#/)) {
            url = url.split(/#/)[0];
        }
        document.location.href = url + "#" + (slideNumber + 1);

        setTimeout(function () {
            adjust(slide);
        }, 100);
    }
}

{'fraction_non_alphanumeric': 0.12094225797184717, 'fraction_numerical': 0.018385521401896008, 'mean_word_length': 1.3952528379772962, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5158406', 'n_tokens_mistral': 2077, 'n_tokens_neox': 1901, 'n_words': 401}