MailChimp for WordPress - Version 4.0.3

Version Description

Download this release

Release Info

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

Code changes from version 4.0.2 to 4.0.3

CHANGELOG.md CHANGED
@@ -1,6 +1,22 @@
1
  Changelog
2
  =========
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  #### 4.0.2 - August 10, 2016
5
 
6
  **Fixes**
1
  Changelog
2
  =========
3
 
4
+ #### 4.0.3 - August 24, 2016
5
+
6
+ **Fixes**
7
+
8
+ - Ninja Forms integration not working when using PayPal integration.
9
+
10
+ **Improvements**
11
+
12
+ - Show connection errors on MailChimp settings page.
13
+
14
+ **Additions**
15
+
16
+ - Add pre-checked option to Ninja Forms integration.
17
+ - You can now conditionally hide fields or elements using the `data-show-if` attribute.
18
+
19
+
20
  #### 4.0.2 - August 10, 2016
21
 
22
  **Fixes**
assets/css/form-themes.css CHANGED
@@ -122,7 +122,6 @@
122
  .mc4wp-form-theme textarea,
123
  .mc4wp-form-theme select {
124
  height: auto;
125
- margin: 0;
126
  padding: 8px 16px;
127
  line-height: 1.428571429;
128
  color: #555555 !important;
@@ -157,7 +156,6 @@
157
  .mc4wp-form-theme button {
158
  display: inline-block;
159
  padding: 8px 16px;
160
- margin: 0;
161
  font-weight: normal;
162
  line-height: 1.428571429;
163
  text-align: center;
@@ -169,6 +167,8 @@
169
  -webkit-user-select: none;
170
  -moz-user-select: none;
171
  user-select: none;
 
 
172
  box-shadow: none;
173
  background: none;
174
  text-shadow: none;
122
  .mc4wp-form-theme textarea,
123
  .mc4wp-form-theme select {
124
  height: auto;
 
125
  padding: 8px 16px;
126
  line-height: 1.428571429;
127
  color: #555555 !important;
156
  .mc4wp-form-theme button {
157
  display: inline-block;
158
  padding: 8px 16px;
 
159
  font-weight: normal;
160
  line-height: 1.428571429;
161
  text-align: center;
167
  -webkit-user-select: none;
168
  -moz-user-select: none;
169
  user-select: none;
170
+ -webkit-box-shadow: none;
171
+ -moz-box-shadow: none;
172
  box-shadow: none;
173
  background: none;
174
  text-shadow: none;
assets/css/form-themes.min.css CHANGED
@@ -1 +1 @@
1
- .mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=text],.mc4wp-form-basic input[type=email],.mc4wp-form-basic input[type=tel],.mc4wp-form-basic input[type=url],.mc4wp-form-basic input[type=date],.mc4wp-form-basic select,.mc4wp-form-basic textarea,.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=url],.mc4wp-form-theme input[type=date],.mc4wp-form-theme select,.mc4wp-form-theme textarea{min-height:32px;width:100%;max-width:480px}.mc4wp-form-basic input[type=number],.mc4wp-form-theme input[type=number]{min-width:40px}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=checkbox],.mc4wp-form-theme input[type=radio]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-theme input[type=checkbox]{-webkit-appearance:checkbox;-moz-appearance:checkbox;appearance:checkbox}.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=radio]{-webkit-appearance:radio;-moz-appearance:radio;appearance:radio}.mc4wp-form-basic button,.mc4wp-form-basic input[type=submit],.mc4wp-form-basic input[type=button],.mc4wp-form-theme button,.mc4wp-form-theme input[type=submit],.mc4wp-form-theme input[type=button]{cursor:pointer;display:inline-block;-webkit-appearance:none;-moz-appearance:none;appearance:none}.mc4wp-form-basic label>span,.mc4wp-form-basic li>label,.mc4wp-form-theme label>span,.mc4wp-form-theme li>label{font-weight:400}.mc4wp-form-basic .mc4wp-alert,.mc4wp-form-theme .mc4wp-alert{color:#c09853;clear:both}.mc4wp-form-basic .mc4wp-success,.mc4wp-form-theme .mc4wp-success{color:#468847}.mc4wp-form-basic .mc4wp-notice,.mc4wp-form-theme .mc4wp-notice{color:#3a87ad}.mc4wp-form-basic .mc4wp-error,.mc4wp-form-theme .mc4wp-error{color:#CD5C5C}.rtl .mc4wp-form-reset input[type=checkbox],.rtl .mc4wp-form-reset input[type=radio]{margin:0 0 0 6px}.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=url],.mc4wp-form-theme input[type=date],.mc4wp-form-theme input[type=number],.mc4wp-form-theme select,.mc4wp-form-theme textarea{height:auto;margin:0;padding:8px 16px;line-height:1.428571429;color:#555!important;vertical-align:middle;background:#fff;border:1px solid #ccc;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);text-shadow:none}.mc4wp-form-theme button:focus,.mc4wp-form-theme input:focus,.mc4wp-form-theme select:focus,.mc4wp-form-theme textarea:focus{outline:0;background-image:none}.mc4wp-form-theme textarea{height:auto}.mc4wp-form-theme input[disabled],.mc4wp-form-theme input[readonly]{background-color:#eee}.mc4wp-form-theme button,.mc4wp-form-theme input[type=submit],.mc4wp-form-theme input[type=button]{display:inline-block;padding:8px 16px;margin:0;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-shadow:none;background:0 0;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form-theme button:focus,.mc4wp-form-theme button:hover,.mc4wp-form-theme input[type=submit]:focus,.mc4wp-form-theme input[type=submit]:hover,.mc4wp-form-theme input[type=button]:focus,.mc4wp-form-theme input[type=button]:hover{outline:0;color:#333;text-decoration:none;background:0 0}.mc4wp-form-theme-dark button,.mc4wp-form-theme-dark input[type=submit]{color:#fff!important;background-color:#444!important;border-color:#1e1e1e}.mc4wp-form-theme-dark button:active,.mc4wp-form-theme-dark button:focus,.mc4wp-form-theme-dark button:hover,.mc4wp-form-theme-dark input[type=submit]:active,.mc4wp-form-theme-dark input[type=submit]:focus,.mc4wp-form-theme-dark input[type=submit]:hover{color:#fff!important;background-color:#1e1e1e!important;border-color:#000}.mc4wp-form-theme-dark input[type=text]:focus,.mc4wp-form-theme-dark input[type=email]:focus,.mc4wp-form-theme-dark input[type=tel]:focus,.mc4wp-form-theme-dark input[type=url]:focus,.mc4wp-form-theme-dark input[type=date]:focus,.mc4wp-form-theme-dark select:focus,.mc4wp-form-theme-dark textarea:focus{border-color:#6a6a6a;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15)}.mc4wp-form-theme-light button,.mc4wp-form-theme-light input[type=submit]{color:#000!important;background-color:#fff!important;border-color:#d9d9d9}.mc4wp-form-theme-light button:active,.mc4wp-form-theme-light button:focus,.mc4wp-form-theme-light button:hover,.mc4wp-form-theme-light input[type=submit]:active,.mc4wp-form-theme-light input[type=submit]:focus,.mc4wp-form-theme-light input[type=submit]:hover{color:#000!important;background-color:#d9d9d9!important;border-color:#b3b3b3}.mc4wp-form-theme-light input[type=text]:focus,.mc4wp-form-theme-light input[type=email]:focus,.mc4wp-form-theme-light input[type=tel]:focus,.mc4wp-form-theme-light input[type=url]:focus,.mc4wp-form-theme-light input[type=date]:focus,.mc4wp-form-theme-light select:focus,.mc4wp-form-theme-light textarea:focus{border-color:#d9d9d9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15)}.mc4wp-form-theme-red button,.mc4wp-form-theme-red input[type=submit]{color:#fff!important;background-color:#d9534f!important;border-color:#b52b27}.mc4wp-form-theme-red button:active,.mc4wp-form-theme-red button:focus,.mc4wp-form-theme-red button:hover,.mc4wp-form-theme-red input[type=submit]:active,.mc4wp-form-theme-red input[type=submit]:focus,.mc4wp-form-theme-red input[type=submit]:hover{color:#fff!important;background-color:#b52b27!important;border-color:#761c19}.mc4wp-form-theme-red input[type=text]:focus,.mc4wp-form-theme-red input[type=email]:focus,.mc4wp-form-theme-red input[type=tel]:focus,.mc4wp-form-theme-red input[type=url]:focus,.mc4wp-form-theme-red input[type=date]:focus,.mc4wp-form-theme-red select:focus,.mc4wp-form-theme-red textarea:focus{border-color:#e7908e;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15)}.mc4wp-form-theme-blue button,.mc4wp-form-theme-blue input[type=submit]{color:#fff!important;background-color:#428bca!important;border-color:#2a6496}.mc4wp-form-theme-blue button:active,.mc4wp-form-theme-blue button:focus,.mc4wp-form-theme-blue button:hover,.mc4wp-form-theme-blue input[type=submit]:active,.mc4wp-form-theme-blue input[type=submit]:focus,.mc4wp-form-theme-blue input[type=submit]:hover{color:#fff!important;background-color:#2a6496!important;border-color:#193c5a}.mc4wp-form-theme-blue input[type=text]:focus,.mc4wp-form-theme-blue input[type=email]:focus,.mc4wp-form-theme-blue input[type=tel]:focus,.mc4wp-form-theme-blue input[type=url]:focus,.mc4wp-form-theme-blue input[type=date]:focus,.mc4wp-form-theme-blue select:focus,.mc4wp-form-theme-blue textarea:focus{border-color:#7eb0db;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15)}.mc4wp-form-theme-green button,.mc4wp-form-theme-green input[type=submit]{color:#fff!important;background-color:#5cb85c!important;border-color:#3d8b3d}.mc4wp-form-theme-green button:active,.mc4wp-form-theme-green button:focus,.mc4wp-form-theme-green button:hover,.mc4wp-form-theme-green input[type=submit]:active,.mc4wp-form-theme-green input[type=submit]:focus,.mc4wp-form-theme-green input[type=submit]:hover{color:#fff!important;background-color:#3d8b3d!important;border-color:#255625}.mc4wp-form-theme-green input[type=text]:focus,.mc4wp-form-theme-green input[type=email]:focus,.mc4wp-form-theme-green input[type=tel]:focus,.mc4wp-form-theme-green input[type=url]:focus,.mc4wp-form-theme-green input[type=date]:focus,.mc4wp-form-theme-green select:focus,.mc4wp-form-theme-green textarea:focus{border-color:#91cf91;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15)}
1
+ .mc4wp-form input[name^="_mc4wp_honey"]{display:none!important}.mc4wp-form-basic,.mc4wp-form-theme{margin:1em 0}.mc4wp-form-basic,.mc4wp-form-basic input,.mc4wp-form-basic label,.mc4wp-form-theme,.mc4wp-form-theme input,.mc4wp-form-theme label{width:auto;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:auto;height:auto;vertical-align:baseline;line-height:normal}.mc4wp-form-basic:after,.mc4wp-form-theme:after{content:"";display:table;clear:both}.mc4wp-form-basic label,.mc4wp-form-theme label{font-weight:700;margin-bottom:6px;display:block}.mc4wp-form-basic input.placeholdersjs,.mc4wp-form-theme input.placeholdersjs{color:#aaa!important}.mc4wp-form-basic input[type=text],.mc4wp-form-basic input[type=email],.mc4wp-form-basic input[type=tel],.mc4wp-form-basic input[type=url],.mc4wp-form-basic input[type=date],.mc4wp-form-basic select,.mc4wp-form-basic textarea,.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=url],.mc4wp-form-theme input[type=date],.mc4wp-form-theme select,.mc4wp-form-theme textarea{min-height:32px;width:100%;max-width:480px}.mc4wp-form-basic input[type=number],.mc4wp-form-theme input[type=number]{min-width:40px}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=checkbox],.mc4wp-form-theme input[type=radio]{position:relative;margin:0 6px 0 0;padding:0;height:13px;width:13px;display:inline-block;border:0}.mc4wp-form-basic input[type=checkbox],.mc4wp-form-theme input[type=checkbox]{-webkit-appearance:checkbox;-moz-appearance:checkbox;appearance:checkbox}.mc4wp-form-basic input[type=radio],.mc4wp-form-theme input[type=radio]{-webkit-appearance:radio;-moz-appearance:radio;appearance:radio}.mc4wp-form-basic button,.mc4wp-form-basic input[type=submit],.mc4wp-form-basic input[type=button],.mc4wp-form-theme button,.mc4wp-form-theme input[type=submit],.mc4wp-form-theme input[type=button]{cursor:pointer;display:inline-block;-webkit-appearance:none;-moz-appearance:none;appearance:none}.mc4wp-form-basic label>span,.mc4wp-form-basic li>label,.mc4wp-form-theme label>span,.mc4wp-form-theme li>label{font-weight:400}.mc4wp-form-basic .mc4wp-alert,.mc4wp-form-theme .mc4wp-alert{color:#c09853;clear:both}.mc4wp-form-basic .mc4wp-success,.mc4wp-form-theme .mc4wp-success{color:#468847}.mc4wp-form-basic .mc4wp-notice,.mc4wp-form-theme .mc4wp-notice{color:#3a87ad}.mc4wp-form-basic .mc4wp-error,.mc4wp-form-theme .mc4wp-error{color:#CD5C5C}.rtl .mc4wp-form-reset input[type=checkbox],.rtl .mc4wp-form-reset input[type=radio]{margin:0 0 0 6px}.mc4wp-form-theme input[type=text],.mc4wp-form-theme input[type=email],.mc4wp-form-theme input[type=tel],.mc4wp-form-theme input[type=url],.mc4wp-form-theme input[type=date],.mc4wp-form-theme input[type=number],.mc4wp-form-theme select,.mc4wp-form-theme textarea{height:auto;padding:8px 16px;line-height:1.428571429;color:#555!important;vertical-align:middle;background:#fff;border:1px solid #ccc;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);text-shadow:none}.mc4wp-form-theme button:focus,.mc4wp-form-theme input:focus,.mc4wp-form-theme select:focus,.mc4wp-form-theme textarea:focus{outline:0;background-image:none}.mc4wp-form-theme textarea{height:auto}.mc4wp-form-theme input[disabled],.mc4wp-form-theme input[readonly]{background-color:#eee}.mc4wp-form-theme button,.mc4wp-form-theme input[type=submit],.mc4wp-form-theme input[type=button]{display:inline-block;padding:8px 16px;font-weight:400;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;background:0 0;text-shadow:none;filter:none;height:auto;width:auto}.mc4wp-form-theme button:focus,.mc4wp-form-theme button:hover,.mc4wp-form-theme input[type=submit]:focus,.mc4wp-form-theme input[type=submit]:hover,.mc4wp-form-theme input[type=button]:focus,.mc4wp-form-theme input[type=button]:hover{outline:0;color:#333;text-decoration:none;background:0 0}.mc4wp-form-theme-dark button,.mc4wp-form-theme-dark input[type=submit]{color:#fff!important;background-color:#444!important;border-color:#1e1e1e}.mc4wp-form-theme-dark button:active,.mc4wp-form-theme-dark button:focus,.mc4wp-form-theme-dark button:hover,.mc4wp-form-theme-dark input[type=submit]:active,.mc4wp-form-theme-dark input[type=submit]:focus,.mc4wp-form-theme-dark input[type=submit]:hover{color:#fff!important;background-color:#1e1e1e!important;border-color:#000}.mc4wp-form-theme-dark input[type=text]:focus,.mc4wp-form-theme-dark input[type=email]:focus,.mc4wp-form-theme-dark input[type=tel]:focus,.mc4wp-form-theme-dark input[type=url]:focus,.mc4wp-form-theme-dark input[type=date]:focus,.mc4wp-form-theme-dark select:focus,.mc4wp-form-theme-dark textarea:focus{border-color:#6a6a6a;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(68,68,68,.15)}.mc4wp-form-theme-light button,.mc4wp-form-theme-light input[type=submit]{color:#000!important;background-color:#fff!important;border-color:#d9d9d9}.mc4wp-form-theme-light button:active,.mc4wp-form-theme-light button:focus,.mc4wp-form-theme-light button:hover,.mc4wp-form-theme-light input[type=submit]:active,.mc4wp-form-theme-light input[type=submit]:focus,.mc4wp-form-theme-light input[type=submit]:hover{color:#000!important;background-color:#d9d9d9!important;border-color:#b3b3b3}.mc4wp-form-theme-light input[type=text]:focus,.mc4wp-form-theme-light input[type=email]:focus,.mc4wp-form-theme-light input[type=tel]:focus,.mc4wp-form-theme-light input[type=url]:focus,.mc4wp-form-theme-light input[type=date]:focus,.mc4wp-form-theme-light select:focus,.mc4wp-form-theme-light textarea:focus{border-color:#d9d9d9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(255,255,255,.15)}.mc4wp-form-theme-red button,.mc4wp-form-theme-red input[type=submit]{color:#fff!important;background-color:#d9534f!important;border-color:#b52b27}.mc4wp-form-theme-red button:active,.mc4wp-form-theme-red button:focus,.mc4wp-form-theme-red button:hover,.mc4wp-form-theme-red input[type=submit]:active,.mc4wp-form-theme-red input[type=submit]:focus,.mc4wp-form-theme-red input[type=submit]:hover{color:#fff!important;background-color:#b52b27!important;border-color:#761c19}.mc4wp-form-theme-red input[type=text]:focus,.mc4wp-form-theme-red input[type=email]:focus,.mc4wp-form-theme-red input[type=tel]:focus,.mc4wp-form-theme-red input[type=url]:focus,.mc4wp-form-theme-red input[type=date]:focus,.mc4wp-form-theme-red select:focus,.mc4wp-form-theme-red textarea:focus{border-color:#e7908e;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(217,83,79,.15)}.mc4wp-form-theme-blue button,.mc4wp-form-theme-blue input[type=submit]{color:#fff!important;background-color:#428bca!important;border-color:#2a6496}.mc4wp-form-theme-blue button:active,.mc4wp-form-theme-blue button:focus,.mc4wp-form-theme-blue button:hover,.mc4wp-form-theme-blue input[type=submit]:active,.mc4wp-form-theme-blue input[type=submit]:focus,.mc4wp-form-theme-blue input[type=submit]:hover{color:#fff!important;background-color:#2a6496!important;border-color:#193c5a}.mc4wp-form-theme-blue input[type=text]:focus,.mc4wp-form-theme-blue input[type=email]:focus,.mc4wp-form-theme-blue input[type=tel]:focus,.mc4wp-form-theme-blue input[type=url]:focus,.mc4wp-form-theme-blue input[type=date]:focus,.mc4wp-form-theme-blue select:focus,.mc4wp-form-theme-blue textarea:focus{border-color:#7eb0db;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(66,139,202,.15)}.mc4wp-form-theme-green button,.mc4wp-form-theme-green input[type=submit]{color:#fff!important;background-color:#5cb85c!important;border-color:#3d8b3d}.mc4wp-form-theme-green button:active,.mc4wp-form-theme-green button:focus,.mc4wp-form-theme-green button:hover,.mc4wp-form-theme-green input[type=submit]:active,.mc4wp-form-theme-green input[type=submit]:focus,.mc4wp-form-theme-green input[type=submit]:hover{color:#fff!important;background-color:#3d8b3d!important;border-color:#255625}.mc4wp-form-theme-green input[type=text]:focus,.mc4wp-form-theme-green input[type=email]:focus,.mc4wp-form-theme-green input[type=tel]:focus,.mc4wp-form-theme-green input[type=url]:focus,.mc4wp-form-theme-green input[type=date]:focus,.mc4wp-form-theme-green select:focus,.mc4wp-form-theme-green textarea:focus{border-color:#91cf91;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(92,184,92,.15)}
assets/js/forms-api.js CHANGED
@@ -14,6 +14,7 @@ var Gator = require('gator');
14
  var forms = require('./forms/forms.js');
15
  var listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];
16
  var config = window.mc4wp_forms_config || {};
 
17
 
18
  // funcs
19
  function scrollToForm(form) {
@@ -25,7 +26,6 @@ function scrollToForm(form) {
25
  }
26
 
27
  function handleFormRequest(form, action, errors, data){
28
-
29
  var pageHeight = document.body.clientHeight;
30
  var timeStart = Date.now();
31
 
@@ -61,6 +61,29 @@ function handleFormRequest(form, action, errors, data){
61
  });
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  // register early listeners
65
  for(var i=0; i<listeners.length;i++) {
66
  forms.on(listeners[i].event, listeners[i].callback);
@@ -94,6 +117,7 @@ if( config.submitted_form ) {
94
  handleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);
95
  }
96
 
 
97
  // expose forms object
98
  mc4wp.forms = forms;
99
  window.mc4wp = mc4wp;
@@ -105,42 +129,38 @@ var serialize = require('form-serialize');
105
  var populate = require('populate.js');
106
 
107
  var Form = function(id, element) {
108
-
109
- var form = this;
110
-
111
  this.id = id;
112
  this.element = element || document.createElement('form');
113
  this.name = this.element.getAttribute('data-name') || "Form #" + this.id;
114
  this.errors = [];
115
  this.started = false;
 
116
 
117
- this.setData = function(data) {
118
- try {
119
- populate(form.element, data);
120
- } catch(e) {
121
- console.error(e);
122
- }
123
- };
124
-
125
- this.getData = function() {
126
- return serialize(form.element, { hash: true });
127
- };
128
 
129
- this.getSerializedData = function() {
130
- return serialize(form.element);
131
- };
132
 
133
- this.setResponse = function( msg ) {
134
- form.element.querySelector('.mc4wp-response').innerHTML = msg;
135
- };
136
 
137
- // revert back to original state
138
- this.reset = function() {
139
- this.setResponse('');
140
- form.element.querySelector('.mc4wp-form-fields').style.display = '';
141
- form.element.reset();
142
- }
143
 
 
 
 
 
 
144
  };
145
 
146
  module.exports = Form;
14
  var forms = require('./forms/forms.js');
15
  var listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];
16
  var config = window.mc4wp_forms_config || {};
17
+ var optionalInputs = document.querySelectorAll('.mc4wp-form [data-show-if]');
18
 
19
  // funcs
20
  function scrollToForm(form) {
26
  }
27
 
28
  function handleFormRequest(form, action, errors, data){
 
29
  var pageHeight = document.body.clientHeight;
30
  var timeStart = Date.now();
31
 
61
  });
