Skip to content

Commit

Permalink
Prepared for v1.01
Browse files Browse the repository at this point in the history
  • Loading branch information
hsnaydd committed Aug 16, 2015
1 parent dc79fdb commit 8bee016
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 122 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "validetta",
"description": "A tiny jquery plugin for validate your forms",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "http://lab.hasanaydogdu.com/validetta/",
"author": {
"name": "Hasan Aydoğdu",
Expand Down
83 changes: 41 additions & 42 deletions dist/validetta.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 23 additions & 31 deletions dist/validetta.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*!
* Validetta (http://lab.hasanaydogdu.com/validetta/)
* Version 1.0.0 ( 04-02-2015 )
* Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE)
* Copyright 2013-2015 Hasan Aydoğdu - http://www.hasanaydogdu.com
*/

/*!
* Validetta (http://lab.hasanaydogdu.com/validetta/)
* Version 1.0.1 ( 16-08-2015 )
* Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE)
* Copyright 2013-2015 Hasan Aydoğdu - http://www.hasanaydogdu.com
*/

;(function( $ ) {
"use strict";
/**
Expand Down Expand Up @@ -48,12 +48,13 @@
errorTemplateClass : 'validetta-bubble', // Class of the element that would receive error message
errorClass : 'validetta-error', // Class that would be added on every failing validation field
validClass : 'validetta-valid', // Same for valid validation
bubblePosition: 'right',
bubblePosition: 'right', // Bubble position // right / bottom
bubbleGapLeft: 15, // Right gap of bubble
bubbleGapTop: 0, // Top gap of bubble
realTime : false, // To enable real-time form control, set this option true.
onValid : function(){}, // This function to be called when the user submits the form and there is no error.
onError : function(){}, // This function to be called when the user submits the form and there are some errors
custom : {}, // Costum reg method variable
remote : {}
validators: {} // Custom validators stored in this variable
},

/**
Expand Down Expand Up @@ -106,10 +107,10 @@
},
// equalTo check
equalTo : function( tmp, self ) {
return $( self.form ).find('input[name="'+ tmp.arg +'"]').val() === tmp.val || messages.notEqual;
return self.form.querySelector('input[name="'+ tmp.arg +'"]').value === tmp.val || messages.notEqual;
},
different: function( tmp, self ) {
return $( self.form ).find('input[name="'+ tmp.arg +'"]').val() !== tmp.val || messages.different;
return self.form.querySelector('input[name="'+ tmp.arg +'"]').value !== tmp.val || messages.different;
},
/**
* Credit Card Control
Expand Down Expand Up @@ -163,7 +164,7 @@
},
// Radio
radio : function( el ) {
var count = $( this.form.querySelectorAll('input[type=radio][name="'+ el.name +'"]') ).filter(':checked').length ;
var count = this.form.querySelectorAll('input[type=radio][name="'+ el.name +'"]:checked').length;
return count === 1;
},
// Custom reg check
Expand Down Expand Up @@ -349,7 +350,7 @@
checkRemote : function( el, e ) {
var ajaxOptions = {},
data = {},
fieldName = el.name || el.getAttribute('id');
fieldName = el.name || el.id;

if ( typeof this.remoteCache === 'undefined' ) this.remoteCache = {};

Expand Down Expand Up @@ -462,34 +463,25 @@
// If the parent element undefined, that means el is an object. So we need to transform to the element
if( typeof elParent === 'undefined' ) elParent = el[0].parentNode;
// if there is an error window which previously opened for el, return
if( $( elParent ).find( '.'+ this.options.errorTemplateClass ).length ) return;
if ( elParent.querySelectorAll( '.'+ this.options.errorTemplateClass ).length ) return;
// Create the error window object which will be appear
var errorObject = document.createElement('span');
errorObject.className = this.options.errorTemplateClass + ' '+this.options.errorTemplateClass + '--' + this.options.bubblePosition;
// if error display is bubble, calculate to positions
if( this.options.display === 'bubble' ) {
var pos, W, H;
var pos, W = 0, H = 0;
// !! Here, JQuery functions are using to support the IE8
pos = $( el ).position();

if ( this.options.bubblePosition === 'bottom' ){
H = el.clientHeight;
if ( H === 0 ) {
pos = $(el.parentNode).position();
H = el.parentNode.clientHeight;
}
pos.top += H +10;
pos.left -= 5;
H = el.offsetHeight;
}
else {
W = $( el ).outerWidth(true);
pos.left += W + 15;
W = el.offsetWidth;
}

$( errorObject ).empty().css({
'left' : pos.left +'px',
'top' : pos.top +'px'
});
errorObject.innerHTML = '';
errorObject.style.top = pos.top + H + this.options.bubbleGapTop +'px';
errorObject.style.left = pos.left + W + this.options.bubbleGapLeft +'px'
}
elParent.appendChild( errorObject );
errorObject.innerHTML = error ;
Expand Down Expand Up @@ -519,7 +511,7 @@
// if el is undefined ( This is the process of resetting all <form> )
// or el is an object that has element more than one
// and these elements are not checkbox
if( typeof el === 'undefined' || ( el.length > 1 && el[0].getAttribute('type') !== 'checkbox' ) ) {
if( typeof el === 'undefined' || ( el.length > 1 && el[0].type !== 'checkbox' ) ) {
_errorMessages = this.form.querySelectorAll( '.'+ this.options.errorTemplateClass );
}
else {
Expand Down
16 changes: 8 additions & 8 deletions dist/validetta.min.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*!
* Validetta (http://lab.hasanaydogdu.com/validetta/)
* Version 1.0.0 ( 04-02-2015 )
* Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE)
* Copyright 2013-2015 Hasan Aydoğdu - http://www.hasanaydogdu.com
*/

.validetta-bubble{position:absolute;background-color:#cd2e26;max-width:325px;border-radius:5px;color:#fff;padding:5px 12px;z-index:9}.validetta-bubble--right:before{top:7px;left:-10px;border-color:transparent #cd2e26 transparent transparent}.validetta-bubble--bottom:before{top:-10px;left:10px;border-color:transparent transparent #cd2e26}.validetta-bubble:before{content:'';position:absolute;display:block;height:0;width:0;border-width:5px;border-style:solid}.validetta-bubble,.validetta-inline{display:block;font:12px/14px Arial,Helvetica,sans-serif}.validetta-inline{color:#cd2e26}
/*!
* Validetta (http://lab.hasanaydogdu.com/validetta/)
* Version 1.0.1 ( 16-08-2015 )
* Licensed under MIT (https://github.com/hsnayd/validetta/blob/master/LICENCE)
* Copyright 2013-2015 Hasan Aydoğdu - http://www.hasanaydogdu.com
*/

.validetta-bubble{position:absolute;background-color:#cd2e26;max-width:325px;border-radius:5px;color:#fff;padding:5px 12px;z-index:9}.validetta-bubble:before{content:'';position:absolute;display:block;height:0;width:0;border-width:5px;border-style:solid}.validetta-bubble--right:before{top:7px;left:-10px;border-color:transparent #cd2e26 transparent transparent}.validetta-bubble--bottom:before{top:-10px;left:10px;border-color:transparent transparent #cd2e26}.validetta-bubble,.validetta-inline{display:block;font:12px/14px Arial,Helvetica,sans-serif}.validetta-inline{color:#cd2e26}
4 changes: 2 additions & 2 deletions dist/validetta.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "validetta",
"description": "A tiny jquery plugin for validate your forms",
"version": "1.0.0",
"version": "1.0.1",
"homepage": "http://lab.hasanaydogdu.com/validetta/",
"author": {
"name": "Hasan Aydoğdu",
Expand Down
69 changes: 34 additions & 35 deletions src/validetta.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions validetta.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name" : "validetta",
"version" : "1.0.0",
"version" : "1.0.1",
"title" : "Validetta - A tiny jquery plugin for validate your forms",
"description" : "Validetta is a tiny jQuery plugin which you can do client-side validation of your forms. It aims to decrease your burden with easy usage and flexible structure.",
"keywords": [
Expand All @@ -15,7 +15,7 @@
"docs" : "http://lab.hasanaydogdu.com/validetta/#documentation",
"demo" : "http://lab.hasanaydogdu.com/validetta/#examples",
"bugs" : "http://github.com/hsnayd/validetta/issues",
"download" : "https://github.com/hsnayd/validetta/releases/download/v1.0.0/validetta-1.0.0-dist.zip",
"download" : "https://github.com/hsnayd/validetta/releases/download/v1.0.1/validetta-1.0.1-dist.zip",
"author" : {
"name": "Hasan Aydoğdu",
"url" : "http://github.com/hsnayd"
Expand Down

0 comments on commit 8bee016

Please sign in to comment.