initial import

This commit is contained in:
2017-03-06 17:58:18 +01:00
commit 0e7b015d20
276 changed files with 101193 additions and 0 deletions

View File

@@ -0,0 +1,281 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:17 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating Bootstrap form (http://getbootstrap.com/)
*/
(function($) {
FormValidation.Framework.Bootstrap = function(element, options, namespace) {
options = $.extend(true, {
button: {
selector: '[type="submit"]:not([formnovalidate])',
// The class of disabled button
// http://getbootstrap.com/css/#buttons-disabled
disabled: 'disabled'
},
err: {
// http://getbootstrap.com/css/#forms-help-text
clazz: 'help-block',
parent: '^(.*)col-(xs|sm|md|lg)-(offset-){0,1}[0-9]+(.*)$'
},
// This feature requires Bootstrap v3.1.0 or later (http://getbootstrap.com/css/#forms-control-validation).
// Since Bootstrap doesn't provide any methods to know its version, this option cannot be on/off automatically.
// In other word, to use this feature you have to upgrade your Bootstrap to v3.1.0 or later.
//
// Examples:
// - Use Glyphicons icons:
// icon: {
// valid: 'glyphicon glyphicon-ok',
// invalid: 'glyphicon glyphicon-remove',
// validating: 'glyphicon glyphicon-refresh',
// feedback: 'form-control-feedback'
// }
// - Use FontAwesome icons:
// icon: {
// valid: 'fa fa-check',
// invalid: 'fa fa-times',
// validating: 'fa fa-refresh',
// feedback: 'form-control-feedback'
// }
icon: {
valid: null,
invalid: null,
validating: null,
feedback: 'form-control-feedback'
},
row: {
// By default, each field is placed inside the <div class="form-group"></div>
// http://getbootstrap.com/css/#forms
selector: '.form-group',
valid: 'has-success',
invalid: 'has-error',
feedback: 'has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options, namespace]);
};
FormValidation.Framework.Bootstrap.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var ns = this._namespace,
type = $field.attr('type'),
field = $field.attr('data-' + ns + '-field'),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row);
// Place it after the container of checkbox/radio
// so when clicking the icon, it doesn't effect to the checkbox/radio element
if ('checkbox' === type || 'radio' === type) {
var $fieldParent = $field.parent();
if ($fieldParent.hasClass(type)) {
$icon.insertAfter($fieldParent);
} else if ($fieldParent.parent().hasClass(type)) {
$icon.insertAfter($fieldParent.parent());
}
}
// The feedback icon does not render correctly if there is no label
// https://github.com/twbs/bootstrap/issues/12873
if ($parent.find('label').length === 0) {
$icon.addClass('fv-icon-no-label');
}
// Fix feedback icons in input-group
if ($parent.find('.input-group').length !== 0) {
$icon.addClass('fv-bootstrap-icon-input-group')
.insertAfter($parent.find('.input-group').eq(0));
}
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon
.css({
'cursor': 'pointer',
'pointer-events': 'auto'
})
.popover('destroy')
.popover({
container: 'body',
content: message,
html: true,
placement: 'auto top',
trigger: 'hover click'
});
break;
case 'tooltip':
/* falls through */
default:
$icon
.css({
'cursor': 'pointer',
'pointer-events': 'auto'
})
.tooltip('destroy')
.tooltip({
container: 'body',
html: true,
placement: 'auto top',
title: message
});
break;
}
}
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon
.css({
'cursor': '',
'pointer-events': 'none'
})
.popover('destroy');
break;
case 'tooltip':
/* falls through */
default:
$icon
.css({
'cursor': '',
'pointer-events': 'none'
})
.tooltip('destroy');
break;
}
}
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon.popover('hide');
break;
case 'tooltip':
/* falls through */
default:
$icon.tooltip('hide');
break;
}
}
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon.popover('show');
break;
case 'tooltip':
/* falls through */
default:
$icon.tooltip('show');
break;
}
}
}
});
/**
* Plugin definition
* Support backward
* @deprecated It will be removed soon. Instead of using $(form).bootstrapValidator(), use
* $(form).formValidation({
* framework: 'bootstrap' // It's equivalent to use data-fv-framework="bootstrap" for <form>
* });
*/
$.fn.bootstrapValidator = function(option) {
var params = arguments;
return this.each(function() {
var $this = $(this),
data = $this.data('formValidation') || $this.data('bootstrapValidator'),
options = 'object' === typeof option && option;
if (!data) {
data = new FormValidation.Framework.Bootstrap(this, $.extend({}, {
events: {
// Support backward
formInit: 'init.form.bv',
formPreValidate: 'prevalidate.form.bv',
formError: 'error.form.bv',
formSuccess: 'success.form.bv',
fieldAdded: 'added.field.bv',
fieldRemoved: 'removed.field.bv',
fieldInit: 'init.field.bv',
fieldError: 'error.field.bv',
fieldSuccess: 'success.field.bv',
fieldStatus: 'status.field.bv',
localeChanged: 'changed.locale.bv',
validatorError: 'error.validator.bv',
validatorSuccess: 'success.validator.bv'
}
}, options), 'bv');
$this.addClass('fv-form-bootstrap')
.data('formValidation', data)
.data('bootstrapValidator', data);
}
// Allow to call plugin method
if ('string' === typeof option) {
data[option].apply(data, Array.prototype.slice.call(params, 1));
}
});
};
$.fn.bootstrapValidator.Constructor = FormValidation.Framework.Bootstrap;
}(jQuery));

