Version Notes
Improved postcode lookup experience for mobile devices.
Download this release
Release Info
| Developer | Data8 |
| Extension | Data8_DataCaptureValidation |
| Version | 1.0.9 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.8 to 1.0.9
app/design/frontend/default/default/layout/Data8_DataCaptureValidation.xml
CHANGED
|
@@ -40,7 +40,7 @@
|
|
| 40 |
<script>Data8/address.js</script>
|
| 41 |
</action>
|
| 42 |
<action method="addJs">
|
| 43 |
-
<script>
|
| 44 |
</action>
|
| 45 |
<action method="addJs">
|
| 46 |
<script>Data8/validation.js</script>
|
| 40 |
<script>Data8/address.js</script>
|
| 41 |
</action>
|
| 42 |
<action method="addJs">
|
| 43 |
+
<script>h</script>
|
| 44 |
</action>
|
| 45 |
<action method="addJs">
|
| 46 |
<script>Data8/validation.js</script>
|
app/etc/modules/Data8_DataCaptureValidation.xml
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
-
|
| 2 |
-
<
|
| 3 |
-
<
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
</config>
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<Data8_DataCaptureValidation>
|
| 4 |
+
<active>true</active>
|
| 5 |
+
<codePool>community</codePool>
|
| 6 |
+
</Data8_DataCaptureValidation>
|
| 7 |
+
</modules>
|
| 8 |
+
</config>
|
|
|
js/Data8/address.js
CHANGED
|
@@ -8,6 +8,19 @@ data8.postcodeLookupButton = function (fields, options) {
|
|
| 8 |
this.validate();
|
| 9 |
};
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
data8.postcodeLookupButton.prototype.validate = function () {
|
| 12 |
this.valid = true;
|
| 13 |
|
|
@@ -27,21 +40,11 @@ data8.postcodeLookupButton.prototype.validate = function () {
|
|
| 27 |
return;
|
| 28 |
}
|
| 29 |
|
| 30 |
-
if (this.options.license != 'FreeTrial' &&
|
| 31 |
-
this.options.license != 'FreeTrialThorofare' &&
|
| 32 |
-
this.options.license != 'WebClickFull' &&
|
| 33 |
-
this.options.license != 'WebClickThorofare' &&
|
| 34 |
-
this.options.license != 'WebServerFull' &&
|
| 35 |
-
this.options.license != 'WebServerThorofare') {
|
| 36 |
-
this.valid = false;
|
| 37 |
-
return;
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
// Check all the fields exist.
|
| 41 |
for (var i = 0; i < this.fields.length; i++) {
|
| 42 |
-
if (!
|
| 43 |
-
|
| 44 |
-
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
|
@@ -78,11 +81,20 @@ data8.postcodeLookupButton.prototype.validate = function () {
|
|
| 78 |
this.valid = false;
|
| 79 |
return;
|
| 80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
};
|
| 82 |
|
| 83 |
data8.postcodeLookupButton.prototype.selectAddress = function (address) {
|
| 84 |
for (var i = 0; i < this.fields.length; i++) {
|
| 85 |
-
var target =
|
| 86 |
var value;
|
| 87 |
if (this.fields[i].field == 'organisation')
|
| 88 |
value = this.toProperCase(address.RawAddress.Organisation);
|
|
@@ -110,9 +122,10 @@ data8.postcodeLookupButton.prototype.selectAddress = function (address) {
|
|
| 110 |
}
|
| 111 |
};
|
| 112 |
|
| 113 |
-
data8.postcodeLookupButton.prototype.createButton = function () {
|
| 114 |
-
var button = document.createElement('
|
| 115 |
-
button.
|
|
|
|
| 116 |
return button;
|
| 117 |
};
|
| 118 |
|
|
@@ -120,8 +133,8 @@ data8.postcodeLookupButton.prototype.insertButton = function () {
|
|
| 120 |
// Find the postcode lookup field and add the button next to it.
|
| 121 |
for (var i = 0; i < this.fields.length; i++) {
|
| 122 |
if (this.fields[i].field == 'postcode') {
|
| 123 |
-
var postcodeElement =
|
| 124 |
-
|
| 125 |
break;
|
| 126 |
}
|
| 127 |
}
|
|
@@ -175,34 +188,40 @@ data8.postcodeLookupButton.prototype.usesOrganisation = function () {
|
|
| 175 |
};
|
| 176 |
|
| 177 |
data8.postcodeLookupButton.prototype.showAddressList = function (addresses) {
|
| 178 |
-
// Find the list to add the addresses to.
|
| 179 |
-
var listElement = document.getElementById(this.options.addressList);
|
| 180 |
-
|
| 181 |
// Clear any existing addresses.
|
| 182 |
-
while (
|
| 183 |
-
|
| 184 |
|
| 185 |
// Add the addresses to the list.
|
| 186 |
for (var i = 0; i < addresses.length; i++) {
|
| 187 |
var option = document.createElement('option');
|
| 188 |
option.text = this.getAddressText(addresses[i]);
|
| 189 |
option.address = addresses[i];
|
| 190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
}
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
// Save the function to apply the selected address.
|
| 194 |
var pcl = this;
|
| 195 |
-
|
| 196 |
-
var address = addresses[
|
| 197 |
pcl.selectAddress(address);
|
| 198 |
-
}
|
| 199 |
|
| 200 |
// Position the drop down.
|
| 201 |
var postcodeElement;
|
| 202 |
|
| 203 |
for (var i = 0; i < this.fields.length; i++) {
|
| 204 |
if (this.fields[i].field == 'postcode') {
|
| 205 |
-
postcodeElement =
|
| 206 |
break;
|
| 207 |
}
|
| 208 |
}
|
|
@@ -210,25 +229,35 @@ data8.postcodeLookupButton.prototype.showAddressList = function (addresses) {
|
|
| 210 |
var position = jQuery(postcodeElement).offset();
|
| 211 |
var height = jQuery(postcodeElement).height();
|
| 212 |
var width = jQuery(postcodeElement).width();
|
| 213 |
-
var container = jQuery(
|
| 214 |
-
|
| 215 |
container.css('left', position.left + 'px');
|
| 216 |
container.css('top', (position.top + height + 4) + 'px');
|
| 217 |
container.show('fast');
|
| 218 |
-
|
| 219 |
};
|
| 220 |
|
| 221 |
data8.postcodeLookupButton.prototype.show = function () {
|
| 222 |
if (!this.valid)
|
| 223 |
return;
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
for (var i = 0; i < this.fields.length; i++) {
|
| 226 |
if (this.fields[i].field == 'postcode') {
|
| 227 |
// Create the button element.
|
| 228 |
-
var postcodeElement =
|
| 229 |
-
this.button = this.createButton();
|
| 230 |
|
| 231 |
this.insertButton();
|
|
|
|
| 232 |
|
| 233 |
// Do a postcode lookup when the button is clicked.
|
| 234 |
var pcl = this;
|
|
@@ -247,7 +276,7 @@ data8.postcodeLookupButton.prototype.show = function () {
|
|
| 247 |
alert('Postcode not recognised');
|
| 248 |
}
|
| 249 |
else {
|
| 250 |
-
if (result.Results.length ==
|
| 251 |
pcl.selectAddress(result.Results[0]);
|
| 252 |
}
|
| 253 |
else {
|
|
@@ -257,9 +286,95 @@ data8.postcodeLookupButton.prototype.show = function () {
|
|
| 257 |
});
|
| 258 |
});
|
| 259 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
}
|
| 261 |
};
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
data8.postcodeLookupButton.prototype.getAddressText = function (address) {
|
| 264 |
var text = '';
|
| 265 |
|
| 8 |
this.validate();
|
| 9 |
};
|
| 10 |
|
| 11 |
+
data8.postcodeLookupButton.prototype.getElement = function(id) {
|
| 12 |
+
var element = document.getElementById(id);
|
| 13 |
+
|
| 14 |
+
if (!element) {
|
| 15 |
+
var elements = document.getElementsByName(id);
|
| 16 |
+
|
| 17 |
+
if (elements && elements.length)
|
| 18 |
+
element = elements[elements.length - 1];
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
return element;
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
data8.postcodeLookupButton.prototype.validate = function () {
|
| 25 |
this.valid = true;
|
| 26 |
|
| 40 |
return;
|
| 41 |
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Check all the fields exist.
|
| 44 |
for (var i = 0; i < this.fields.length; i++) {
|
| 45 |
+
if (!this.getElement(this.fields[i].element)) {
|
| 46 |
+
this.valid = false;
|
| 47 |
+
return;
|
| 48 |
}
|
| 49 |
}
|
| 50 |
|
| 81 |
this.valid = false;
|
| 82 |
return;
|
| 83 |
}
|
| 84 |
+
|
| 85 |
+
if (!this.options.findLabel)
|
| 86 |
+
this.options.findLabel = 'Find';
|
| 87 |
+
|
| 88 |
+
if (!this.options.okLabel)
|
| 89 |
+
this.options.okLabel = 'OK';
|
| 90 |
+
|
| 91 |
+
if (!this.options.cancelLabel)
|
| 92 |
+
this.options.cancelLabel = 'Cancel';
|
| 93 |
};
|
| 94 |
|
| 95 |
data8.postcodeLookupButton.prototype.selectAddress = function (address) {
|
| 96 |
for (var i = 0; i < this.fields.length; i++) {
|
| 97 |
+
var target = this.getElement(this.fields[i].element);
|
| 98 |
var value;
|
| 99 |
if (this.fields[i].field == 'organisation')
|
| 100 |
value = this.toProperCase(address.RawAddress.Organisation);
|
| 122 |
}
|
| 123 |
};
|
| 124 |
|
| 125 |
+
data8.postcodeLookupButton.prototype.createButton = function (label) {
|
| 126 |
+
var button = document.createElement('input');
|
| 127 |
+
button.type = 'button';
|
| 128 |
+
button.value = label;
|
| 129 |
return button;
|
| 130 |
};
|
| 131 |
|
| 133 |
// Find the postcode lookup field and add the button next to it.
|
| 134 |
for (var i = 0; i < this.fields.length; i++) {
|
| 135 |
if (this.fields[i].field == 'postcode') {
|
| 136 |
+
var postcodeElement = this.getElement(this.fields[i].element);
|
| 137 |
+
jQuery(this.button).insertAfter(postcodeElement);
|
| 138 |
break;
|
| 139 |
}
|
| 140 |
}
|
| 188 |
};
|
| 189 |
|
| 190 |
data8.postcodeLookupButton.prototype.showAddressList = function (addresses) {
|
|
|
|
|
|
|
|
|
|
| 191 |
// Clear any existing addresses.
|
| 192 |
+
while (this.list.options.length > 0)
|
| 193 |
+
this.list.options[this.list.options.length - 1] = null;
|
| 194 |
|
| 195 |
// Add the addresses to the list.
|
| 196 |
for (var i = 0; i < addresses.length; i++) {
|
| 197 |
var option = document.createElement('option');
|
| 198 |
option.text = this.getAddressText(addresses[i]);
|
| 199 |
option.address = addresses[i];
|
| 200 |
+
|
| 201 |
+
try {
|
| 202 |
+
this.list.add(option, this.list.options[null]);
|
| 203 |
+
}
|
| 204 |
+
catch (e) {
|
| 205 |
+
this.list.add(option, null);
|
| 206 |
+
}
|
| 207 |
}
|
| 208 |
+
|
| 209 |
+
this.list.multiple = false;
|
| 210 |
+
this.list.selectedIndex = 0;
|
| 211 |
|
| 212 |
// Save the function to apply the selected address.
|
| 213 |
var pcl = this;
|
| 214 |
+
this.list.applySelectedAddress = function () {
|
| 215 |
+
var address = addresses[pcl.list.selectedIndex];
|
| 216 |
pcl.selectAddress(address);
|
| 217 |
+
};
|
| 218 |
|
| 219 |
// Position the drop down.
|
| 220 |
var postcodeElement;
|
| 221 |
|
| 222 |
for (var i = 0; i < this.fields.length; i++) {
|
| 223 |
if (this.fields[i].field == 'postcode') {
|
| 224 |
+
postcodeElement = this.getElement(this.fields[i].element);
|
| 225 |
break;
|
| 226 |
}
|
| 227 |
}
|
| 229 |
var position = jQuery(postcodeElement).offset();
|
| 230 |
var height = jQuery(postcodeElement).height();
|
| 231 |
var width = jQuery(postcodeElement).width();
|
| 232 |
+
var container = jQuery(this.dropdown);
|
| 233 |
+
this.list.style.minWidth = width + 'px';
|
| 234 |
container.css('left', position.left + 'px');
|
| 235 |
container.css('top', (position.top + height + 4) + 'px');
|
| 236 |
container.show('fast');
|
| 237 |
+
this.list.focus();
|
| 238 |
};
|
| 239 |
|
| 240 |
data8.postcodeLookupButton.prototype.show = function () {
|
| 241 |
if (!this.valid)
|
| 242 |
return;
|
| 243 |
|
| 244 |
+
this.shown = true;
|
| 245 |
+
|
| 246 |
+
if (this.button) {
|
| 247 |
+
this.button.style.display = this.buttonDisplay;
|
| 248 |
+
return;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
this.createUI();
|
| 252 |
+
|
| 253 |
for (var i = 0; i < this.fields.length; i++) {
|
| 254 |
if (this.fields[i].field == 'postcode') {
|
| 255 |
// Create the button element.
|
| 256 |
+
var postcodeElement = this.getElement(this.fields[i].element);
|
| 257 |
+
this.button = this.createButton(this.options.findLabel);
|
| 258 |
|
| 259 |
this.insertButton();
|
| 260 |
+
this.buttonDisplay = this.button.style.display;
|
| 261 |
|
| 262 |
// Do a postcode lookup when the button is clicked.
|
| 263 |
var pcl = this;
|
| 276 |
alert('Postcode not recognised');
|
| 277 |
}
|
| 278 |
else {
|
| 279 |
+
if (result.Results.length == 1) {
|
| 280 |
pcl.selectAddress(result.Results[0]);
|
| 281 |
}
|
| 282 |
else {
|
| 286 |
});
|
| 287 |
});
|
| 288 |
}
|
| 289 |
+
else if (this.fields[i].field == 'country' && this.options.expectedCountry) {
|
| 290 |
+
var countryElement = jQuery(this.getElement(this.fields[i].element));
|
| 291 |
+
var country = countryElement.val();
|
| 292 |
+
if (country != this.options.expectedCountry)
|
| 293 |
+
this.hide(true);
|
| 294 |
+
|
| 295 |
+
var pcl = this;
|
| 296 |
+
countryElement.change(function (e) {
|
| 297 |
+
if (countryElement.val() != pcl.options.expectedCountry)
|
| 298 |
+
pcl.hide(true);
|
| 299 |
+
else if (pcl.shown)
|
| 300 |
+
pcl.show();
|
| 301 |
+
});
|
| 302 |
+
}
|
| 303 |
}
|
| 304 |
};
|
| 305 |
|
| 306 |
+
data8.postcodeLookupButton.prototype.hide = function (shown) {
|
| 307 |
+
if (this.button) {
|
| 308 |
+
this.button.style.display = 'none';
|
| 309 |
+
this.shown = shown;
|
| 310 |
+
}
|
| 311 |
+
};
|
| 312 |
+
|
| 313 |
+
data8.postcodeLookupButton.prototype.createUI = function() {
|
| 314 |
+
this.dropdown = document.createElement('div');
|
| 315 |
+
this.dropdown.style.position = 'absolute';
|
| 316 |
+
this.dropdown.style.display = 'none';
|
| 317 |
+
this.dropdown.style.backgroundColor = '#FFFFFF';
|
| 318 |
+
this.dropdown.style.padding = '1px';
|
| 319 |
+
|
| 320 |
+
document.body.appendChild(this.dropdown);
|
| 321 |
+
|
| 322 |
+
this.list = document.createElement('select');
|
| 323 |
+
this.list.size = 10;
|
| 324 |
+
this.dropdown.appendChild(this.list);
|
| 325 |
+
|
| 326 |
+
var buttons = document.createElement('div');
|
| 327 |
+
buttons.style.textAlign = 'right';
|
| 328 |
+
buttons.style.marginTop = '1em';
|
| 329 |
+
this.dropdown.appendChild(buttons);
|
| 330 |
+
|
| 331 |
+
var ok = this.createButton(this.options.okLabel);
|
| 332 |
+
buttons.appendChild(ok);
|
| 333 |
+
|
| 334 |
+
var cancel = this.createButton(this.options.cancelLabel);
|
| 335 |
+
buttons.appendChild(cancel);
|
| 336 |
+
|
| 337 |
+
var ignoreBlur = false;
|
| 338 |
+
var pcl = this;
|
| 339 |
+
|
| 340 |
+
jQuery(this.list).blur(function(e) {
|
| 341 |
+
data8PostcodeLookupListOnBlur = function () {
|
| 342 |
+
if (ignoreBlur) {
|
| 343 |
+
ignoreBlur = false;
|
| 344 |
+
jQuery(pcl.list).focus();
|
| 345 |
+
}
|
| 346 |
+
else if (document.activeElement == null || document.activeElement != ok) {
|
| 347 |
+
jQuery(pcl.dropdown).hide('fast');
|
| 348 |
+
}
|
| 349 |
+
};
|
| 350 |
+
|
| 351 |
+
setTimeout('data8PostcodeLookupListOnBlur()', 100);
|
| 352 |
+
})
|
| 353 |
+
.dblclick(function(e) {
|
| 354 |
+
jQuery(ok).click()
|
| 355 |
+
})
|
| 356 |
+
.click(function(e) {
|
| 357 |
+
var ua = navigator.userAgent;
|
| 358 |
+
if (/iPad/i.test(ua) || /iPhone/i.test(ua))
|
| 359 |
+
ignoreBlur = true;
|
| 360 |
+
})
|
| 361 |
+
.change(function (e) {
|
| 362 |
+
if (pcl.mobileCheck())
|
| 363 |
+
jQuery(ok).click();
|
| 364 |
+
});
|
| 365 |
+
|
| 366 |
+
jQuery(ok).click(function(e) {
|
| 367 |
+
pcl.list.applySelectedAddress();
|
| 368 |
+
jQuery(pcl.dropdown).hide('fast');
|
| 369 |
+
});
|
| 370 |
+
};
|
| 371 |
+
|
| 372 |
+
data8.postcodeLookupButton.prototype.mobileCheck = function () {
|
| 373 |
+
var check = false;
|
| 374 |
+
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true })(navigator.userAgent || navigator.vendor || window.opera);
|
| 375 |
+
return check;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
data8.postcodeLookupButton.prototype.getAddressText = function (address) {
|
| 379 |
var text = '';
|
| 380 |
|
js/Data8/magentoaddress.js
CHANGED
|
@@ -2,13 +2,27 @@
|
|
| 2 |
data8 = function () { };
|
| 3 |
}
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
data8.magentoPostcodeLookupButton = function (fields, options) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
data8.postcodeLookupButton.apply(this, arguments);
|
| 7 |
};
|
| 8 |
|
| 9 |
data8.magentoPostcodeLookupButton.prototype = new data8.postcodeLookupButton();
|
| 10 |
|
| 11 |
-
data8.magentoPostcodeLookupButton.prototype.createButton = function () {
|
| 12 |
var button = document.createElement('button');
|
| 13 |
button.setAttribute('type', 'button');
|
| 14 |
button.className = 'button';
|
|
@@ -17,7 +31,7 @@ data8.magentoPostcodeLookupButton.prototype.createButton = function () {
|
|
| 17 |
button.appendChild(span1);
|
| 18 |
var span2 = document.createElement('span');
|
| 19 |
span1.appendChild(span2);
|
| 20 |
-
span2.innerHTML =
|
| 21 |
|
| 22 |
return button;
|
| 23 |
};
|
| 2 |
data8 = function () { };
|
| 3 |
}
|
| 4 |
|
| 5 |
+
// Array Remove - By John Resig (MIT Licensed)
|
| 6 |
+
Array.prototype.remove = function(from, to) {
|
| 7 |
+
var rest = this.slice((to || from) + 1 || this.length);
|
| 8 |
+
this.length = from < 0 ? this.length + from : from;
|
| 9 |
+
return this.push.apply(this, rest);
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
data8.magentoPostcodeLookupButton = function (fields, options) {
|
| 13 |
+
// Remove any missing fields.
|
| 14 |
+
for (var i = fields.length - 1; i >= 0; i--) {
|
| 15 |
+
if (document.getElementById(fields[i].element) == null) {
|
| 16 |
+
fields.remove(i);
|
| 17 |
+
}
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
data8.postcodeLookupButton.apply(this, arguments);
|
| 21 |
};
|
| 22 |
|
| 23 |
data8.magentoPostcodeLookupButton.prototype = new data8.postcodeLookupButton();
|
| 24 |
|
| 25 |
+
data8.magentoPostcodeLookupButton.prototype.createButton = function (label) {
|
| 26 |
var button = document.createElement('button');
|
| 27 |
button.setAttribute('type', 'button');
|
| 28 |
button.className = 'button';
|
| 31 |
button.appendChild(span1);
|
| 32 |
var span2 = document.createElement('span');
|
| 33 |
span1.appendChild(span2);
|
| 34 |
+
span2.innerHTML = label;
|
| 35 |
|
| 36 |
return button;
|
| 37 |
};
|
package.xml
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Data8_DataCaptureValidation</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Adds postcode lookup functionality for UK addresses to all address entry screens, telephone validation for UK and US telephone numbers and international email address validation.</summary>
|
| 10 |
-
<description>* Adds postcode lookup functionality to all address entry screens, speeding up the checkout process and improving the deliverability of parcels. Covers all UK addresses and degrades gracefully when a different country is selected
|
| 11 |
-
* Adds extensive telephone number validation for all UK and North American telephone numbers and degrades gracefully when a different country is selected
|
| 12 |
* Adds extensive international email address validation.</description>
|
| 13 |
-
<notes>Improved
|
| 14 |
<authors><author><name>Data8</name><user>data8_technical</user><email>technical@data-8.co.uk</email></author></authors>
|
| 15 |
-
<date>
|
| 16 |
-
<time>
|
| 17 |
-
<contents><target name="magecommunity"><dir name="Data8"><dir name="DataCaptureValidation"><dir name="Block"><file name="Javascript.php" hash="16f9e4084dd2f20ca6588a39edcc1f0c"/></dir><file name="EmailValidationTypeList.php" hash="89910b62ec4efe9c4eada99b76d8b2cd"/><dir name="Helper"><file name="Data.php" hash="e8c6af1f98bf0f9640134b24dc642122"/></dir><file name="LicenseTypeList.php" hash="ddd66dd3149d083ecd69555bd4ba1a52"/><dir name="controllers"><file name="IndexController.php" hash="8d82912789ff1b1494aa56345ff5d7d9"/></dir><dir name="etc"><file name="config.xml" hash="1f1ce2961df39faeac18070051f01893"/><file name="system.xml" hash="c1a609fa83e13d2c1ccab80d3890f6a9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="Data8_DataCaptureValidation.xml" hash="
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Data8_DataCaptureValidation</name>
|
| 4 |
+
<version>1.0.9</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Open Software License (OSL)</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Adds postcode lookup functionality for UK addresses to all address entry screens, telephone validation for UK and US telephone numbers and international email address validation.</summary>
|
| 10 |
+
<description>* Adds postcode lookup functionality to all address entry screens, speeding up the checkout process and improving the deliverability of parcels. Covers all UK addresses and degrades gracefully when a different country is selected.&#xD;
|
| 11 |
+
* Adds extensive telephone number validation for all UK and North American telephone numbers and degrades gracefully when a different country is selected.&#xD;
|
| 12 |
* Adds extensive international email address validation.</description>
|
| 13 |
+
<notes>Improved postcode lookup experience for mobile devices.</notes>
|
| 14 |
<authors><author><name>Data8</name><user>data8_technical</user><email>technical@data-8.co.uk</email></author></authors>
|
| 15 |
+
<date>2014-04-24</date>
|
| 16 |
+
<time>08:12:23</time>
|
| 17 |
+
<contents><target name="magecommunity"><dir name="Data8"><dir name="DataCaptureValidation"><dir name="Block"><file name="Javascript.php" hash="16f9e4084dd2f20ca6588a39edcc1f0c"/></dir><file name="EmailValidationTypeList.php" hash="89910b62ec4efe9c4eada99b76d8b2cd"/><dir name="Helper"><file name="Data.php" hash="e8c6af1f98bf0f9640134b24dc642122"/></dir><file name="LicenseTypeList.php" hash="ddd66dd3149d083ecd69555bd4ba1a52"/><dir name="controllers"><file name="IndexController.php" hash="8d82912789ff1b1494aa56345ff5d7d9"/></dir><dir name="etc"><file name="config.xml" hash="1f1ce2961df39faeac18070051f01893"/><file name="system.xml" hash="c1a609fa83e13d2c1ccab80d3890f6a9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="Data8_DataCaptureValidation.xml" hash="a9b7f2f63a1a629c59cb94c8a5449f0c"/></dir><dir name="template"><dir name="data8"><dir name="datacapturevalidation"><file name="data8_javascript.phtml" hash="00ac46ea0ca8a082052d5dfe72aec3f5"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="Data8"><file name="address.js" hash="90f64822d1a012b4d102035355c0203c"/><file name="jquery-1.7.1.min.js" hash="2c57990a020cc3a35c4a603413d67a28"/><file name="magentoaddress.js" hash="d7f12f57dded224ccd9447010e8b8fbf"/><file name="validation.js" hash="473d41224831d7448ebcccd850b4c123"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Data8_DataCaptureValidation.xml" hash="8e6a2d12c438c6fed0d66e4fe8978b12"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Data8_DataCaptureValidation.csv" hash="845e7bce7a102df9aefb67abace15a1c"/></dir></target></contents>
|
| 18 |
<compatible/>
|
| 19 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 20 |
</package>
|
