From b41524457fdd12f3b15d4a555de676ace7f8f42a Mon Sep 17 00:00:00 2001 From: Matt Mo Date: Wed, 25 Aug 2021 00:00:09 -0700 Subject: [PATCH] Resetting, didn't like the new docs --- ignite-html-input.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ignite-html-input.js b/ignite-html-input.js index 42f5379..3d3ed70 100644 --- a/ignite-html-input.js +++ b/ignite-html-input.js @@ -5,7 +5,7 @@ import { IgniteTemplate } from "../ignite-html/ignite-template.js"; * @param {Number} max Max number of digits allowed to be inputed. Default is -1 which disables this feature. * @returns {IgniteTemplate} This ignite template. */ -function inputDigits(max = -1) { + IgniteTemplate.prototype.inputDigits = function(max = -1) { this.on("keydown", e => { //If the input key isn't a digit, and it's not a backspace or escape or tab, ignore it. if ((e.key < '0' || e.key > '9') && e.key != 'Backspace' && e.key != 'Escape' && e.key != 'Tab' && e.key != 'Control' && e.ctrlKey == false) { @@ -29,15 +29,13 @@ function inputDigits(max = -1) { return this; } -IgniteTemplate.prototype.inputDigits = inputDigits; - /** * Forces an input to only allow letters for input. * @param {Number} max Max number of letters allow to be inputed. Default is -1 which disables this feature. * @param {Boolean} allowSpace Whether or not to allow spaces to be entered. Default is true. * @returns {IgniteTemplate} This ignite template. */ -function inputLetters(max = -1, allowSpace = true) { + IgniteTemplate.prototype.inputLetters = function(max = -1, allowSpace = true) { this.on("keydown", e => { //If the input key isn't a letter, and it's not a space, backspace or escape or tab, ignore it. if ((e.key < 'a' || e.key > 'z') && (e.key < 'A' || e.key > 'Z') && e.key != ' ' && e.key != 'Backspace' && e.key != 'Escape' && e.key != 'Tab' && e.key != 'Control' && e.ctrlKey == false) { @@ -66,14 +64,12 @@ function inputLetters(max = -1, allowSpace = true) { return this; } -IgniteTemplate.prototype.inputLetters = inputLetters; - /** * Forces an input to only allow email based characters for input. * @param {Number} max Max number of letters allowed to be inputed. Default is -1 which disables this feature. * @returns {IgniteTemplate} This ignite template. */ -function inputEmail(max = -1) { + IgniteTemplate.prototype.inputEmail = function(max = -1) { this.on("keydown", e => { //If the input key isn't a letter, and it's not a space, backspace or escape or tab, ignore it. if ((e.key < 'a' || e.key > 'z') && (e.key < 'A' || e.key > 'Z') && (e.key < '0' || e.key > '9') && e.key != '@' && e.key != '.' && e.key != '-' && e.key != '_' && e.key != '+' && e.key != '~' && e.key != 'Backspace' && e.key != 'Escape' && e.key != 'Tab' && e.key != 'Control' && e.ctrlKey == false) { @@ -96,5 +92,3 @@ function inputEmail(max = -1) { return this; } - -IgniteTemplate.prototype.inputEmail = inputEmail;