SO: /js/post-validation.js?v=bb996020492a

by Pratik Bhonsle

HTML

http://meta.stackoverflow.com/content/js/post-validation.js?v=bb996020492a

JavaScript

'use strict';
StackExchange.postValidation = function () {
    function s(b, a, d) {
        var c = b.find('input[type="submit"]:visible'),
            e = c.length && c.is(":enabled");
        e && c.attr("disabled", !0);
        x(b);
        y(b, a, d);
        z(b);
        A(b);
        B(b);
        var f = function () {
            1 != a || b.find(m).length ? (C(b), e && c.attr("disabled", !1)) : setTimeout(f, 250)
        };
        f()
    }
    function t() {
        for (var b = 0; b < g.length; b++) clearTimeout(g[b]);
        g = []
    }
    function x(b) {
        var a = b.find(o);
        a.length && a.blur(function () {
            g.push(setTimeout(function () {
                var d = a.val(),
                    c = $.trim(d);
                if (0 == c.length) e(b, a);
                else {
                    var i = a.data("min-length");
                    i && c.length < i ? f(a, ["Title must be at least " + i + " characters."], h()) : (i = a.data("max-length")) && c.length > i ? f(a, ["Title cannot be longer than " + i + " characters."], h()) : $.ajax({
                        type: "POST",
                        url: "/posts/validate-title",
                        data: {
                            title: d
                        },
                        success: function (c) {
                            c.success ? e(b, a) : f(a, c.errors.Title, h())
                        },
                        error: function () {
                            e(b, a)
                        }
                    })
                }
            }, j))
        })
    }
    function y(b, a, d) {
        var c = b.find(p);
        c.length && c.blur(function () {
            g.push(setTimeout(function () {
                var i = c.val(),
                    g = $.trim(i);
                0 == g.length ? e(b, c) : 5 == a ? (i = c.data("min-length")) && g.length < i ? f(c, ["Wiki Body must be at least " + i + " characters. You entered " +...