Resetting, didn't like the new docs
This commit is contained in:
		| @@ -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. |  * @param {Number} max Max number of digits allowed to be inputed. Default is -1 which disables this feature. | ||||||
|  * @returns {IgniteTemplate} This ignite template. |  * @returns {IgniteTemplate} This ignite template. | ||||||
|  */ |  */ | ||||||
| function inputDigits(max = -1) { |  IgniteTemplate.prototype.inputDigits = function(max = -1) { | ||||||
|     this.on("keydown", e => { |     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 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) { |         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; |     return this; | ||||||
| } | } | ||||||
|  |  | ||||||
| IgniteTemplate.prototype.inputDigits = inputDigits; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Forces an input to only allow letters for input. |  * 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 {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. |  * @param {Boolean} allowSpace Whether or not to allow spaces to be entered. Default is true. | ||||||
|  * @returns {IgniteTemplate} This ignite template. |  * @returns {IgniteTemplate} This ignite template. | ||||||
|  */ |  */ | ||||||
| function inputLetters(max = -1, allowSpace = true) { |  IgniteTemplate.prototype.inputLetters = function(max = -1, allowSpace = true) { | ||||||
|     this.on("keydown", e => { |     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 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) { |         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; |     return this; | ||||||
| } | } | ||||||
|  |  | ||||||
| IgniteTemplate.prototype.inputLetters = inputLetters; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Forces an input to only allow email based characters for input. |  * 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. |  * @param {Number} max Max number of letters allowed to be inputed. Default is -1 which disables this feature. | ||||||
|  * @returns {IgniteTemplate} This ignite template. |  * @returns {IgniteTemplate} This ignite template. | ||||||
|  */ |  */ | ||||||
| function inputEmail(max = -1) { |  IgniteTemplate.prototype.inputEmail = function(max = -1) { | ||||||
|     this.on("keydown", e => { |     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 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) { |         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; |     return this; | ||||||
| } | } | ||||||
|  |  | ||||||
| IgniteTemplate.prototype.inputEmail = inputEmail; |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user