MailChimp for WordPress - Version 4.1.9

Version Description

Download this release

Release Info

Developer DvanKooten
Plugin Icon 128x128 MailChimp for WordPress
Version 4.1.9
Comparing to
See all releases

Code changes from version 4.1.8 to 4.1.9

CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
4
 
5
  #### 4.1.7 & 4.1.8 - September 8, 2017
6
 
1
  Changelog
2
  =========
3
 
4
+ #### 4.1.9 - September 19, 2017
5
+
6
+ **Improvements**
7
+
8
+ - Add `<label>` element to sign-up checkbox for WCAG compatibility.
9
+ - Custom integration now works with Enfold theme's contact form element.
10
+
11
 
12
  #### 4.1.7 & 4.1.8 - September 8, 2017
13
 
assets/js/forms-api.js CHANGED
@@ -12,7 +12,9 @@ var config = window.mc4wp_forms_config || {};
12
  function scrollToForm(form) {
13
  var animate = config.auto_scroll === 'animated';
14
  var args = {
15
- behavior: animate ? "smooth" : "instant"
 
 
16
  };
17
  form.element.scrollIntoView(args);
18
  }
@@ -36,7 +38,7 @@ function handleFormRequest(form, action, errors, data) {
36
 
37
  // scroll to form again if page height changed since last scroll
38
  // (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)
39
- if (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight != pageHeight) {
40
  scrollToForm(form);
41
  }
42
 
12
  function scrollToForm(form) {
13
  var animate = config.auto_scroll === 'animated';
14
  var args = {
15
+ behavior: animate ? "smooth" : "instant",
16
+ block: "center",
17
+ inline: "center"
18
  };
19
  form.element.scrollIntoView(args);
20
  }
38
 
39
  // scroll to form again if page height changed since last scroll
40
  // (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)
41
+ if (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight !== pageHeight) {
42
  scrollToForm(form);
43
  }
44
 
assets/js/forms-api.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function t(n,r,i){function o(a,c){if(!r[a]){if(!n[a]){var u="function"==typeof e&&e;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};n[a][0].call(l.exports,function(e){var t=n[a][1][e];return o(t||e)},l,l.exports,t,n,r,i)}return r[a].exports}for(var s="function"==typeof e&&e,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){"use strict";function r(e){var t="animated"===u.auto_scroll,n={behavior:t?"smooth":"instant"};e.element.scrollIntoView(n)}function i(e,t,n){return function(){var r=this.value.trim(),i="radio"!==this.getAttribute("type")&&"checked"!==this.getAttribute("type")||this.checked,o=i&&(r===t&&""!==t||""===t&&r.length>0);e.style.display=n?o?"":"none":o?"none":""}}function o(){var e=this,t=e.form.querySelectorAll("[data-show-if], [data-hide-if]"),n=(e.getAttribute("name")||"").toLowerCase();[].forEach.call(t,function(t){var r=!!t.getAttribute("data-show-if"),o=r?t.getAttribute("data-show-if").split(":"):t.getAttribute("data-hide-if").split(":"),s=o[0],a=o[1]||"";if(n===s.toLowerCase()){i(t,a,r).call(e)}})}var s=window.mc4wp||{},a=e("gator"),c=e("./forms/forms.js"),u=window.mc4wp_forms_config||{};if(a(document.body).on("keyup",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",o),a(document.body).on("change",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",o),window.addEventListener("load",function(){[].forEach.call(document.querySelectorAll(".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select"),function(e){o.call(e)})}),a(document.body).on("submit",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);c.trigger("submit",[t,e]),c.trigger(t.id+".submit",[t,e])}),a(document.body).on("focus",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);t.started||(c.trigger("started",[t,e]),c.trigger(t.id+".started",[t,e]),t.started=!0)}),a(document.body).on("change",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);c.trigger("change",[t,e]),c.trigger(t.id+".change",[t,e])}),s.listeners){for(var f=s.listeners,l=0;l<f.length;l++)c.on(f[l].event,f[l].callback);delete s.listeners}if(s.forms=c,u.submitted_form){var h=u.submitted_form,d=document.getElementById(h.element_id),m=c.getByElement(d);!function(e,t,n,i){var o=document.body.clientHeight,s=Date.now();n&&e.setData(i),u.auto_scroll&&r(e),window.addEventListener("load",function(){var a=Date.now()-s;u.auto_scroll&&a<800&&document.body.clientHeight!=o&&r(e),c.trigger("submitted",[e]),c.trigger(e.id+".submitted",[e]),n?(c.trigger("error",[e,n]),c.trigger(e.id+".error",[e,n])):(c.trigger("success",[e,i]),c.trigger(e.id+".success",[e,i]),c.trigger(t+"d",[e,i]),c.trigger(e.id+"."+t+"d",[e,i]))})}(m,h.action,h.errors,h.data)}window.mc4wp=s},{"./forms/forms.js":3,gator:5}],2:[function(e,t,n){"use strict";var r=e("form-serialize"),i=e("populate.js"),o=function(e,t){this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1};o.prototype.setData=function(e){try{i(this.element,e)}catch(e){console.error(e)}},o.prototype.getData=function(){return r(this.element,{hash:!0})},o.prototype.getSerializedData=function(){return r(this.element)},o.prototype.setResponse=function(e){this.element.querySelector(".mc4wp-response").innerHTML=e},o.prototype.reset=function(){this.setResponse(""),this.element.querySelector(".mc4wp-form-fields").style.display="",this.element.reset()},t.exports=o},{"form-serialize":4,"populate.js":6}],3:[function(e,t,n){"use strict";function r(e){for(var t=0;t<f.length;t++)if(f[t].id==e)return f[t];return o(document.querySelector(".mc4wp-form-"+e),e)}function i(e){for(var t=e.form||e,n=0;n<f.length;n++)if(f[n].element==t)return f[n];return o(t)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new c(t,e);return f.push(n),n}function s(){return f}var a=e("wolfy87-eventemitter"),c=e("./form.js"),u=new a,f=[];t.exports={all:s,get:r,getByElement:i,on:u.on.bind(u),trigger:u.trigger.bind(u),off:u.off.bind(u)}},{"./form.js":2,"wolfy87-eventemitter":7}],4:[function(e,t,n){function r(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",r=t.serializer||(t.hash?s:a),i=e&&e.elements?e.elements:[],o=Object.create(null),f=0;f<i.length;++f){var l=i[f];if((t.disabled||!l.disabled)&&l.name&&(u.test(l.nodeName)&&!c.test(l.type))){var h=l.name,d=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(d=void 0),t.empty){if("checkbox"!==l.type||l.checked||(d=""),"radio"===l.type&&(o[l.name]||l.checked?l.checked&&(o[l.name]=!0):o[l.name]=!1),void 0==d&&"radio"==l.type)continue}else if(!d)continue;if("select-multiple"!==l.type)n=r(n,h,d);else{d=[];for(var m=l.options,p=!1,v=0;v<m.length;++v){var g=m[v],y=t.empty&&!g.value,w=g.value||y;g.selected&&w&&(p=!0,n=t.hash&&"[]"!==h.slice(h.length-2)?r(n,h+"[]",g.value):r(n,h,g.value))}!p&&t.empty&&(n=r(n,h,""))}}}if(t.empty)for(var h in o)o[h]||(n=r(n,h,""));return n}function i(e){var t=[],n=/^([^\[\]]*)/,r=new RegExp(f),i=n.exec(e);for(i[1]&&t.push(i[1]);null!==(i=r.exec(e));)t.push(i[1]);return t}function o(e,t,n){if(0===t.length)return e=n;var r=t.shift(),i=r.match(/^\[(.+?)\]$/);if("[]"===r)return e=e||[],Array.isArray(e)?e.push(o(null,t,n)):(e._values=e._values||[],e._values.push(o(null,t,n))),e;if(i){var s=i[1],a=+s;isNaN(a)?(e=e||{},e[s]=o(e[s],t,n)):(e=e||[],e[a]=o(e[a],t,n))}else e[r]=o(e[r],t,n);return e}function s(e,t,n){if(t.match(f))o(e,i(t),n);else{var r=e[t];r?(Array.isArray(r)||(e[t]=[r]),e[t].push(n)):e[t]=n}return e}function a(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}var c=/^(?:submit|button|image|reset|file)$/i,u=/^(?:input|select|textarea|keygen)/i,f=/(\[[^\[\]]*\])/g;t.exports=r},{}],5:[function(e,t,n){!function(){function e(e,t,n){var r="blur"==t||"focus"==t;e.element.addEventListener(t,n,r)}function n(e){e.preventDefault(),e.stopPropagation()}function r(e){return f||(f=e.matches?e.matches:e.webkitMatchesSelector?e.webkitMatchesSelector:e.mozMatchesSelector?e.mozMatchesSelector:e.msMatchesSelector?e.msMatchesSelector:e.oMatchesSelector?e.oMatchesSelector:u.matchesSelector)}function i(e,t,n){if("_root"==t)return n;if(e!==n)return r(e).call(e,t)?e:e.parentNode?(l++,i(e.parentNode,t,n)):void 0}function o(e,t,n,r){d[e.id]||(d[e.id]={}),d[e.id][t]||(d[e.id][t]={}),d[e.id][t][n]||(d[e.id][t][n]=[]),d[e.id][t][n].push(r)}function s(e,t,n,r){if(d[e.id])if(t){if(!r&&!n)return void(d[e.id][t]={});if(!r)return void delete d[e.id][t][n];if(d[e.id][t][n])for(var i=0;i<d[e.id][t][n].length;i++)if(d[e.id][t][n][i]===r){d[e.id][t][n].splice(i,1);break}}else for(var o in d[e.id])d[e.id].hasOwnProperty(o)&&(d[e.id][o]={})}function a(e,t,n){if(d[e][n]){var r,o,s=t.target||t.srcElement,a={},c=0,f=0;l=0;for(r in d[e][n])d[e][n].hasOwnProperty(r)&&(o=i(s,r,m[e].element))&&u.matchesEvent(n,m[e].element,o,"_root"==r,t)&&(l++,d[e][n][r].match=o,a[l]=d[e][n][r]);for(t.stopPropagation=function(){t.cancelBubble=!0},c=0;c<=l;c++)if(a[c])for(f=0;f<a[c].length;f++){if(!1===a[c][f].call(a[c].match,t))return void u.cancel(t);if(t.cancelBubble)return}}}function c(e,t,n,r){if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var i,c=this.id;for(i=0;i<e.length;i++)r?s(this,e[i],t,n):(d[c]&&d[c][e[i]]||u.addEvent(this,e[i],function(e){return function(t){a(c,t,e)}}(e[i])),o(this,e[i],t,n));return this}}function u(e,t){if(!(this instanceof u)){for(var n in m)if(m[n].element===e)return m[n];return h++,m[h]=new u(e,h),m[h]}this.element=e,this.id=t}var f,l=0,h=0,d={},m={};u.prototype.on=function(e,t,n){return c.call(this,e,t,n)},u.prototype.off=function(e,t,n){return c.call(this,e,t,n,!0)},u.matchesSelector=function(){},u.cancel=n,u.addEvent=e,u.matchesEvent=function(){return!0},void 0!==t&&t.exports&&(t.exports=u),window.Gator=u}()},{}],6:[function(e,n,r){!function(e){var r=function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){var o=i,s=t[i];if(void 0===s&&(s=""),null===s&&(s=""),void 0!==n&&(o=n+"["+i+"]"),s.constructor===Array)o+="[]";else if("object"==typeof s){r(e,s,o);continue}var a=e.elements.namedItem(o);if(a){var c=a.type||a[0].type;switch(c){default:a.value=s;break;case"radio":case"checkbox":for(var u=0;u<a.length;u++)a[u].checked=s.indexOf(a[u].value)>-1;break;case"select-multiple":for(var f=s.constructor==Array?s:[s],l=0;l<a.options.length;l++)a.options[l].selected|=f.indexOf(a.options[l].value)>-1;break;case"select":case"select-one":a.value=s.toString()||s;break;case"date":a.value=new Date(s).toISOString().split("T")[0]}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):void 0!==n&&n.exports?n.exports=r:e.populate=r}(this)},{}],7:[function(e,n,r){!function(e){"use strict";function r(){}function i(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}function s(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&s(e.listener)}var a=r.prototype,c=e.EventEmitter;a.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},a.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},a.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},a.addListener=function(e,t){if(!s(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),o="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===i(r[n],t)&&r[n].push(o?t:{listener:t,once:!1});return this},a.on=o("addListener"),a.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},a.once=o("addOnceListener"),a.defineEvent=function(e){return this.getListeners(e),this},a.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},a.removeListener=function(e,t){var n,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&-1!==(n=i(o[r],t))&&o[r].splice(n,1);return this},a.off=o("removeListener"),a.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},a.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},a.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):s.call(this,r,i));return this},a.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},a.removeAllListeners=o("removeEvent"),a.emitEvent=function(e,t){var n,r,i,o,s=this.getListenersAsObject(e);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].slice(0),i=0;i<n.length;i++)r=n[i],!0===r.once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},a.trigger=o("emitEvent"),a.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},a.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},a._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},a._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return e.EventEmitter=c,r},"function"==typeof t&&t.amd?t(function(){return r}):"object"==typeof n&&n.exports?n.exports=r:e.EventEmitter=r}(this||{})},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function t(n,r,i){function o(c,a){if(!r[c]){if(!n[c]){var u="function"==typeof e&&e;if(!a&&u)return u(c,!0);if(s)return s(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[c]={exports:{}};n[c][0].call(l.exports,function(e){var t=n[c][1][e];return o(t||e)},l,l.exports,t,n,r,i)}return r[c].exports}for(var s="function"==typeof e&&e,c=0;c<i.length;c++)o(i[c]);return o}({1:[function(e,t,n){"use strict";function r(e){var t="animated"===u.auto_scroll,n={behavior:t?"smooth":"instant",block:"center",inline:"center"};e.element.scrollIntoView(n)}function i(e,t,n){return function(){var r=this.value.trim(),i="radio"!==this.getAttribute("type")&&"checked"!==this.getAttribute("type")||this.checked,o=i&&(r===t&&""!==t||""===t&&r.length>0);e.style.display=n?o?"":"none":o?"none":""}}function o(){var e=this,t=e.form.querySelectorAll("[data-show-if], [data-hide-if]"),n=(e.getAttribute("name")||"").toLowerCase();[].forEach.call(t,function(t){var r=!!t.getAttribute("data-show-if"),o=r?t.getAttribute("data-show-if").split(":"):t.getAttribute("data-hide-if").split(":"),s=o[0],c=o[1]||"";if(n===s.toLowerCase()){i(t,c,r).call(e)}})}var s=window.mc4wp||{},c=e("gator"),a=e("./forms/forms.js"),u=window.mc4wp_forms_config||{};if(c(document.body).on("keyup",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",o),c(document.body).on("change",".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select",o),window.addEventListener("load",function(){[].forEach.call(document.querySelectorAll(".mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select"),function(e){o.call(e)})}),c(document.body).on("submit",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);a.trigger("submit",[t,e]),a.trigger(t.id+".submit",[t,e])}),c(document.body).on("focus",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);t.started||(a.trigger("started",[t,e]),a.trigger(t.id+".started",[t,e]),t.started=!0)}),c(document.body).on("change",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);a.trigger("change",[t,e]),a.trigger(t.id+".change",[t,e])}),s.listeners){for(var f=s.listeners,l=0;l<f.length;l++)a.on(f[l].event,f[l].callback);delete s.listeners}if(s.forms=a,u.submitted_form){var h=u.submitted_form,d=document.getElementById(h.element_id),m=a.getByElement(d);!function(e,t,n,i){var o=document.body.clientHeight,s=Date.now();n&&e.setData(i),u.auto_scroll&&r(e),window.addEventListener("load",function(){var c=Date.now()-s;u.auto_scroll&&c<800&&document.body.clientHeight!==o&&r(e),a.trigger("submitted",[e]),a.trigger(e.id+".submitted",[e]),n?(a.trigger("error",[e,n]),a.trigger(e.id+".error",[e,n])):(a.trigger("success",[e,i]),a.trigger(e.id+".success",[e,i]),a.trigger(t+"d",[e,i]),a.trigger(e.id+"."+t+"d",[e,i]))})}(m,h.action,h.errors,h.data)}window.mc4wp=s},{"./forms/forms.js":3,gator:5}],2:[function(e,t,n){"use strict";var r=e("form-serialize"),i=e("populate.js"),o=function(e,t){this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1};o.prototype.setData=function(e){try{i(this.element,e)}catch(e){console.error(e)}},o.prototype.getData=function(){return r(this.element,{hash:!0})},o.prototype.getSerializedData=function(){return r(this.element)},o.prototype.setResponse=function(e){this.element.querySelector(".mc4wp-response").innerHTML=e},o.prototype.reset=function(){this.setResponse(""),this.element.querySelector(".mc4wp-form-fields").style.display="",this.element.reset()},t.exports=o},{"form-serialize":4,"populate.js":6}],3:[function(e,t,n){"use strict";function r(e){for(var t=0;t<f.length;t++)if(f[t].id==e)return f[t];return o(document.querySelector(".mc4wp-form-"+e),e)}function i(e){for(var t=e.form||e,n=0;n<f.length;n++)if(f[n].element==t)return f[n];return o(t)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new a(t,e);return f.push(n),n}function s(){return f}var c=e("wolfy87-eventemitter"),a=e("./form.js"),u=new c,f=[];t.exports={all:s,get:r,getByElement:i,on:u.on.bind(u),trigger:u.trigger.bind(u),off:u.off.bind(u)}},{"./form.js":2,"wolfy87-eventemitter":7}],4:[function(e,t,n){function r(e,t){"object"!=typeof t?t={hash:!!t}:void 0===t.hash&&(t.hash=!0);for(var n=t.hash?{}:"",r=t.serializer||(t.hash?s:c),i=e&&e.elements?e.elements:[],o=Object.create(null),f=0;f<i.length;++f){var l=i[f];if((t.disabled||!l.disabled)&&l.name&&(u.test(l.nodeName)&&!a.test(l.type))){var h=l.name,d=l.value;if("checkbox"!==l.type&&"radio"!==l.type||l.checked||(d=void 0),t.empty){if("checkbox"!==l.type||l.checked||(d=""),"radio"===l.type&&(o[l.name]||l.checked?l.checked&&(o[l.name]=!0):o[l.name]=!1),void 0==d&&"radio"==l.type)continue}else if(!d)continue;if("select-multiple"!==l.type)n=r(n,h,d);else{d=[];for(var m=l.options,p=!1,v=0;v<m.length;++v){var g=m[v],y=t.empty&&!g.value,w=g.value||y;g.selected&&w&&(p=!0,n=t.hash&&"[]"!==h.slice(h.length-2)?r(n,h+"[]",g.value):r(n,h,g.value))}!p&&t.empty&&(n=r(n,h,""))}}}if(t.empty)for(var h in o)o[h]||(n=r(n,h,""));return n}function i(e){var t=[],n=/^([^\[\]]*)/,r=new RegExp(f),i=n.exec(e);for(i[1]&&t.push(i[1]);null!==(i=r.exec(e));)t.push(i[1]);return t}function o(e,t,n){if(0===t.length)return e=n;var r=t.shift(),i=r.match(/^\[(.+?)\]$/);if("[]"===r)return e=e||[],Array.isArray(e)?e.push(o(null,t,n)):(e._values=e._values||[],e._values.push(o(null,t,n))),e;if(i){var s=i[1],c=+s;isNaN(c)?(e=e||{},e[s]=o(e[s],t,n)):(e=e||[],e[c]=o(e[c],t,n))}else e[r]=o(e[r],t,n);return e}function s(e,t,n){if(t.match(f))o(e,i(t),n);else{var r=e[t];r?(Array.isArray(r)||(e[t]=[r]),e[t].push(n)):e[t]=n}return e}function c(e,t,n){return n=n.replace(/(\r)?\n/g,"\r\n"),n=encodeURIComponent(n),n=n.replace(/%20/g,"+"),e+(e?"&":"")+encodeURIComponent(t)+"="+n}var a=/^(?:submit|button|image|reset|file)$/i,u=/^(?:input|select|textarea|keygen)/i,f=/(\[[^\[\]]*\])/g;t.exports=r},{}],5:[function(e,t,n){!function(){function e(e,t,n){var r="blur"==t||"focus"==t;e.element.addEventListener(t,n,r)}function n(e){e.preventDefault(),e.stopPropagation()}function r(e){return f||(f=e.matches?e.matches:e.webkitMatchesSelector?e.webkitMatchesSelector:e.mozMatchesSelector?e.mozMatchesSelector:e.msMatchesSelector?e.msMatchesSelector:e.oMatchesSelector?e.oMatchesSelector:u.matchesSelector)}function i(e,t,n){if("_root"==t)return n;if(e!==n)return r(e).call(e,t)?e:e.parentNode?(l++,i(e.parentNode,t,n)):void 0}function o(e,t,n,r){d[e.id]||(d[e.id]={}),d[e.id][t]||(d[e.id][t]={}),d[e.id][t][n]||(d[e.id][t][n]=[]),d[e.id][t][n].push(r)}function s(e,t,n,r){if(d[e.id])if(t){if(!r&&!n)return void(d[e.id][t]={});if(!r)return void delete d[e.id][t][n];if(d[e.id][t][n])for(var i=0;i<d[e.id][t][n].length;i++)if(d[e.id][t][n][i]===r){d[e.id][t][n].splice(i,1);break}}else for(var o in d[e.id])d[e.id].hasOwnProperty(o)&&(d[e.id][o]={})}function c(e,t,n){if(d[e][n]){var r,o,s=t.target||t.srcElement,c={},a=0,f=0;l=0;for(r in d[e][n])d[e][n].hasOwnProperty(r)&&(o=i(s,r,m[e].element))&&u.matchesEvent(n,m[e].element,o,"_root"==r,t)&&(l++,d[e][n][r].match=o,c[l]=d[e][n][r]);for(t.stopPropagation=function(){t.cancelBubble=!0},a=0;a<=l;a++)if(c[a])for(f=0;f<c[a].length;f++){if(!1===c[a][f].call(c[a].match,t))return void u.cancel(t);if(t.cancelBubble)return}}}function a(e,t,n,r){if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var i,a=this.id;for(i=0;i<e.length;i++)r?s(this,e[i],t,n):(d[a]&&d[a][e[i]]||u.addEvent(this,e[i],function(e){return function(t){c(a,t,e)}}(e[i])),o(this,e[i],t,n));return this}}function u(e,t){if(!(this instanceof u)){for(var n in m)if(m[n].element===e)return m[n];return h++,m[h]=new u(e,h),m[h]}this.element=e,this.id=t}var f,l=0,h=0,d={},m={};u.prototype.on=function(e,t,n){return a.call(this,e,t,n)},u.prototype.off=function(e,t,n){return a.call(this,e,t,n,!0)},u.matchesSelector=function(){},u.cancel=n,u.addEvent=e,u.matchesEvent=function(){return!0},void 0!==t&&t.exports&&(t.exports=u),window.Gator=u}()},{}],6:[function(e,n,r){!function(e){var r=function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){var o=i,s=t[i];if(void 0===s&&(s=""),null===s&&(s=""),void 0!==n&&(o=n+"["+i+"]"),s.constructor===Array)o+="[]";else if("object"==typeof s){r(e,s,o);continue}var c=e.elements.namedItem(o);if(c){var a=c.type||c[0].type;switch(a){default:c.value=s;break;case"radio":case"checkbox":for(var u=0;u<c.length;u++)c[u].checked=s.indexOf(c[u].value)>-1;break;case"select-multiple":for(var f=s.constructor==Array?s:[s],l=0;l<c.options.length;l++)c.options[l].selected|=f.indexOf(c.options[l].value)>-1;break;case"select":case"select-one":c.value=s.toString()||s;break;case"date":c.value=new Date(s).toISOString().split("T")[0]}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):void 0!==n&&n.exports?n.exports=r:e.populate=r}(this)},{}],7:[function(e,n,r){!function(e){"use strict";function r(){}function i(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function o(e){return function(){return this[e].apply(this,arguments)}}function s(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&s(e.listener)}var c=r.prototype,a=e.EventEmitter;c.getListeners=function(e){var t,n,r=this._getEvents();if(e instanceof RegExp){t={};for(n in r)r.hasOwnProperty(n)&&e.test(n)&&(t[n]=r[n])}else t=r[e]||(r[e]=[]);return t},c.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},c.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},c.addListener=function(e,t){if(!s(t))throw new TypeError("listener must be a function");var n,r=this.getListenersAsObject(e),o="object"==typeof t;for(n in r)r.hasOwnProperty(n)&&-1===i(r[n],t)&&r[n].push(o?t:{listener:t,once:!1});return this},c.on=o("addListener"),c.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},c.once=o("addOnceListener"),c.defineEvent=function(e){return this.getListeners(e),this},c.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},c.removeListener=function(e,t){var n,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&-1!==(n=i(o[r],t))&&o[r].splice(n,1);return this},c.off=o("removeListener"),c.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},c.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},c.manipulateListeners=function(e,t,n){var r,i,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(r=n.length;r--;)o.call(this,t,n[r]);else for(r in t)t.hasOwnProperty(r)&&(i=t[r])&&("function"==typeof i?o.call(this,r,i):s.call(this,r,i));return this},c.removeEvent=function(e){var t,n=typeof e,r=this._getEvents();if("string"===n)delete r[e];else if(e instanceof RegExp)for(t in r)r.hasOwnProperty(t)&&e.test(t)&&delete r[t];else delete this._events;return this},c.removeAllListeners=o("removeEvent"),c.emitEvent=function(e,t){var n,r,i,o,s=this.getListenersAsObject(e);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].slice(0),i=0;i<n.length;i++)r=n[i],!0===r.once&&this.removeListener(e,r.listener),r.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},c.trigger=o("emitEvent"),c.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},c.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},c._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},c._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return e.EventEmitter=a,r},"function"==typeof t&&t.amd?t(function(){return r}):"object"==typeof n&&n.exports?n.exports=r:e.EventEmitter=r}(this||{})},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
assets/js/forms-api.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","scrollToForm","form","animate","config","auto_scroll","args","behavior","element","scrollIntoView","toggleElement","el","expectedValue","show","value","this","trim","checked","getAttribute","conditionMet","style","display","toggleConditionalElements","input","elements","querySelectorAll","inputName","toLowerCase","forEach","conditions","split","nameCondition","valueCondition","mc4wp","window","Gator","forms","mc4wp_forms_config","document","body","on","addEventListener","event","getByElement","target","srcElement","trigger","id","started","listeners","callback","submitted_form","formConfig","getElementById","element_id","action","errors","data","pageHeight","clientHeight","timeStart","Date","now","setData","timeElapsed","./forms/forms.js","gator","2","serialize","populate","Form","createElement","name","prototype","console","error","getData","hash","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","3","get","formId","createFromElement","formElement","parseInt","push","all","EventEmitter","events","bind","off","./form.js","wolfy87-eventemitter","4","options","result","serializer","hash_serializer","str_serialize","radio_store","Object","create","disabled","k_r_success_contrls","test","nodeName","k_r_submitter","type","key","val","empty","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","slice","parse_keys","string","keys","prefix","children","RegExp","brackets","match","exec","hash_assign","shift","between","Array","isArray","_values","index","isNaN","existing","replace","encodeURIComponent","5","_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","addEvent","_id","6","root","basename","constructor","namedItem","indexOf","values","k","toString","toISOString","amd","7","indexOfListener","listener","alias","apply","arguments","isValidListener","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","addListeners","manipulateListeners","removeListeners","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,OAAUC,GAAeC,MAASD,IAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,GAAIF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,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fpG,MAAK8M,OAGhB,OAAO9M,OAQXsL,EAAMyB,mBAAqB7B,EAAM,eAcjCI,EAAM0B,UAAY,SAAmBvB,EAAKlM,GACtC,GACI2C,GACA+I,EACAzM,EACA4H,EAJA6G,EAAejN,KAAK8L,qBAAqBL,EAO7C,KAAKrF,IAAO6G,GACR,GAAIA,EAAavD,eAAetD,GAG5B,IAFAlE,EAAY+K,EAAa7G,GAAKU,MAAM,GAE/BtI,EAAI,EAAGA,EAAI0D,EAAUnD,OAAQP,IAG9ByM,EAAW/I,EAAU1D,IAEC,IAAlByM,EAASiB,MACTlM,KAAKuM,eAAed,EAAKR,EAASA,UAG3BA,EAASA,SAASE,MAAMnL,KAAMT,SAExBS,KAAKkN,uBAClBlN,KAAKuM,eAAed,EAAKR,EAASA,SAMlD,OAAOjL,OAMXsL,EAAMvJ,QAAUmJ,EAAM,aAUtBI,EAAM6B,KAAO,SAAc1B,GACvB,GAAIlM,GAAOoI,MAAMjE,UAAUoD,MAAMhI,KAAKsM,UAAW,EACjD,OAAOpL,MAAKgN,UAAUvB,EAAKlM,IAW/B+L,EAAM8B,mBAAqB,SAA4BrN,GAEnD,MADAC,MAAKqN,iBAAmBtN,EACjBC,MAWXsL,EAAM4B,oBAAsB,WACxB,OAAIlN,KAAK0J,eAAe,qBACb1J,KAAKqN,kBAapB/B,EAAMK,WAAa,WACf,MAAO3L,MAAK8M,UAAY9M,KAAK8M,aAQjC/H,EAAauI,WAAa,WAEtB,MADAzO,GAAQkG,aAAewG,EAChBxG,GAIW,kBAAXhH,IAAyBA,EAAO+M,IACvC/M,EAAO,WACH,MAAOgH,KAGY,gBAAX9F,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUkG,EAGjBlG,EAAQkG,aAAeA,GAE7B/E,oBAES","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (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);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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){\n'use strict';\n\n// deps & vars\n\nvar mc4wp = window.mc4wp || {};\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar config = window.mc4wp_forms_config || {};\n\n// funcs\nfunction scrollToForm(form) {\n\tvar animate = config.auto_scroll === 'animated';\n\tvar args = {\n\t\tbehavior: animate ? \"smooth\" : \"instant\"\n\t};\n\tform.element.scrollIntoView(args);\n}\n\nfunction handleFormRequest(form, action, errors, data) {\n\tvar pageHeight = document.body.clientHeight;\n\tvar timeStart = Date.now();\n\n\t// re-populate form\n\tif (errors) {\n\t\tform.setData(data);\n\t}\n\n\tif (config.auto_scroll) {\n\t\tscrollToForm(form);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function () {\n\t\tvar timeElapsed = Date.now() - timeStart;\n\n\t\t// scroll to form again if page height changed since last scroll\n\t\t// (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)\n\t\tif (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight != pageHeight) {\n\t\t\tscrollToForm(form);\n\t\t}\n\n\t\t// trigger events\n\t\tforms.trigger('submitted', [form]);\n\t\tforms.trigger(form.id + '.submitted', [form]);\n\n\t\tif (errors) {\n\t\t\tforms.trigger('error', [form, errors]);\n\t\t\tforms.trigger(form.id + '.error', [form, errors]);\n\t\t} else {\n\t\t\t// form was successfully submitted\n\t\t\tforms.trigger('success', [form, data]);\n\t\t\tforms.trigger(form.id + '.success', [form, data]);\n\n\t\t\t// subscribed / unsubscribed\n\t\t\tforms.trigger(action + \"d\", [form, data]);\n\t\t\tforms.trigger(form.id + \".\" + action + \"d\", [form, data]);\n\t\t}\n\t});\n}\n\nfunction toggleElement(el, expectedValue, show) {\n\treturn function () {\n\t\tvar value = this.value.trim();\n\t\tvar checked = this.getAttribute('type') !== 'radio' && this.getAttribute('type') !== 'checked' || this.checked;\n\t\tvar conditionMet = checked && (value === expectedValue && expectedValue !== \"\" || expectedValue === \"\" && value.length > 0);\n\t\tif (show) {\n\t\t\tel.style.display = conditionMet ? '' : 'none';\n\t\t} else {\n\t\t\tel.style.display = conditionMet ? 'none' : '';\n\t\t}\n\t};\n}\n\nfunction toggleConditionalElements() {\n\tvar input = this;\n\tvar elements = input.form.querySelectorAll('[data-show-if], [data-hide-if]');\n\tvar inputName = (input.getAttribute('name') || '').toLowerCase();\n\n\t[].forEach.call(elements, function (el) {\n\t\tvar show = !!el.getAttribute('data-show-if');\n\t\tvar conditions = show ? el.getAttribute('data-show-if').split(':') : el.getAttribute('data-hide-if').split(':');\n\t\tvar nameCondition = conditions[0];\n\t\tvar valueCondition = conditions[1] || \"\";\n\n\t\tif (inputName !== nameCondition.toLowerCase()) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar callback = toggleElement(el, valueCondition, show);\n\t\tcallback.call(input);\n\t});\n}\n\nGator(document.body).on('keyup', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nGator(document.body).on('change', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nwindow.addEventListener('load', function () {\n\t[].forEach.call(document.querySelectorAll('.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select'), function (el) {\n\t\ttoggleConditionalElements.call(el);\n\t});\n});\n\n// Bind browser events to form events (using delegation)\nGator(document.body).on('submit', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n\tforms.trigger(form.id + '.submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\n\tif (!form.started) {\n\t\tforms.trigger('started', [form, event]);\n\t\tforms.trigger(form.id + '.started', [form, event]);\n\t\tform.started = true;\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form, event]);\n\tforms.trigger(form.id + '.change', [form, event]);\n});\n\n// register early listeners\nif (mc4wp.listeners) {\n\tvar listeners = mc4wp.listeners;\n\tfor (var i = 0; i < listeners.length; i++) {\n\t\tforms.on(listeners[i].event, listeners[i].callback);\n\t}\n\n\t// delete temp listeners array, so we don't bind twice\n\tdelete mc4wp[\"listeners\"];\n}\n\n// expose forms object\nmc4wp.forms = forms;\n\n// handle submitted form\nif (config.submitted_form) {\n\tvar formConfig = config.submitted_form,\n\t element = document.getElementById(formConfig.element_id),\n\t form = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose mc4wp object globally\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":5}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('form-serialize');\nvar populate = require('populate.js');\n\nvar Form = function Form(id, element) {\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n};\n\nForm.prototype.setData = function (data) {\n\ttry {\n\t\tpopulate(this.element, data);\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n};\n\nForm.prototype.getData = function () {\n\treturn serialize(this.element, { hash: true });\n};\n\nForm.prototype.getSerializedData = function () {\n\treturn serialize(this.element);\n};\n\nForm.prototype.setResponse = function (msg) {\n\tthis.element.querySelector('.mc4wp-response').innerHTML = msg;\n};\n\n// revert back to original state\nForm.prototype.reset = function () {\n\tthis.setResponse('');\n\tthis.element.querySelector('.mc4wp-form-fields').style.display = '';\n\tthis.element.reset();\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":4,\"populate.js\":6}],3:[function(require,module,exports){\n'use strict';\n\n// deps\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement, formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(formElement);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement, id) {\n\tid = id || parseInt(formElement.getAttribute('data-id')) || 0;\n\tvar form = new Form(id, formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": events.on.bind(events),\n\t\"trigger\": events.trigger.bind(events),\n\t\"off\": events.off.bind(events)\n};\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":7}],4:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n //Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i<elements.length ; ++i) {\n var element = elements[i];\n\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n // for checkbox\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j<selectOptions.length ; ++j) {\n var option = selectOptions[j];\n var allowedEmpty = options.empty && !option.value;\n var hasValue = (option.value || allowedEmpty);\n if (option.selected && hasValue) {\n isSelectedOptions = true;\n\n // If using a hash serializer be sure to add the\n // correct notation for an array in the multi-select\n // context. Here the name attribute on the select element\n // might be missing the trailing bracket pair. Both names\n // \"foo\" and \"foo[]\" should be arrays.\n if (options.hash && key.slice(key.length - 2) !== '[]') {\n result = serializer(result, key + '[]', option.value);\n }\n else {\n result = serializer(result, key, option.value);\n }\n }\n }\n\n // Serialize if no selected options and options.empty is true\n if (!isSelectedOptions && options.empty) {\n result = serializer(result, key, '');\n }\n\n continue;\n }\n\n result = serializer(result, key, val);\n }\n\n // Check for all empty radio buttons and serialize them with key=\"\"\n if (options.empty) {\n for (var key in radio_store) {\n if (!radio_store[key]) {\n result = serializer(result, key, '');\n }\n }\n }\n\n return result;\n}\n\nfunction parse_keys(string) {\n var keys = [];\n var prefix = /^([^\\[\\]]*)/;\n var children = new RegExp(brackets);\n var match = prefix.exec(string);\n\n if (match[1]) {\n keys.push(match[1]);\n }\n\n while ((match = children.exec(string)) !== null) {\n keys.push(match[1]);\n }\n\n return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n if (keys.length === 0) {\n result = value;\n return result;\n }\n\n var key = keys.shift();\n var between = key.match(/^\\[(.+?)\\]$/);\n\n if (key === '[]') {\n result = result || [];\n\n if (Array.isArray(result)) {\n result.push(hash_assign(null, keys, value));\n }\n else {\n // This might be the result of bad name attributes like \"[][foo]\",\n // in this case the original `result` object will already be\n // assigned to an object literal. Rather than coerce the object to\n // an array, or cause an exception the attribute \"_values\" is\n // assigned as an array.\n result._values = result._values || [];\n result._values.push(hash_assign(null, keys, value));\n }\n\n return result;\n }\n\n // Key is an attribute name and can be assigned directly.\n if (!between) {\n result[key] = hash_assign(result[key], keys, value);\n }\n else {\n var string = between[1];\n // +var converts the variable into a number\n // better than parseInt because it doesn't truncate away trailing\n // letters and actually fails if whole thing is not a number\n var index = +string;\n\n // If the characters between the brackets is not a number it is an\n // attribute name and can be assigned directly.\n if (isNaN(index)) {\n result = result || {};\n result[string] = hash_assign(result[string], keys, value);\n }\n else {\n result = result || [];\n result[index] = hash_assign(result[index], keys, value);\n }\n }\n\n return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n var matches = key.match(brackets);\n\n // Has brackets? Use the recursive assignment function to walk the keys,\n // construct any missing objects in the result tree and make the assignment\n // at the end of the chain.\n if (matches) {\n var keys = parse_keys(key);\n hash_assign(result, keys, value);\n }\n else {\n // Non bracket notation can make assignments directly.\n var existing = result[key];\n\n // If the value has been assigned already (for instance when a radio and\n // a checkbox have the same name attribute) convert the previous value\n // into an array before pushing into it.\n //\n // NOTE: If this requirement were removed all hash creation and\n // assignment could go through `hash_assign`.\n if (existing) {\n if (!Array.isArray(existing)) {\n result[key] = [ existing ];\n }\n\n result[key].push(value);\n }\n else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n // encode newlines as \\r\\n cause the html spec says so\n value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n value = encodeURIComponent(value);\n\n // spaces should be '+' rather than '%20'.\n value = value.replace(/%20/g, '+');\n return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n\n},{}],5:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],6:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n if ('undefined' === typeof value) {\n value = '';\n }\n\n if (null === value) {\n value = '';\n }\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n \t\t\t\telement.value = new Date(value).toISOString().split('T')[0];\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.2 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n })();"]}
1
+ {"version":3,"sources":["forms-api.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","scrollToForm","form","animate","config","auto_scroll","args","behavior","block","inline","element","scrollIntoView","toggleElement","el","expectedValue","show","value","this","trim","checked","getAttribute","conditionMet","style","display","toggleConditionalElements","input","elements","querySelectorAll","inputName","toLowerCase","forEach","conditions","split","nameCondition","valueCondition","mc4wp","window","Gator","forms","mc4wp_forms_config","document","body","on","addEventListener","event","getByElement","target","srcElement","trigger","id","started","listeners","callback","submitted_form","formConfig","getElementById","element_id","action","errors","data","pageHeight","clientHeight","timeStart","Date","now","setData","timeElapsed","./forms/forms.js","gator","2","serialize","populate","Form","createElement","name","prototype","console","error","getData","hash","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","3","get","formId","createFromElement","formElement","parseInt","push","all","EventEmitter","events","bind","off","./form.js","wolfy87-eventemitter","4","options","result","serializer","hash_serializer","str_serialize","radio_store","Object","create","disabled","k_r_success_contrls","test","nodeName","k_r_submitter","type","key","val","empty","selectOptions","isSelectedOptions","j","option","allowedEmpty","hasValue","selected","slice","parse_keys","string","keys","prefix","children","RegExp","brackets","match","exec","hash_assign","shift","between","Array","isArray","_values","index","isNaN","existing","replace","encodeURIComponent","5","_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","addEvent","_id","6","root","basename","constructor","namedItem","indexOf","values","k","toString","toISOString","amd","7","indexOfListener","listener","alias","apply","arguments","isValidListener","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","TypeError","listenerIsWrapped","once","addOnceListener","defineEvent","defineEvents","evts","removeListener","addListeners","manipulateListeners","removeListeners","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","listenersMap","_getOnceReturnValue","emit","setOnceReturnValue","_onceReturnValue","noConflict"],"mappings":"CAAA,WAAe,GAAIA,OAAUC,GAAeC,MAASD,IAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,S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G,EAAQoG,aAAeA,GAE7B/E,oBAES","file":"forms-api.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (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);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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){\n'use strict';\n\n// deps & vars\n\nvar mc4wp = window.mc4wp || {};\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar config = window.mc4wp_forms_config || {};\n\n// funcs\nfunction scrollToForm(form) {\n\tvar animate = config.auto_scroll === 'animated';\n\tvar args = {\n\t\tbehavior: animate ? \"smooth\" : \"instant\",\n\t\tblock: \"center\",\n\t\tinline: \"center\"\n\t};\n\tform.element.scrollIntoView(args);\n}\n\nfunction handleFormRequest(form, action, errors, data) {\n\tvar pageHeight = document.body.clientHeight;\n\tvar timeStart = Date.now();\n\n\t// re-populate form\n\tif (errors) {\n\t\tform.setData(data);\n\t}\n\n\tif (config.auto_scroll) {\n\t\tscrollToForm(form);\n\t}\n\n\t// trigger events on window.load so all other scripts have loaded\n\twindow.addEventListener('load', function () {\n\t\tvar timeElapsed = Date.now() - timeStart;\n\n\t\t// scroll to form again if page height changed since last scroll\n\t\t// (only if load didn't take more than 0.8 seconds to prevent overtaking user scroll)\n\t\tif (config.auto_scroll && timeElapsed < 800 && document.body.clientHeight !== pageHeight) {\n\t\t\tscrollToForm(form);\n\t\t}\n\n\t\t// trigger events\n\t\tforms.trigger('submitted', [form]);\n\t\tforms.trigger(form.id + '.submitted', [form]);\n\n\t\tif (errors) {\n\t\t\tforms.trigger('error', [form, errors]);\n\t\t\tforms.trigger(form.id + '.error', [form, errors]);\n\t\t} else {\n\t\t\t// form was successfully submitted\n\t\t\tforms.trigger('success', [form, data]);\n\t\t\tforms.trigger(form.id + '.success', [form, data]);\n\n\t\t\t// subscribed / unsubscribed\n\t\t\tforms.trigger(action + \"d\", [form, data]);\n\t\t\tforms.trigger(form.id + \".\" + action + \"d\", [form, data]);\n\t\t}\n\t});\n}\n\nfunction toggleElement(el, expectedValue, show) {\n\treturn function () {\n\t\tvar value = this.value.trim();\n\t\tvar checked = this.getAttribute('type') !== 'radio' && this.getAttribute('type') !== 'checked' || this.checked;\n\t\tvar conditionMet = checked && (value === expectedValue && expectedValue !== \"\" || expectedValue === \"\" && value.length > 0);\n\t\tif (show) {\n\t\t\tel.style.display = conditionMet ? '' : 'none';\n\t\t} else {\n\t\t\tel.style.display = conditionMet ? 'none' : '';\n\t\t}\n\t};\n}\n\nfunction toggleConditionalElements() {\n\tvar input = this;\n\tvar elements = input.form.querySelectorAll('[data-show-if], [data-hide-if]');\n\tvar inputName = (input.getAttribute('name') || '').toLowerCase();\n\n\t[].forEach.call(elements, function (el) {\n\t\tvar show = !!el.getAttribute('data-show-if');\n\t\tvar conditions = show ? el.getAttribute('data-show-if').split(':') : el.getAttribute('data-hide-if').split(':');\n\t\tvar nameCondition = conditions[0];\n\t\tvar valueCondition = conditions[1] || \"\";\n\n\t\tif (inputName !== nameCondition.toLowerCase()) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar callback = toggleElement(el, valueCondition, show);\n\t\tcallback.call(input);\n\t});\n}\n\nGator(document.body).on('keyup', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nGator(document.body).on('change', '.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select', toggleConditionalElements);\nwindow.addEventListener('load', function () {\n\t[].forEach.call(document.querySelectorAll('.mc4wp-form input, .mc4wp-form textarea, .mc4wp-form select'), function (el) {\n\t\ttoggleConditionalElements.call(el);\n\t});\n});\n\n// Bind browser events to form events (using delegation)\nGator(document.body).on('submit', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('submit', [form, event]);\n\tforms.trigger(form.id + '.submit', [form, event]);\n});\n\nGator(document.body).on('focus', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\n\tif (!form.started) {\n\t\tforms.trigger('started', [form, event]);\n\t\tforms.trigger(form.id + '.started', [form, event]);\n\t\tform.started = true;\n\t}\n});\n\nGator(document.body).on('change', '.mc4wp-form', function (event) {\n\tvar form = forms.getByElement(event.target || event.srcElement);\n\tforms.trigger('change', [form, event]);\n\tforms.trigger(form.id + '.change', [form, event]);\n});\n\n// register early listeners\nif (mc4wp.listeners) {\n\tvar listeners = mc4wp.listeners;\n\tfor (var i = 0; i < listeners.length; i++) {\n\t\tforms.on(listeners[i].event, listeners[i].callback);\n\t}\n\n\t// delete temp listeners array, so we don't bind twice\n\tdelete mc4wp[\"listeners\"];\n}\n\n// expose forms object\nmc4wp.forms = forms;\n\n// handle submitted form\nif (config.submitted_form) {\n\tvar formConfig = config.submitted_form,\n\t element = document.getElementById(formConfig.element_id),\n\t form = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose mc4wp object globally\nwindow.mc4wp = mc4wp;\n\n},{\"./forms/forms.js\":3,\"gator\":5}],2:[function(require,module,exports){\n'use strict';\n\nvar serialize = require('form-serialize');\nvar populate = require('populate.js');\n\nvar Form = function Form(id, element) {\n\tthis.id = id;\n\tthis.element = element || document.createElement('form');\n\tthis.name = this.element.getAttribute('data-name') || \"Form #\" + this.id;\n\tthis.errors = [];\n\tthis.started = false;\n};\n\nForm.prototype.setData = function (data) {\n\ttry {\n\t\tpopulate(this.element, data);\n\t} catch (e) {\n\t\tconsole.error(e);\n\t}\n};\n\nForm.prototype.getData = function () {\n\treturn serialize(this.element, { hash: true });\n};\n\nForm.prototype.getSerializedData = function () {\n\treturn serialize(this.element);\n};\n\nForm.prototype.setResponse = function (msg) {\n\tthis.element.querySelector('.mc4wp-response').innerHTML = msg;\n};\n\n// revert back to original state\nForm.prototype.reset = function () {\n\tthis.setResponse('');\n\tthis.element.querySelector('.mc4wp-form-fields').style.display = '';\n\tthis.element.reset();\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":4,\"populate.js\":6}],3:[function(require,module,exports){\n'use strict';\n\n// deps\n\nvar EventEmitter = require('wolfy87-eventemitter');\nvar Form = require('./form.js');\n\n// variables\nvar events = new EventEmitter();\nvar forms = [];\n\n// get form by its id\n// please note that this will get the FIRST occurence of the form with that ID on the page\nfunction get(formId) {\n\n\t// do we have form for this one already?\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].id == formId) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\t// try to create from first occurence of this element\n\tvar formElement = document.querySelector('.mc4wp-form-' + formId);\n\treturn createFromElement(formElement, formId);\n}\n\n// get form by <form> element (or any input in form)\nfunction getByElement(element) {\n\tvar formElement = element.form || element;\n\n\tfor (var i = 0; i < forms.length; i++) {\n\t\tif (forms[i].element == formElement) {\n\t\t\treturn forms[i];\n\t\t}\n\t}\n\n\treturn createFromElement(formElement);\n}\n\n// create form object from <form> element\nfunction createFromElement(formElement, id) {\n\tid = id || parseInt(formElement.getAttribute('data-id')) || 0;\n\tvar form = new Form(id, formElement);\n\tforms.push(form);\n\treturn form;\n}\n\nfunction all() {\n\treturn forms;\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": events.on.bind(events),\n\t\"trigger\": events.trigger.bind(events),\n\t\"off\": events.off.bind(events)\n};\n\n},{\"./form.js\":2,\"wolfy87-eventemitter\":7}],4:[function(require,module,exports){\n// get successful control from form and assemble into object\n// http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2\n\n// types which indicate a submit action and are not successful controls\n// these will be ignored\nvar k_r_submitter = /^(?:submit|button|image|reset|file)$/i;\n\n// node names which could be successful controls\nvar k_r_success_contrls = /^(?:input|select|textarea|keygen)/i;\n\n// Matches bracket notation.\nvar brackets = /(\\[[^\\[\\]]*\\])/g;\n\n// serializes form fields\n// @param form MUST be an HTMLForm element\n// @param options is an optional argument to configure the serialization. Default output\n// with no options specified is a url encoded string\n// - hash: [true | false] Configure the output type. If true, the output will\n// be a js object.\n// - serializer: [function] Optional serializer function to override the default one.\n// The function takes 3 arguments (result, key, value) and should return new result\n// hash and url encoded str serializers are provided with this module\n// - disabled: [true | false]. If true serialize disabled fields.\n// - empty: [true | false]. If true serialize empty fields\nfunction serialize(form, options) {\n if (typeof options != 'object') {\n options = { hash: !!options };\n }\n else if (options.hash === undefined) {\n options.hash = true;\n }\n\n var result = (options.hash) ? {} : '';\n var serializer = options.serializer || ((options.hash) ? hash_serializer : str_serialize);\n\n var elements = form && form.elements ? form.elements : [];\n\n //Object store each radio and set if it's empty or not\n var radio_store = Object.create(null);\n\n for (var i=0 ; i<elements.length ; ++i) {\n var element = elements[i];\n\n // ingore disabled fields\n if ((!options.disabled && element.disabled) || !element.name) {\n continue;\n }\n // ignore anyhting that is not considered a success field\n if (!k_r_success_contrls.test(element.nodeName) ||\n k_r_submitter.test(element.type)) {\n continue;\n }\n\n var key = element.name;\n var val = element.value;\n\n // we can't just use element.value for checkboxes cause some browsers lie to us\n // they say \"on\" for value when the box isn't checked\n if ((element.type === 'checkbox' || element.type === 'radio') && !element.checked) {\n val = undefined;\n }\n\n // If we want empty elements\n if (options.empty) {\n // for checkbox\n if (element.type === 'checkbox' && !element.checked) {\n val = '';\n }\n\n // for radio\n if (element.type === 'radio') {\n if (!radio_store[element.name] && !element.checked) {\n radio_store[element.name] = false;\n }\n else if (element.checked) {\n radio_store[element.name] = true;\n }\n }\n\n // if options empty is true, continue only if its radio\n if (val == undefined && element.type == 'radio') {\n continue;\n }\n }\n else {\n // value-less fields are ignored unless options.empty is true\n if (!val) {\n continue;\n }\n }\n\n // multi select boxes\n if (element.type === 'select-multiple') {\n val = [];\n\n var selectOptions = element.options;\n var isSelectedOptions = false;\n for (var j=0 ; j<selectOptions.length ; ++j) {\n var option = selectOptions[j];\n var allowedEmpty = options.empty && !option.value;\n var hasValue = (option.value || allowedEmpty);\n if (option.selected && hasValue) {\n isSelectedOptions = true;\n\n // If using a hash serializer be sure to add the\n // correct notation for an array in the multi-select\n // context. Here the name attribute on the select element\n // might be missing the trailing bracket pair. Both names\n // \"foo\" and \"foo[]\" should be arrays.\n if (options.hash && key.slice(key.length - 2) !== '[]') {\n result = serializer(result, key + '[]', option.value);\n }\n else {\n result = serializer(result, key, option.value);\n }\n }\n }\n\n // Serialize if no selected options and options.empty is true\n if (!isSelectedOptions && options.empty) {\n result = serializer(result, key, '');\n }\n\n continue;\n }\n\n result = serializer(result, key, val);\n }\n\n // Check for all empty radio buttons and serialize them with key=\"\"\n if (options.empty) {\n for (var key in radio_store) {\n if (!radio_store[key]) {\n result = serializer(result, key, '');\n }\n }\n }\n\n return result;\n}\n\nfunction parse_keys(string) {\n var keys = [];\n var prefix = /^([^\\[\\]]*)/;\n var children = new RegExp(brackets);\n var match = prefix.exec(string);\n\n if (match[1]) {\n keys.push(match[1]);\n }\n\n while ((match = children.exec(string)) !== null) {\n keys.push(match[1]);\n }\n\n return keys;\n}\n\nfunction hash_assign(result, keys, value) {\n if (keys.length === 0) {\n result = value;\n return result;\n }\n\n var key = keys.shift();\n var between = key.match(/^\\[(.+?)\\]$/);\n\n if (key === '[]') {\n result = result || [];\n\n if (Array.isArray(result)) {\n result.push(hash_assign(null, keys, value));\n }\n else {\n // This might be the result of bad name attributes like \"[][foo]\",\n // in this case the original `result` object will already be\n // assigned to an object literal. Rather than coerce the object to\n // an array, or cause an exception the attribute \"_values\" is\n // assigned as an array.\n result._values = result._values || [];\n result._values.push(hash_assign(null, keys, value));\n }\n\n return result;\n }\n\n // Key is an attribute name and can be assigned directly.\n if (!between) {\n result[key] = hash_assign(result[key], keys, value);\n }\n else {\n var string = between[1];\n // +var converts the variable into a number\n // better than parseInt because it doesn't truncate away trailing\n // letters and actually fails if whole thing is not a number\n var index = +string;\n\n // If the characters between the brackets is not a number it is an\n // attribute name and can be assigned directly.\n if (isNaN(index)) {\n result = result || {};\n result[string] = hash_assign(result[string], keys, value);\n }\n else {\n result = result || [];\n result[index] = hash_assign(result[index], keys, value);\n }\n }\n\n return result;\n}\n\n// Object/hash encoding serializer.\nfunction hash_serializer(result, key, value) {\n var matches = key.match(brackets);\n\n // Has brackets? Use the recursive assignment function to walk the keys,\n // construct any missing objects in the result tree and make the assignment\n // at the end of the chain.\n if (matches) {\n var keys = parse_keys(key);\n hash_assign(result, keys, value);\n }\n else {\n // Non bracket notation can make assignments directly.\n var existing = result[key];\n\n // If the value has been assigned already (for instance when a radio and\n // a checkbox have the same name attribute) convert the previous value\n // into an array before pushing into it.\n //\n // NOTE: If this requirement were removed all hash creation and\n // assignment could go through `hash_assign`.\n if (existing) {\n if (!Array.isArray(existing)) {\n result[key] = [ existing ];\n }\n\n result[key].push(value);\n }\n else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n// urlform encoding serializer\nfunction str_serialize(result, key, value) {\n // encode newlines as \\r\\n cause the html spec says so\n value = value.replace(/(\\r)?\\n/g, '\\r\\n');\n value = encodeURIComponent(value);\n\n // spaces should be '+' rather than '%20'.\n value = value.replace(/%20/g, '+');\n return result + (result ? '&' : '') + encodeURIComponent(key) + '=' + value;\n}\n\nmodule.exports = serialize;\n\n},{}],5:[function(require,module,exports){\n/**\n * Copyright 2014 Craig Campbell\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * GATOR.JS\n * Simple Event Delegation\n *\n * @version 1.2.4\n *\n * Compatible with IE 9+, FF 3.6+, Safari 5+, Chrome\n *\n * Include legacy.js for compatibility with older browsers\n *\n * .-._ _ _ _ _ _ _ _ _\n * .-''-.__.-'00 '-' ' ' ' ' ' ' ' '-.\n * '.___ ' . .--_'-' '-' '-' _'-' '._\n * V: V 'vv-' '_ '. .' _..' '.'.\n * '=.____.=_.--' :_.__.__:_ '. : :\n * (((____.-' '-. / : :\n * (((-'\\ .' /\n * _____..' .'\n * '-._____.-'\n */\n(function() {\n var _matcher,\n _level = 0,\n _id = 0,\n _handlers = {},\n _gatorInstances = {};\n\n function _addEvent(gator, type, callback) {\n\n // blur and focus do not bubble up but if you use event capturing\n // then you will get them\n var useCapture = type == 'blur' || type == 'focus';\n gator.element.addEventListener(type, callback, useCapture);\n }\n\n function _cancel(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n /**\n * returns function to use for determining if an element\n * matches a query selector\n *\n * @returns {Function}\n */\n function _getMatcher(element) {\n if (_matcher) {\n return _matcher;\n }\n\n if (element.matches) {\n _matcher = element.matches;\n return _matcher;\n }\n\n if (element.webkitMatchesSelector) {\n _matcher = element.webkitMatchesSelector;\n return _matcher;\n }\n\n if (element.mozMatchesSelector) {\n _matcher = element.mozMatchesSelector;\n return _matcher;\n }\n\n if (element.msMatchesSelector) {\n _matcher = element.msMatchesSelector;\n return _matcher;\n }\n\n if (element.oMatchesSelector) {\n _matcher = element.oMatchesSelector;\n return _matcher;\n }\n\n // if it doesn't match a native browser method\n // fall back to the gator function\n _matcher = Gator.matchesSelector;\n return _matcher;\n }\n\n /**\n * determines if the specified element matches a given selector\n *\n * @param {Node} element - the element to compare against the selector\n * @param {string} selector\n * @param {Node} boundElement - the element the listener was attached to\n * @returns {void|Node}\n */\n function _matchesSelector(element, selector, boundElement) {\n\n // no selector means this event was bound directly to this element\n if (selector == '_root') {\n return boundElement;\n }\n\n // if we have moved up to the element you bound the event to\n // then we have come too far\n if (element === boundElement) {\n return;\n }\n\n // if this is a match then we are done!\n if (_getMatcher(element).call(element, selector)) {\n return element;\n }\n\n // if this element did not match but has a parent we should try\n // going up the tree to see if any of the parent elements match\n // for example if you are looking for a click on an <a> tag but there\n // is a <span> inside of the a tag that it is the target,\n // it should still work\n if (element.parentNode) {\n _level++;\n return _matchesSelector(element.parentNode, selector, boundElement);\n }\n }\n\n function _addHandler(gator, event, selector, callback) {\n if (!_handlers[gator.id]) {\n _handlers[gator.id] = {};\n }\n\n if (!_handlers[gator.id][event]) {\n _handlers[gator.id][event] = {};\n }\n\n if (!_handlers[gator.id][event][selector]) {\n _handlers[gator.id][event][selector] = [];\n }\n\n _handlers[gator.id][event][selector].push(callback);\n }\n\n function _removeHandler(gator, event, selector, callback) {\n\n // if there are no events tied to this element at all\n // then don't do anything\n if (!_handlers[gator.id]) {\n return;\n }\n\n // if there is no event type specified then remove all events\n // example: Gator(element).off()\n if (!event) {\n for (var type in _handlers[gator.id]) {\n if (_handlers[gator.id].hasOwnProperty(type)) {\n _handlers[gator.id][type] = {};\n }\n }\n return;\n }\n\n // if no callback or selector is specified remove all events of this type\n // example: Gator(element).off('click')\n if (!callback && !selector) {\n _handlers[gator.id][event] = {};\n return;\n }\n\n // if a selector is specified but no callback remove all events\n // for this selector\n // example: Gator(element).off('click', '.sub-element')\n if (!callback) {\n delete _handlers[gator.id][event][selector];\n return;\n }\n\n // if we have specified an event type, selector, and callback then we\n // need to make sure there are callbacks tied to this selector to\n // begin with. if there aren't then we can stop here\n if (!_handlers[gator.id][event][selector]) {\n return;\n }\n\n // if there are then loop through all the callbacks and if we find\n // one that matches remove it from the array\n for (var i = 0; i < _handlers[gator.id][event][selector].length; i++) {\n if (_handlers[gator.id][event][selector][i] === callback) {\n _handlers[gator.id][event][selector].splice(i, 1);\n break;\n }\n }\n }\n\n function _handleEvent(id, e, type) {\n if (!_handlers[id][type]) {\n return;\n }\n\n var target = e.target || e.srcElement,\n selector,\n match,\n matches = {},\n i = 0,\n j = 0;\n\n // find all events that match\n _level = 0;\n for (selector in _handlers[id][type]) {\n if (_handlers[id][type].hasOwnProperty(selector)) {\n match = _matchesSelector(target, selector, _gatorInstances[id].element);\n\n if (match && Gator.matchesEvent(type, _gatorInstances[id].element, match, selector == '_root', e)) {\n _level++;\n _handlers[id][type][selector].match = match;\n matches[_level] = _handlers[id][type][selector];\n }\n }\n }\n\n // stopPropagation() fails to set cancelBubble to true in Webkit\n // @see http://code.google.com/p/chromium/issues/detail?id=162270\n e.stopPropagation = function() {\n e.cancelBubble = true;\n };\n\n for (i = 0; i <= _level; i++) {\n if (matches[i]) {\n for (j = 0; j < matches[i].length; j++) {\n if (matches[i][j].call(matches[i].match, e) === false) {\n Gator.cancel(e);\n return;\n }\n\n if (e.cancelBubble) {\n return;\n }\n }\n }\n }\n }\n\n /**\n * binds the specified events to the element\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @param {boolean=} remove\n * @returns {Object}\n */\n function _bind(events, selector, callback, remove) {\n\n // fail silently if you pass null or undefined as an alement\n // in the Gator constructor\n if (!this.element) {\n return;\n }\n\n if (!(events instanceof Array)) {\n events = [events];\n }\n\n if (!callback && typeof(selector) == 'function') {\n callback = selector;\n selector = '_root';\n }\n\n var id = this.id,\n i;\n\n function _getGlobalCallback(type) {\n return function(e) {\n _handleEvent(id, e, type);\n };\n }\n\n for (i = 0; i < events.length; i++) {\n if (remove) {\n _removeHandler(this, events[i], selector, callback);\n continue;\n }\n\n if (!_handlers[id] || !_handlers[id][events[i]]) {\n Gator.addEvent(this, events[i], _getGlobalCallback(events[i]));\n }\n\n _addHandler(this, events[i], selector, callback);\n }\n\n return this;\n }\n\n /**\n * Gator object constructor\n *\n * @param {Node} element\n */\n function Gator(element, id) {\n\n // called as function\n if (!(this instanceof Gator)) {\n // only keep one Gator instance per node to make sure that\n // we don't create a ton of new objects if you want to delegate\n // multiple events from the same node\n //\n // for example: Gator(document).on(...\n for (var key in _gatorInstances) {\n if (_gatorInstances[key].element === element) {\n return _gatorInstances[key];\n }\n }\n\n _id++;\n _gatorInstances[_id] = new Gator(element, _id);\n\n return _gatorInstances[_id];\n }\n\n this.element = element;\n this.id = id;\n }\n\n /**\n * adds an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.on = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback);\n };\n\n /**\n * removes an event\n *\n * @param {string|Array} events\n * @param {string} selector\n * @param {Function} callback\n * @returns {Object}\n */\n Gator.prototype.off = function(events, selector, callback) {\n return _bind.call(this, events, selector, callback, true);\n };\n\n Gator.matchesSelector = function() {};\n Gator.cancel = _cancel;\n Gator.addEvent = _addEvent;\n Gator.matchesEvent = function() {\n return true;\n };\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Gator;\n }\n\n window.Gator = Gator;\n}) ();\n\n},{}],6:[function(require,module,exports){\n/*! populate.js v1.0.2 by @dannyvankooten | MIT license */\n;(function(root) {\n\n\t/**\n\t * Populate form fields from a JSON object.\n\t *\n\t * @param form object The form element containing your input fields.\n\t * @param data array JSON data to populate the fields with.\n\t * @param basename string Optional basename which is added to `name` attributes\n\t */\n\tvar populate = function( form, data, basename) {\n\n\t\tfor(var key in data) {\n\n\t\t\tif( ! data.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar name = key;\n\t\t\tvar value = data[key];\n\n if ('undefined' === typeof value) {\n value = '';\n }\n\n if (null === value) {\n value = '';\n }\n\n\t\t\t// handle array name attributes\n\t\t\tif(typeof(basename) !== \"undefined\") {\n\t\t\t\tname = basename + \"[\" + key + \"]\";\n\t\t\t}\n\n\t\t\tif(value.constructor === Array) {\n\t\t\t\tname += '[]';\n\t\t\t} else if(typeof value == \"object\") {\n\t\t\t\tpopulate( form, value, name);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// only proceed if element is set\n\t\t\tvar element = form.elements.namedItem( name );\n\t\t\tif( ! element ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar type = element.type || element[0].type;\n\n\t\t\tswitch(type ) {\n\t\t\t\tdefault:\n\t\t\t\t\telement.value = value;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'radio':\n\t\t\t\tcase 'checkbox':\n\t\t\t\t\tfor( var j=0; j < element.length; j++ ) {\n\t\t\t\t\t\telement[j].checked = ( value.indexOf(element[j].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select-multiple':\n\t\t\t\t\tvar values = value.constructor == Array ? value : [value];\n\n\t\t\t\t\tfor(var k = 0; k < element.options.length; k++) {\n\t\t\t\t\t\telement.options[k].selected |= (values.indexOf(element.options[k].value) > -1 );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'select':\n\t\t\t\tcase 'select-one':\n\t\t\t\t\telement.value = value.toString() || value;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'date':\n \t\t\t\telement.value = new Date(value).toISOString().split('T')[0];\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\t// Play nice with AMD, CommonJS or a plain global object.\n\tif ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) {\n\t\tdefine(function() {\n\t\t\treturn populate;\n\t\t});\n\t}\telse if ( typeof module !== 'undefined' && module.exports ) {\n\t\tmodule.exports = populate;\n\t} else {\n\t\troot.populate = populate;\n\t}\n\n}(this));\n\n},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v5.2.2 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function (exports) {\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n var originalGlobalValue = exports.EventEmitter;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n }\n else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n function isValidListener (listener) {\n if (typeof listener === 'function' || listener instanceof RegExp) {\n return true\n } else if (listener && typeof listener === 'object') {\n return isValidListener(listener.listener)\n } else {\n return false\n }\n }\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n if (!isValidListener(listener)) {\n throw new TypeError('listener must be a function');\n }\n\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n }\n else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n }\n else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n }\n else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n }\n else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listenersMap = this.getListenersAsObject(evt);\n var listeners;\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listenersMap) {\n if (listenersMap.hasOwnProperty(key)) {\n listeners = listenersMap[key].slice(0);\n\n for (i = 0; i < listeners.length; i++) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n }\n else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n /**\n * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.\n *\n * @return {Function} Non conflicting EventEmitter class.\n */\n EventEmitter.noConflict = function noConflict() {\n exports.EventEmitter = originalGlobalValue;\n return EventEmitter;\n };\n\n // Expose the class either via AMD, CommonJS or the global object\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return EventEmitter;\n });\n }\n else if (typeof module === 'object' && module.exports){\n module.exports = EventEmitter;\n }\n else {\n exports.EventEmitter = EventEmitter;\n }\n}(this || {}));\n\n},{}]},{},[1]);\n })();"]}
includes/class-field-guesser.php CHANGED
@@ -51,28 +51,32 @@ class MC4WP_Field_Guesser {
51
 
52
  // transform value into array to support 1-level arrays
53
  $sub_fields = is_array( $value ) ? $value : array( $value );
 
54
  foreach( $sub_fields as $sub_field_value ) {
55
 
 
 
 
56
  // is this an email value? if so, assume it's the EMAIL field
57
  if( empty( $guessed['EMAIL'] ) && is_string( $sub_field_value ) && is_email( $sub_field_value ) ) {
58
  $guessed['EMAIL'] = $sub_field_value;
59
  continue 2;
60
  }
61
- }
62
 
63
- // remove special characters from field name
64
- $simple_key = str_replace( array( '-', '_', ' ' ), '', $field );
65
-
66
- if( empty( $guessed['FNAME'] ) && $this->string_contains( $simple_key, array( 'FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME' ) ) ) {
67
- // find first name field
68
- $guessed['FNAME'] = $value;
69
- } elseif( empty( $guessed['LNAME'] ) && $this->string_contains( $simple_key, array( 'LASTNAME', 'LNAME', 'SURNAME', 'FAMILYNAME' ) ) ) {
70
- // find last name field
71
- $guessed['LNAME'] = $value;
72
- } elseif( empty( $guessed['NAME'] ) && $this->string_contains( $simple_key, 'NAME' ) ){
73
- // find name field
74
- $guessed['NAME'] = $value;
75
- }
 
76
 
77
  }
78
 
51
 
52
  // transform value into array to support 1-level arrays
53
  $sub_fields = is_array( $value ) ? $value : array( $value );
54
+
55
  foreach( $sub_fields as $sub_field_value ) {
56
 
57
+ // poor man's urldecode, to get Enfold theme's contact element to work.
58
+ $sub_field_value = str_replace( '%40', '@', $sub_field_value );
59
+
60
  // is this an email value? if so, assume it's the EMAIL field
61
  if( empty( $guessed['EMAIL'] ) && is_string( $sub_field_value ) && is_email( $sub_field_value ) ) {
62
  $guessed['EMAIL'] = $sub_field_value;
63
  continue 2;
64
  }
 
65
 
66
+ // remove special characters from field name
67
+ $simple_key = str_replace( array( '-', '_', ' ' ), '', $field );
68
+
69
+ if( empty( $guessed['FNAME'] ) && $this->string_contains( $simple_key, array( 'FIRSTNAME', 'FNAME', 'GIVENNAME', 'FORENAME' ) ) ) {
70
+ // find first name field
71
+ $guessed['FNAME'] = $sub_field_value;
72
+ } elseif( empty( $guessed['LNAME'] ) && $this->string_contains( $simple_key, array( 'LASTNAME', 'LNAME', 'SURNAME', 'FAMILYNAME' ) ) ) {
73
+ // find last name field
74
+ $guessed['LNAME'] = $sub_field_value;
75
+ } elseif( empty( $guessed['NAME'] ) && $this->string_contains( $simple_key, 'NAME' ) ){
76
+ // find name field
77
+ $guessed['NAME'] = $sub_field_value;
78
+ }
79
+ }
80
 
81
  }
82
 
includes/forms/class-form-element.php CHANGED
@@ -79,7 +79,7 @@ class MC4WP_Form_Element {
79
  protected function get_hidden_fields() {
80
 
81
  // hidden fields
82
- $hidden_fields = '<div style="display: none;"><input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></div>';
83
  $hidden_fields .= '<input type="hidden" name="_mc4wp_timestamp" value="'. time() . '" />';
84
  $hidden_fields .= '<input type="hidden" name="_mc4wp_form_id" value="'. esc_attr( $this->form->ID ) .'" />';
85
  $hidden_fields .= '<input type="hidden" name="_mc4wp_form_element_id" value="'. esc_attr( $this->ID ) .'" />';
79
  protected function get_hidden_fields() {
80
 
81
  // hidden fields
82
+ $hidden_fields = '<label style="display: none !important;">' . __( 'Leave this field empty if you\'re human:', 'mailchimp-for-wp' ) . ' ' . '<input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off" /></label>';
83
  $hidden_fields .= '<input type="hidden" name="_mc4wp_timestamp" value="'. time() . '" />';
84
  $hidden_fields .= '<input type="hidden" name="_mc4wp_form_id" value="'. esc_attr( $this->form->ID ) .'" />';
85
  $hidden_fields .= '<input type="hidden" name="_mc4wp_form_element_id" value="'. esc_attr( $this->ID ) .'" />';
includes/forms/class-form.php CHANGED
@@ -21,29 +21,42 @@ class MC4WP_Form {
21
  /**
22
  * Get a shared form instance.
23
  *
24
- * @param int|WP_Post $form_id
25
  * @return MC4WP_Form
26
  * @throws Exception
27
  */
28
- public static function get_instance( $form_id = 0 ) {
29
 
30
- if( $form_id instanceof WP_Post ) {
31
- $form_id = $form_id->ID;
32
  } else {
33
- $form_id = (int) $form_id;
34
 
35
- if( empty( $form_id ) ) {
36
- $form_id = (int) get_option( 'mc4wp_default_form_id', 0 );
37
  }
38
  }
39
 
40
- if( isset( self::$instances[ $form_id ] ) ) {
41
- return self::$instances[ $form_id ];
42
  }
43
 
44
- $form = new MC4WP_Form( $form_id );
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- self::$instances[ $form_id ] = $form;
 
47
 
48
  return $form;
49
  }
@@ -122,18 +135,13 @@ class MC4WP_Form {
122
 
123
  /**
124
  * @param int $id The post ID
125
- * @throws Exception
 
126
  */
127
- public function __construct( $id ) {
128
  $this->ID = $id = (int) $id;
129
- $this->post = $post = get_post( $this->ID );
130
- $this->post_meta = get_post_meta( $this->ID );
131
-
132
- if( ! is_object( $post ) || ! isset( $post->post_type ) || $post->post_type !== 'mc4wp-form' ) {
133
- $message = sprintf( __( 'There is no form with ID %d, perhaps it was deleted?', 'mailchimp-for-wp' ), $id );
134
- throw new Exception( $message );
135
- }
136
-
137
  $this->name = $post->post_title;
138
  $this->content = $post->post_content;
139
  $this->settings = $this->load_settings();
21
  /**
22
  * Get a shared form instance.
23
  *
24
+ * @param WP_Post|int $post Post instance or post ID.
25
  * @return MC4WP_Form
26
  * @throws Exception
27
  */
28
+ public static function get_instance( $post = 0 ) {
29
 
30
+ if( $post instanceof WP_Post ) {
31
+ $post_id = $post->ID;
32
  } else {
33
+ $post_id = (int) $post;
34
 
35
+ if( empty( $post_id ) ) {
36
+ $post_id = (int) get_option( 'mc4wp_default_form_id', 0 );
37
  }
38
  }
39
 
40
+ if( isset( self::$instances[ $post_id ] ) ) {
41
+ return self::$instances[ $post_id ];
42
  }
43
 
44
+ // get post object if we don't have it by now
45
+ if( ! $post instanceof WP_Post ) {
46
+ $post = get_post( $post_id );
47
+ }
48
+
49
+ // check post object
50
+ if( ! is_object( $post ) || ! isset( $post->post_type ) || $post->post_type !== 'mc4wp-form' ) {
51
+ $message = sprintf( __( 'There is no form with ID %d, perhaps it was deleted?', 'mailchimp-for-wp' ), $post_id );
52
+ throw new Exception( $message );
53
+ }
54
+
55
+ $post_meta = get_post_meta( $post_id );
56
+ $form = new MC4WP_Form( $post_id, $post, $post_meta );
57
 
58
+ // store instance
59
+ self::$instances[ $post_id ] = $form;
60
 
61
  return $form;
62
  }
135
 
136
  /**
137
  * @param int $id The post ID
138
+ * @param WP_Post $post
139
+ * @param array $post_meta
140
  */
141
+ public function __construct( $id, $post, $post_meta = array() ) {
142
  $this->ID = $id = (int) $id;
143
+ $this->post = $post;
144
+ $this->post_meta = $post_meta;
 
 
 
 
 
 
145
  $this->name = $post->post_title;
146
  $this->content = $post->post_content;
147
  $this->settings = $this->load_settings();
includes/forms/functions.php CHANGED
@@ -10,7 +10,7 @@
10
  * @return MC4WP_Form
11
  */
12
  function mc4wp_get_form( $form_id = 0 ) {
13
- return MC4WP_Form::get_instance( $form_id );
14
  }
15
 
16
  /**
@@ -24,15 +24,25 @@ function mc4wp_get_form( $form_id = 0 ) {
24
  * @return MC4WP_Form[]
25
  */
26
  function mc4wp_get_forms( array $args = array() ) {
27
- $default_args = array(
28
- 'post_status' => 'publish',
29
- 'numberposts' => -1,
30
- );
31
- $args = array_merge( $default_args, $args );
32
- $args['post_type'] = 'mc4wp-form';
33
- $forms = get_posts( $args );
34
- $forms = array_map( 'mc4wp_get_form', $forms );
35
- return $forms;
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
  /**
@@ -47,9 +57,9 @@ function mc4wp_get_forms( array $args = array() ) {
47
  * @return string
48
  */
49
  function mc4wp_show_form( $form_id = 0, $config = array(), $echo = true ) {
50
- /** @var MC4WP_Form_Manager $forms */
51
- $forms = mc4wp('forms');
52
- return $forms->output_form( $form_id, $config, $echo );
53
  }
54
 
55
  /**
@@ -67,18 +77,18 @@ function mc4wp_show_form( $form_id = 0, $config = array(), $echo = true ) {
67
  */
68
  function mc4wp_form_is_submitted( $form_id = 0, $element_id = null ) {
69
 
70
- try {
71
- $form = mc4wp_get_form( $form_id );
72
- } catch( Exception $e ) {
73
- return false;
74
- }
75
 
76
- if( $element_id ) {
77
- $form_element = new MC4WP_Form_Element( $form, array( 'element_id' => $element_id ) );
78
- return $form_element->is_submitted;
79
- }
80
 
81
- return $form->is_submitted;
82
  }
83
 
84
  /**
@@ -93,13 +103,13 @@ function mc4wp_form_is_submitted( $form_id = 0, $element_id = null ) {
93
  */
94
  function mc4wp_form_get_response_html( $form_id = 0 ) {
95
 
96
- try {
97
- $form = mc4wp_get_form( $form_id );
98
- } catch( Exception $e ) {
99
- return '';
100
- }
101
 
102
- return $form->get_response_html();
103
  }
104
 
105
  /**
@@ -110,5 +120,5 @@ function mc4wp_form_get_response_html( $form_id = 0 ) {
110
  * @return MC4WP_Form|null
111
  */
112
  function mc4wp_get_submitted_form() {
113
- return mc4wp('forms')->get_submitted_form();
114
  }
10
  * @return MC4WP_Form
11
  */
12
  function mc4wp_get_form( $form_id = 0 ) {
13
+ return MC4WP_Form::get_instance( $form_id );
14
  }
15
 
16
  /**
24
  * @return MC4WP_Form[]
25
  */
26
  function mc4wp_get_forms( array $args = array() ) {
27
+ $default_args = array(
28
+ 'post_status' => 'publish',
29
+ 'numberposts' => -1,
30
+ );
31
+ $args = array_merge( $default_args, $args );
32
+ $args['post_type'] = 'mc4wp-form';
33
+ $posts = get_posts( $args );
34
+ $forms = array();
35
+
36
+ foreach( $posts as $post ) {
37
+ try {
38
+ $form = mc4wp_get_form( $post );
39
+ } catch( Exception $e ) {
40
+ continue;
41
+ }
42
+
43
+ $forms[] = $form;
44
+ }
45
+ return $forms;
46
  }
47
 
48
  /**
57
  * @return string
58
  */
59
  function mc4wp_show_form( $form_id = 0, $config = array(), $echo = true ) {
60
+ /** @var MC4WP_Form_Manager $forms */
61
+ $forms = mc4wp('forms');
62
+ return $forms->output_form( $form_id, $config, $echo );
63
  }
64
 
65
  /**
77
  */
78
  function mc4wp_form_is_submitted( $form_id = 0, $element_id = null ) {
79
 
80
+ try {
81
+ $form = mc4wp_get_form( $form_id );
82
+ } catch( Exception $e ) {
83
+ return false;
84
+ }
85
 
86
+ if( $element_id ) {
87
+ $form_element = new MC4WP_Form_Element( $form, array( 'element_id' => $element_id ) );
88
+ return $form_element->is_submitted;
89
+ }
90
 
91
+ return $form->is_submitted;
92
  }
93
 
94
  /**
103
  */
104
  function mc4wp_form_get_response_html( $form_id = 0 ) {
105
 
106
+ try {
107
+ $form = mc4wp_get_form( $form_id );
108
+ } catch( Exception $e ) {
109
+ return '';
110
+ }
111
 
112
+ return $form->get_response_html();
113
  }
114
 
115
  /**
120
  * @return MC4WP_Form|null
121
  */
122
  function mc4wp_get_submitted_form() {
123
+ return mc4wp('forms')->get_submitted_form();
124
  }
integrations/ninja-forms/bootstrap.php CHANGED
@@ -2,15 +2,14 @@
2
 
3
  mc4wp_register_integration( 'ninja-forms', 'MC4WP_Ninja_Forms_Integration', true );
4
 
5
- function _mc4wp_ninja_forms_register_field( $fields ) {
6
- $fields['mc4wp_optin'] = new MC4WP_Ninja_Forms_Field();
7
- return $fields;
8
- }
9
 
10
- function _mc4wp_ninja_forms_register_action( $actions ) {
11
- $actions['mc4wp_subscribe'] = new MC4WP_Ninja_Forms_Action();
12
- return $actions;
13
- }
14
 
15
- add_filter( 'ninja_forms_register_fields', '_mc4wp_ninja_forms_register_field' );
16
- add_filter( 'ninja_forms_register_actions', '_mc4wp_ninja_forms_register_action' );
 
 
2
 
3
  mc4wp_register_integration( 'ninja-forms', 'MC4WP_Ninja_Forms_Integration', true );
4
 
5
+ if( class_exists( 'Ninja_Forms' ) && method_exists( 'Ninja_Forms', 'instance' ) ) {
6
+ $ninja_forms = Ninja_Forms::instance();
 
 
7
 
8
+ if( isset( $ninja_forms->fields ) ) {
9
+ $ninja_forms->fields['mc4wp_optin'] = new MC4WP_Ninja_Forms_Field();
10
+ }
 
11
 
12
+ if( isset( $ninja_forms->actions ) ) {
13
+ $ninja_forms->actions['mc4wp_subscribe'] = new MC4WP_Ninja_Forms_Action();
14
+ }
15
+ }
integrations/wpforms/class-field.php CHANGED
@@ -1,330 +1,277 @@
1
  <?php
2
 
3
- if( class_exists( 'WPForms_Field' ) ) {
 
 
 
 
 
 
 
 
 
 
4
 
 
 
 
 
5
 
6
  /**
7
- * Checkbox field.
8
  *
9
- * @package WPForms
10
- * @author WPForms
11
- * @since 1.0.0
12
- * @license GPL-2.0+
13
- * @copyright Copyright (c) 2016, WPForms LLC
14
  */
15
- class MC4WP_WPForms_Field extends WPForms_Field
16
  {
17
 
18
- /**
19
- * @var MC4WP_MailChimp
20
- */
21
- private $mailchimp;
22
-
23
- /**
24
- * Primary class constructor.
25
- *
26
- * @since 1.0.0
27
- */
28
- public function init()
29
- {
30
-
31
- // Define field type information
32
- $this->name = 'MailChimp';
33
- $this->type = 'mailchimp';
34
- $this->icon = 'fa-envelope-o';
35
- $this->order = 21;
36
- $this->defaults = array(
37
- 0 => array(
38
- 'label' => __('Sign-up to our newsletter?', 'mailchimp-for-wp'),
39
- 'value' => '1',
40
- 'default' => '',
41
- )
42
- );
43
- }
44
-
45
- /**
46
- * Field options panel inside the builder.
47
- *
48
- * @since 1.0.0
49
- * @param array $field
50
- */
51
- public function field_options($field)
52
- {
53
 
54
- //--------------------------------------------------------------------//
55
- // Basic field options
56
- //--------------------------------------------------------------------//
 
 
 
 
 
57
 
58
- // Options open markup
59
- $this->field_option('basic-options', $field, array('markup' => 'open'));
 
60
 
61
- // MailChimp list
62
- $this->field_option_mailchimp_list($field);
63
 
64
- // Choices
65
- $this->field_option_choices($field);
66
 
67
- // Description
68
- $this->field_option('description', $field);
69
 
70
- // Required toggle
71
- $this->field_option('required', $field);
72
 
73
- // Options close markup
74
- $this->field_option('basic-options', $field, array('markup' => 'close'));
75
 
76
- //--------------------------------------------------------------------//
77
- // Advanced field options
78
- //--------------------------------------------------------------------//
79
 
80
- // Options open markup
81
- $this->field_option('advanced-options', $field, array('markup' => 'open'));
 
82
 
83
- // Custom CSS classes
84
- $this->field_option('css', $field);
85
 
86
- // Options close markup
87
- $this->field_option('advanced-options', $field, array('markup' => 'close'));
88
- }
89
 
90
- private function field_option_mailchimp_list($field)
91
- {
92
- $mailchimp = new MC4WP_MailChimp();
93
-
94
- // Field option label
95
- $tooltip = __('Select the MailChimp list to subscribe to.', 'mailchimp-for-wp');
96
- $option_label = $this->field_element(
97
- 'label',
98
- $field,
99
- array(
100
- 'slug' => 'mailchimp-list',
101
- 'value' => __('MailChimp list', 'mailchimp-for-wp'),
102
- 'tooltip' => $tooltip,
103
- ),
104
- false
105
- );
106
-
107
- $option_select = sprintf('<select name="fields[%s][mailchimp_list]" data-field-id="%d" data-field-type="%s">', $field['id'], $field['id'], $this->type);
108
- $lists = $mailchimp->get_cached_lists();
109
- foreach ($lists as $list) {
110
- $option_select .= sprintf('<option value="%s" %s>%s</option>', $list->id, selected($list->id, $field['mailchimp_list'], false), $list->name);
111
- }
112
- $option_select .= '</select>';
113
-
114
-
115
- // Field option row (markup) including label and input.
116
- $output = $this->field_element(
117
- 'row',
118
- $field,
119
- array(
120
- 'slug' => 'mailchimp-list',
121
- 'content' => $option_label . $option_select,
122
- )
123
- );
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
 
126
 
127
- private function field_option_choices($field)
128
- {
129
- $tooltip = __('Set your sign-up label text and whether it should be pre-checked.', 'mailchimp-for-wp');
130
- $values = !empty($field['choices']) ? $field['choices'] : $this->defaults;
131
- $class = !empty($field['show_values']) && $field['show_values'] == '1' ? 'show-values' : '';
132
- $class .= !empty($dynamic) ? ' wpforms-hidden' : '';
133
-
134
- // Field option label
135
- $option_label = $this->field_element(
136
- 'label',
137
- $field,
138
- array(
139
- 'slug' => 'mailchimp-checkbox',
140
- 'value' => __('Sign-up checkbox', 'mailchimp-for-wp'),
141
- 'tooltip' => $tooltip,
142
- ),
143
- false
144
- );
145
 
146
- // Field option choices inputs
147
- $option_choices = sprintf('<ul class="choices-list %s" data-field-id="%d" data-field-type="%s">', $class, $field['id'], $this->type);
148
- foreach ($values as $key => $value) {
149
- $default = !empty($value['default']) ? $value['default'] : '';
150
- $option_choices .= sprintf('<li data-key="%d">', $key);
151
- $option_choices .= sprintf('<input type="checkbox" name="fields[%s][choices][%s][default]" class="default" value="1" %s>', $field['id'], $key, checked('1', $default, false));
152
- $option_choices .= sprintf('<input type="text" name="fields[%s][choices][%s][label]" value="%s" class="label">', $field['id'], $key, esc_attr($value['label']));
153
- $option_choices .= sprintf('<input type="text" name="fields[%s][choices][%s][value]" value="%s" class="value">', $field['id'], $key, esc_attr($value['value']));
154
- $option_choices .= '</li>';
155
- }
156
- $option_choices .= '</ul>';
157
-
158
- // Field option row (markup) including label and input.
159
- $output = $this->field_element(
160
- 'row',
161
- $field,
162
- array(
163
- 'slug' => 'choices',
164
- 'content' => $option_label . $option_choices,
165
- )
166
- );
167
- }
168
-
169
- /**
170
- * Field preview inside the builder.
171
- *
172
- * @since 1.0.0
173
- * @param array $field
174
- */
175
- public function field_preview($field)
176
- {
177
- $values = !empty($field['choices']) ? $field['choices'] : $this->defaults;
178
 
179
- // Field checkbox elements
180
- echo '<ul class="primary-input">';
181
 
182
- // Notify if currently empty
183
- if (empty($values)) {
184
- $values = array('label' => __('(empty)', 'wpforms'));
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
- // Individual checkbox options
188
- foreach ($values as $key => $value) {
 
 
 
 
 
 
 
189
 
190
- $default = isset($value['default']) ? $value['default'] : '';
191
- $selected = checked('1', $default, false);
192
 
193
- printf('<li><input type="checkbox" %s disabled>%s</li>', $selected, $value['label']);
194
- }
 
 
195
 
196
- echo '</ul>';
 
197
 
198
- // Dynamic population is enabled and contains more than 20 items
199
- if (isset($total) && $total > 20) {
200
- echo '<div class="wpforms-alert-dynamic wpforms-alert wpforms-alert-warning">';
201
- printf(__('Showing the first 20 choices.<br> All %d choices will be displayed when viewing the form.', 'wpforms'), absint($total));
202
- echo '</div>';
203
- }
204
 
205
- // Description
206
- $this->field_preview_option('description', $field);
207
  }
208
 
209
- /**
210
- * Field display on the form front-end.
211
- *
212
- * @since 1.0.0
213
- * @param array $field
214
- * @param array $form_data
215
- */
216
- public function field_display($field, $field_atts, $form_data)
217
- {
218
-
219
- // Setup and sanitize the necessary data
220
- $field_required = !empty($field['required']) ? ' required' : '';
221
- $field_class = implode(' ', array_map('sanitize_html_class', $field_atts['input_class']));
222
- $field_id = implode(' ', array_map('sanitize_html_class', $field_atts['input_id']));
223
- $form_id = $form_data['id'];
224
- $choices = $field['choices'];
225
 
 
 
 
 
 
 
226
 
227
- // List
228
- printf('<ul id="%s" class="%s">', $field_id, $field_class);
 
229
 
230
- foreach ($choices as $key => $choice) {
 
 
 
 
 
 
 
 
231
 
232
- $selected = isset($choice['default']) ? '1' : '0';
233
- $depth = isset($choice['depth']) ? absint($choice['depth']) : 1;
 
 
 
 
234
 
235
- printf('<li class="choice-%d depth-%d">', $key, $depth);
236
 
237
- // Checkbox elements
238
- printf('<input type="checkbox" id="wpforms-%d-field_%d_%d" name="wpforms[fields][%d]" value="%s" %s %s>',
239
- $form_id,
240
- $field['id'],
241
- $key,
242
- $field['id'],
243
- esc_attr($choice['value']),
244
- checked('1', $selected, false),
245
- $field_required
246
- );
247
 
248
- printf('<label class="wpforms-field-label-inline" for="wpforms-%d-field_%d_%d">%s</label>', $form_id, $field['id'], $key, wp_kses_post($choice['label']));
249
 
250
- echo '</li>';
251
- }
252
 
253
- echo '</ul>';
254
- }
255
 
256
- /**
257
- * Formats and sanitizes field.
258
- *
259
- * @since 1.0.2
260
- * @param int $field_id
261
- * @param array $field_submit
262
- * @param array $form_data
263
- */
264
- public function format($field_id, $field_submit, $form_data)
265
- {
266
-
267
- $field = $form_data['fields'][$field_id];
268
- $choice = array_pop($field['choices']);
269
- $name = sanitize_text_field($choice['label']);
270
-
271
- $data = array(
272
- 'name' => $name,
273
- 'value' => empty($field_submit) ? __('No') : __('Yes'),
274
- 'value_raw' => $field_submit,
275
- 'id' => absint($field_id),
276
- 'type' => $this->type,
277
  );
278
 
 
279
 
280
- // Push field details to be saved
281
- wpforms()->process->fields[$field_id] = $data;
282
-
283
- // Subscribe to MailChimp
284
- if (!empty($field_submit)) {
285
- $this->subscribe($field, $form_data, $_POST['wpforms']);
286
- }
287
-
288
  }
289
 
290
- /**
291
- * @param $field
292
- * @param $form
293
- * @param $data
294
- */
295
- private function subscribe($field, $form, $data)
296
- {
297
- $mailchimp = new MC4WP_MailChimp();
298
-
299
- // get id of email field
300
- foreach ($form['fields'] as $form_field) {
301
- if ($form_field['type'] === 'email') {
302
- $email_field_id = $form_field['id'];
303
- break;
304
- }
305
- }
306
-
307
- if (empty($email_field_id) || empty($data['fields'][$email_field_id])) {
308
- return;
309
- }
310
-
311
- $email_address = $data['fields'][$email_field_id];
312
- $mailchimp_list_id = $field['mailchimp_list'];
313
-
314
- $success = $mailchimp->list_subscribe($mailchimp_list_id, $email_address);
315
- $log = mc4wp('log');
316
-
317
- if ($success) {
318
- $log->info(sprintf('%s > Successfully subscribed %s', 'WPForms', $email_address));
319
- } else {
320
- // log error
321
- if ($mailchimp->get_error_code() == 214) {
322
- $log->warning(sprintf("%s > %s is already subscribed to the selected list(s)", 'WPForms', $email_address));
323
- } else {
324
- $log->error(sprintf('%s > MailChimp API Error: %s', 'WPForms', $mailchimp->get_error_message()));
325
- }
326
- }
327
- }
328
  }
329
 
330
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ /**
4
+ * Checkbox field.
5
+ *
6
+ * @package WPForms
7
+ * @author WPForms
8
+ * @since 1.0.0
9
+ * @license GPL-2.0+
10
+ * @copyright Copyright (c) 2016, WPForms LLC
11
+ */
12
+ class MC4WP_WPForms_Field extends WPForms_Field
13
+ {
14
 
15
+ /**
16
+ * @var MC4WP_MailChimp
17
+ */
18
+ private $mailchimp;
19
 
20
  /**
21
+ * Primary class constructor.
22
  *
23
+ * @since 1.0.0
 
 
 
 
24
  */
25
+ public function init()
26
  {
27
 
28
+ // Define field type information
29
+ $this->name = 'MailChimp';
30
+ $this->type = 'mailchimp';
31
+ $this->icon = 'fa-envelope-o';
32
+ $this->order = 21;
33
+ $this->defaults = array(
34
+ 0 => array(
35
+ 'label' => __('Sign-up to our newsletter?', 'mailchimp-for-wp'),
36
+ 'value' => '1',
37
+ 'default' => '',
38
+ )
39
+ );
40
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
+ /**
43
+ * Field options panel inside the builder.
44
+ *
45
+ * @since 1.0.0
46
+ * @param array $field
47
+ */
48
+ public function field_options($field)
49
+ {
50
 
51
+ //--------------------------------------------------------------------//
52
+ // Basic field options
53
+ //--------------------------------------------------------------------//
54
 
55
+ // Options open markup
56
+ $this->field_option('basic-options', $field, array('markup' => 'open'));
57
 
58
+ // MailChimp list
59
+ $this->field_option_mailchimp_list($field);
60
 
61
+ // Choices
62
+ $this->field_option_choices($field);
63
 
64
+ // Description
65
+ $this->field_option('description', $field);
66
 
67
+ // Required toggle
68
+ $this->field_option('required', $field);
69
 
70
+ // Options close markup
71
+ $this->field_option('basic-options', $field, array('markup' => 'close'));
 
72
 
73
+ //--------------------------------------------------------------------//
74
+ // Advanced field options
75
+ //--------------------------------------------------------------------//
76
 
77
+ // Options open markup
78
+ $this->field_option('advanced-options', $field, array('markup' => 'open'));
79
 
80
+ // Custom CSS classes
81
+ $this->field_option('css', $field);
 
82
 
83
+ // Options close markup
84
+ $this->field_option('advanced-options', $field, array('markup' => 'close'));
85
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
+ private function field_option_mailchimp_list($field)
88
+ {
89
+ $mailchimp = new MC4WP_MailChimp();
90
+
91
+ // Field option label
92
+ $tooltip = __('Select the MailChimp list to subscribe to.', 'mailchimp-for-wp');
93
+ $option_label = $this->field_element(
94
+ 'label',
95
+ $field,
96
+ array(
97
+ 'slug' => 'mailchimp-list',
98
+ 'value' => __('MailChimp list', 'mailchimp-for-wp'),
99
+ 'tooltip' => $tooltip,
100
+ ),
101
+ false
102
+ );
103
+
104
+ $option_select = sprintf('<select name="fields[%s][mailchimp_list]" data-field-id="%d" data-field-type="%s">', $field['id'], $field['id'], $this->type);
105
+ $lists = $mailchimp->get_cached_lists();
106
+ foreach ($lists as $list) {
107
+ $option_select .= sprintf('<option value="%s" %s>%s</option>', $list->id, selected($list->id, $field['mailchimp_list'], false), $list->name);
108
  }
109
+ $option_select .= '</select>';
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ // Field option row (markup) including label and input.
113
+ $output = $this->field_element(
114
+ 'row',
115
+ $field,
116
+ array(
117
+ 'slug' => 'mailchimp-list',
118
+ 'content' => $option_label . $option_select,
119
+ )
120
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
+ }
 
123
 
124
+ private function field_option_choices($field)
125
+ {
126
+ $tooltip = __('Set your sign-up label text and whether it should be pre-checked.', 'mailchimp-for-wp');
127
+ $values = !empty($field['choices']) ? $field['choices'] : $this->defaults;
128
+ $class = !empty($field['show_values']) && $field['show_values'] == '1' ? 'show-values' : '';
129
+ $class .= !empty($dynamic) ? ' wpforms-hidden' : '';
130
+
131
+ // Field option label
132
+ $option_label = $this->field_element(
133
+ 'label',
134
+ $field,
135
+ array(
136
+ 'slug' => 'mailchimp-checkbox',
137
+ 'value' => __('Sign-up checkbox', 'mailchimp-for-wp'),
138
+ 'tooltip' => $tooltip,
139
+ ),
140
+ false
141
+ );
142
+
143
+ // Field option choices inputs
144
+ $option_choices = sprintf('<ul class="choices-list %s" data-field-id="%d" data-field-type="%s">', $class, $field['id'], $this->type);
145
+ foreach ($values as $key => $value) {
146
+ $default = !empty($value['default']) ? $value['default'] : '';
147
+ $option_choices .= sprintf('<li data-key="%d">', $key);
148
+ $option_choices .= sprintf('<input type="checkbox" name="fields[%s][choices][%s][default]" class="default" value="1" %s>', $field['id'], $key, checked('1', $default, false));
149
+ $option_choices .= sprintf('<input type="text" name="fields[%s][choices][%s][label]" value="%s" class="label">', $field['id'], $key, esc_attr($value['label']));
150
+ $option_choices .= sprintf('<input type="text" name="fields[%s][choices][%s][value]" value="%s" class="value">', $field['id'], $key, esc_attr($value['value']));
151
+ $option_choices .= '</li>';
152
+ }
153
+ $option_choices .= '</ul>';
154
+
155
+ // Field option row (markup) including label and input.
156
+ $output = $this->field_element(
157
+ 'row',
158
+ $field,
159
+ array(
160
+ 'slug' => 'choices',
161
+ 'content' => $option_label . $option_choices,
162
+ )
163
+ );
164
+ }
165
 
166
+ /**
167
+ * Field preview inside the builder.
168
+ *
169
+ * @since 1.0.0
170
+ * @param array $field
171
+ */
172
+ public function field_preview($field)
173
+ {
174
+ $values = !empty($field['choices']) ? $field['choices'] : $this->defaults;
175
 
176
+ // Field checkbox elements
177
+ echo '<ul class="primary-input">';
178
 
179
+ // Notify if currently empty
180
+ if (empty($values)) {
181
+ $values = array('label' => __('(empty)', 'wpforms'));
182
+ }
183
 
184
+ // Individual checkbox options
185
+ foreach ($values as $key => $value) {
186
 
187
+ $default = isset($value['default']) ? $value['default'] : '';
188
+ $selected = checked('1', $default, false);
 
 
 
 
189
 
190
+ printf('<li><input type="checkbox" %s disabled>%s</li>', $selected, $value['label']);
 
191
  }
192
 
193
+ echo '</ul>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
 
195
+ // Dynamic population is enabled and contains more than 20 items
196
+ if (isset($total) && $total > 20) {
197
+ echo '<div class="wpforms-alert-dynamic wpforms-alert wpforms-alert-warning">';
198
+ printf(__('Showing the first 20 choices.<br> All %d choices will be displayed when viewing the form.', 'wpforms'), absint($total));
199
+ echo '</div>';
200
+ }
201
 
202
+ // Description
203
+ $this->field_preview_option('description', $field);
204
+ }
205
 
206
+ /**
207
+ * Field display on the form front-end.
208
+ *
209
+ * @since 1.0.0
210
+ * @param array $field
211
+ * @param array $form_data
212
+ */
213
+ public function field_display($field, $field_atts, $form_data)
214
+ {
215
 
216
+ // Setup and sanitize the necessary data
217
+ $field_required = !empty($field['required']) ? ' required' : '';
218
+ $field_class = implode(' ', array_map('sanitize_html_class', $field_atts['input_class']));
219
+ $field_id = implode(' ', array_map('sanitize_html_class', $field_atts['input_id']));
220
+ $form_id = $form_data['id'];
221
+ $choices = $field['choices'];
222
 
 
223
 
224
+ // List
225
+ printf('<ul id="%s" class="%s">', $field_id, $field_class);
 
 
 
 
 
 
 
 
226
 
227
+ foreach ($choices as $key => $choice) {
228
 
229
+ $selected = isset($choice['default']) ? '1' : '0';
230
+ $depth = isset($choice['depth']) ? absint($choice['depth']) : 1;
231
 
232
+ printf('<li class="choice-%d depth-%d">', $key, $depth);
 
233
 
234
+ // Checkbox elements
235
+ printf('<input type="checkbox" id="wpforms-%d-field_%d_%d" name="wpforms[fields][%d]" value="%s" %s %s>',
236
+ $form_id,
237
+ $field['id'],
238
+ $key,
239
+ $field['id'],
240
+ esc_attr($choice['value']),
241
+ checked('1', $selected, false),
242
+ $field_required
 
 
 
 
 
 
 
 
 
 
 
 
243
  );
244
 
245
+ printf('<label class="wpforms-field-label-inline" for="wpforms-%d-field_%d_%d">%s</label>', $form_id, $field['id'], $key, wp_kses_post($choice['label']));
246
 
247
+ echo '</li>';
 
 
 
 
 
 
 
248
  }
249
 
250
+ echo '</ul>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
252
 
253
+ /**
254
+ * Formats and sanitizes field.
255
+ *
256
+ * @since 1.0.2
257
+ * @param int $field_id
258
+ * @param array $field_submit
259
+ * @param array $form_data
260
+ */
261
+ public function format($field_id, $field_submit, $form_data)
262
+ {
263
+ $field = $form_data['fields'][$field_id];
264
+ $choice = array_pop($field['choices']);
265
+ $name = sanitize_text_field($choice['label']);
266
+
267
+ $data = array(
268
+ 'name' => $name,
269
+ 'value' => empty($field_submit) ? __('No') : __('Yes'),
270
+ 'value_raw' => $field_submit,
271
+ 'id' => absint($field_id),
272
+ 'type' => $this->type,
273
+ );
274
+
275
+ wpforms()->process->fields[$field_id] = $data;
276
+ }
277
+ }
integrations/wpforms/class-wpforms.php CHANGED
@@ -23,7 +23,9 @@ class MC4WP_WPForms_Integration extends MC4WP_Integration {
23
  /**
24
  * Add hooks
25
  */
26
- public function add_hooks() {}
 
 
27
 
28
  /**
29
  * @return bool
@@ -40,4 +42,30 @@ class MC4WP_WPForms_Integration extends MC4WP_Integration {
40
  return array();
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  }
23
  /**
24
  * Add hooks
25
  */
26
+ public function add_hooks() {
27
+ add_action( 'wpforms_process', array( $this, 'listen_to_wpforms' ), 20, 3 );
28
+ }
29
 
30
  /**
31
  * @return bool
42
  return array();
43
  }
44
 
45
+ public function listen_to_wpforms( $fields, $entry, $form_data ) {
46
+
47
+ foreach( $fields as $field_id => $field ) {
48
+ if( $field['type'] === 'mailchimp' && $field['value_raw'] == 1 ) {
49
+ return $this->subscribe_from_wpforms( $field_id, $fields, $form_data );
50
+ }
51
+ }
52
+ }
53
+
54
+ public function subscribe_from_wpforms( $checkbox_field_id, $fields, $form_data ) {
55
+ foreach( $fields as $field ) {
56
+ if( $field['type'] === 'email' ) {
57
+ $email_address = $field['value'];
58
+ }
59
+ }
60
+
61
+
62
+
63
+ $mailchimp_list_id = $form_data['fields'][$checkbox_field_id]['mailchimp_list'];
64
+ $this->options['lists'] = array( $mailchimp_list_id );
65
+
66
+ if( ! empty( $email_address ) ) {
67
+ return $this->subscribe( array( 'EMAIL' => $email_address ), $form_data['id'] );
68
+ }
69
+ }
70
+
71
  }
languages/mailchimp-for-wp-sl_SI.mo CHANGED
Binary file
languages/mailchimp-for-wp-sl_SI.po CHANGED
@@ -1,75 +1,29 @@
1
- # Copyright (C) 2015 MailChimp for WordPress
2
- # This file is distributed under the same license as the MailChimp for WordPress package.
3
  # Translators:
4
  # Andraž Poje <andraz.poje@gmail.com>, 2015
 
5
  # teja <teja.cetinski@gmail.com>, 2016
6
  # Tine, 2017
7
  # Tine, 2017
8
  msgid ""
9
  msgstr ""
10
  "Project-Id-Version: MailChimp for WordPress\n"
11
- "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mailchimp-for-wp\n"
12
- "POT-Creation-Date: 2015-11-30 10:15:18+00:00\n"
13
- "PO-Revision-Date: 2017-02-05 13:13+0000\n"
14
- "Last-Translator: Tine\n"
15
  "Language-Team: Slovenian (Slovenia) (http://www.transifex.com/ibericode/mailchimp-for-wordpress/language/sl_SI/)\n"
16
  "MIME-Version: 1.0\n"
17
  "Content-Type: text/plain; charset=UTF-8\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
  "Language: sl_SI\n"
20
  "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
 
 
 
 
 
21
 
22
- #: config/default-form-content.php:3
23
- msgid "Email address"
24
- msgstr "E-naslov"
25
-
26
- #: config/default-form-content.php:4
27
- msgid "Your email address"
28
- msgstr "Vaš e-naslov"
29
-
30
- #: config/default-form-content.php:5
31
- msgid "Sign up"
32
- msgstr "Prijava"
33
-
34
- #: config/default-form-messages.php:5
35
- msgid ""
36
- "Thank you, your sign-up request was successful! Please check your email "
37
- "inbox to confirm."
38
- msgstr "Hvala, vaša prijava je uspela! Prosimo, preverite vaš nabiralnik za potrditev."
39
-
40
- #: config/default-form-messages.php:9
41
- msgid "Oops. Something went wrong. Please try again later."
42
- msgstr "Oops. Nekaj je šlo narobe. Prosimo poskusite kasneje."
43
-
44
- #: config/default-form-messages.php:13
45
- msgid "Please provide a valid email address."
46
- msgstr "Vnesite veljaven e-naslov."
47
-
48
- #: config/default-form-messages.php:17
49
- msgid "Given email address is already subscribed, thank you!"
50
- msgstr "Vpisani e-naslov je že naročen, hvala!"
51
-
52
- #: config/default-form-messages.php:21
53
- msgid "Please fill in the required fields."
54
- msgstr "Izpolnite zahtevana polja."
55
-
56
- #: config/default-form-messages.php:25
57
- msgid "You were successfully unsubscribed."
58
- msgstr "Uspešno ste se naročili."
59
-
60
- #: config/default-form-messages.php:29
61
- msgid "Given email address is not subscribed."
62
- msgstr "Vpisani e-naslov ni naročen."
63
-
64
- #: config/default-form-messages.php:33
65
- msgid "Please select at least one list."
66
- msgstr "Izberite vsaj en seznam."
67
-
68
- #: config/default-integration-options.php:5
69
- msgid "Sign me up for the newsletter!"
70
- msgstr "Prijavi me na novice!"
71
-
72
- #: includes/admin/class-admin-texts.php:62
73
  #: includes/forms/views/edit-form.php:6
74
  msgid "Settings"
75
  msgstr "Nastavitve"
@@ -78,141 +32,388 @@ msgstr "Nastavitve"
78
  msgid "Documentation"
79
  msgstr "Dokumentacija"
80
 
81
- #: includes/admin/class-admin.php:167
82
  msgid ""
83
  "Success! The cached configuration for your MailChimp lists has been renewed."
84
  msgstr "Uspeh! Predpomnjena konfiguracija Mailchimp list je prenovljena."
85
 
86
- #: includes/admin/class-admin.php:257
87
  msgid ""
88
  "This is a pro-only feature. Please upgrade to the premium version to be able"
89
  " to use it."
90
  msgstr "To je ekskluzivna funkcija. Prosimo nadgradite v plačljivo verzijo, da jo lahko uporabite."
91
 
92
- #: includes/admin/class-admin.php:323 includes/views/general-settings.php:28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  msgid "MailChimp API Settings"
94
  msgstr "Nastavitve MailChimp API-ja"
95
 
96
- #: includes/admin/class-admin.php:324
97
- #: integrations/ninja-forms/class-ninja-forms.php:34
98
  msgid "MailChimp"
99
  msgstr "MailChimp"
100
 
101
- #: includes/admin/class-ads.php:33
102
- msgid "Upgrade to MailChimp for WordPress Pro"
103
- msgstr "Nadgradi na MailChimp za WordPress Pro"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- #: includes/admin/class-ads.php:41
106
  msgid ""
107
- "Enjoying this plugin? <a href=\"%s\">Purchase our bundle of premium "
108
- "features</a> for an even better plugin."
109
- msgstr "Vam je vtičnik všeč? <a href=\"%s\">Kupite naš plačljiv paket funkcij</a> za še boljši vtičnik."
110
 
111
- #: includes/admin/class-ads.php:62
112
  msgid "More subscribers, better newsletters."
113
  msgstr "Več naročnikov, boljše e-novice."
114
 
115
- #: includes/admin/class-ads.php:63
116
  msgid ""
117
  "Learn how to best grow your lists & write better emails by subscribing to "
118
  "our monthly tips."
119
  msgstr "Nauči se kako povečati liste & kreiraj boljše emaile z naročitvijo na naše mesečne nasvete."
120
 
121
- #: includes/admin/class-ads.php:66
122
  msgid "Email Address"
123
  msgstr "E-naslov"
124
 
125
- #: includes/admin/class-ads.php:70
126
  msgid "First Name"
127
  msgstr "Ime"
128
 
129
- #: includes/admin/class-ads.php:77
130
  msgid "Subscribe"
131
  msgstr "Naroči se"
132
 
133
- #: includes/admin/class-usage-tracking.php:57
134
- msgid "Once a month"
135
- msgstr "Enkrat mesečno"
 
 
136
 
137
- #: includes/admin/migrations/3.0-form-1-post-type.php:35
138
- msgid "Default sign-up form"
139
- msgstr "Privzet obrazec za prijavo"
 
 
 
 
 
 
 
 
140
 
141
- #: includes/class-api.php:83
 
 
 
 
 
 
 
 
 
 
142
  msgid "Read more about common connectivity issues."
143
  msgstr "Preberi več o pogostih težavah s povezavo."
144
 
145
- #: includes/forms/class-admin.php:71 includes/forms/class-admin.php:72
146
- #: includes/forms/views/edit-form.php:17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  msgid "Forms"
148
  msgstr "Obrazci"
149
 
150
- #: includes/forms/class-admin.php:101 includes/forms/class-admin.php:176
151
  msgid "<strong>Success!</strong> Form successfully saved."
152
  msgstr "<strong>Uspeh!</strong> Obrazec uspešno shranjen."
153
 
154
- #: includes/forms/class-admin.php:176
155
  msgid "Preview form"
156
  msgstr "Obrazec za predogled"
157
 
158
- #: includes/forms/class-admin.php:279
159
- msgid "Form not found."
160
- msgstr "Obrazec ni bil najden."
161
 
162
- #: includes/forms/class-admin.php:281
163
- msgid "Go back"
164
- msgstr "Nazaj"
165
 
166
- #: includes/forms/class-form-previewer.php:162
167
  msgid "Form preview"
168
  msgstr "Predogled obrazca"
169
 
170
- #: includes/forms/class-form-tags.php:51
171
  msgid "Replaced with the form response (error or success messages)."
172
  msgstr "Nadomeščeno z odzivom obrazca (sporočilo napake ali uspeha)."
173
 
174
- #: includes/forms/class-form-tags.php:56
175
  msgid "Data from the URL or a submitted form."
176
  msgstr "Podatki iz URL-ja ali iz predloženega obrazca."
177
 
178
- #: includes/forms/class-form-tags.php:62
 
 
 
 
179
  #: includes/integrations/class-integration-tags.php:45
180
  msgid "Replaced with the number of subscribers on the selected list(s)"
181
  msgstr "Nadomeščen s številko naročnikov z izbranih list(e)"
182
 
183
- #: includes/forms/class-form-tags.php:67
184
  msgid "The email address of the current visitor (if known)."
185
  msgstr "E-naslov trenutnega obiskovalca (če je znan)."
186
 
187
- #: includes/forms/class-form-tags.php:72
188
  msgid "The URL of the page."
189
  msgstr "URL naslov strani."
190
 
191
- #: includes/forms/class-form-tags.php:77
192
  msgid "The path of the page."
193
  msgstr "Pot strani."
194
 
195
- #: includes/forms/class-form-tags.php:82
196
  msgid "The current date. Example: %s."
197
  msgstr "Trenutni datum. Primer: %s."
198
 
199
- #: includes/forms/class-form-tags.php:87
200
  msgid "The current time. Example: %s."
201
  msgstr "Trenutni čas. Primer: %s."
202
 
203
- #: includes/forms/class-form-tags.php:92
204
  msgid "The site's language. Example: %s."
205
  msgstr "Jezik strani. Primer: %s."
206
 
207
- #: includes/forms/class-form-tags.php:97
208
  msgid "The visitor's IP address. Example: %s."
209
  msgstr "IP naslov obiskovalca. Primer: %s."
210
 
211
- #: includes/forms/class-form-tags.php:102
212
  msgid "The property of the currently logged-in user."
213
  msgstr "Lastnost trenutno prijavljenega uporabnika."
214
 
215
- #: includes/forms/class-form.php:128
 
 
 
 
216
  msgid "There is no form with ID %d, perhaps it was deleted?"
217
  msgstr "Obrazec z ID %d ne obstaja, mogoče je izbrisan?"
218
 
@@ -220,10 +421,6 @@ msgstr "Obrazec z ID %d ne obstaja, mogoče je izbrisan?"
220
  msgid "Newsletter"
221
  msgstr "E-novice"
222
 
223
- #: includes/forms/class-widget.php:30
224
- msgid "MailChimp Sign-Up Form"
225
- msgstr "Mailchimp prijavni obrzec"
226
-
227
  #: includes/forms/class-widget.php:32
228
  msgid "Displays your MailChimp for WordPress sign-up form"
229
  msgstr "Prikaži Mailchimp-ov prijavni obrazec za Wordpress"
@@ -238,7 +435,114 @@ msgid ""
238
  " form settings</a>."
239
  msgstr "Lahko prilagodiš prijavni obrazec v <a href=\"%s\">MailChimp nastavitvah obrazca za Wordpress</a>."
240
 
241
- #: includes/forms/views/add-form.php:10 includes/forms/views/add-form.php:60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  msgid "Add new form"
243
  msgstr "Dodaj nov obrazec"
244
 
@@ -266,38 +570,266 @@ msgstr "Polja"
266
  msgid "Messages"
267
  msgstr "Sporočila"
268
 
269
- #: includes/forms/views/edit-form.php:7
270
- msgid "Appearance"
271
- msgstr "Izgled"