1290 lines
No EOL
84 KiB
JavaScript
1290 lines
No EOL
84 KiB
JavaScript
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
/**
|
|
* Errors
|
|
*/
|
|
module.exports = {
|
|
|
|
required: 'This field is required',
|
|
digits: 'Must be only digits',
|
|
name: 'Must be at least 3 characters long and must only contain letters',
|
|
email: 'Must be a valid email',
|
|
username: 'Must be at between 4 and 32 characters long and start with a letter. You may use letters, numbers, underscores, and one dot',
|
|
pass: 'Must be at least 6 characters long, and contain at least one number, one uppercase and one lowercase letter',
|
|
strongpass: 'Must be at least 8 characters long and contain at least one uppercase and one lowercase letter and one number or special character',
|
|
phone: 'Must be a valid phone number',
|
|
zip: 'Must be a valid zip code',
|
|
url: 'Must be a valid URL',
|
|
number: 'Must be a number',
|
|
range: 'Must be a number between {0} and {1}',
|
|
min: 'Must be at least {0} characters long',
|
|
max: 'Must be under {0} characters',
|
|
minoption: 'Select at least {0} options',
|
|
maxoption: 'Select no more than {0} options',
|
|
minmax: 'Must be between {0} and {1} characters long',
|
|
select: 'Select an option',
|
|
extension: 'File(s) must have a valid extension ({*})',
|
|
equalto: 'Must have the same value as the "{0}" field',
|
|
date: 'Must be a valid date {0}'
|
|
|
|
};
|
|
|
|
},{}],2:[function(require,module,exports){
|
|
/**
|
|
* Adaptive
|
|
*/
|
|
module.exports = {
|
|
|
|
name: 'adaptive',
|
|
|
|
options: {
|
|
adaptiveWidth: $('<p class="idealforms-field-width"/>').appendTo('body').css('width').replace('px','')
|
|
},
|
|
|
|
methods: {
|
|
|
|
// @extend
|
|
_init: function () {
|
|
|
|
var self = this;
|
|
|
|
function adapt() {
|
|
|
|
var formWidth = self.$form.outerWidth()
|
|
, isAdaptive = self.opts.adaptiveWidth > formWidth;
|
|
|
|
self.$form.toggleClass('adaptive', isAdaptive);
|
|
|
|
if (self._hasExtension('steps')) {
|
|
self.$stepsContainer.toggleClass('adaptive', isAdaptive);
|
|
}
|
|
|
|
$('#ui-datepicker-div').hide();
|
|
}
|
|
|
|
$(window).resize(adapt);
|
|
adapt();
|
|
|
|
this.$form.find('select, .datepicker').each(function() {
|
|
self._getField(this).find(self.opts.error).addClass('hidden');
|
|
});
|
|
|
|
$('p.idealforms-field-width').remove();
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
},{}],3:[function(require,module,exports){
|
|
module.exports = {
|
|
|
|
name: 'ajax',
|
|
|
|
methods: {
|
|
|
|
// @extend
|
|
_init: function() {
|
|
|
|
$.extend($.idealforms, { _requests: {} });
|
|
|
|
$.extend($.idealforms.errors, {
|
|
ajax: 'Loading...'
|
|
});
|
|
|
|
$.extend($.idealforms.rules, {
|
|
|
|
ajax: function(input) {
|
|
|
|
var self = this
|
|
, $field = this._getField(input)
|
|
, url = $(input).data('idealforms-ajax')
|
|
, userError = $.idealforms._getKey('errors.'+ input.name +'.ajaxError', self.opts)
|
|
, requests = $.idealforms._requests
|
|
, data = {};
|
|
|
|
data[input.name] = input.value;
|
|
|
|
$field.addClass('ajax');
|
|
|
|
if (requests[input.name]) requests[input.name].abort();
|
|
|
|
requests[input.name] = $.post(url, data, function(resp) {
|
|
|
|
if (resp === true) {
|
|
$field.data('idealforms-valid', true);
|
|
self._handleError(input);
|
|
self._handleStyle(input);
|
|
} else {
|
|
self._handleError(input, userError);
|
|
}
|
|
|
|
$field.removeClass('ajax');
|
|
|
|
}, 'json');
|
|
|
|
return false;
|
|
}
|
|
});
|
|
},
|
|
|
|
// @extend
|
|
_validate: function(input, rule) {
|
|
if (rule != 'ajax' && $.idealforms._requests[input.name]) {
|
|
$.idealforms._requests[input.name].abort();
|
|
this._getField(input).removeClass('ajax');
|
|
}
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
},{}],4:[function(require,module,exports){
|
|
require('./idealfile');
|
|
require('./idealradiocheck');
|
|
|
|
module.exports = {
|
|
|
|
name: 'customInputs',
|
|
|
|
methods: {
|
|
|
|
// @extend
|
|
_init: function() {
|
|
this._buildCustomInputs();
|
|
},
|
|
|
|
addFields: function() {
|
|
this._buildCustomInputs();
|
|
},
|
|
|
|
_buildCustomInputs: function() {
|
|
this.$form.find(':file').idealfile();
|
|
this.$form.find(':checkbox, :radio').idealradiocheck();
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
},{"./idealfile":5,"./idealradiocheck":6}],5:[function(require,module,exports){
|
|
/**
|
|
* Ideal File
|
|
*/
|
|
(function($, win, doc, undefined) {
|
|
|
|
// Browser supports HTML5 multiple file?
|
|
var multipleSupport = typeof $('<input/>')[0].multiple !== 'undefined'
|
|
, isIE = /msie/i.test(navigator.userAgent)
|
|
, plugin = {};
|
|
|
|
plugin.name = 'idealfile';
|
|
|
|
plugin.methods = {
|
|
|
|
_init: function() {
|
|
|
|
var $file = $(this.el).addClass('ideal-file') // the original file input
|
|
, $wrap = $('<div class="ideal-file-wrap">')
|
|
, $input = $('<input type="text" class="ideal-file-filename" />')
|
|
// Button that will be used in non-IE browsers
|
|
, $button = $('<button type="button" class="ideal-file-upload">Open</button>')
|
|
// Hack for IE
|
|
, $label = $('<label class="ideal-file-upload" for="' + $file[0].id + '">Open</label>');
|
|
|
|
// Hide by shifting to the left so we
|
|
// can still trigger events
|
|
$file.css({
|
|
position: 'absolute',
|
|
left: '-9999px'
|
|
});
|
|
|
|
$wrap.append($input, (isIE ? $label : $button)).insertAfter($file);
|
|
|
|
// Prevent focus
|
|
$file.attr('tabIndex', -1);
|
|
$button.attr('tabIndex', -1);
|
|
|
|
$button.click(function () {
|
|
$file.focus().click(); // Open dialog
|
|
});
|
|
|
|
$file.change(function () {
|
|
|
|
var files = []
|
|
, fileArr, filename;
|
|
|
|
// If multiple is supported then extract
|
|
// all filenames from the file array
|
|
if (multipleSupport) {
|
|
fileArr = $file[0].files;
|
|
for (var i = 0, len = fileArr.length; i < len; i++) {
|
|
files.push(fileArr[i].name);
|
|
}
|
|
filename = files.join(', ');
|
|
|
|
// If not supported then just take the value
|
|
// and remove the path to just show the filename
|
|
} else {
|
|
filename = $file.val().split('\\').pop();
|
|
}
|
|
|
|
$input .val(filename).attr('title', filename);
|
|
|
|
});
|
|
|
|
$input.on({
|
|
blur: function () {
|
|
$file.trigger('blur');
|
|
},
|
|
keydown: function (e) {
|
|
if (e.which === 13) { // Enter
|
|
if (!isIE) $file.trigger('click');
|
|
$(this).closest('form').one('keydown', function(e) {
|
|
if (e.which === 13) e.preventDefault();
|
|
});
|
|
} else if (e.which === 8 || e.which === 46) { // Backspace & Del
|
|
// In IE the value is read-only
|
|
// with this trick we remove the old input and add
|
|
// a clean clone with all the original events attached
|
|
if (isIE) $file.replaceWith($file = $file.clone(true));
|
|
$file.val('').trigger('change');
|
|
$input.val('');
|
|
} else if (e.which === 9) { // TAB
|
|
return;
|
|
} else { // All other keys
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
require('../../plugin')(plugin);
|
|
|
|
}(jQuery, window, document));
|
|
|
|
},{"../../plugin":12}],6:[function(require,module,exports){
|
|
/*
|
|
* idealRadioCheck: jQuery plguin for checkbox and radio replacement
|
|
* Usage: $('input[type=checkbox], input[type=radio]').idealRadioCheck()
|
|
*/
|
|
(function($, win, doc, undefined) {
|
|
|
|
var plugin = {};
|
|
|
|
plugin.name = 'idealradiocheck';
|
|
|
|
plugin.methods = {
|
|
|
|
_init: function() {
|
|
|
|
var $input = $(this.el);
|
|
var $span = $('<span/>');
|
|
|
|
$span.addClass('ideal-'+ ($input.is(':checkbox') ? 'check' : 'radio'));
|
|
$input.is(':checked') && $span.addClass('checked'); // init
|
|
$span.insertAfter($input);
|
|
|
|
$input.parent('label')
|
|
.addClass('ideal-radiocheck-label')
|
|
.attr('onclick', ''); // Fix clicking label in iOS
|
|
|
|
$input.css({ position: 'absolute', left: '-9999px' }); // hide by shifting left
|
|
|
|
// Events
|
|
$input.on({
|
|
change: function() {
|
|
var $input = $(this);
|
|
if ( $input.is('input[type="radio"]') ) {
|
|
$input.parent().siblings('label').find('.ideal-radio').removeClass('checked');
|
|
}
|
|
$span.toggleClass('checked', $input.is(':checked'));
|
|
},
|
|
focus: function() { $span.addClass('focus') },
|
|
blur: function() { $span.removeClass('focus') },
|
|
click: function() { $(this).trigger('focus') }
|
|
});
|
|
}
|
|
|
|
};
|
|
|
|
require('../../plugin')(plugin);
|
|
|
|
}(jQuery, window, document));
|
|
|
|
|
|
},{"../../plugin":12}],7:[function(require,module,exports){
|
|
module.exports = {
|
|
|
|
name: 'datepicker',
|
|
|
|
methods: {
|
|
|
|
// @extend
|
|
_init: function() {
|
|
this._buildDatepicker();
|
|
},
|
|
|
|
_buildDatepicker: function() {
|
|
|
|
var $datepicker = this.$form.find('input.datepicker');
|
|
|
|
// Always show datepicker below the input
|
|
if (jQuery.ui) {
|
|
$.datepicker._checkOffset = function(a,b,c){ return b };
|
|
}
|
|
|
|
if (jQuery.ui && $datepicker.length) {
|
|
|
|
$datepicker.each(function() {
|
|
|
|
$(this).datepicker({
|
|
beforeShow: function(input) {
|
|
$(input).addClass('open');
|
|
},
|
|
onChangeMonthYear: function() {
|
|
// Hack to fix IE9 not resizing
|
|
var $this = $(this)
|
|
, width = $this.outerWidth(); // cache first!
|
|
setTimeout(function() {
|
|
$this.datepicker('widget').css('width', width);
|
|
}, 1);
|
|
},
|
|
onClose: function() {
|
|
$(this).removeClass('open');
|
|
}
|
|
});
|
|
});
|
|
|
|
// Adjust width
|
|
$datepicker.on('focus keyup', function() {
|
|
var t = $(this), w = t.outerWidth();
|
|
t.datepicker('widget').css('width', w);
|
|
});
|
|
}
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
},{}],8:[function(require,module,exports){
|
|
function template(html, data) {
|
|
|
|
var loop = /\{@([^}]+)\}(.+?)\{\/\1\}/g
|
|
, loopVariable = /\{#([^}]+)\}/g
|
|
, variable = /\{([^}]+)\}/g;
|
|
|
|
return html
|
|
.replace(loop, function(_, key, list) {
|
|
return $.map(data[key], function(item) {
|
|
return list.replace(loopVariable, function(_, k) {
|
|
return item[k];
|
|
});
|
|
}).join('');
|
|
})
|
|
.replace(variable, function(_, key) {
|
|
return data[key] || '';
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
|
|
name: 'dynamicFields',
|
|
|
|
options: {
|
|
|
|
templates: {
|
|
|
|
base:'\
|
|
<div class="field" {class}>\
|
|
<label class="main">{label}</label>\
|
|
{field}\
|
|
<span class="error"></span>\
|
|
</div>\
|
|
',
|
|
|
|
text: '<input name="{name}" type="{subtype}" value="{value}" {attrs}>',
|
|
|
|
file: '<input id="{name} "name="{name}" type="file" {attrs}>',
|
|
|
|
textarea: '<textarea name="{name}" {attrs}>{text}</textarea>',
|
|
|
|
group: '\
|
|
<p class="group">\
|
|
{@list}\
|
|
<label><input name="{name}" type="{subtype}" value="{#value}" {#attrs}>{#text}</label>\
|
|
{/list}\
|
|
</p>\
|
|
',
|
|
|
|
select: '\
|
|
<select name={name}>\
|
|
{@list}\
|
|
<option value="{#value}">{#text}</option>\
|
|
{/list}\
|
|
</select>\
|
|
'
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
|
|
addFields: function(fields) {
|
|
|
|
var self = this;
|
|
|
|
$.each(fields, function(name, field) {
|
|
|
|
var typeArray = field.type.split(':')
|
|
, rules = {}
|
|
, $last = self.$form.find(self.opts.field).last();
|
|
|
|
field.name = name;
|
|
field.type = typeArray[0];
|
|
if (typeArray[1]) field.subtype = typeArray[1];
|
|
|
|
field.html = template(self.opts.templates.base, {
|
|
label: field.label,
|
|
field: template(self.opts.templates[field.type], field)
|
|
});
|
|
|
|
self._inject('addFields', field);
|
|
|
|
if (field.after || field.before) {
|
|
self.$form.find('[name="'+ (field.after || field.before) +'"]').first().each(function() {
|
|
self._getField(this)[field.after ? 'after' : 'before'](field.html);
|
|
});
|
|
} else {
|
|
// Form has at least one field
|
|
if ($last.length) $last.after(field.html);
|
|
// Form has no fields
|
|
else self.$form.append(field.html);
|
|
}
|
|
|
|
if (field.rules) {
|
|
rules[name] = field.rules;
|
|
self.addRules(rules);
|
|
}
|
|
});
|
|
|
|
},
|
|
|
|
removeFields: function(names) {
|
|
|
|
var self = this;
|
|
|
|
$.each(names.split(' '), function(i, name) {
|
|
var $field = self._getField($('[name="'+ name +'"]'));
|
|
self.$fields = self.$fields.filter(function() {
|
|
return ! $(this).is($field);
|
|
});
|
|
$field.remove();
|
|
});
|
|
|
|
this._inject('removeFields');
|
|
},
|
|
|
|
toggleFields: function(names) {
|
|
|
|
var self = this;
|
|
|
|
$.each(names.split(' '), function(i, name) {
|
|
var $field = self._getField($('[name="'+ name +'"]'));
|
|
$field.data('idealforms-valid', $field.is(':visible')).toggle();
|
|
});
|
|
|
|
this._inject('toggleFields');
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
},{}],9:[function(require,module,exports){
|
|
/*!
|
|
* Ideal Steps
|
|
*/
|
|
(function($, win, doc, undefined) {
|
|
|
|
var plugin = {};
|
|
|
|
plugin.name = 'idealsteps';
|
|
|
|
plugin.defaults = {
|
|
nav: '.idealsteps-nav',
|
|
navItems: 'li',
|
|
buildNavItems: true,
|
|
wrap: '.idealsteps-wrap',
|
|
step: '.idealsteps-step',
|
|
activeClass: 'idealsteps-step-active',
|
|
before: null,
|
|
after: null,
|
|
fadeSpeed: 0
|
|
};
|
|
|
|
plugin.methods = {
|
|
|
|
_init: function() {
|
|
|
|
var self = this,
|
|
active = this.opts.activeClass;
|
|
|
|
this.$el = $(this.el);
|
|
|
|
this.$nav = this.$el.find(this.opts.nav);
|
|
this.$navItems = this.$nav.find(this.opts.navItems);
|
|
|
|
this.$wrap = this.$el.find(this.opts.wrap);
|
|
this.$steps = this.$wrap.find(this.opts.step);
|
|
|
|
if (this.opts.buildNavItems) this._buildNavItems();
|
|
|
|
this.$steps.hide().first().show();
|
|
this.$navItems.removeClass(active).first().addClass(active);
|
|
|
|
this.$navItems.click(function() {
|
|
self.go(self.$navItems.index(this));
|
|
});
|
|
},
|
|
|
|
_buildNavItems: function() {
|
|
|
|
var self = this,
|
|
isCustom = typeof this.opts.buildNavItems == 'function',
|
|
item = function(val){ return '<li><a href="#" tabindex="-1">'+ val +'</a></li>'; },
|
|
items;
|
|
|
|
items = isCustom ?
|
|
this.$steps.map(function(i){ return item(self.opts.buildNavItems.call(self, i)) }).get() :
|
|
this.$steps.map(function(i){ return item(++i); }).get();
|
|
|
|
this.$navItems = $(items.join(''));
|
|
|
|
this.$nav.append($('<ul/>').append(this.$navItems));
|
|
},
|
|
|
|
_getCurIdx: function() {
|
|
return this.$steps.index(this.$steps.filter(':visible'));
|
|
},
|
|
|
|
go: function(idx) {
|
|
|
|
var active = this.opts.activeClass,
|
|
fadeSpeed = this.opts.fadeSpeed;
|
|
|
|
if (typeof idx == 'function') idx = idx.call(this, this._getCurIdx());
|
|
|
|
if (idx >= this.$steps.length) idx = 0;
|
|
if (idx < 0) idx = this.$steps.length-1;
|
|
|
|
if (this.opts.before) this.opts.before.call(this, idx);
|
|
|
|
this.$navItems.removeClass(active).eq(idx).addClass(active);
|
|
this.$steps.fadeOut(fadeSpeed).eq(idx).fadeIn(fadeSpeed);
|
|
|
|
if (this.opts.after) this.opts.after.call(this, idx);
|
|
},
|
|
|
|
prev: function() {
|
|
this.go(this._getCurIdx() - 1);
|
|
},
|
|
|
|
next: function() {
|
|
this.go(this._getCurIdx() + 1);
|
|
},
|
|
|
|
first: function() {
|
|
this.go(0);
|
|
},
|
|
|
|
last: function() {
|
|
this.go(this.$steps.length-1);
|
|
}
|
|
};
|
|
|
|
require('../../plugin')(plugin);
|
|
|
|
}(jQuery, window, document));
|
|
|
|
},{"../../plugin":12}],10:[function(require,module,exports){
|
|
require('./idealsteps');
|
|
|
|
module.exports = {
|
|
|
|
name: 'steps',
|
|
|
|
options: {
|
|
steps: {
|
|
container: '.idealsteps-container',
|
|
nav: '.idealsteps-nav',
|
|
navItems: 'li',
|
|
buildNavItems: true,
|
|
wrap: '.idealsteps-wrap',
|
|
step: '.idealsteps-step',
|
|
activeClass: 'idealsteps-step-active',
|
|
before: null,
|
|
after: null,
|
|
fadeSpeed: 0
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
|
|
// @extend
|
|
_init: function() {
|
|
this._buildSteps();
|
|
},
|
|
|
|
// @extend
|
|
_validate: function() {
|
|
|
|
var self = this;
|
|
|
|
this._updateSteps();
|
|
|
|
if (this._hasExtension('ajax')) {
|
|
$.each($.idealforms._requests, function(key, request) {
|
|
request.done(function(){ self._updateSteps() });
|
|
});
|
|
}
|
|
},
|
|
|
|
// @extend
|
|
focusFirstInvalid: function(firstInvalid) {
|
|
|
|
var self = this;
|
|
|
|
this.$stepsContainer.idealsteps('go', function() {
|
|
return this.$steps.filter(function() {
|
|
return $(this).find(firstInvalid).length;
|
|
}).index();
|
|
});
|
|
},
|
|
|
|
_buildSteps: function() {
|
|
|
|
var self = this, options
|
|
, hasRules = ! $.isEmptyObject(this.opts.rules)
|
|
, counter = hasRules
|
|
? '<span class="counter"/>'
|
|
: '<span class="counter zero">0</span>';
|
|
|
|
if (this.opts.steps.buildNavItems === true) {
|
|
this.opts.steps.buildNavItems = function(i) {
|
|
return 'Step '+ (i+1) + counter;
|
|
};
|
|
}
|
|
|
|
this.$stepsContainer = this.$form
|
|
.closest(this.opts.steps.container)
|
|
.idealsteps(this.opts.steps);
|
|
},
|
|
|
|
_updateSteps: function() {
|
|
|
|
var self = this;
|
|
|
|
this.$stepsContainer.idealsteps('_inject', function() {
|
|
|
|
var idealsteps = this;
|
|
|
|
this.$navItems.each(function(i) {
|
|
var invalid = idealsteps.$steps.eq(i).find(self.getInvalid()).length;
|
|
$(this).find('span').text(invalid).toggleClass('zero', ! invalid);
|
|
});
|
|
});
|
|
},
|
|
|
|
// @extend
|
|
addRules: function() {
|
|
this.firstStep();
|
|
},
|
|
|
|
// @extend
|
|
addFields: function(field) {
|
|
field.after = this.$stepsContainer
|
|
.find(this.opts.steps.step)
|
|
.eq(field.appendToStep)
|
|
.find('input, textarea, select')
|
|
.last()[0].name;
|
|
},
|
|
|
|
// @extend
|
|
toggleFields: function() {
|
|
this._updateSteps();
|
|
},
|
|
|
|
// @extend
|
|
removeFields: function() {
|
|
this._updateSteps();
|
|
},
|
|
|
|
goToStep: function(idx) {
|
|
this.$stepsContainer.idealsteps('go', idx);
|
|
},
|
|
|
|
prevStep: function() {
|
|
this.$stepsContainer.idealsteps('prev');
|
|
},
|
|
|
|
nextStep: function() {
|
|
this.$stepsContainer.idealsteps('next');
|
|
},
|
|
|
|
firstStep: function() {
|
|
this.$stepsContainer.idealsteps('first');
|
|
},
|
|
|
|
lastStep: function() {
|
|
this.$stepsContainer.idealsteps('last');
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
},{"./idealsteps":9}],11:[function(require,module,exports){
|
|
/*!
|
|
* jQuery Ideal Forms
|
|
* @author: Cedric Ruiz
|
|
* @version: 3.0
|
|
* @license GPL or MIT
|
|
*/
|
|
(function($, win, doc, undefined) {
|
|
|
|
var plugin = {};
|
|
|
|
plugin.name = 'idealforms';
|
|
|
|
plugin.defaults = {
|
|
field: '.field',
|
|
error: '.error',
|
|
iconHtml: '<i/>',
|
|
iconClass: 'icon',
|
|
invalidClass: 'invalid',
|
|
validClass: 'valid',
|
|
silentLoad: true,
|
|
onValidate: $.noop,
|
|
onSubmit: $.noop
|
|
};
|
|
|
|
plugin.global = {
|
|
|
|
_format: function(str) {
|
|
var args = [].slice.call(arguments, 1);
|
|
return str.replace(/\{(\d)\}/g, function(_, match) {
|
|
return args[+match] || '';
|
|
}).replace(/\{\*([^*}]*)\}/g, function(_, sep) {
|
|
return args.join(sep || ', ');
|
|
});
|
|
},
|
|
|
|
_getKey: function(key, obj) {
|
|
return key.split('.').reduce(function(a,b) {
|
|
return a && a[b];
|
|
}, obj);
|
|
},
|
|
|
|
ruleSeparator: ' ',
|
|
argSeparator: ':',
|
|
|
|
rules: require('./rules'),
|
|
errors: require('./errors'),
|
|
|
|
extensions: [
|
|
require('./extensions/dynamic-fields/dynamic-fields.ext'),
|
|
require('./extensions/ajax/ajax.ext'),
|
|
require('./extensions/steps/steps.ext'),
|
|
require('./extensions/custom-inputs/custom-inputs.ext'),
|
|
require('./extensions/datepicker/datepicker.ext'),
|
|
require('./extensions/adaptive/adaptive.ext')
|
|
]
|
|
};
|
|
|
|
plugin.methods = $.extend({}, require('./private'), require('./public'));
|
|
|
|
require('./plugin')(plugin);
|
|
|
|
}(jQuery, window, document));
|
|
|
|
},{"./errors":1,"./extensions/adaptive/adaptive.ext":2,"./extensions/ajax/ajax.ext":3,"./extensions/custom-inputs/custom-inputs.ext":4,"./extensions/datepicker/datepicker.ext":7,"./extensions/dynamic-fields/dynamic-fields.ext":8,"./extensions/steps/steps.ext":10,"./plugin":12,"./private":13,"./public":14,"./rules":15}],12:[function(require,module,exports){
|
|
/**
|
|
* Plugin boilerplate
|
|
*/
|
|
module.exports = (function() {
|
|
|
|
var AP = Array.prototype;
|
|
|
|
return function(plugin) {
|
|
|
|
plugin = $.extend(true, {
|
|
name: 'plugin',
|
|
defaults: {
|
|
disabledExtensions: 'none'
|
|
},
|
|
methods: {},
|
|
global: {},
|
|
}, plugin);
|
|
|
|
$[plugin.name] = $.extend({
|
|
|
|
addExtension: function(extension) {
|
|
plugin.global.extensions.push(extension);
|
|
}
|
|
}, plugin.global);
|
|
|
|
function Plugin(element, options) {
|
|
|
|
this.opts = $.extend({}, plugin.defaults, options);
|
|
this.el = element;
|
|
|
|
this._name = plugin.name;
|
|
|
|
this._init();
|
|
}
|
|
|
|
Plugin._extended = {};
|
|
|
|
Plugin.prototype._hasExtension = function(extension) {
|
|
|
|
var self = this;
|
|
|
|
return plugin.global.extensions.filter(function(ext) {
|
|
return ext.name == extension && self.opts.disabledExtensions.indexOf(ext.name) < 0;
|
|
}).length;
|
|
};
|
|
|
|
Plugin.prototype._extend = function(extensions) {
|
|
|
|
var self = this;
|
|
|
|
$.each(extensions, function(i, extension) {
|
|
|
|
$.extend(self.opts, $.extend(true, extension.options, self.opts));
|
|
|
|
$.each(extension.methods, function(method, fn) {
|
|
|
|
if (self.opts.disabledExtensions.indexOf(extension.name) > -1) {
|
|
return;
|
|
}
|
|
|
|
if (Plugin.prototype[method]) {
|
|
Plugin._extended[method] = Plugin._extended[method] || [];
|
|
Plugin._extended[method].push({ name: extension.name, fn: fn });
|
|
} else {
|
|
Plugin.prototype[method] = fn;
|
|
}
|
|
});
|
|
|
|
});
|
|
};
|
|
|
|
Plugin.prototype._inject = function(method) {
|
|
|
|
var args = [].slice.call(arguments, 1);
|
|
|
|
if (typeof method == 'function') return method.call(this);
|
|
|
|
var self = this;
|
|
|
|
if (Plugin._extended[method]) {
|
|
$.each(Plugin._extended[method], function(i, plugin) {
|
|
plugin.fn.apply(self, args);
|
|
});
|
|
}
|
|
};
|
|
|
|
Plugin.prototype._init = $.noop;
|
|
|
|
Plugin.prototype[plugin.name] = function(method) {
|
|
if (!method) return this;
|
|
try { return this[method].apply(this, AP.slice.call(arguments, 1)); }
|
|
catch(e) {}
|
|
};
|
|
|
|
$.extend(Plugin.prototype, plugin.methods);
|
|
|
|
$.fn[plugin.name] = function() {
|
|
|
|
var args = AP.slice.call(arguments)
|
|
, methodArray = typeof args[0] == 'string' && args[0].split(':')
|
|
, method = methodArray[methodArray.length > 1 ? 1 : 0]
|
|
, prefix = methodArray.length > 1 && methodArray[0]
|
|
, opts = typeof args[0] == 'object' && args[0]
|
|
, params = args.slice(1)
|
|
, ret;
|
|
|
|
if (prefix) {
|
|
method = prefix + method.substr(0,1).toUpperCase() + method.substr(1,method.length-1);
|
|
}
|
|
|
|
this.each(function() {
|
|
|
|
var instance = $.data(this, plugin.name);
|
|
|
|
// Method
|
|
if (instance) {
|
|
return ret = instance[plugin.name].apply(instance, [method].concat(params));
|
|
}
|
|
|
|
// Init
|
|
return $.data(this, plugin.name, new Plugin(this, opts));
|
|
});
|
|
|
|
return prefix ? ret : this;
|
|
};
|
|
};
|
|
|
|
}());
|
|
|
|
},{}],13:[function(require,module,exports){
|
|
/**
|
|
* Private methods
|
|
*/
|
|
module.exports = {
|
|
|
|
_init: function() {
|
|
|
|
var self = this;
|
|
|
|
this._extend($.idealforms.extensions);
|
|
|
|
this.$form = $(this.el);
|
|
this.$fields = $();
|
|
this.$inputs = $();
|
|
|
|
this.$form.submit(function(e) {
|
|
e.preventDefault();
|
|
self.focusFirstInvalid();
|
|
self.opts.onSubmit.call(this, self.getInvalid().length, e);
|
|
});
|
|
|
|
this._inject('_init');
|
|
|
|
this.addRules(this.opts.rules || {});
|
|
|
|
if (! this.opts.silentLoad) this.focusFirstInvalid();
|
|
},
|
|
|
|
_buildField: function(input) {
|
|
|
|
var self = this
|
|
, $field = this._getField(input)
|
|
, $icon;
|
|
|
|
$icon = $(this.opts.iconHtml, {
|
|
class: this.opts.iconClass,
|
|
click: function(){ $(input).focus() }
|
|
});
|
|
|
|
if (! this.$fields.filter($field).length) {
|
|
this.$fields = this.$fields.add($field);
|
|
if (this.opts.iconHtml) $field.append($icon);
|
|
$field.addClass('idealforms-field idealforms-field-'+ input.type);
|
|
}
|
|
|
|
this._addEvents(input);
|
|
|
|
this._inject('_buildField', input);
|
|
},
|
|
|
|
_addEvents: function(input) {
|
|
|
|
var self = this
|
|
, $field = this._getField(input);
|
|
|
|
$(input)
|
|
.on('change keyup', function(e) {
|
|
|
|
var oldValue = $field.data('idealforms-value');
|
|
|
|
if (e.which == 9 || e.which == 16) return;
|
|
if (! $(this).is(':checkbox, :radio') && oldValue == this.value) return;
|
|
|
|
$field.data('idealforms-value', this.value);
|
|
|
|
self._validate(this, true, true);
|
|
})
|
|
.focus(function() {
|
|
|
|
if (self.isValid(this.name)) return false;
|
|
|
|
if (self._isRequired(this) || this.value) {
|
|
$field.find(self.opts.error).show();
|
|
}
|
|
})
|
|
.blur(function() {
|
|
$field.find(self.opts.error).hide();
|
|
});
|
|
},
|
|
|
|
_isRequired: function(input) {
|
|
// We assume non-text inputs with rules are required
|
|
if ($(input).is(':checkbox, :radio, select')) return true;
|
|
return this.opts.rules[input.name].indexOf('required') > -1;
|
|
},
|
|
|
|
_getRelated: function(input) {
|
|
return this._getField(input).find('[name="'+ input.name +'"]');
|
|
},
|
|
|
|
_getField: function(input) {
|
|
return $(input).closest(this.opts.field);
|
|
},
|
|
|
|
_getFirstInvalid: function() {
|
|
return this.getInvalid().first().find('input:first, textarea, select');
|
|
},
|
|
|
|
_handleError: function(input, error, valid) {
|
|
valid = valid || this.isValid(input.name);
|
|
var $error = this._getField(input).find(this.opts.error);
|
|
this.$form.find(this.opts.error).hide();
|
|
if (error) $error.text(error);
|
|
$error.toggle(!valid);
|
|
},
|
|
|
|
_handleStyle: function(input, valid) {
|
|
valid = valid || this.isValid(input.name);
|
|
this._getField(input)
|
|
.removeClass(this.opts.validClass +' '+ this.opts.invalidClass)
|
|
.addClass(valid ? this.opts.validClass : this.opts.invalidClass)
|
|
.find('.'+ this.opts.iconClass).show();
|
|
},
|
|
|
|
_fresh: function(input) {
|
|
this._getField(input)
|
|
.removeClass(this.opts.validClass +' '+ this.opts.invalidClass)
|
|
.find(this.opts.error).hide()
|
|
.end()
|
|
.find('.'+ this.opts.iconClass).toggle(this._isRequired(input));
|
|
},
|
|
|
|
_validate: function(input, handleError, handleStyle) {
|
|
|
|
var self = this
|
|
, $field = this._getField(input)
|
|
, userRules = this.opts.rules[input.name].split($.idealforms.ruleSeparator)
|
|
, valid = true
|
|
, rule;
|
|
|
|
// Non-required input with empty value must pass validation
|
|
if (! input.value && ! this._isRequired(input)) {
|
|
$field.removeData('idealforms-valid');
|
|
this._fresh(input);
|
|
|
|
// Required inputs
|
|
} else {
|
|
|
|
$.each(userRules, function(i, userRule) {
|
|
|
|
userRule = userRule.split($.idealforms.argSeparator);
|
|
|
|
rule = userRule[0];
|
|
|
|
var theRule = $.idealforms.rules[rule]
|
|
, args = userRule.slice(1)
|
|
, error;
|
|
|
|
error = $.idealforms._format.apply(null, [
|
|
$.idealforms._getKey('errors.'+ input.name +'.'+ rule, self.opts) ||
|
|
$.idealforms.errors[rule]
|
|
].concat(args));
|
|
|
|
valid = typeof theRule == 'function'
|
|
? theRule.apply(self, [input, input.value].concat(args))
|
|
: theRule.test(input.value);
|
|
|
|
$field.data('idealforms-valid', valid);
|
|
|
|
if (handleError) self._handleError(input, error, valid);
|
|
if (handleStyle) self._handleStyle(input, valid);
|
|
|
|
self.opts.onValidate.call(self, input, rule, valid);
|
|
|
|
return valid;
|
|
});
|
|
}
|
|
|
|
this._inject('_validate', input, rule, valid);
|
|
|
|
return valid;
|
|
}
|
|
|
|
};
|
|
|
|
},{}],14:[function(require,module,exports){
|
|
/**
|
|
* Public methods
|
|
*/
|
|
module.exports = {
|
|
|
|
addRules: function(rules) {
|
|
|
|
var self = this;
|
|
|
|
var $inputs = this.$form.find($.map(rules, function(_, name) {
|
|
return '[name="'+ name +'"]';
|
|
}).join(','));
|
|
|
|
$.extend(this.opts.rules, rules);
|
|
|
|
$inputs.each(function(){ self._buildField(this) });
|
|
|
|
this.$inputs = this.$inputs
|
|
.add($inputs)
|
|
.each(function(){ self._validate(this, true) });
|
|
|
|
this.$fields.find(this.opts.error).hide();
|
|
|
|
this._inject('addRules');
|
|
},
|
|
|
|
getInvalid: function() {
|
|
return this.$fields.filter(function() {
|
|
return $(this).data('idealforms-valid') === false;
|
|
});
|
|
},
|
|
|
|
focusFirstInvalid: function() {
|
|
|
|
var firstInvalid = this._getFirstInvalid()[0];
|
|
|
|
if (firstInvalid) {
|
|
this._handleError(firstInvalid);
|
|
this._handleStyle(firstInvalid);
|
|
this._inject('focusFirstInvalid', firstInvalid);
|
|
firstInvalid.focus();
|
|
}
|
|
},
|
|
|
|
isValid: function(name) {
|
|
if (name) return ! this.getInvalid().find('[name="'+ name +'"]').length;
|
|
return ! this.getInvalid().length;
|
|
},
|
|
|
|
reset: function(name) {
|
|
|
|
var self = this
|
|
, $inputs = this.$inputs;
|
|
|
|
if (name) $inputs = $inputs.filter('[name="'+ name +'"]');
|
|
|
|
$inputs.filter('input:not(:checkbox, :radio)').val('');
|
|
$inputs.filter(':checkbox, :radio').prop('checked', false);
|
|
$inputs.filter('select').find('option').prop('selected', function() {
|
|
return this.defaultSelected;
|
|
});
|
|
|
|
$inputs.change().each(function(){ self._resetErrorAndStyle(this) });
|
|
|
|
this._inject('reset', name);
|
|
}
|
|
|
|
};
|
|
|
|
},{}],15:[function(require,module,exports){
|
|
/**
|
|
* Rules
|
|
*/
|
|
module.exports = {
|
|
|
|
required: /.+/,
|
|
digits: /^\d+$/,
|
|
email: /^[^@]+@[^@]+\..{2,6}$/,
|
|
username: /^[a-z](?=[\w.]{3,31}$)\w*\.?\w*$/i,
|
|
pass: /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,
|
|
strongpass: /(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
|
|
phone: /^[2-9]\d{2}-\d{3}-\d{4}$/,
|
|
zip: /^\d{5}$|^\d{5}-\d{4}$/,
|
|
url: /^(?:(ftp|http|https):\/\/)?(?:[\w\-]+\.)+[a-z]{2,6}([\:\/?#].*)?$/i,
|
|
|
|
number: function(input, value) {
|
|
return !isNaN(value);
|
|
},
|
|
|
|
range: function(input, value, mix, max) {
|
|
return Number(value) >= min && Number(value) <= max;
|
|
},
|
|
|
|
min: function(input, value, min) {
|
|
return value.length >= min;
|
|
},
|
|
|
|
max: function(input, value, max) {
|
|
return value.length <= max;
|
|
},
|
|
|
|
minoption: function(input, value, min) {
|
|
return this._getRelated(input).filter(':checked').length >= min;
|
|
},
|
|
|
|
maxoption: function(input, value, max) {
|
|
return this._getRelated(input).filter(':checked').length <= max;
|
|
},
|
|
|
|
minmax: function(input, value, min, max) {
|
|
return value.length >= min && value.length <= max;
|
|
},
|
|
|
|
select: function(input, value, def) {
|
|
return value != def;
|
|
},
|
|
|
|
extension: function(input) {
|
|
|
|
var extensions = [].slice.call(arguments, 1)
|
|
, valid = false;
|
|
|
|
$.each(input.files || [{name: input.value}], function(i, file) {
|
|
valid = $.inArray(file.name.match(/\.(.+)$/)[1], extensions) > -1;
|
|
});
|
|
|
|
return valid;
|
|
},
|
|
|
|
equalto: function(input, value, target) {
|
|
|
|
var self = this
|
|
, $target = $('[name="'+ target +'"]');
|
|
|
|
if (this.getInvalid().find($target).length) return false;
|
|
|
|
$target.off('keyup.equalto').on('keyup.equalto', function() {
|
|
self._validate(input, false, true);
|
|
});
|
|
|
|
return input.value == $target.val();
|
|
},
|
|
|
|
date: function(input, value, format) {
|
|
|
|
format = format || 'mm/dd/yyyy';
|
|
|
|
var delimiter = /[^mdy]/.exec(format)[0]
|
|
, theFormat = format.split(delimiter)
|
|
, theDate = value.split(delimiter);
|
|
|
|
function isDate(date, format) {
|
|
|
|
var m, d, y;
|
|
|
|
for (var i = 0, len = format.length; i < len; i++) {
|
|
if (/m/.test(format[i])) m = date[i];
|
|
if (/d/.test(format[i])) d = date[i];
|
|
if (/y/.test(format[i])) y = date[i];
|
|
}
|
|
|
|
if (!m || !d || !y) return false;
|
|
|
|
return m > 0 && m < 13 &&
|
|
y && y.length == 4 &&
|
|
d > 0 && d <= (new Date(y, m, 0)).getDate();
|
|
}
|
|
|
|
return isDate(theDate, theFormat);
|
|
}
|
|
|
|
};
|
|
|
|
},{}]},{},[11])
|
|
//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvdmFyL3d3dy9qcS1pZGVhbGZvcm1zL2pzL2Vycm9ycy5qcyIsIi92YXIvd3d3L2pxLWlkZWFsZm9ybXMvanMvZXh0ZW5zaW9ucy9hZGFwdGl2ZS9hZGFwdGl2ZS5leHQuanMiLCIvdmFyL3d3d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gICAgICAgICAgICAgICAkdGhpcy5kYXRlcGlja2VyKCd3aWRnZXQnKS5jc3MoJ3dpZHRoJywgd2lkdGgpO1xuICAgICAgICAgICAgICB9LCAxKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBvbkNsb3NlOiBmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgJCh0aGlzKS5yZW1vdmVDbGFzcygnb3BlbicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcblxuICAgICAgICAvLyBBZGp1c3Qgd2lkdGhcbiAgICAgICAgJGRhdGVwaWNrZXIub24oJ2ZvY3VzIGtleXVwJywgZnVuY3Rpb24oKSB7XG4gICAgICAgICAgdmFyIHQgPSAkKHRoaXMpLCB3ID0gdC5vdXRlcldpZHRoKCk7XG4gICAgICAgICAgdC5kYXRlcGlja2VyKCd3aWRnZXQnKS5jc3MoJ3dpZHRoJywgdyk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH1cblxuICB9XG59O1xuIiwiZnVuY3Rpb24gdGVtcGxhdGUoaHRtbCwgZGF0YSkge1xuXG4gIHZhciBsb29wID0gL1xce0AoW159XSspXFx9KC4rPylcXHtcXC9cXDFcXH0vZ1xuICAgICwgbG9vcFZhcmlhYmxlID0gL1xceyMoW159XSspXFx9L2dcbiAgICAsIHZhcmlhYmxlID0gL1xceyhbXn1dKylcXH0vZztcblxuICByZXR1cm4gaHRtbFxuICAgIC5yZXBsYWNlKGxvb3AsIGZ1bmN0aW9uKF8sIGtleSwgbGlzdCkge1xuICAgICAgcmV0dXJuICQubWFwKGRhdGFba2V5XSwgZnVuY3Rpb24oaXRlbSkge1xuICAgICAgICByZXR1cm4gbGlzdC5yZXBsYWNlKGxvb3BWYXJpYWJsZSwgZnVuY3Rpb24oXywgaykge1xuICAgICAgICAgIHJldHVybiBpdGVtW2tdO1xuICAgICAgICB9KTtcbiAgICAgIH0pLmpvaW4oJycpO1xuICAgIH0pXG4gICAgLnJ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