62
  }
63
 
64
+ function showIf(el, expectedValue ) {
65
+ return function() {
66
+ var value = this.value.trim();
67
+ var checked = ( this.getAttribute('type') !== 'radio' && this.getAttribute('type') !== 'checked' ) || this.checked;
68
+ var conditionMet = checked && ( value === expectedValue || ( expectedValue === "" && value.length > 0 ) );
69
+ el.style.display = ( conditionMet ) ? '' : 'none';
70
+ }
71
+ }
72
+
73
+ // hide fields with [data-show-if] attribute
74
+ [].forEach.call(optionalInputs, function(el) {
75
+ var condition = el.getAttribute('data-show-if').split(':');
76
+ var fields = document.querySelectorAll('.mc4wp-form [name="' + condition[0] + '"]');
77
+ var expectedValue = condition[1] || "";
78
+ var callback = showIf(el, expectedValue);
79
+
80
+ for(var i=0; i<fields.length; i++) {
81
+ fields[i].addEventListener('change', callback);
82
+ fields[i].addEventListener('keyup', callback);
83
+ callback.call(fields[i]);
84
+ }
85
+ });
86
+
87
  // register early listeners
88
  for(var i=0; i<listeners.length;i++) {
89
  forms.on(listeners[i].event, listeners[i].callback);
117
  handleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);