View File

@@ -0,0 +1,10 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:21 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
!function(a){FormValidation.Framework.Bootstrap=function(b,c,d){c=a.extend(!0,{button:{selector:'[type="submit"]:not([formnovalidate])',disabled:"disabled"},err:{clazz:"help-block",parent:"^(.*)col-(xs|sm|md|lg)-(offset-){0,1}[0-9]+(.*)$"},icon:{valid:null,invalid:null,validating:null,feedback:"form-control-feedback"},row:{selector:".form-group",valid:"has-success",invalid:"has-error",feedback:"has-feedback"}},c),FormValidation.Base.apply(this,[b,c,d])},FormValidation.Framework.Bootstrap.prototype=a.extend({},FormValidation.Base.prototype,{_fixIcon:function(a,b){var c=this._namespace,d=a.attr("type"),e=a.attr("data-"+c+"-field"),f=this.options.fields[e].row||this.options.row.selector,g=a.closest(f);if("checkbox"===d||"radio"===d){var h=a.parent();h.hasClass(d)?b.insertAfter(h):h.parent().hasClass(d)&&b.insertAfter(h.parent())}0===g.find("label").length&&b.addClass("fv-icon-no-label"),0!==g.find(".input-group").length&&b.addClass("fv-bootstrap-icon-input-group").insertAfter(g.find(".input-group").eq(0))},_createTooltip:function(a,b,c){var d=this._namespace,e=a.data(d+".icon");if(e)switch(c){case"popover":e.css({cursor:"pointer","pointer-events":"auto"}).popover("destroy").popover({container:"body",content:b,html:!0,placement:"auto top",trigger:"hover click"});break;case"tooltip":default:e.css({cursor:"pointer","pointer-events":"auto"}).tooltip("destroy").tooltip({container:"body",html:!0,placement:"auto top",title:b})}},_destroyTooltip:function(a,b){var c=this._namespace,d=a.data(c+".icon");if(d)switch(b){case"popover":d.css({cursor:"","pointer-events":"none"}).popover("destroy");break;case"tooltip":default:d.css({cursor:"","pointer-events":"none"}).tooltip("destroy")}},_hideTooltip:function(a,b){var c=this._namespace,d=a.data(c+".icon");if(d)switch(b){case"popover":d.popover("hide");break;case"tooltip":default:d.tooltip("hide")}},_showTooltip:function(a,b){var c=this._namespace,d=a.data(c+".icon");if(d)switch(b){case"popover":d.popover("show");break;case"tooltip":default:d.tooltip("show")}}}),a.fn.bootstrapValidator=function(b){var c=arguments;return this.each(function(){var d=a(this),e=d.data("formValidation")||d.data("bootstrapValidator"),f="object"==typeof b&&b;e||(e=new FormValidation.Framework.Bootstrap(this,a.extend({},{events:{formInit:"init.form.bv",formPreValidate:"prevalidate.form.bv",formError:"error.form.bv",formSuccess:"success.form.bv",fieldAdded:"added.field.bv",fieldRemoved:"removed.field.bv",fieldInit:"init.field.bv",fieldError:"error.field.bv",fieldSuccess:"success.field.bv",fieldStatus:"status.field.bv",localeChanged:"changed.locale.bv",validatorError:"error.validator.bv",validatorSuccess:"success.validator.bv"}},f),"bv"),d.addClass("fv-form-bootstrap").data("formValidation",e).data("bootstrapValidator",e)),"string"==typeof b&&e[b].apply(e,Array.prototype.slice.call(c,1))})},a.fn.bootstrapValidator.Constructor=FormValidation.Framework.Bootstrap}(jQuery);

