<commit_before>/**
 * Simulates keyboard actions on DOM elements
 */
/*global jQuery*/
(function () {
    'use strict';
    function Keyboard(el, lock) {
        this.el = el;
        // TODO: Break out AngularJS
        this.scope = el.scope();

        var editableTypes = "text password number email url search tel";
        this.isEditable = (/textarea|select/i.test(el[0].nodeName) || editableTypes.indexOf(el[0].type.toLowerCase()) > -1);

        if (this.isEditable) {
            this.selStart = el.getSelectionStart() || 0;
            this.selEnd = el.getSelectionEnd() || el.val().length;
            el.setSelection(this.selStart, this.selEnd);
            this.cursorPosition = this.selEnd;
        }

        this.capsLocked = false;

        if (lock) {
            this.lock();
        }
    }

    /**
     * Executes a series of actions on Keyboard
     * @param el jQuery
     * @param actions String
     * @example "This is a test" left left left delete -> This is a tst
     */
    Keyboard.exec = function (el/*:jQuery*/, actions/*:String*/) {
        var kbd = new Keyboard(el),
            acl = actions.match(/"[^"]+"|\w+/gim),
            action, val, i = 0, len = acl.length;
        kbd.lock();

        while (i < len) {
            val = acl[i];
            action = val.match(/[^"]+/gim)[0];
            if (typeof kdb[action] === 'function') {
                kbd[action]();
            } else {
                kbd.type(action);
            }
            kbd.release();
            i += 1;
        }
    };

    var proto = Keyboard.prototype;

    proto.checkShiftKey = function (letter) {
        var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+{}|:\"<>?~;",
            testLetter = letter.toUpperCase();
        if (testLetter === letter) {
            return true;
        }
        return false;
    };

    proto.key = {
        'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18, 'pause': 19,
        'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34, 'end': 35, 'home': 36,
        'left': 37, 'up': 38, 'right': 39, 'down': 40, 'insert': 45, 'delete': 46,<commit_msg>fixed typo in sendKeys<commit_after>/**
 * Simulates keyboard actions on DOM elements
 */
/*global jQuery*/
(function () {
    'use strict';
    function Keyboard(el, lock) {
        this.el = el;
        // TODO: Break out AngularJS
        this.scope = el.scope();

        var editableTypes = "text password number email url search tel";
        this.isEditable = (/textarea|select/i.test(el[0].nodeName) || editableTypes.indexOf(el[0].type.toLowerCase()) > -1);

        if (this.isEditable) {
            this.selStart = el.getSelectionStart() || 0;
            this.selEnd = el.getSelectionEnd() || el.val().length;
            el.setSelection(this.selStart, this.selEnd);
            this.cursorPosition = this.selEnd;
        }

        this.capsLocked = false;

        if (lock) {
            this.lock();
        }
    }

    /**
     * Executes a series of actions on Keyboard
     * @param el jQuery
     * @param actions String
     * @example "This is a test" left left left delete -> This is a tst
     */
    Keyboard.exec = function (el/*:jQuery*/, actions/*:String*/) {
        var kbd = new Keyboard(el),
            acl = actions.match(/"[^"]+"|\w+/gim),
            action, val, i = 0, len = acl.length;
        kbd.lock();

        while (i < len) {
            val = acl[i];
            action = val.match(/[^"]+/gim)[0];
            if (typeof kbd[action] === 'function') {
                kbd[action]();
            } else {
                kbd.type(action);
            }
            kbd.release();
            i += 1;
        }
    };

    var proto = Keyboard.prototype;

    proto.checkShiftKey = function (letter) {
        var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+{}|:\"<>?~;",
            testLetter = letter.toUpperCase();
        if (testLetter === letter) {
            return true;
        }
        return false;
    };

    proto.key = {
        'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18, 'pause': 19,
        'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34, 'end': 35, 'home': 36,
        'left': 37, 'up': 38, 'right': 39, 'down': 40, 'insert': 45, 'delete': 46,
{'fraction_non_alphanumeric': 0.1693268563497571, 'fraction_numerical': 0.020818875780707843, 'mean_word_length': 1.8597883597883598, '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': '6683526', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1369, 'n_words': 346}