<commit_before>/* globals jQuery, ripples */

(function($) {
    // Selector to select only not already processed elements
    $.expr[":"].notmdproc = function(obj){
        if ($(obj).data("mdproc")) {
            return false;
        } else {
            return true;
        }
    };

    function _isChar(evt) {
        if (typeof evt.which == "undefined") {
            return true;
        } else if (typeof evt.which == "number" && evt.which > 0) {
            return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which != 8;
        }
        return false;
    }

    $.material =  {
        "options": {
            "withRipples": [
                ".btn:not(.btn-link)",
                ".card-image",
                ".navbar a:not(.withoutripple)",
                ".dropdown-menu a",
                ".nav-tabs a:not(.withoutripple)",
                ".withripple"
            ].join(","),
            "inputElements": "input.form-control, textarea.form-control, select.form-control",
            "checkboxElements": ".checkbox > label > input[type=checkbox]",
            "radioElements": ".radio > label > input[type=radio]"
        },
        "checkbox": function(selector) {
            // Add fake-checkbox to material checkboxes
            $((selector) ? selector : this.options.checkboxElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .after("<span class=check></span>");
        },
        "radio": function(selector) {
            // Add fake-radio to material radios
            $((selector) ? selector : this.options.radioElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .after("<span class=circle></span><span class=check></span>");
        },
        "input": function(selector) {
            $((selector) ? selector : this.options.inputElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .each( function() {
                var $this = $(this);
                $this.wrap("<div class=form-control-wrapper></div>");
                $this.after("<span class=material-input></span>");
                if ($this.hasClass("floating-label")) {
                    var placeholder = $this.attr("placeholder");
                    $this.attr("placeholder", null).removeClass("floating-label");
                    $this.after("<div class=floating-label>" + placeholder + "</div>");
                }
                if ($this.val() === null || $this.val() == "undefined" || $this.val() === "") {
                    console.log("enter empty");
                    $this.addClass("empty");
                }
                if ($this.parent().next().is("[type=file]")) {
                    $this.parent().addClass("fileinput");
                    var $input = $this.parent().next().detach();
                    $this.after($input);
                }
            });

            $(document)
            .on("change", ".checkbox input", function() { $(this).blur(); })
            .on("keydown", ".form-control", function(e) {
                if(_isChar(e)) {
                    $(this).removeClass("empty");<commit_msg>Fix: Floating label is not floated on paste event<commit_after>/* globals jQuery, ripples */

(function($) {
    // Selector to select only not already processed elements
    $.expr[":"].notmdproc = function(obj){
        if ($(obj).data("mdproc")) {
            return false;
        } else {
            return true;
        }
    };

    function _isChar(evt) {
        if (typeof evt.which == "undefined") {
            return true;
        } else if (typeof evt.which == "number" && evt.which > 0) {
            return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which != 8;
        }
        return false;
    }

    $.material =  {
        "options": {
            "withRipples": [
                ".btn:not(.btn-link)",
                ".card-image",
                ".navbar a:not(.withoutripple)",
                ".dropdown-menu a",
                ".nav-tabs a:not(.withoutripple)",
                ".withripple"
            ].join(","),
            "inputElements": "input.form-control, textarea.form-control, select.form-control",
            "checkboxElements": ".checkbox > label > input[type=checkbox]",
            "radioElements": ".radio > label > input[type=radio]"
        },
        "checkbox": function(selector) {
            // Add fake-checkbox to material checkboxes
            $((selector) ? selector : this.options.checkboxElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .after("<span class=check></span>");
        },
        "radio": function(selector) {
            // Add fake-radio to material radios
            $((selector) ? selector : this.options.radioElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .after("<span class=circle></span><span class=check></span>");
        },
        "input": function(selector) {
            $((selector) ? selector : this.options.inputElements)
            .filter(":notmdproc")
            .data("mdproc", true)
            .each( function() {
                var $this = $(this);
                $this.wrap("<div class=form-control-wrapper></div>");
                $this.after("<span class=material-input></span>");
                if ($this.hasClass("floating-label")) {
                    var placeholder = $this.attr("placeholder");
                    $this.attr("placeholder", null).removeClass("floating-label");
                    $this.after("<div class=floating-label>" + placeholder + "</div>");
                }
                if ($this.val() === null || $this.val() == "undefined" || $this.val() === "") {
                    console.log("enter empty");
                    $this.addClass("empty");
                }
                if ($this.parent().next().is("[type=file]")) {
                    $this.parent().addClass("fileinput");
                    var $input = $this.parent().next().detach();
                    $this.after($input);
                }
            });

            $(document)
            .on("change", ".checkbox input", function() { $(this).blur(); })
            .on("keydown paste", ".form-control", function(e) {
                if(_isChar(e)) {
                    $(this).removeClass("empty");
{'fraction_non_alphanumeric': 0.1713703355283788, 'fraction_numerical': 0.0006271558482282847, 'mean_word_length': 1.5994295028524856, 'pattern_counts': {'":': 24, '<': 27, '<?xml version=': 0, '>': 37, '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': '7515524', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1665, 'n_words': 320}