View File

@@ -0,0 +1,163 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:17 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating Foundation form (http://foundation.zurb.com/)
*/
/* global Foundation: false */
(function($) {
FormValidation.Framework.Foundation = function(element, options) {
options = $.extend(true, {
button: {
selector: '[type="submit"]:not([formnovalidate])',
// The class for disabled button
// http://foundation.zurb.com/docs/components/buttons.html#button-colors
disabled: 'disabled'
},
err: {
// http://foundation.zurb.com/docs/components/forms.html#error-states
clazz: 'error',
parent: '^.*((small|medium|large)-[0-9]+)\\s.*(columns).*$'
},
// Foundation doesn't support feedback icon
icon: {
valid: null,
invalid: null,
validating: null,
feedback: 'fv-control-feedback'
},
row: {
// http://foundation.zurb.com/docs/components/forms.html
selector: '.row',
valid: 'fv-has-success',
invalid: 'error',
feedback: 'fv-has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options]);
};
FormValidation.Framework.Foundation.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var ns = this._namespace,
type = $field.attr('type'),
field = $field.attr('data-' + ns + '-field'),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row);
if ('checkbox' === type || 'radio' === type) {
var $next = $icon.next();
if ($next.is('label')) {
$icon.insertAfter($next);
}
}
if ($parent.find('label').length === 0) {
$icon.addClass('fv-icon-no-label');
}
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
var that = this,
$icon = $field.data('fv.icon');
if ($icon) {
$icon
.attr('title', message)
.css({
'cursor': 'pointer'
})
.off('mouseenter.container.fv focusin.container.fv')
.on('mouseenter.container.fv', function() {
that._showTooltip($field, type);
})
.off('mouseleave.container.fv focusout.container.fv')
.on('mouseleave.container.fv focusout.container.fv', function() {
that._hideTooltip($field, type);
});
Foundation.libs.tooltip.create($icon);
$icon.data('fv.foundation.tooltip', $icon);
}
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
$icon.css({
'cursor': ''
});
var $tooltip = $icon.data('fv.foundation.tooltip');
if ($tooltip) {
// Foundation doesn't provide method to destroy particular tooltip instance
$tooltip.off('.fndtn.tooltip');
Foundation.libs.tooltip.hide($tooltip);
$icon.removeData('fv.foundation.tooltip');
}
}
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
$icon.css({
'cursor': ''
});
var $tooltip = $icon.data('fv.foundation.tooltip');
if ($tooltip) {
Foundation.libs.tooltip.hide($tooltip);
}
}
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
var $tooltip = $icon.data('fv.foundation.tooltip');
if ($tooltip) {
$icon.css({
'cursor': 'pointer'
});
Foundation.libs.tooltip.show($tooltip);
}
}
}
});
}(jQuery));

View File

