<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">var NDPassword = function (selector, options) {
    this.$input = document.querySelector(selector);
    this.$inputJQ = jQuery(selector);
    if (!this.$input) {
        return;
    }
    this.capsLockOn = false;

    this.options = typeof options === 'undefined' ? {} : options

};

NDPassword.prototype = {
    init: function () {
        if (!this.$input) {
            return;
        }
        this.options.capsLockOnMessage = this.options.capsLockOnMessage || "Capitalization is on"
        this.options.tipCreate = !this.options.$tipJQ || this.options.$tipJQ.length === 0;
        this.options.$tipJQ = this.options.tipCreate ? jQuery('&lt;div class="capsLockOnTip"&gt;&lt;/div&gt;') : this.options.$tipJQ; 


        this.$input.addEventListener("keydown", this.capsLockListener.bind(this));
        this.$input.addEventListener("keyup", this.capsLockListener.bind(this));
        this.$input.addEventListener("click", this.capsLockListener.bind(this));
        this.$input.addEventListener("focus", this.capsLockListener.bind(this));
        this.$input.addEventListener("blur", this.clearIndicators.bind(this));

        if (this.options.tipCreate) {
            this.$inputJQ.after(this.options.$tipJQ);
        }
    },
    capsLockListener: function (e) {
        if (e.type === "focus") {
            e.target.click();
            return;
        }

        if (e.getModifierState("CapsLock")) {
            if (!this.capsLockOn) {
                this.setCapsLock(true);
            }
        } else if (this.capsLockOn) {
            this.setCapsLock(false);
        }
    },
    setCapsLock: function (value) {
        if (value === true) {
            this.options.$tipJQ.text(this.options.capsLockOnMessage).show();
        } else {
            this.options.$tipJQ.text('');
        }

        this.capsLockOn = value;
    },
    clearIndicators: function (e) {
        this.setCapsLock(false);
    },
};
</pre></body></html>