118
  }
119
 
120
+
121
  // expose forms object
122
  mc4wp.forms = forms;
123
  window.mc4wp = mc4wp;
129
  var populate = require('populate.js');
130
 
131
  var Form = function(id, element) {
 
 
 
132
  this.id = id;
133
  this.element = element || document.createElement('form');
134
  this.name = this.element.getAttribute('data-name') || "Form #" + this.id;
135
  this.errors = [];
136
  this.started = false;
137
+ };
138
 
139
+ Form.prototype.setData = function(data) {
140
+ try {
141
+ populate(this.element, data);
142
+ } catch(e) {
143
+ console.error(e);
144
+ }
145
+ };
 
 
 
 
146
 
147
+ Form.prototype.getData = function() {
148
+ return serialize(this.element, { hash: true });
149
+ };
150
 
151
+ Form.prototype.getSerializedData = function() {
152
+ return serialize(this.element);
153
+ };
154
 
155
+ Form.prototype.setResponse = function( msg ) {
156
+ this.element.querySelector('.mc4wp-response').innerHTML = msg;
157
+ };
 
 
 
158
 
159
+ // revert back to original state
160
+ Form.prototype.reset = function() {
161
+ this.setResponse('');
162
+ this.element.querySelector('.mc4wp-form-fields').style.display = '';
163
+ this.element.reset();
164
  };