@@ -0,0 +1,10 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:21 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
!function(a){FormValidation.Framework.Foundation=function(b,c){c=a.extend(!0,{button:{selector:'[type="submit"]:not([formnovalidate])',disabled:"disabled"},err:{clazz:"error",parent:"^.*((small|medium|large)-[0-9]+)\\s.*(columns).*$"},icon:{valid:null,invalid:null,validating:null,feedback:"fv-control-feedback"},row:{selector:".row",valid:"fv-has-success",invalid:"error",feedback:"fv-has-feedback"}},c),FormValidation.Base.apply(this,[b,c])},FormValidation.Framework.Foundation.prototype=a.extend({},FormValidation.Base.prototype,{_fixIcon:function(a,b){var c=this._namespace,d=a.attr("type"),e=a.attr("data-"+c+"-field"),f=this.options.fields[e].row||this.options.row.selector,g=a.closest(f);if("checkbox"===d||"radio"===d){var h=b.next();h.is("label")&&b.insertAfter(h)}0===g.find("label").length&&b.addClass("fv-icon-no-label")},_createTooltip:function(a,b,c){var d=this,e=a.data("fv.icon");e&&(e.attr("title",b).css({cursor:"pointer"}).off("mouseenter.container.fv focusin.container.fv").on("mouseenter.container.fv",function(){d._showTooltip(a,c)}).off("mouseleave.container.fv focusout.container.fv").on("mouseleave.container.fv focusout.container.fv",function(){d._hideTooltip(a,c)}),Foundation.libs.tooltip.create(e),e.data("fv.foundation.tooltip",e))},_destroyTooltip:function(a,b){var c=a.data("fv.icon");if(c){c.css({cursor:""});var d=c.data("fv.foundation.tooltip");d&&(d.off(".fndtn.tooltip"),Foundation.libs.tooltip.hide(d),c.removeData("fv.foundation.tooltip"))}},_hideTooltip:function(a,b){var c=a.data("fv.icon");if(c){c.css({cursor:""});var d=c.data("fv.foundation.tooltip");d&&Foundation.libs.tooltip.hide(d)}},_showTooltip:function(a,b){var c=a.data("fv.icon");if(c){var d=c.data("fv.foundation.tooltip");d&&(c.css({cursor:"pointer"}),Foundation.libs.tooltip.show(d))}}})}(jQuery);

View File

@@ -0,0 +1,64 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:17 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating Pure framework (http://purecss.io/)
*/
(function($) {
FormValidation.Framework.Pure = function(element, options) {
options = $.extend(true, {
button: {
selector: '[type="submit"]:not([formnovalidate])',
// The class of disabled button
// http://purecss.io/buttons/#disabled-buttons
disabled: 'pure-button-disabled'
},
err: {
clazz: 'fv-help-block',
parent: '^.*pure-control-group.*$'
},
// Pure doesn't support feedback icon
icon: {
valid: null,
invalid: null,
validating: null,
feedback: 'fv-control-feedback'
},
row: {
// http://purecss.io/forms/#aligned-form
selector: '.pure-control-group',
valid: 'fv-has-success',
invalid: 'fv-has-error',
feedback: 'fv-has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options]);
};
FormValidation.Framework.Pure.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var ns = this._namespace,
type = $field.attr('type'),
field = $field.attr('data-' + ns + '-field'),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row);
if ($parent.find('label').length === 0) {
$icon.addClass('fv-icon-no-label');
}
}
});
}(jQuery));

View File

@@ -0,0 +1,10 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:21 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
!function(a){FormValidation.Framework.Pure=function(b,c){c=a.extend(!0,{button:{selector:'[type="submit"]:not([formnovalidate])',disabled:"pure-button-disabled"},err:{clazz:"fv-help-block",parent:"^.*pure-control-group.*$"},icon:{valid:null,invalid:null,validating:null,feedback:"fv-control-feedback"},row:{selector:".pure-control-group",valid:"fv-has-success",invalid:"fv-has-error",feedback:"fv-has-feedback"}},c),FormValidation.Base.apply(this,[b,c])},FormValidation.Framework.Pure.prototype=a.extend({},FormValidation.Base.prototype,{_fixIcon:function(a,b){var c=this._namespace,d=(a.attr("type"),a.attr("data-"+c+"-field")),e=this.options.fields[d].row||this.options.row.selector,f=a.closest(e);0===f.find("label").length&&b.addClass("fv-icon-no-label")}})}(jQuery);

View File

