From be9f66a80077936ef9cd696fd33e9262b5e62f9b Mon Sep 17 00:00:00 2001 From: elclanrs Date: Sat, 25 Jan 2014 16:15:04 -0500 Subject: [PATCH] fix #30 --- index.php | 2 +- js/extensions/adaptive/adaptive.ext.js | 10 +++++----- js/out/jquery.idealforms.js | 15 +++++++-------- js/out/jquery.idealforms.min.js | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index 0c1ad6b..076cdcc 100644 --- a/index.php +++ b/index.php @@ -195,7 +195,7 @@ - + diff --git a/js/extensions/adaptive/adaptive.ext.js b/js/extensions/adaptive/adaptive.ext.js index 1b0d654..a9298ab 100644 --- a/js/extensions/adaptive/adaptive.ext.js +++ b/js/extensions/adaptive/adaptive.ext.js @@ -5,10 +5,6 @@ module.exports = { name: 'adaptive', - options: { - adaptiveWidth: $('

').appendTo('body').css('width').replace('px','') - }, - methods: { // @extend @@ -16,6 +12,10 @@ module.exports = { var self = this; + var $dummy = $('

').appendTo('body'); + + this.opts.adaptiveWidth = $dummy.css('width').replace('px','') + function adapt() { var formWidth = self.$form.outerWidth() @@ -37,7 +37,7 @@ module.exports = { self._getField(this).find(self.opts.error).addClass('hidden'); }); - $('p.idealforms-field-width').remove(); + $dummy.remove(); } } diff --git a/js/out/jquery.idealforms.js b/js/out/jquery.idealforms.js index 4300bdf..0a2d78c 100644 --- a/js/out/jquery.idealforms.js +++ b/js/out/jquery.idealforms.js @@ -1,4 +1,4 @@ -;(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').appendTo('body').css('width').replace('px','') - }, - methods: { // @extend @@ -47,6 +43,10 @@ module.exports = { var self = this; + var $dummy = $('

').appendTo('body'); + + this.opts.adaptiveWidth = $dummy.css('width').replace('px','') + function adapt() { var formWidth = self.$form.outerWidth() @@ -68,7 +68,7 @@ module.exports = { self._getField(this).find(self.opts.error).addClass('hidden'); }); - $('p.idealforms-field-width').remove(); + $dummy.remove(); } } @@ -1365,5 +1365,4 @@ module.exports = { }; },{}]},{},[11]) -//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlcyI6WyIvdmFyL3d3dy9qcS1pZGVhbGZvcm1zL2pzL2Vycm9ycy5qcyIsIi92YXIvd3d3L2pxLWlkZWFsZm9ybXMvanMvZXh0ZW5zaW9ucy9hZGFwdGl2ZS9hZGFwdGl2ZS5leHQuanMiLCIvdmFyL3d3dy9qcS1pZGVhbGZvcm1zL2pzL2V4dGVuc2lvbnMvYWpheC9hamF4LmV4dC5qcyIsIi92YXIvd3d3L2pxLWlkZWFsZm9ybXMvanMvZXh0ZW5zaW9ucy9jdXN0b20taW5wdXRzL2N1c3RvbS1pbnB1dHMuZXh0LmpzIiwiL3Zhci93d3cvanEtaWRlYWxmb3Jtcy9qcy9leHRlbnNpb25zL2N1c3RvbS1pbnB1dHMvaWRlYWxmaWxlLmpzIiwiL3Zhci93d3cvanEtaWRlYWxmb3Jtcy9qcy9leHRlbnNpb25zL2N1c3RvbS1pbnB1dHMvaWRlYWxyYWRpb2NoZWNrLmpzIiwiL3Zhci93d3cvanEtaWRlYWxmb3Jtcy9qcy9leHRlbnNpb25zL2RhdGVwaWNrZXIvZGF0ZXBpY2tlci5leHQuanMiLCIvdmFyL3d3dy9qcS1pZGVhbGZvcm1zL2pzL2V4dGVuc2lvbnMvZHluYW1pYy1maWVsZHMvZHluYW1pYy1maWVsZHMuZXh0LmpzIiwiL3Zhci93d3cvanEtaWRlYWxmb3Jtcy9qcy9leHRlbnNpb25zL3N0ZXBzL2lkZWFsc3RlcHMuanMiLCIvdmFyL3d3dy9qcS1pZGVhbGZvcm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wgbGVuOyBpKyspIHtcbiAgICAgICAgICAgIGZpbGVzLnB1c2goZmlsZUFycltpXS5uYW1lKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZmlsZW5hbWUgPSBmaWxlcy5qb2luKCcsICcpO1xuXG4gICAgICAgICAgLy8gSWYgbm90IHN1cHBvcnRlZCB0aGVuIGp1c3QgdGFrZSB0aGUgdmFsdWVcbiAgICAgICAgICAvLyBhbmQgcmVtb3ZlIHRoZSBwYXRoIHRvIGp1c3Qgc2hvdyB0aGUgZmlsZW5hbWVcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBmaWxlbmFtZSA9ICRmaWxlLnZhbCgpLnNwbGl0KCdcXFxcJykucG9wKCk7XG4gICAgICAgIH1cblxuICAgICAgICAkaW5wdXQgLnZhbChmaWxlbmFtZSkuYXR0cigndGl0bGUnLCBmaWxlbmFtZSk7XG5cbiAgICAgIH0pO1xuXG4gICAgICAkaW5wdXQub24oe1xuICAgICAgICBibHVyOiBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgJGZpbGUudHJpZ2dlcignYmx1cicpO1xuICAgICAgICB9LFxuICAgICAgICBrZXlkb3duOiBmdW5jdGlvbiAoZSkge1xuICAgICAgICAgIGlmIChlLndoaWNoID09PSAxMykgeyAvLyBFbnRlclxuICAgICAgICAgICAgaWYgKCFpc0lFKSAkZmlsZS50cmlnZ2VyKCdjbGljaycpO1xuICAgICAgICAgICAgJCh0aGlzKS5jbG9zZXN0KCdmb3JtJykub25lKCdrZXlkb3duJywgZnVuY3Rpb24oZSkge1xuICAgICAgICAgICAgICBpZiAoZS53aGljaCA9PT0gMTMpIGUucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH0gZWxzZSBpZiAoZS53aGljaCA9PT0gOCB8fCBlLndoaWNoID09PSA0NikgeyAvLyBCYWNrc3BhY2UgJiBEZWxcbiAgICAgICAgICAgIC8vIEluIElFIHRoZSB2YWx1ZSBpcyByZW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7XG4gICAgICAgICAgICBmaWxlcy5wdXNoKGZpbGVBcnJbaV0ubmFtZSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGZpbGVuYW1lID0gZmlsZXMuam9pbignLCAnKTtcblxuICAgICAgICAgIC8vIElmIG5vdCBzdXBwb3J0ZWQgdGhlbiBqdXN0IHRha2UgdGhlIHZhbHVlXG4gICAgICAgICAgLy8gYW5kIHJlbW92ZSB0aGUgcGF0aCB0byBqdXN0IHNob3cgdGhlIGZpbGVuYW1lXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgZmlsZW5hbWUgPSAkZmlsZS52YWwoKS5zcGxpdCgnXFxcXCcpLnBvcCgpO1xuICAgICAgICB9XG5cbiAgICAgICAgJGlucHV0IC52YWwoZmlsZW5hbWUpLmF0dHIoJ3RpdGxlJywgZmlsZW5hbWUpO1xuXG4gICAgICB9KTtcblxuICAgICAgJGlucHV0Lm9uKHtcbiAgICAgICAgYmx1cjogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICRmaWxlLnRyaWdnZXIoJ2JsdXInKTtcbiAgICAgICAgfSxcbiAgICAgICAga2V5ZG93bjogZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICBpZiAoZS53aGljaCA9PT0gMTMpIHsgLy8gRW50ZXJcbiAgICAgICAgICAgIGlmICghaXNJRSkgJGZpbGUudHJpZ2dlcignY2xpY2snKTtcbiAgICAgICAgICAgICQodGhpcykuY2xvc2VzdCgnZm9ybScpLm9uZSgna2V5ZG93bicsIGZ1bmN0aW9uKGUpIHtcbiAgICAgICAgICAgICAgaWYgKGUud2hpY2ggPT09IDEzKSBlLnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9IGVsc2UgaWYgKGUud2hpY2ggPT09IDggfHwgZS53aGljaCA9PT0gNDYpIHsgLy8gQmFja3NwYWNlICYgRGVsXG4gICAgICAgICAgICAvLyBJbiBJRSB0aGUgdmFsdWUgaXMgcmVhZC1vbm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PiAtMSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChQbHVnaW4ucHJvdG90eXBlW21ldGhvZC5zcGxpdCgnOicpWzBdXSkge1xuICAgICAgICAgICAgUGx1Z2luLl9leHRlbmRlZFttZXRob2RdID0gUGx1Z2luLl9leHRlbmRlZFttZXRob2RdIHx8IFtdO1xuICAgICAgICAgICAgUGx1Z2luLl9leHRlbmRlZFttZXRob2RdLnB1c2goeyBuYW1lOiBleHRlbnNpb24ubmFtZSwgZm46IGZuIH0pO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBQbHVnaW4ucHJvdG90eXBlW21ldGhvZF0gPSBmbjtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuXG4gICAgICB9KTtcbiAgICB9O1xuXG4gICAgUGx1Z2luLnByb3RvdHlwZS5faW5qZWN0ID0gZnVuY3Rpb24obWV0aG9kKSB7XG5cbiAgICAgIHZhciBhcmdzID0gW10uc2xpY2UuY2FsbChhcmd1bWVudHMsIDEpO1xuXG4gICAgICBpZiAodHlwZW9mIG1ldGhvZCA9PSAnZnVuY3Rpb24nKSByZXR1cm4gbWV0aG9kLmNhbGwodGhpcyk7XG5cbiAgICAgIHZhciBzZWxmID0gdGhpcztcblxuICAgICAgaWYgKFBsdWdpbi5fZXh0ZW5kZWRbbWV0aG9kXSkge1xuICAgICAgICAkLmVhY2goUGx1Z2luLl9leHRlbmRlZFttZXRob2RdLCBmdW5jdGlvbihpLCBwbHVnaW4pIHtcbiAgICAgICAgICBwbHVnaW4uZm4uYXBwbHkoc2VsZiwgYXJncyk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuICAgIH07XG5cbiAgICBQbHVnaW4ucHJvdG90eXBlLl9pbml0ID0gJC5ub29wO1xuXG4gICAgUGx1Z2luLnByb3RvdHlwZVtwbHVnaW4ubmFtZV0gPSBmdW5jdGlvbihtZXRob2QpIHtcbiAgICAgIGlmICghbWV0aG9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ID0gZm9ybWF0Lmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XG4gICAgICAgIGlmICgvbS8udGVzdChmb3JtYXRbaV0pKSBtID0gZGF0ZVtpXTtcbiAgICAgICAgaWYgKC9kLy50ZXN0KGZvcm1hdFtpXSkpIGQgPSBkYXRlW2ldO1xuICAgICAgICBpZiAoL3kvLnRlc3QoZm9ybWF0W2ldKSkgeSA9IGRhdGVbaV07XG4gICAgICB9XG5cbiAgICAgIGlmICghbSB8fCAhZCB8fCAheSkgcmV0dXJuIGZhbHNlO1xuXG4gICAgICByZXR1cm4gbSA+IDAgJiYgbSA8IDEzICYmXG4gICAgICAgIHkgJiYgeS5sZW5ndGggPT0gNCAmJlxuICAgICAgICBkID4gMCAmJiBkIDw9IChuZXcgRGF0ZSh5LCBtLCAwKSkuZ2V0RGF0ZSgpO1xuICAgIH1cblxuICAgIHJldHVybiBpc0RhdGUodGhlRGF0ZSwgdGhlRm9ybWF0KTtcbiAgfVxuXG59O1xuIl19 diff --git a/js/out/jquery.idealforms.min.js b/js/out/jquery.idealforms.min.js index baa7649..92cfd67 100644 --- a/js/out/jquery.idealforms.min.js +++ b/js/out/jquery.idealforms.min.js @@ -1,4 +1,4 @@ -!function e(t,i,s){function n(o,r){if(!i[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);throw new Error("Cannot find module '"+o+"'")}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){var i=t[o][1][e];return n(i?i:e)},d,d.exports,e,t,i,s)}return i[o].exports}for(var a="function"==typeof require&&require,o=0;o').appendTo("body").css("width").replace("px","")},methods:{_init:function(){function e(){var e=t.$form.outerWidth(),i=t.opts.adaptiveWidth>e;t.$form.toggleClass("adaptive",i),t._hasExtension("steps")&&t.$stepsContainer.toggleClass("adaptive",i),$("#ui-datepicker-div").hide()}var t=this;$(window).resize(e),e(),this.$form.find("select, .datepicker").each(function(){t._getField(this).find(t.opts.error).addClass("hidden")}),$("p.idealforms-field-width").remove()}}}},{}],3:[function(e,t){t.exports={name:"ajax",methods:{_init:function(){$.extend($.idealforms,{_requests:{}}),$.idealforms.errors.ajax=$.idealforms.errors.ajax||"Loading...",$.extend($.idealforms.rules,{ajax:function(e){var t=this,i=this._getField(e),s=$(e).data("idealforms-ajax"),n=$.idealforms._getKey("errors."+e.name+".ajaxError",t.opts),a=$.idealforms._requests,o={};return o[e.name]=e.value,i.addClass("ajax"),a[e.name]&&a[e.name].abort(),a[e.name]=$.post(s,o,function(s){s===!0?(i.data("idealforms-valid",!0),t._handleError(e),t._handleStyle(e)):t._handleError(e,n),t.opts.onValidate.call(t,e,"ajax",s),i.removeClass("ajax")},"json"),!1}})},_validate:function(e,t){"ajax"!=t&&$.idealforms._requests[e.name]&&($.idealforms._requests[e.name].abort(),this._getField(e).removeClass("ajax"))}}}},{}],4:[function(e,t){e("./idealfile"),e("./idealradiocheck"),t.exports={name:"customInputs",options:{customInputs:{i18n:{open:"Open"}}},methods:{_init:function(){this._buildCustomInputs()},"addFields:after":function(){this._buildCustomInputs()},_buildCustomInputs:function(){this.$form.find(":file").idealfile(this.opts.customInputs.i18n),this.$form.find(":checkbox, :radio").idealradiocheck()}}}},{"./idealfile":5,"./idealradiocheck":6}],5:[function(e){!function(t){var i="undefined"!=typeof t("")[0].multiple,s=/msie/i.test(navigator.userAgent),n={};n.name="idealfile",n.defaults={open:"Open"},n.methods={_init:function(){var e=t(this.el).addClass("ideal-file"),n=t('

'),a=t(''),o=t('"),r=t('");s&&r.add(o).addClass("ie"),e.css({position:"absolute",left:"-9999px"}),n.append(a,s?r:o).insertAfter(e),e.attr("tabIndex",-1),o.attr("tabIndex",-1),o.click(function(){e.focus().click()}),e.change(function(){var t,s,n=[];if(i){t=e[0].files;for(var o=0,r=t.length;r>o;o++)n.push(t[o].name);s=n.join(", ")}else s=e.val().split("\\").pop();a.val(s).attr("title",s)}),a.on({blur:function(){e.trigger("blur")},keydown:function(i){if(13===i.which)s||e.trigger("click"),t(this).closest("form").one("keydown",function(e){13===e.which&&e.preventDefault()});else{if(8!==i.which&&46!==i.which)return 9===i.which?void 0:!1;s&&e.replaceWith(e=e.clone(!0)),e.val("").trigger("change"),a.val("")}}})}},e("../../plugin")(n)}(jQuery,window,document)},{"../../plugin":12}],6:[function(e){!function(t){var i={};i.name="idealradiocheck",i.methods={_init:function(){var e=t(this.el),i=t("");i.addClass("ideal-"+(e.is(":checkbox")?"check":"radio")),e.is(":checked")&&i.addClass("checked"),i.insertAfter(e),e.parent("label").addClass("ideal-radiocheck-label").attr("onclick",""),e.css({position:"absolute",left:"-9999px"}),e.on({change:function(){var e=t(this);e.is('input[type="radio"]')&&e.parent().siblings("label").find(".ideal-radio").removeClass("checked"),i.toggleClass("checked",e.is(":checked"))},focus:function(){i.addClass("focus")},blur:function(){i.removeClass("focus")},click:function(){t(this).trigger("focus")}})}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],7:[function(e,t){t.exports={name:"datepicker",methods:{_init:function(){this._buildDatepicker()},_buildDatepicker:function(){var e=this.$form.find("input.datepicker");jQuery.ui&&($.datepicker._checkOffset=function(e,t){return t}),jQuery.ui&&e.length&&(e.each(function(){$(this).datepicker({beforeShow:function(e){$(e).addClass("open")},onChangeMonthYear:function(){var e=$(this),t=e.outerWidth();setTimeout(function(){e.datepicker("widget").css("width",t)},1)},onClose:function(){$(this).removeClass("open")}})}),e.on("focus keyup",function(){var e=$(this),t=e.outerWidth();e.datepicker("widget").css("width",t)}))}}}},{}],8:[function(e,t){function i(e,t){var i=/\{@([^}]+)\}(.+?)\{\/\1\}/g,s=/\{#([^}]+)\}/g,n=/\{([^}]+)\}/g;return e.replace(i,function(e,i,n){return $.map(t[i],function(e){return n.replace(s,function(t,i){return e[i]})}).join("")}).replace(n,function(e,i){return t[i]||""})}t.exports={name:"dynamicFields",options:{templates:{base:'
{field}
',text:'',file:'',textarea:'',group:'

{@list} {/list}

',select:' '}},methods:{addFields:function(e){var t=this;$.each(e,function(e,s){var n=s.type.split(":"),a={},o=t.$form.find(t.opts.field).last();s.name=e,s.type=n[0],n[1]&&(s.subtype=n[1]),s.html=i(t.opts.templates.base,{label:s.label,field:i(t.opts.templates[s.type],s)}),t._inject("addFields:before",s),s.after||s.before?t.$form.find('[name="'+(s.after||s.before)+'"]').first().each(function(){t._getField(this)[s.after?"after":"before"](s.html)}):o.length?o.after(s.html):t.$form.append(s.html),s.rules&&(a[e]=s.rules,t.addRules(a)),t._inject("addFields:after",s)})},removeFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));t.$fields=t.$fields.filter(function(){return!$(this).is(s)}),s.remove()}),this._inject("removeFields")},toggleFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));s.data("idealforms-valid",s.is(":visible")).toggle()}),this._inject("toggleFields")}}}},{}],9:[function(e){!function(t){var i={};i.name="idealsteps",i.defaults={nav:".idealsteps-nav",navItems:"li",buildNavItems:!0,wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:t.noop,after:t.noop,fadeSpeed:0},i.methods={_init:function(){var e=this,i=this.opts.activeClass;this.$el=t(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),this.opts.buildNavItems&&this._buildNavItems(),this.$steps.hide().first().show(),this.$navItems.removeClass(i).first().addClass(i),this.$navItems.click(function(i){i.preventDefault(),t(this).is("."+e.opts.activeClass)||e.go(e.$navItems.index(this))})},_buildNavItems:function(){var e,i=this,s="function"==typeof this.opts.buildNavItems,n=function(e){return'
  • '+e+"
  • "};e=s?this.$steps.map(function(e){return n(i.opts.buildNavItems.call(i,e))}).get():this.$steps.map(function(e){return n(++e)}).get(),this.$navItems=t(e.join("")),this.$nav.append(t("
      ").append(this.$navItems))},_getCurIdx:function(){return this.$steps.index(this.$steps.filter(":visible"))},go:function(e){var t=this.opts.activeClass,i=this.opts.fadeSpeed;"function"==typeof e&&(e=e.call(this,this._getCurIdx())),e>=this.$steps.length&&(e=0),0>e&&(e=this.$steps.length-1),this.opts.before.call(this,e),this.$navItems.removeClass(t).eq(e).addClass(t),this.$steps.hide().eq(e).fadeIn(i),this.opts.after.call(this,e)},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)}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],10:[function(e,t){e("./idealsteps"),t.exports={name:"steps",options:{steps:{container:".idealsteps-container",nav:".idealsteps-nav",navItems:"li",buildNavItems:function(e){return this.opts.steps.i18n.step+" "+(e+1)},wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:$.noop,after:$.noop,fadeSpeed:0,i18n:{step:"Step"}}},methods:{_init:function(){this._buildSteps()},_validate:function(){var e=this;this._updateSteps(),this._hasExtension("ajax")&&$.each($.idealforms._requests,function(t,i){i.done(function(){e._updateSteps()})})},focusFirstInvalid:function(e){this.$stepsContainer.idealsteps("go",function(){return this.$steps.filter(function(){return $(this).find(e).length}).index()}),setTimeout(function(){$(e).focus()},this.opts.steps.fadeSpeed)},addRules:function(){this.firstStep()},"addFields:before":function(e){if(!e.after&&!e.before){var t=this.$stepsContainer.find(this.opts.steps.step);"appendToStep"in e||(e.appendToStep=t.length-1),e.after=t.eq(e.appendToStep).find("input, select, textarea").last()[0].name}},toggleFields:function(){this._updateSteps()},removeFields:function(){this._updateSteps()},_buildSteps:function(){var e=this,t=!$.isEmptyObject(this.opts.rules),i=this.opts.steps.buildNavItems,s=t?'':'0';this.opts.steps.buildNavItems&&(this.opts.steps.buildNavItems=function(t){return i.call(e,t)+s}),this.$stepsContainer=this.$form.closest(this.opts.steps.container).idealsteps(this.opts.steps)},_updateSteps:function(){var e=this;this.$stepsContainer.idealsteps("_inject",function(){var t=this;this.$navItems.each(function(i){var s=t.$steps.eq(i).find(e.getInvalid()).length;$(this).find("span").text(s).toggleClass("zero",!s)})})},goToStep:function(e){this.$stepsContainer.idealsteps("go",e)},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(e){/*! +!function e(t,i,s){function n(o,r){if(!i[o]){if(!t[o]){var l="function"==typeof require&&require;if(!r&&l)return l(o,!0);if(a)return a(o,!0);throw new Error("Cannot find module '"+o+"'")}var d=i[o]={exports:{}};t[o][0].call(d.exports,function(e){var i=t[o][1][e];return n(i?i:e)},d,d.exports,e,t,i,s)}return i[o].exports}for(var a="function"==typeof require&&require,o=0;oe;t.$form.toggleClass("adaptive",i),t._hasExtension("steps")&&t.$stepsContainer.toggleClass("adaptive",i),$("#ui-datepicker-div").hide()}var t=this,i=$('

      ').appendTo("body");this.opts.adaptiveWidth=i.css("width").replace("px",""),$(window).resize(e),e(),this.$form.find("select, .datepicker").each(function(){t._getField(this).find(t.opts.error).addClass("hidden")}),i.remove()}}}},{}],3:[function(e,t){t.exports={name:"ajax",methods:{_init:function(){$.extend($.idealforms,{_requests:{}}),$.idealforms.errors.ajax=$.idealforms.errors.ajax||"Loading...",$.extend($.idealforms.rules,{ajax:function(e){var t=this,i=this._getField(e),s=$(e).data("idealforms-ajax"),n=$.idealforms._getKey("errors."+e.name+".ajaxError",t.opts),a=$.idealforms._requests,o={};return o[e.name]=e.value,i.addClass("ajax"),a[e.name]&&a[e.name].abort(),a[e.name]=$.post(s,o,function(s){s===!0?(i.data("idealforms-valid",!0),t._handleError(e),t._handleStyle(e)):t._handleError(e,n),t.opts.onValidate.call(t,e,"ajax",s),i.removeClass("ajax")},"json"),!1}})},_validate:function(e,t){"ajax"!=t&&$.idealforms._requests[e.name]&&($.idealforms._requests[e.name].abort(),this._getField(e).removeClass("ajax"))}}}},{}],4:[function(e,t){e("./idealfile"),e("./idealradiocheck"),t.exports={name:"customInputs",options:{customInputs:{i18n:{open:"Open"}}},methods:{_init:function(){this._buildCustomInputs()},"addFields:after":function(){this._buildCustomInputs()},_buildCustomInputs:function(){this.$form.find(":file").idealfile(this.opts.customInputs.i18n),this.$form.find(":checkbox, :radio").idealradiocheck()}}}},{"./idealfile":5,"./idealradiocheck":6}],5:[function(e){!function(t){var i="undefined"!=typeof t("")[0].multiple,s=/msie/i.test(navigator.userAgent),n={};n.name="idealfile",n.defaults={open:"Open"},n.methods={_init:function(){var e=t(this.el).addClass("ideal-file"),n=t('

      '),a=t(''),o=t('"),r=t('");s&&r.add(o).addClass("ie"),e.css({position:"absolute",left:"-9999px"}),n.append(a,s?r:o).insertAfter(e),e.attr("tabIndex",-1),o.attr("tabIndex",-1),o.click(function(){e.focus().click()}),e.change(function(){var t,s,n=[];if(i){t=e[0].files;for(var o=0,r=t.length;r>o;o++)n.push(t[o].name);s=n.join(", ")}else s=e.val().split("\\").pop();a.val(s).attr("title",s)}),a.on({blur:function(){e.trigger("blur")},keydown:function(i){if(13===i.which)s||e.trigger("click"),t(this).closest("form").one("keydown",function(e){13===e.which&&e.preventDefault()});else{if(8!==i.which&&46!==i.which)return 9===i.which?void 0:!1;s&&e.replaceWith(e=e.clone(!0)),e.val("").trigger("change"),a.val("")}}})}},e("../../plugin")(n)}(jQuery,window,document)},{"../../plugin":12}],6:[function(e){!function(t){var i={};i.name="idealradiocheck",i.methods={_init:function(){var e=t(this.el),i=t("");i.addClass("ideal-"+(e.is(":checkbox")?"check":"radio")),e.is(":checked")&&i.addClass("checked"),i.insertAfter(e),e.parent("label").addClass("ideal-radiocheck-label").attr("onclick",""),e.css({position:"absolute",left:"-9999px"}),e.on({change:function(){var e=t(this);e.is('input[type="radio"]')&&e.parent().siblings("label").find(".ideal-radio").removeClass("checked"),i.toggleClass("checked",e.is(":checked"))},focus:function(){i.addClass("focus")},blur:function(){i.removeClass("focus")},click:function(){t(this).trigger("focus")}})}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],7:[function(e,t){t.exports={name:"datepicker",methods:{_init:function(){this._buildDatepicker()},_buildDatepicker:function(){var e=this.$form.find("input.datepicker");jQuery.ui&&($.datepicker._checkOffset=function(e,t){return t}),jQuery.ui&&e.length&&(e.each(function(){$(this).datepicker({beforeShow:function(e){$(e).addClass("open")},onChangeMonthYear:function(){var e=$(this),t=e.outerWidth();setTimeout(function(){e.datepicker("widget").css("width",t)},1)},onClose:function(){$(this).removeClass("open")}})}),e.on("focus keyup",function(){var e=$(this),t=e.outerWidth();e.datepicker("widget").css("width",t)}))}}}},{}],8:[function(e,t){function i(e,t){var i=/\{@([^}]+)\}(.+?)\{\/\1\}/g,s=/\{#([^}]+)\}/g,n=/\{([^}]+)\}/g;return e.replace(i,function(e,i,n){return $.map(t[i],function(e){return n.replace(s,function(t,i){return e[i]})}).join("")}).replace(n,function(e,i){return t[i]||""})}t.exports={name:"dynamicFields",options:{templates:{base:'
      {field}
      ',text:'',file:'',textarea:'',group:'

      {@list} {/list}

      ',select:' '}},methods:{addFields:function(e){var t=this;$.each(e,function(e,s){var n=s.type.split(":"),a={},o=t.$form.find(t.opts.field).last();s.name=e,s.type=n[0],n[1]&&(s.subtype=n[1]),s.html=i(t.opts.templates.base,{label:s.label,field:i(t.opts.templates[s.type],s)}),t._inject("addFields:before",s),s.after||s.before?t.$form.find('[name="'+(s.after||s.before)+'"]').first().each(function(){t._getField(this)[s.after?"after":"before"](s.html)}):o.length?o.after(s.html):t.$form.append(s.html),s.rules&&(a[e]=s.rules,t.addRules(a)),t._inject("addFields:after",s)})},removeFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));t.$fields=t.$fields.filter(function(){return!$(this).is(s)}),s.remove()}),this._inject("removeFields")},toggleFields:function(e){var t=this;$.each(e.split(" "),function(e,i){var s=t._getField($('[name="'+i+'"]'));s.data("idealforms-valid",s.is(":visible")).toggle()}),this._inject("toggleFields")}}}},{}],9:[function(e){!function(t){var i={};i.name="idealsteps",i.defaults={nav:".idealsteps-nav",navItems:"li",buildNavItems:!0,wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:t.noop,after:t.noop,fadeSpeed:0},i.methods={_init:function(){var e=this,i=this.opts.activeClass;this.$el=t(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),this.opts.buildNavItems&&this._buildNavItems(),this.$steps.hide().first().show(),this.$navItems.removeClass(i).first().addClass(i),this.$navItems.click(function(i){i.preventDefault(),t(this).is("."+e.opts.activeClass)||e.go(e.$navItems.index(this))})},_buildNavItems:function(){var e,i=this,s="function"==typeof this.opts.buildNavItems,n=function(e){return'
    • '+e+"
    • "};e=s?this.$steps.map(function(e){return n(i.opts.buildNavItems.call(i,e))}).get():this.$steps.map(function(e){return n(++e)}).get(),this.$navItems=t(e.join("")),this.$nav.append(t("
        ").append(this.$navItems))},_getCurIdx:function(){return this.$steps.index(this.$steps.filter(":visible"))},go:function(e){var t=this.opts.activeClass,i=this.opts.fadeSpeed;"function"==typeof e&&(e=e.call(this,this._getCurIdx())),e>=this.$steps.length&&(e=0),0>e&&(e=this.$steps.length-1),this.opts.before.call(this,e),this.$navItems.removeClass(t).eq(e).addClass(t),this.$steps.hide().eq(e).fadeIn(i),this.opts.after.call(this,e)},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)}},e("../../plugin")(i)}(jQuery,window,document)},{"../../plugin":12}],10:[function(e,t){e("./idealsteps"),t.exports={name:"steps",options:{steps:{container:".idealsteps-container",nav:".idealsteps-nav",navItems:"li",buildNavItems:function(e){return this.opts.steps.i18n.step+" "+(e+1)},wrap:".idealsteps-wrap",step:".idealsteps-step",activeClass:"idealsteps-step-active",before:$.noop,after:$.noop,fadeSpeed:0,i18n:{step:"Step"}}},methods:{_init:function(){this._buildSteps()},_validate:function(){var e=this;this._updateSteps(),this._hasExtension("ajax")&&$.each($.idealforms._requests,function(t,i){i.done(function(){e._updateSteps()})})},focusFirstInvalid:function(e){this.$stepsContainer.idealsteps("go",function(){return this.$steps.filter(function(){return $(this).find(e).length}).index()}),setTimeout(function(){$(e).focus()},this.opts.steps.fadeSpeed)},addRules:function(){this.firstStep()},"addFields:before":function(e){if(!e.after&&!e.before){var t=this.$stepsContainer.find(this.opts.steps.step);"appendToStep"in e||(e.appendToStep=t.length-1),e.after=t.eq(e.appendToStep).find("input, select, textarea").last()[0].name}},toggleFields:function(){this._updateSteps()},removeFields:function(){this._updateSteps()},_buildSteps:function(){var e=this,t=!$.isEmptyObject(this.opts.rules),i=this.opts.steps.buildNavItems,s=t?'':'0';this.opts.steps.buildNavItems&&(this.opts.steps.buildNavItems=function(t){return i.call(e,t)+s}),this.$stepsContainer=this.$form.closest(this.opts.steps.container).idealsteps(this.opts.steps)},_updateSteps:function(){var e=this;this.$stepsContainer.idealsteps("_inject",function(){var t=this;this.$navItems.each(function(i){var s=t.$steps.eq(i).find(e.getInvalid()).length;$(this).find("span").text(s).toggleClass("zero",!s)})})},goToStep:function(e){this.$stepsContainer.idealsteps("go",e)},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(e){/*! * jQuery Ideal Forms * @author: Cedric Ruiz * @version: 3.0