165
 
166
  module.exports = Form;
assets/js/forms-api.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){var e=void 0,t=void 0;!function n(t,r,i){function o(c,a){if(!r[c]){if(!t[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:{}};t[c][0].call(l.exports,function(e){var n=t[c][1][e];return o(n?n:e)},l,l.exports,n,t,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"};e.element.scrollIntoView(n)}function i(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]),n?c.trigger("error",[e,n]):(c.trigger("success",[e,i]),c.trigger(t+"d",[e,i]))})}var o=window.mc4wp||{};if(window.addEventListener){for(var s=e("gator"),c=e("./forms/forms.js"),a=window.mc4wp&&window.mc4wp.listeners?window.mc4wp.listeners:[],u=window.mc4wp_forms_config||{},f=0;f<a.length;f++)c.on(a[f].event,a[f].callback);if(s(document.body).on("submit",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);c.trigger("submit",[t,e])}),s(document.body).on("focus",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);t.started||(c.trigger("started",[t,e]),t.started=!0)}),s(document.body).on("change",".mc4wp-form",function(e){var t=c.getByElement(e.target||e.srcElement);c.trigger("change",[t,e])}),u.submitted_form){var l=u.submitted_form,h=document.getElementById(l.element_id),d=c.getByElement(h);i(d,l.action,l.errors,l.data)}o.forms=c,window.mc4wp=o}},{"./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){var n=this;this.id=e,this.element=t||document.createElement("form"),this.name=this.element.getAttribute("data-name")||"Form #"+this.id,this.errors=[],this.started=!1,this.setData=function(e){try{i(n.element,e)}catch(t){console.error(t)}},this.getData=function(){return r(n.element,{hash:!0})},this.getSerializedData=function(){return r(n.element)},this.setResponse=function(e){n.element.querySelector(".mc4wp-response").innerHTML=e},this.reset=function(){this.setResponse(""),n.element.querySelector(".mc4wp-form-fields").style.display="",n.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<d.length;t++)if(d[t].id==e)return d[t];var n=document.querySelector(".mc4wp-form-"+e);return o(n,e)}function i(e){for(var t=e.form||e,n=0;n<d.length;n++)if(d[n].element==t)return d[n];return o(t)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new l(t,e);return d.push(n),n}function s(){return d}function c(e,t){return h.on(e,t)}function a(e,t){return h.trigger(e,t)}function u(e,t){return h.off(e,t)}var f=e("wolfy87-eventemitter"),l=e("./form.js"),h=new f,d=[];t.exports={all:s,get:r,getByElement:i,on:c,trigger:a,off: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),!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){var r=t.match(f);if(r){var s=i(t);o(e,s,n)}else{var c=e[t];c?(Array.isArray(c)||(e[t]=[c]),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: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),o&&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(c[a][f].call(c[a].match,t)===!1)return void u.cancel(t);if(t.cancelBubble)return}}}function a(e,t,n,r){function i(e){return function(t){c(f,t,e)}}if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var a,f=this.id;for(a=0;a<e.length;a++)r?s(this,e[a],t,n):(d[f]&&d[f][e[a]]||u.addEvent(this,e[a],i(e[a])),o(this,e[a],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},"undefined"!=typeof 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("undefined"!=typeof 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}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):"undefined"!=typeof n&&n.exports?n.exports=r:e.populate=r}(this)},{}],7:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var o=e.prototype,s=this,c=s.EventEmitter;o.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},o.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},o.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},o.addListener=function(e,t){var n,i=this.getListenersAsObject(e),o="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&r(i[n],t)===-1&&i[n].push(o?t:{listener:t,once:!1});return this},o.on=i("addListener"),o.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},o.once=i("addOnceListener"),o.defineEvent=function(e){return this.getListeners(e),this},o.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},o.removeListener=function(e,t){var n,i,o=this.getListenersAsObject(e);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],t),n!==-1&&o[i].splice(n,1));return this},o.off=i("removeListener"),o.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},o.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},o.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},o.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},o.removeAllListeners=i("removeEvent"),o.emitEvent=function(e,t){var n,r,i,o,s,c=this.getListenersAsObject(e);for(o in c)if(c.hasOwnProperty(o))for(n=c[o].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),s=r.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},o.trigger=i("emitEvent"),o.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},o.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},o._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=c,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:s.EventEmitter=e}).call(this)},{}]},{},[1])}();
2
  //# sourceMappingURL=forms-api.min.js.map
1
+ !function(){var e=void 0,t=void 0;!function n(t,r,i){function o(c,a){if(!r[c]){if(!t[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:{}};t[c][0].call(l.exports,function(e){var n=t[c][1][e];return o(n?n:e)},l,l.exports,n,t,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"===f.auto_scroll,n={behavior:t?"smooth":"instant"};e.element.scrollIntoView(n)}function i(e,t,n,i){var o=document.body.clientHeight,s=Date.now();n&&e.setData(i),f.auto_scroll&&r(e),window.addEventListener("load",function(){var c=Date.now()-s;f.auto_scroll&&c<800&&document.body.clientHeight!=o&&r(e),a.trigger("submitted",[e]),n?a.trigger("error",[e,n]):(a.trigger("success",[e,i]),a.trigger(t+"d",[e,i]))})}function o(e,t){return function(){var n=this.value.trim(),r="radio"!==this.getAttribute("type")&&"checked"!==this.getAttribute("type")||this.checked,i=r&&(n===t||""===t&&n.length>0);e.style.display=i?"":"none"}}var s=window.mc4wp||{};if(window.addEventListener){var c=e("gator"),a=e("./forms/forms.js"),u=window.mc4wp&&window.mc4wp.listeners?window.mc4wp.listeners:[],f=window.mc4wp_forms_config||{},l=document.querySelectorAll(".mc4wp-form [data-show-if]");[].forEach.call(l,function(e){for(var t=e.getAttribute("data-show-if").split(":"),n=document.querySelectorAll('.mc4wp-form [name="'+t[0]+'"]'),r=t[1]||"",i=o(e,r),s=0;s<n.length;s++)n[s].addEventListener("change",i),n[s].addEventListener("keyup",i),i.call(n[s])});for(var h=0;h<u.length;h++)a.on(u[h].event,u[h].callback);if(c(document.body).on("submit",".mc4wp-form",function(e){var t=a.getByElement(e.target||e.srcElement);a.trigger("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]),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])}),f.submitted_form){var d=f.submitted_form,m=document.getElementById(d.element_id),p=a.getByElement(m);i(p,d.action,d.errors,d.data)}s.forms=a,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(t){console.error(t)}},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<d.length;t++)if(d[t].id==e)return d[t];var n=document.querySelector(".mc4wp-form-"+e);return o(n,e)}function i(e){for(var t=e.form||e,n=0;n<d.length;n++)if(d[n].element==t)return d[n];return o(t)}function o(e,t){t=t||parseInt(e.getAttribute("data-id"))||0;var n=new l(t,e);return d.push(n),n}function s(){return d}function c(e,t){return h.on(e,t)}function a(e,t){return h.trigger(e,t)}function u(e,t){return h.off(e,t)}var f=e("wolfy87-eventemitter"),l=e("./form.js"),h=new f,d=[];t.exports={all:s,get:r,getByElement:i,on:c,trigger:a,off: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),!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){var r=t.match(f);if(r){var s=i(t);o(e,s,n)}else{var c=e[t];c?(Array.isArray(c)||(e[t]=[c]),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: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),o&&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(c[a][f].call(c[a].match,t)===!1)return void u.cancel(t);if(t.cancelBubble)return}}}function a(e,t,n,r){function i(e){return function(t){c(f,t,e)}}if(this.element){e instanceof Array||(e=[e]),n||"function"!=typeof t||(n=t,t="_root");var a,f=this.id;for(a=0;a<e.length;a++)r?s(this,e[a],t,n):(d[f]&&d[f][e[a]]||u.addEvent(this,e[a],i(e[a])),o(this,e[a],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},"undefined"!=typeof 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("undefined"!=typeof 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}}}};"function"==typeof t&&"object"==typeof t.amd&&t.amd?t(function(){return r}):"undefined"!=typeof n&&n.exports?n.exports=r:e.populate=r}(this)},{}],7:[function(e,n,r){(function(){"use strict";function e(){}function r(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function i(e){return function(){return this[e].apply(this,arguments)}}var o=e.prototype,s=this,c=s.EventEmitter;o.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},o.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},o.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},o.addListener=function(e,t){var n,i=this.getListenersAsObject(e),o="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&r(i[n],t)===-1&&i[n].push(o?t:{listener:t,once:!1});return this},o.on=i("addListener"),o.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},o.once=i("addOnceListener"),o.defineEvent=function(e){return this.getListeners(e),this},o.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},o.removeListener=function(e,t){var n,i,o=this.getListenersAsObject(e);for(i in o)o.hasOwnProperty(i)&&(n=r(o[i],t),n!==-1&&o[i].splice(n,1));return this},o.off=i("removeListener"),o.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},o.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},o.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},o.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},o.removeAllListeners=i("removeEvent"),o.emitEvent=function(e,t){var n,r,i,o,s,c=this.getListenersAsObject(e);for(o in c)if(c.hasOwnProperty(o))for(n=c[o].slice(0),i=n.length;i--;)r=n[i],r.once===!0&&this.removeListener(e,r.listener),s=r.listener.apply(this,t||[]),s===this._getOnceReturnValue()&&this.removeListener(e,r.listener);return this},o.trigger=i("emitEvent"),o.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},o.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},o._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},o._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return s.EventEmitter=c,e},"function"==typeof t&&t.amd?t(function(){return e}):"object"==typeof n&&n.exports?n.exports=e:s.EventEmitter=e}).call(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","handleFormRequest","action","errors","data","pageHeight","document","body","clientHeight","timeStart","Date","now","setData","window","addEventListener","timeElapsed","forms","trigger","mc4wp","Gator","listeners","mc4wp_forms_config","on","event","callback","getByElement","target","srcElement","started","submitted_form","formConfig","getElementById","element_id","./forms/forms.js","gator","2","serialize","populate","Form","id","this","createElement","name","getAttribute","console","error","getData","hash","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","style","display","form-serialize","populate.js","3","get","formId","formElement","createFromElement","parseInt","push","all","events","off","EventEmitter","./form.js","wolfy87-eventemitter","4","options","result","serializer","hash_serializer","str_serialize","elements","radio_store","Object","create","disabled","k_r_success_contrls","test","nodeName","k_r_submitter","type","key","val","value","checked","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","matches","existing","replace","encodeURIComponent","5","_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","_getGlobalCallback","addEvent","_id","prototype","6","root","basename","constructor","namedItem","indexOf","values","k","toString","amd","7","indexOfListener","listener","alias","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","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,GAAUC,OAAeC,EAASD,QAAW,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,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAA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5B,IAHAnE,EAAYiL,EAAa9G,GAAKY,MAAM,GACpCrH,EAAIsC,EAAU/B,OAEPP,KAGHyL,EAAWnJ,EAAUtC,GAEjByL,EAASe,QAAS,GAClB9I,KAAKmJ,eAAeb,EAAKP,EAASA,UAGtCQ,EAAWR,EAASA,SAASE,MAAMjI,KAAM3C,OAErCkL,IAAavI,KAAK8J,uBAClB9J,KAAKmJ,eAAeb,EAAKP,EAASA,SAMlD,OAAO/H,OAMXmI,EAAM1J,QAAUuJ,EAAM,aAUtBG,EAAM4B,KAAO,SAAczB,GACvB,GAAIjL,GAAOmH,MAAM0C,UAAUvD,MAAM/G,KAAKsL,UAAW,EACjD,OAAOlI,MAAK4J,UAAUtB,EAAKjL,IAW/B8K,EAAM6B,mBAAqB,SAA4B/G,GAEnD,MADAjD,MAAKiK,iBAAmBhH,EACjBjD,MAWXmI,EAAM2B,oBAAsB,WACxB,OAAI9J,KAAKuG,eAAe,qBACbvG,KAAKiK,kBAapB9B,EAAMK,WAAa,WACf,MAAOxI,MAAK0J,UAAY1J,KAAK0J,aAQjC9H,EAAasI,WAAa,WAEtB,MADAvN,GAAQiF,aAAewG,EAChBxG,GAIW,kBAAX/F,IAAyBA,EAAO+L,IACvC/L,EAAO,WACH,MAAO+F,KAGY,gBAAX7E,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAUiF,EAGjBjF,EAAQiF,aAAeA,IAE7BhF,KAAKoD,gBAEI","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\nvar mc4wp = window.mc4wp || {};\n\n// bail early if we're on IE8..\n// TODO: just don't load in IE8\nif( ! window.addEventListener ) {\n\treturn;\n}\n\n// deps & vars\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];\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\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\n\t\tif( errors ) {\n\t\t\tforms.trigger('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(action + \"d\", [form, data]);\n\t\t}\n\t});\n}\n\n// register early listeners\nfor(var i=0; i<listeners.length;i++) {\n\tforms.on(listeners[i].event, listeners[i].callback);\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});\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\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});\n\nif( config.submitted_form ) {\n\tvar formConfig = config.submitted_form,\n\t\telement = document.getElementById(formConfig.element_id),\n\t\tform = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n// expose forms object\nmc4wp.forms = forms;\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(id, element) {\n\n\tvar form = this;\n\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\tthis.setData = function(data) {\n\t\ttry {\n\t\t\tpopulate(form.element, data);\n\t\t} catch(e) {\n\t\t\tconsole.error(e);\n\t\t}\n\t};\n\n\tthis.getData = function() {\n\t\treturn serialize(form.element, { hash: true });\n\t};\n\n\tthis.getSerializedData = function() {\n\t\treturn serialize(form.element);\n\t};\n\n\tthis.setResponse = function( msg ) {\n\t\tform.element.querySelector('.mc4wp-response').innerHTML = msg;\n\t};\n\n\t// revert back to original state\n\tthis.reset = function() {\n\t\tthis.setResponse('');\n\t\tform.element.querySelector('.mc4wp-form-fields').style.display = '';\n\t\tform.element.reset();\n\t}\n\n};\n\nmodule.exports = Form;\n\n},{\"form-serialize\":4,\"populate.js\":6}],3:[function(require,module,exports){\n'use strict';\n\n// deps\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\nfunction on(event,callback) {\n\treturn events.on(event,callback);\n}\n\nfunction trigger(event,args) {\n\treturn events.trigger(event,args);\n}\n\nfunction off(event,callback) {\n\treturn events.off(event,callback);\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": on,\n\t\"trigger\": trigger,\n\t\"off\": off\n};\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 && 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\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\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},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\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 exports = this;\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 /**\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 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 second 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 second 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 i = listeners.length;\n\n while (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}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
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","handleFormRequest","action","errors","data","pageHeight","document","body","clientHeight","timeStart","Date","now","setData","window","addEventListener","timeElapsed","forms","trigger","showIf","el","expectedValue","value","this","trim","checked","getAttribute","conditionMet","style","display","mc4wp","Gator","listeners","mc4wp_forms_config","optionalInputs","querySelectorAll","forEach","condition","split","fields","callback","on","event","getByElement","target","srcElement","started","submitted_form","formConfig","getElementById","element_id","./forms/forms.js","gator","2","serialize","populate","Form","id","createElement","name","prototype","console","error","getData","hash","getSerializedData","setResponse","msg","querySelector","innerHTML","reset","form-serialize","populate.js","3","get","formId","formElement","createFromElement","parseInt","push","all","events","off","EventEmitter","./form.js","wolfy87-eventemitter","4","options","result","serializer","hash_serializer","str_serialize","elements","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","matches","existing","replace","encodeURIComponent","5","_addEvent","useCapture","_cancel","preventDefault","stopPropagation","_getMatcher","_matcher","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","matchesSelector","_matchesSelector","selector","boundElement","parentNode","_level","_addHandler","_handlers","_removeHandler","splice","hasOwnProperty","_handleEvent","_gatorInstances","matchesEvent","cancelBubble","cancel","_bind","remove","_getGlobalCallback","addEvent","_id","6","root","basename","constructor","namedItem","indexOf","values","k","toString","amd","7","indexOfListener","listener","alias","apply","arguments","proto","originalGlobalValue","getListeners","evt","response","_getEvents","flattenListeners","flatListeners","getListenersAsObject","addListener","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,GAAUC,OAAeC,EAASD,QAAW,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,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,GACvhB,YAkBA,SAASK,GAAaC,GACrB,GAAIC,GAAiC,aAAvBC,EAAOC,YACjBC,GACHC,SAAUJ,EAAU,SA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AAO6G,KAGY,gBAAX3F,IAAuBA,EAAOJ,QAC1CI,EAAOJ,QAAU+F,EAGjB/F,EAAQ+F,aAAeA,IAE7B9F,KAAKkC,gBAEI","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\nvar mc4wp = window.mc4wp || {};\n\n// bail early if we're on IE8..\n// TODO: just don't load in IE8\nif( ! window.addEventListener ) {\n\treturn;\n}\n\n// deps & vars\nvar Gator = require('gator');\nvar forms = require('./forms/forms.js');\nvar listeners = window.mc4wp && window.mc4wp.listeners ? window.mc4wp.listeners : [];\nvar config = window.mc4wp_forms_config || {};\nvar optionalInputs = document.querySelectorAll('.mc4wp-form [data-show-if]');\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\n\t\tif( errors ) {\n\t\t\tforms.trigger('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(action + \"d\", [form, data]);\n\t\t}\n\t});\n}\n\nfunction showIf(el, expectedValue ) {\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 === \"\" && value.length > 0 ) );\n\t\tel.style.display = ( conditionMet ) ? '' : 'none';\n\t}\n}\n\n// hide fields with [data-show-if] attribute\n[].forEach.call(optionalInputs, function(el) {\n\tvar condition = el.getAttribute('data-show-if').split(':');\n\tvar fields = document.querySelectorAll('.mc4wp-form [name=\"' + condition[0] + '\"]');\n\tvar expectedValue = condition[1] || \"\";\n\tvar callback = showIf(el, expectedValue);\n\n\tfor(var i=0; i<fields.length; i++) {\n\t\tfields[i].addEventListener('change', callback);\n\t\tfields[i].addEventListener('keyup', callback);\n\t\tcallback.call(fields[i]);\n\t}\n});\n\n// register early listeners\nfor(var i=0; i<listeners.length;i++) {\n\tforms.on(listeners[i].event, listeners[i].callback);\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});\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\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});\n\nif( config.submitted_form ) {\n\tvar formConfig = config.submitted_form,\n\t\telement = document.getElementById(formConfig.element_id),\n\t\tform = forms.getByElement(element);\n\n\thandleFormRequest(form, formConfig.action, formConfig.errors, formConfig.data);\n}\n\n\n// expose forms object\nmc4wp.forms = forms;\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(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\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\nfunction on(event,callback) {\n\treturn events.on(event,callback);\n}\n\nfunction trigger(event,args) {\n\treturn events.trigger(event,args);\n}\n\nfunction off(event,callback) {\n\treturn events.off(event,callback);\n}\n\nmodule.exports = {\n\t\"all\": all,\n\t\"get\": get,\n\t\"getByElement\": getByElement,\n\t\"on\": on,\n\t\"trigger\": trigger,\n\t\"off\": off\n};\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 && 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\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\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},{}],7:[function(require,module,exports){\n/*!\n * EventEmitter v4.2.11 - git.io/ee\n * Unlicense - http://unlicense.org/\n * Oliver Caldwell - http://oli.me.uk/\n * @preserve\n */\n\n;(function () {\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 exports = this;\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 /**\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 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 second 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 second 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 i = listeners.length;\n\n while (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}.call(this));\n\n},{}]},{},[1]);\n })();"],"sourceRoot":"/source/"}
includes/admin/class-admin.php CHANGED
@@ -435,6 +435,7 @@ class MC4WP_Admin {
435
  try {
436
  $connected = $this->get_api()->is_connected();
437
  } catch( Exception $e ) {
 
438
  $connected = false;
439
  }
440
 
435
  try {
436
  $connected = $this->get_api()->is_connected();
437
  } catch( Exception $e ) {
438
+ $this->messages->flash( $e->getMessage(), 'error' );
439
  $connected = false;
440
  }
441
 
includes/class-field-formatter.php CHANGED
@@ -48,6 +48,11 @@ class MC4WP_Field_Formatter {
48
  * @return string
49
  */
50
  public function birthday( $value ) {
 
 
 
 
 
51
  if( is_array( $value ) ) {
52
  // allow for "day" and "month" fields
53
  if( isset( $value['month'] ) && isset( $value['day'] ) ) {
@@ -80,6 +85,11 @@ class MC4WP_Field_Formatter {
80
  */
81
  public function date( $value ) {
82
 
 
 
 
 
 
83
  if( is_array( $value ) ) {
84
 
85
  // allow for "year", "month" and "day" keys
48
  * @return string
49
  */
50
  public function birthday( $value ) {
51
+ $value = trim( $value );
52
+ if( empty( $value ) ) {
53
+ return $value;
54
+ }
55
+
56
  if( is_array( $value ) ) {
57
  // allow for "day" and "month" fields
58
  if( isset( $value['month'] ) && isset( $value['day'] ) ) {
85
  */
86
  public function date( $value ) {
87
 
88
+ $value = trim( $value );
89
+ if( empty( $value ) ) {
90
+ return $value;
91
+ }
92
+
93
  if( is_array( $value ) ) {
94
 
95
  // allow for "year", "month" and "day" keys
includes/class-mailchimp.php CHANGED
@@ -187,61 +187,67 @@ class MC4WP_MailChimp {
187
 
188
  try{
189
  $lists_data = $this->api->get_lists( array( 'count' => 100, 'fields' => 'lists.id' ) );
190
- $list_ids = wp_list_pluck( $lists_data, 'id' );
 
 
 
 
191
 
192
- /**
193
- * @var MC4WP_MailChimp_List[]
194
- */
195
- $lists = array();
196
 
197
- foreach ( $list_ids as $list_id ) {
198
 
199
- $list_data = $this->api->get_list( $list_id, array( 'fields' => 'id,name,stats') );
 
 
200
 
201
- // create local object
202
- $list = new MC4WP_MailChimp_List( $list_data->id, $list_data->name );
203
- $list->subscriber_count = $list_data->stats->member_count;
204
 
205
- // parse web_id from the "link" response header
206
- $headers = $this->api->get_last_response_headers();
207
- $link_header = $headers['link'];
208
- preg_match( '/\?id=(\d+)/', $link_header, $matches );
209
- if( ! empty( $matches[1] ) ) {
210
- $list->web_id = $matches[1];
211
- };
212
 
213
- // add to array
214
- $lists["{$list->id}"] = $list;
215
 
216
- // get merge fields (if any)
217
- if( $list_data->stats->merge_field_count > 0 ) {
218
- $field_data = $this->api->get_list_merge_fields( $list->id, array( 'count' => 100, 'fields' => 'merge_fields.name,merge_fields.tag,merge_fields.type,merge_fields.required,merge_fields.default_value,merge_fields.options,merge_fields.public' ) );
219
 
220
  // hydrate data into object
221
  foreach( $field_data as $data ) {
222
  $object = MC4WP_MailChimp_Merge_Field::from_data( $data );
223
  $list->merge_fields[] = $object;
224
  }
225
- }
226
 
227
- // get interest categories
228
- $interest_categories_data = $this->api->get_list_interest_categories( $list->id, array( 'count' => 100, 'fields' => 'categories.id,categories.title,categories.type' ) );
229
- foreach( $interest_categories_data as $interest_category_data ) {
230
- $interest_category = MC4WP_MailChimp_Interest_Category::from_data( $interest_category_data );
231
 
232
- // fetch groups for this interest
233
- $interests_data = $this->api->get_list_interest_category_interests( $list->id, $interest_category->id, array( 'count' => 100, 'fields' => 'interests.id,interests.name') );
234
- foreach( $interests_data as $interest_data ) {
235
- $interest_category->interests[ $interest_data->id ] = $interest_data->name;
236
- }
237
 
238
- $list->interest_categories[] = $interest_category;
239
- }
 
 
 
240
 
241
- }
242
- } catch( MC4WP_API_Exception $e ) {
243
- return array();
244
- }
245
 
246
  // store lists in transients
247
  set_transient( 'mc4wp_mailchimp_lists_v3', $lists, ( 60 * 60 * 24 * 3 ) ); // 3 days
@@ -283,7 +289,12 @@ class MC4WP_MailChimp {
283
  }
284
 
285
  // transient not valid, fetch from API
286
- $lists = $this->api->get_lists();
 
 
 
 
 
287
  $list_counts = array();
288
 
289
  // we got a valid response
187
 
188
  try{
189
  $lists_data = $this->api->get_lists( array( 'count' => 100, 'fields' => 'lists.id' ) );
190
+ } catch( MC4WP_API_Exception $e ) {
191
+ return array();
192
+ }
193
+
194
+ $list_ids = wp_list_pluck( $lists_data, 'id' );
195
 
196
+ /**
197
+ * @var MC4WP_MailChimp_List[]
198
+ */
199
+ $lists = array();
200
 
201
+ foreach ( $list_ids as $list_id ) {
202
 
203
+ // if any API call for this list fails, simply move on to next list.
204
+ try {
205
+ $list_data = $this->api->get_list( $list_id, array( 'fields' => 'id,name,stats' ) );
206
 
207
+ // create local object
208
+ $list = new MC4WP_MailChimp_List( $list_data->id, $list_data->name );
209
+ $list->subscriber_count = $list_data->stats->member_count;
210
 
211
+ // parse web_id from the "link" response header
212
+ $headers = $this->api->get_last_response_headers();
213
+ $link_header = $headers['link'];
214
+ preg_match( '/\?id=(\d+)/', $link_header, $matches );
215
+ if( ! empty( $matches[1] ) ) {
216
+ $list->web_id = $matches[1];
217
+ };
218
 
219
+ // add to array
220
+ $lists["{$list->id}"] = $list;
221
 
222
+ // get merge fields (if any)
223
+ if( $list_data->stats->merge_field_count > 0 ) {
224
+ $field_data = $this->api->get_list_merge_fields( $list->id, array( 'count' => 100, 'fields' => 'merge_fields.name,merge_fields.tag,merge_fields.type,merge_fields.required,merge_fields.default_value,merge_fields.options,merge_fields.public' ) );
225
 
226
  // hydrate data into object
227
  foreach( $field_data as $data ) {
228
  $object = MC4WP_MailChimp_Merge_Field::from_data( $data );
229
  $list->merge_fields[] = $object;
230
  }
231
+ }
232
 
233
+ // get interest categories
234
+ $interest_categories_data = $this->api->get_list_interest_categories( $list->id, array( 'count' => 100, 'fields' => 'categories.id,categories.title,categories.type' ) );
235
+ foreach( $interest_categories_data as $interest_category_data ) {
236
+ $interest_category = MC4WP_MailChimp_Interest_Category::from_data( $interest_category_data );
237
 
238
+ // fetch groups for this interest
239
+ $interests_data = $this->api->get_list_interest_category_interests( $list->id, $interest_category->id, array( 'count' => 100, 'fields' => 'interests.id,interests.name') );
240
+ foreach( $interests_data as $interest_data ) {
241
+ $interest_category->interests[ $interest_data->id ] = $interest_data->name;
242
+ }
243
 
244
+ $list->interest_categories[] = $interest_category;
245
+ }
246
+ } catch( MC4WP_API_Exception $e ) {
247
+ continue;
248
+ }
249
 
250
+ }
 
 
 
251
 
252
  // store lists in transients
253
  set_transient( 'mc4wp_mailchimp_lists_v3', $lists, ( 60 * 60 * 24 * 3 ) ); // 3 days
289
  }
290
 
291
  // transient not valid, fetch from API
292
+ try {
293
+ $lists = $this->api->get_lists( array( 'count' => 100, 'fields' => 'lists.id,lists.stats' ) );
294
+ } catch( MC4WP_API_Exception $e ) {
295
+ return array();
296
+ }
297
+
298
  $list_counts = array();
299
 
300
  // we got a valid response
includes/forms/class-asset-manager.php CHANGED
@@ -159,7 +159,7 @@ class MC4WP_Form_Asset_Manager {
159
  $config = array(
160
  'submitted_form' => array(
161
  'id' => $submitted_form->ID,
162
- 'data' => $submitted_form->data,
163
  'action' => $submitted_form->config['action'],
164
  'element_id' => $submitted_form->config['element_id'],
165
  )
@@ -190,7 +190,6 @@ class MC4WP_Form_Asset_Manager {
190
 
191
  /**
192
  * Load JavaScript files
193
- * @return bool
194
  */
195
  public function before_output_form() {
196
 
159
  $config = array(
160
  'submitted_form' => array(
161
  'id' => $submitted_form->ID,
162
+ 'data' => $submitted_form->get_data(),
163
  'action' => $submitted_form->config['action'],
164
  'element_id' => $submitted_form->config['element_id'],
165
  )
190
 
191
  /**
192
  * Load JavaScript files
 
193
  */
194
  public function before_output_form() {
195
 
includes/forms/class-form-manager.php CHANGED
@@ -38,7 +38,6 @@ class MC4WP_Form_Manager {
38
  * Hook!
39
  */
40
  public function add_hooks() {
41
-
42
  add_action( 'init', array( $this, 'initialize' ) );
43
 
44
  // forms
38
  * Hook!
39
  */
40
  public function add_hooks() {
 
41
  add_action( 'init', array( $this, 'initialize' ) );
42
 
43
  // forms
includes/forms/views/tabs/form-settings.php CHANGED
@@ -76,7 +76,7 @@
76
  <?php _e( 'No' ); ?>
77
  </label>
78
  <p class="help">
79
- <?php _e( 'Select "no" if you want to add the selected groupings to any previously selected groupings when updating a subscriber.', 'mailchimp-for-wp' ); ?>
80
  <?php printf( ' <a href="%s" target="_blank">' . __( 'What does this do?', 'mailchimp-for-wp' ) . '</a>', 'https://mc4wp.com/kb/what-does-replace-groupings-mean/' ); ?>
81
  </p>
82
  </td>
76
  <?php _e( 'No' ); ?>
77
  </label>
78
  <p class="help">
79
+ <?php _e( 'Select "no" if you want to add the selected interests to any previously selected interests when updating a subscriber.', 'mailchimp-for-wp' ); ?>
80
  <?php printf( ' <a href="%s" target="_blank">' . __( 'What does this do?', 'mailchimp-for-wp' ) . '</a>', 'https://mc4wp.com/kb/what-does-replace-groupings-mean/' ); ?>
81
  </p>
82
  </td>
includes/integrations/functions.php CHANGED
@@ -46,11 +46,8 @@ function mc4wp_register_integration( $slug, $class, $always_enabled = false ) {
46
  *
47
  * @since 3.0
48
  * @access public
49
- *
50
  * @param string $slug
51
- *
52
- * @return void
53
  */
54
  function mc4wp_deregister_integration( $slug ) {
55
- return mc4wp('integrations')->deregister_integration( $slug );
56
  }
46
  *
47
  * @since 3.0
48
  * @access public
 
49
  * @param string $slug
 
 
50
  */
51
  function mc4wp_deregister_integration( $slug ) {
52
+ mc4wp('integrations')->deregister_integration( $slug );
53
  }
includes/integrations/views/integration-settings.php CHANGED
@@ -196,7 +196,7 @@
196
  <?php _e( 'No' ); ?>
197
  </label>
198
  <p class="help">
199
- <?php _e( 'Select "no" if you want to add the selected groupings to any previously selected groupings when updating a subscriber.', 'mailchimp-for-wp' ); ?>
200
  <?php printf( ' <a href="%s" target="_blank">' . __( 'What does this do?', 'mailchimp-for-wp' ) . '</a>', 'https://mc4wp.com/kb/what-does-replace-groupings-mean/' ); ?>
201
  </p>
202
  </td>
196
  <?php _e( 'No' ); ?>
197
  </label>
198
  <p class="help">
199
+ <?php _e( 'Select "no" if you want to add the selected interests to any previously selected interests when updating a subscriber.', 'mailchimp-for-wp' ); ?>
200
  <?php printf( ' <a href="%s" target="_blank">' . __( 'What does this do?', 'mailchimp-for-wp' ) . '</a>', 'https://mc4wp.com/kb/what-does-replace-groupings-mean/' ); ?>
201
  </p>
202
  </td>
includes/views/general-settings.php CHANGED
@@ -19,7 +19,10 @@ defined( 'ABSPATH' ) or exit;
19
  </h1>
20
 
21
  <h2 style="display: none;"></h2>
22
- <?php settings_errors(); ?>
 
 
 
23
 
24
  <form action="<?php echo admin_url( 'options.php' ); ?>" method="post">
25
  <?php settings_fields( 'mc4wp_settings' ); ?>
19
  </h1>
20
 
21
  <h2 style="display: none;"></h2>
22
+ <?php
23
+ settings_errors();
24
+ $this->messages->show();
25
+ ?>
26
 
27
  <form action="<?php echo admin_url( 'options.php' ); ?>" method="post">
28
  <?php settings_fields( 'mc4wp_settings' ); ?>
integrations/events-manager/class-events-manager.php CHANGED
@@ -29,7 +29,7 @@ class MC4WP_Events_Manager_Integration extends MC4WP_Integration {
29
  add_action( 'em_booking_form_footer', array( $this, 'output_checkbox' ) );
30
  }
31
 
32
- add_action( 'em_bookings_added', array( $this, 'subscribe_from_events_manager' ) );
33
  }
34
 
35
 
29
  add_action( 'em_booking_form_footer', array( $this, 'output_checkbox' ) );
30
  }
31
 
32
+ add_action( 'em_bookings_added', array( $this, 'subscribe_from_events_manager' ), 5 );
33
  }
34
 
35
 
integrations/ninja-forms/class-ninja-forms.php CHANGED
@@ -34,12 +34,40 @@ class MC4WP_Ninja_Forms_Integration extends MC4WP_Integration {
34
  'display_function' => 'ninja_forms_field_checkbox_display',
35
  'group' => 'standard_fields',
36
  'sidebar' => 'template_fields',
 
 
 
 
 
 
 
 
37
  'edit_placeholder' => false,
38
- 'edit_meta' => true,
39
- 'edit_options' => '',
40
- 'post_process' => array( $this, 'process' ),
41
- 'default_label' => $this->options['label']
42
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  );
44
 
45
  ninja_forms_register_field( 'mc4wp-subscribe', $args );
34
  'display_function' => 'ninja_forms_field_checkbox_display',
35
  'group' => 'standard_fields',
36
  'sidebar' => 'template_fields',
37
+ 'edit_label' => true,
38
+ 'edit_label_pos' => true,
39
+ 'label_pos_options' => array(
40
+ array('name' => __( 'Left of Element', 'ninja-forms' ), 'value' => 'left'),
41
+ array('name' => __( 'Above Element', 'ninja-forms' ), 'value' => 'above'),
42
+ array('name' => __( 'Below Element', 'ninja-forms' ), 'value' => 'below'),
43
+ array('name' => __( 'Right of Element', 'ninja-forms' ), 'value' => 'right'),
44
+ ),
45
  'edit_placeholder' => false,
46
+ 'edit_req' => true,
47
+ 'edit_custom_class' => true,
48
+ 'edit_help' => true,
49
+ 'edit_desc' => true,
50
+ 'edit_meta' => false,
51
+ 'process' => array( $this, 'process' ),
52
+ 'default_label' => $this->options['label'],
53
+ 'edit_options' => array(
54
+ array(
55
+ 'type' => 'select', //What type of input should this be?
56
+ 'options' => array(
57
+ array(
58
+ 'name' => __( 'Unchecked', 'ninja-forms' ),
59
+ 'value' => 'unchecked',
60
+ ),
61
+ array(
62
+ 'name' => __( 'Checked', 'ninja-forms' ),
63
+ 'value' => 'checked',
64
+ ),
65
+ ),
66
+ 'name' => 'default_value', //What should it be named. This should always be a programmatic name, not a label.
67
+ 'label' => __( 'Default Value', 'ninja-forms' ),
68
+ 'class' => 'widefat', //Additional classes to be added to the input element.
69
+ ),
70
+ ),
71
  );
72
 
73
  ninja_forms_register_field( 'mc4wp-subscribe', $args );
mailchimp-for-wp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailChimp for WordPress
4
  Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
5
  Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
6
- Version: 4.0.2
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
@@ -47,7 +47,7 @@ function __mc4wp_load_plugin() {
47
  }
48
 
49
  // bootstrap the core plugin
50
- define( 'MC4WP_VERSION', '4.0.2' );
51
  define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
52
  define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
53
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
3
  Plugin Name: MailChimp for WordPress
4
  Plugin URI: https://mc4wp.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=plugins-page
5
  Description: MailChimp for WordPress by ibericode. Adds various highly effective sign-up methods to your site.
6
+ Version: 4.0.3
7
  Author: ibericode
8
  Author URI: https://ibericode.com/
9
  Text Domain: mailchimp-for-wp
47
  }
48
 
49
  // bootstrap the core plugin
50
+ define( 'MC4WP_VERSION', '4.0.3' );
51
  define( 'MC4WP_PLUGIN_DIR', dirname( __FILE__ ) . '/' );
52
  define( 'MC4WP_PLUGIN_URL', plugins_url( '/' , __FILE__ ) );
53
  define( 'MC4WP_PLUGIN_FILE', __FILE__ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://mc4wp.com/#utm_source=wp-plugin-repo&utm_medium=mailchimp-f
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
5
  Requires at least: 3.8
6
  Tested up to: 4.6
7
- Stable tag: 4.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -188,6 +188,22 @@ MailChimp for WordPress is being developed on GitHub. If you want to collaborate
188
  == Changelog ==
189
 
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  #### 4.0.2 - August 10, 2016
192
 
193
  **Fixes**
4
  Tags: mailchimp, mc4wp, email, marketing, newsletter, subscribe, widget, mc4wp, contact form 7, woocommerce, buddypress, ibericode, mailchimp forms, mailchimp integrations
5
  Requires at least: 3.8
6
  Tested up to: 4.6
7
+ Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
188
  == Changelog ==
189
 
190
 
191
+ #### 4.0.3 - August 24, 2016
192
+
193
+ **Fixes**
194
+
195
+ - Ninja Forms integration not working when using PayPal integration.
196
+
197
+ **Improvements**
198
+
199
+ - Show connection errors on MailChimp settings page.
200
+
201
+ **Additions**
202
+
203
+ - Add pre-checked option to Ninja Forms integration.
204
+ - You can now [conditionally hide fields or elements](https://mc4wp.com/kb/conditional-fields-elements/) using the `data-show-if` attribute.
205
+
206
+
207
  #### 4.0.2 - August 10, 2016
208
 
209
  **Fixes**
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit54a9d7b3cafbef0854dae23755f85280::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit45e8825233e44cafb4f134e93ac41b16::getLoader();
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit54a9d7b3cafbef0854dae23755f85280 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit54a9d7b3cafbef0854dae23755f85280 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit54a9d7b3cafbef0854dae23755f85280', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit54a9d7b3cafbef0854dae23755f85280', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit45e8825233e44cafb4f134e93ac41b16 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit45e8825233e44cafb4f134e93ac41b16', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit45e8825233e44cafb4f134e93ac41b16', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);