@@ -0,0 +1,163 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:17 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating SemanticUI form (http://semantic-ui.com/)
*/
(function($) {
FormValidation.Framework.Semantic = function(element, options) {
options = $.extend(true, {
button: {
selector: '[type="submit"]:not([formnovalidate])',
// CSS class of disabled button
// http://semantic-ui.com/elements/button.html#disabled
disabled: 'disabled'
},
control: {
valid: '',
invalid: ''
},
err: {
// http://semantic-ui.com/elements/label.html#pointing
clazz: 'ui red pointing label transition',
parent: '^.*(field|column).*$'
},
// When using feedback icon, the input must place inside 'ui input icon' element
// <div class="ui input icon">
// <input type="text" />
// </div>
// See http://semantic-ui.com/elements/input.html#icon
icon: {
// http://semantic-ui.com/elements/icon.html
valid: null, // 'checkmark icon'
invalid: null, // 'remove icon'
validating: null, // 'refresh icon'
feedback: 'fv-control-feedback'
},
row: {
// http://semantic-ui.com/collections/form.html
selector: '.field',
valid: 'fv-has-success',
invalid: 'error',
feedback: 'fv-has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options]);
};
FormValidation.Framework.Semantic.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var type = $field.attr('type');
if ('checkbox' === type || 'radio' === type) {
var $fieldParent = $field.parent();
if ($fieldParent.hasClass(type)) {
$icon.insertAfter($fieldParent);
}
}
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
// Remove the popup if it's already exists
if ($icon.popup('exists')) {
$icon.popup('remove popup')
.popup('destroy');
}
// http://semantic-ui.com/modules/popup.html
switch (type) {
case 'popover':
$icon
.css({
'cursor': 'pointer'
})
.popup({
content: message,
position: 'top center'
});
break;
case 'tooltip':
/* falls through */
default:
$icon
.css({
'cursor': 'pointer'
})
.popup({
content: message,
position: 'top center',
variation: 'inverted'
});
break;
}
}
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon && $icon.popup('exists')) {
$icon
.css({
'cursor': ''
})
.popup('remove popup')
.popup('destroy');
}
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
$icon.popup('hide');
}
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
$icon.popup('show');
}
}
});
}(jQuery));

View File

@@ -0,0 +1,10 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:21 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
!function(a){FormValidation.Framework.Semantic=function(b,c){c=a.extend(!0,{button:{selector:'[type="submit"]:not([formnovalidate])',disabled:"disabled"},control:{valid:"",invalid:""},err:{clazz:"ui red pointing label transition",parent:"^.*(field|column).*$"},icon:{valid:null,invalid:null,validating:null,feedback:"fv-control-feedback"},row:{selector:".field",valid:"fv-has-success",invalid:"error",feedback:"fv-has-feedback"}},c),FormValidation.Base.apply(this,[b,c])},FormValidation.Framework.Semantic.prototype=a.extend({},FormValidation.Base.prototype,{_fixIcon:function(a,b){var c=a.attr("type");if("checkbox"===c||"radio"===c){var d=a.parent();d.hasClass(c)&&b.insertAfter(d)}},_createTooltip:function(a,b,c){var d=a.data("fv.icon");if(d)switch(d.popup("exists")&&d.popup("remove popup").popup("destroy"),c){case"popover":d.css({cursor:"pointer"}).popup({content:b,position:"top center"});break;case"tooltip":default:d.css({cursor:"pointer"}).popup({content:b,position:"top center",variation:"inverted"})}},_destroyTooltip:function(a,b){var c=a.data("fv.icon");c&&c.popup("exists")&&c.css({cursor:""}).popup("remove popup").popup("destroy")},_hideTooltip:function(a,b){var c=a.data("fv.icon");c&&c.popup("hide")},_showTooltip:function(a,b){var c=a.data("fv.icon");c&&c.popup("show")}})}(jQuery);

View File

