JSFiddle - React, Tailwind, and code Playground
JavaScript
/*
* Projekt Orange - Orange-J -
* Orange Extension for jQuery or Standalone
* Bringing even more advanced coding laziness to the developer
* Version 2.3.4.3
* author: Donovan Walker
*/
//jQuery POSITION Methods
jQuery.fn.centerElement = function(inConfig) {
var doWidth = true; var doHeight = true;
if(typeof inConfig == 'string') {
if(inConfig == "width")
doHeight = false;
else
doWidth = false;
}
var width = parseInt(this.css("width"));
var height = parseInt(this.css("height"));
var winHeight = jQuery(document).height();
var winWidth = jQuery(document).width();
//if(doHeight) this.css("top", Math.floor((winHeight - height) /2) + "px");
if(doWidth) this.css("left", Math.floor((winWidth - width) /2) + "px");
return(this);
}
//jQuery KEYLISTENER Methods
jQuery.fn.listen = function(inConfig) {
/* if(this.selector.indexOf("#") == 0 && typeof(inConfig.htmlID) == "undefined") {
inConfig.htmlID = this.selector.substring(1);
} */
if(!inConfig.hasOwnProperty("element")) {
inConfig.element = this;
}
var keyListener = new KeyListener(inConfig);
switch(inConfig.keystroke) {
case "keydown" :
this.keydown( function(e) {
keyListener.processKey(e);
});
break;
case "keyup" :
this.keyup( function(e) {
keyListener.processKey(e);
});
break;
case "keypress" :
default :
this.keypress( function(e) {
//keyListener.element = this;
keyListener.processKey(e);
});
}
return(this);
}
//jQuery VALIDATE Methods
/**
* tests the matched element against a regular expression in the library
* inRe = the name of the regular expression
*
* returns mixed - false on fail, the value of the element on success
*/
jQuery.fn.validate = function(inRe) {
jQuery.makeOrangeVars();
if(typeof(inRe) == "string") {
...