<commit_before>window.onerror = function (e) {
    $API.debug (e.message);
}

$(document).ready(function () {

    if (typeof $API === "undefined") {
        alert("Load this page into Johnny's Webview");
        return;
    }

    $(".close").on("click", $API.closeWindow);

    var maximized = false;

    $(".maximize").on("click", function () {
        if (!maximized) {
            $API.setWindowState("MAXIMIZED");
            $(".window.finder").css({
                left:   "0px",
                top:    "0px",
                bottom: "0px",
                right:  "0px",
            });
            maximized = true;
        } else {
            $API.setWindowState("RESTORED");
            maximized = false;
            $(".window.finder").css({
                left:   "90px",
                top:    "90px",
                bottom: "90px",
                right:  "90px",
            });
        }
    });

    /* drag */
    var initialPos = {};
    var drag = false;
    $(".drag").on("mousedown", function (e) {
        drag = true;
        initialPos.x = e.pageX;
        initialPos.y = e.pageY;
    }).on("mousemove", function (e) {

        if (!drag) { return; }

        var current = $API.getWindowPosition();

        var winLeft, winTop;


        winLeft = current.left + (e.pageX - initialPos.x);
        winTop  = current.top + (e.pageY- initialPos.y);

        $API.setWindowPosition(winLeft, winTop);
    });

    $("body").on("mouseout mouseup", function () {
        drag = false;
        initial = {};
    });
});<commit_msg>Added the basic JavaScript code<commit_after>window.onerror = function (e) {
    $API.debug (JSON.stringify(e));
}

$(document).ready(function () {
    var $start = $(".start")
      , $width = $(".width")
      , $height = $(".height")
      , $position = $(".position")
      , $output = $(".output")
      ;

    setInterval (function () {
        var position = $API.getWindowPosition()
          , size     = $API.getWindowSize()
          ;
        $position.text(
            "X: " + position.left + "\n" +
            "Y: " + position.top + "\n" +
            "width: " + size.width + "\n" +
            "height: " + size.height
        );
    }, 100)

    $start.on("click", function () {

        var position = $API.getWindowPosition()
          , size     = $API.getWindowSize()
          , screenSize = $API.getScreenSize()
          ;

        // TODO compute position
        var command = "byzanz-record -d 120 -h " + size.height +
                      " -w " + size.width +
                      " -x " + position.left +
                      " -y " + position.top +
                      " -c " + $output.val()

        $API.resize (200, 100);
        $API.setWindowPosition (screenSize.width - 220, screenSize.height - 150);
    });
});
{'fraction_non_alphanumeric': 0.17116477272727273, 'fraction_numerical': 0.01065340909090909, 'mean_word_length': 1.5151785714285715, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3248785', 'n_tokens_mistral': 894, 'n_tokens_neox': 843, 'n_words': 170}