@@ -0,0 +1,165 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:17 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating UIKit form (http://getuikit.com/)
*/
(function($) {
FormValidation.Framework.Uikit = function(element, options) {
options = $.extend(true, {
button: {
selector: '[type="submit"]:not([formnovalidate])',
// The class for disabled button
// http://getuikit.com/docs/button.html
disabled: 'disabled'
},
control: {
valid: 'uk-form-success',
invalid: 'uk-form-danger'
},
err: {
// http://getuikit.com/docs/text.html#text-styles
clazz: 'uk-text-danger',
parent: '^.*(uk-form-controls|uk-width-[\\d+]-[\\d+]).*$'
},
// UIKit doesn't support feedback icon
icon: {
valid: null,
invalid: null,
validating: null,
feedback: 'fv-control-feedback'
},
row: {
// http://getuikit.com/docs/form.html
selector: '.uk-form-row',
valid: 'fv-has-success',
invalid: 'fv-has-error',
feedback: 'fv-has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options]);
};
FormValidation.Framework.Uikit.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var ns = this._namespace,
type = $field.attr('type'),
field = $field.attr('data-' + ns + '-field'),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row);
if ('checkbox' === type || 'radio' === type) {
var $fieldParent = $field.parent();
if ($fieldParent.is('label')) {
$icon.insertAfter($fieldParent);
}
}
if ($parent.find('label').length === 0) {
$icon.addClass('fv-icon-no-label');
}
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
// Remove the tooltip if it's already exists
if ($icon.data('tooltip')) {
$icon.data('tooltip').off();
$icon.removeData('tooltip');
}
$icon
.attr('title', message)
.css({
'cursor': 'pointer'
});
new $.UIkit.tooltip($icon);
// UIKit auto set the 'tooltip' data for the element
// so I can retrieve the tooltip later via $icon.data('tooltip')
}
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
var tooltip = $icon.data('tooltip');
if (tooltip) {
tooltip.hide();
tooltip.off();
$icon.off('focus mouseenter')
.removeData('tooltip');
}
$icon.css({
'cursor': ''
});
}
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
var tooltip = $icon.data('tooltip');
if (tooltip) {
tooltip.hide();
}
$icon.css({
'cursor': ''
});
}
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
var $icon = $field.data('fv.icon');
if ($icon) {
$icon.css({
'cursor': 'pointer'
});
var tooltip = $icon.data('tooltip');
if (tooltip) {
tooltip.show();
}
}
}
});
}(jQuery));

View File

@@ -0,0 +1,10 @@
/*!
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @version v0.7.0, built on 2015-08-01 4:57:21 PM
* @author https://twitter.com/formvalidation
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
!function(a){FormValidation.Framework.Uikit=function(b,c){c=a.extend(!0,{button:{selector:'[type="submit"]:not([formnovalidate])',disabled:"disabled"},control:{valid:"uk-form-success",invalid:"uk-form-danger"},err:{clazz:"uk-text-danger",parent:"^.*(uk-form-controls|uk-width-[\\d+]-[\\d+]).*$"},icon:{valid:null,invalid:null,validating:null,feedback:"fv-control-feedback"},row:{selector:".uk-form-row",valid:"fv-has-success",invalid:"fv-has-error",feedback:"fv-has-feedback"}},c),FormValidation.Base.apply(this,[b,c])},FormValidation.Framework.Uikit.prototype=a.extend({},FormValidation.Base.prototype,{_fixIcon:function(a,b){var c=this._namespace,d=a.attr("type"),e=a.attr("data-"+c+"-field"),f=this.options.fields[e].row||this.options.row.selector,g=a.closest(f);if("checkbox"===d||"radio"===d){var h=a.parent();h.is("label")&&b.insertAfter(h)}0===g.find("label").length&&b.addClass("fv-icon-no-label")},_createTooltip:function(b,c,d){var e=b.data("fv.icon");e&&(e.data("tooltip")&&(e.data("tooltip").off(),e.removeData("tooltip")),e.attr("title",c).css({cursor:"pointer"}),new a.UIkit.tooltip(e))},_destroyTooltip:function(a,b){var c=a.data("fv.icon");if(c){var d=c.data("tooltip");d&&(d.hide(),d.off(),c.off("focus mouseenter").removeData("tooltip")),c.css({cursor:""})}},_hideTooltip:function(a,b){var c=a.data("fv.icon");if(c){var d=c.data("tooltip");d&&d.hide(),c.css({cursor:""})}},_showTooltip:function(a,b){var c=a.data("fv.icon");if(c){c.css({cursor:"pointer"});var d=c.data("tooltip");d&&d.show()}}})}(jQuery);