Crafty_Clicks_Clicktoaddress - Version 0.5.7

Version Notes

v0.5.7
- Core JS v1.1.2
- Change: the company input field will stay unmodified if there's no company data available for the selected address.

v0.5.6
- Core JS v1.1.1
- New feature: Lock country to dropdown
- Fix: "no results" and the "generic error" messages weren't passed correctly.
- Fix: added "input-text" class to the "Address Search" element on the front-end.

v0.5.5
- Core JS v1.0.2
- Added Texts option to change the country dropdown's language from English to German.

v0.5.4
- Core JS v0.1.8
- Added Advanced Option to limit selectable countries to match countries set by Magento

v0.5.3
- Core JS v0.1.3.2
- New Feature: Use Address Line #1 instead of a new dropdown

v0.5.2
- Updated core js
- Modified some javascript files to match with altered js functionality

v0.5.0
- Initial release for our global address endpoint.

Download this release

Release Info

Developer Gabor Suranyi
Extension Crafty_Clicks_Clicktoaddress
Version 0.5.7
Comparing to
See all releases


Code changes from version 0.5.6 to 0.5.7

app/code/community/Craftyclicks/C2a/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Craftyclicks_C2a>
5
- <version>0.5.6</version>
6
  </Craftyclicks_C2a>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Craftyclicks_C2a>
5
+ <version>0.5.7</version>
6
  </Craftyclicks_C2a>
7
  </modules>
8
 
js/craftyclicks/c2a/lib/cc_c2a.min.js CHANGED
@@ -5,7 +5,7 @@
5
  * @link https://craftyclicks.co.uk
6
  * @copyright Copyright (c) 2016, Crafty Clicks Limited
7
  * @license Licensed under the terms of the MIT license.
8
- * @version 1.1.1
9
  */
10
- clickToAddress.prototype.search=function(searchText,id,sequence){"use strict";var that=this;if(searchText===""){return}this.setProgressBar(0);var parameters={key:this.key,query:searchText,id:id,country:this.activeCountry,fingerprint:this.fingerprint,integration:this.tag,js_version:this.jsVersion,sequence:sequence};if(typeof this.accessTokenOverride[this.activeCountry]!="undefined"){parameters.key=this.accessTokenOverride[this.activeCountry]}if(this.coords!={}){parameters.coords={};parameters.coords.lat=this.coords.latitude;parameters.coords.lng=this.coords.longitude}try{var data=this.cacheRetrieve(parameters);that.hideErrors();that.searchResults=data;that.showResults();if(!that.focused){that.activeInput.focus()}that.setProgressBar(1);return}catch(err){if(["cc/cr/01","cc/cr/02"].indexOf(err)==-1){throw err}}var url=this.baseURL+"find";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");request.onreadystatechange=function(){if(this.readyState!==4){return}if(this.status>=200&&this.status<400){if(this.status==200){var data="";try{data=JSON.parse(this.responseText);if(that.searchStatus.lastResponseId<=sequence){that.setProgressBar(1);that.clear();that.hideErrors();that.searchResults=data;that.showResults();if(!that.focused){that.activeInput.focus()}that.searchStatus.lastResponseId=sequence;that.cacheStore(parameters,data,sequence)}}catch(err){that.error("JS502")}}}else{that.handleApiError(this)}};request.send(JSON.stringify(parameters));request=null};clickToAddress.prototype.getAddressDetails=function(id){"use strict";var parameters={id:id,country:this.activeCountry,key:this.key,fingerprint:this.fingerprint,js_version:this.jsVersion,integration:this.tag};if(typeof this.accessTokenOverride[this.activeCountry]!="undefined"){parameters.key=this.accessTokenOverride[this.activeCountry]}if(this.coords!={}){parameters.coords=this.coords}var url=this.baseURL+"retrieve";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");var that=this;request.onreadystatechange=function(){if(this.readyState===4){if(this.status>=200&&this.status<400){try{that.fillData(JSON.parse(this.responseText));that.hideErrors();that.cleanHistory()}catch(e){that.error("JS503")}}else{that.handleApiError(this)}}};request.send(JSON.stringify(parameters));request=null};clickToAddress.prototype.getAvailableCountries=function(success_function){"use strict";var parameters={key:this.key,fingerprint:this.fingerprint,js_version:this.jsVersion,integration:this.tag,language:this.countryLanguage};var url=this.baseURL+"countries";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");var that=this;request.onreadystatechange=function(){if(this.readyState===4){if(this.status==401){return}if(this.status>=200&&this.status<400){try{that.serviceReady=1;var respJson=JSON.parse(this.responseText);that.validCountries=respJson.countries;that.ipLocation=respJson.ip_location;that.hideErrors();success_function()}catch(e){that.error("JS505")}}else{that.handleApiError(this)}}};request.send(JSON.stringify(parameters));var xmlHttpTimeout=setTimeout(function(){if(request!==null&&request.readyState!==4){request.abort();that.error("JS501")}},1e4)};clickToAddress.prototype.handleApiError=function(ajax){"use strict";if([401,402].indexOf(ajax.status)!=-1){this.serviceReady=-1}var data={};try{data=JSON.parse(ajax.responseText)}catch(e){data={}}if(typeof data.error!="undefined"&&typeof data.error.status=="string"){this.error(data.error.status,data.error.message)}else{this.error("JS500")}};clickToAddress.prototype.cacheRetrieve=function(search){"use strict";if(typeof this.cache[search.country]=="undefined"){throw"cc/cr/01"}for(var i=0;i<this.cache[search.country].length;i++){if(this.cache[search.country][i].query==search.query&&this.cache[search.country][i].id==search.id){return this.cache[search.country][i].response}}throw"cc/cr/02"};clickToAddress.prototype.cacheStore=function(search,obj,sequence){"use strict";if(typeof this.cache[search.country]=="undefined"){this.cache[search.country]=[]}var splice_pos=Math.abs(binaryIndexOf(this.cache[search.country],sequence));this.cache[search.country].splice(splice_pos,0,{query:search.query,id:search.id,response:obj,sequence:sequence});if(this.cache[search.country].length>100){this.cache[search.country].shift()}this.setHistoryStep()};clickToAddress.prototype.history=function(dir){"use strict";if(!this.historyTools)return;if(this.cachePos<=-1){this.cachePos=0}var searchParams={};var cacheLength=Object.keys(this.cache[this.activeCountry]).length-1;if(dir===0){this.cachePos++;searchParams=this.cache[this.activeCountry][cacheLength-this.cachePos]}else{this.cachePos--;searchParams=this.cache[this.activeCountry][cacheLength-this.cachePos]}this.setHistoryStep();this.activeInput.value=searchParams.query;this.search(searchParams.query,searchParams.id)};clickToAddress.prototype.setHistoryActions=function(){"use strict";if(!this.historyTools)return;var that=this;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];ccEvent(backBtn,"click",function(){if(backBtn.className=="cc-back"){that.history(0)}});ccEvent(forwardBtn,"click",function(){if(forwardBtn.className=="cc-forward"){that.history(1)}})};clickToAddress.prototype.setHistoryStep=function(){"use strict";if(!this.historyTools)return;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];backBtn.className="cc-back";forwardBtn.className="cc-forward";var logo_visible=0;if(typeof this.cache[this.activeCountry]=="undefined"||this.cachePos>=Object.keys(this.cache[this.activeCountry]).length-1||Object.keys(this.cache[this.activeCountry]).length<=1){backBtn.className="cc-back cc-disabled";logo_visible++}if(typeof this.cache[this.activeCountry]=="undefined"||this.cachePos<=0||Object.keys(this.cache[this.activeCountry]).length<=1){forwardBtn.className="cc-forward cc-disabled";logo_visible++}var logo=this.searchObj.getElementsByClassName("c2a_logo");if(logo.length){if(logo_visible==2){logo[0].className="c2a_logo"}else{logo[0].className="c2a_logo hidden"}}};clickToAddress.prototype.hideHistory=function(){"use strict";if(!this.historyTools)return;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];backBtn.className="cc-back cc-disabled";forwardBtn.className="cc-forward cc-disabled"};clickToAddress.prototype.cleanHistory=function(){"use strict";if(this.cachePos<=0||typeof this.cache[this.activeCountry]=="undefined"){return}var removeAt=Object.keys(this.cache[this.activeCountry]).length-this.cachePos;this.cache[this.activeCountry].splice(removeAt,this.cachePos);this.cachePos=-1;this.activeId=this.cache[this.activeCountry][Object.keys(this.cache[this.activeCountry]).length-1].id;this.setHistoryStep()};clickToAddress.prototype.error=function(code,message){"use strict";var errors={JS500:"Unknown Server Error",JS501:"API server seems unreachable",JS502:"API search request resulted in a JS error.",JS503:"API address retrieve request resulted in a JS error.",JS505:"API countrylist retrieve request resulted in a JS error.",JS401:'Invalid value for countryMatchWith. Fallback to "text"'};message=typeof message!=="undefined"?message:errors[code];if(cc_debug){console.warn("CraftyClicks Debug Error Message: ["+code+"] "+message)}if(this.serviceReady==-1){this.errorObj.innerHTML=message}else{this.errorObj.innerHTML=this.texts.generic_error}this.errorObj.className="c2a_error";if(typeof this.onError!="undefined"){this.onError(code,message)}};clickToAddress.prototype.hideErrors=function(){"use strict";if(this.serviceReady!=-1){this.errorObj.innerHTML="";this.errorObj.className="c2a_error c2a_error_hidden"}};clickToAddress.prototype.info=function(state,count){"use strict";var infoBar=this.searchObj.getElementsByClassName("infoBar")[0];switch(state){case"pre-trial":infoBar.className+=" infoActive infoTrial";infoBar.innerHTML='<h5>Access token is needed!</h5><p>To get a trial token, sign up for a <a href="https://account.craftyclicks.co.uk/login/signup">free trial</a>.</p><p>Then find the placeholder accessToken xxxxx-xxxxx-xxxxx-xxxxx in your HTML and replace it with a your own token.</p>';break;case"no-results":infoBar.className+=" infoActive infoWarning";infoBar.innerHTML=this.texts.no_results;break;default:infoBar.className="infoBar";infoBar.innerHTML="";break}};clickToAddress.prototype.setFingerPrint=function(){"use strict";var low=1e15;var high=1e16;var value=Math.floor(Math.random()*(high-low+1)+low);this.fingerprint=value.toString(16)};clickToAddress.prototype.getFingerPrint=function(){"use strict";return this.fingerprint};function clickToAddress(config){"use strict";var that=this;if(document.getElementById("cc_c2a")!==null){throw"Already initiated"}if(typeof that.preset=="undefined"){throw'Incorrect way to initialize this code. use "new ClickToAddress(config);"'}that.preset(config);that.gfxModeTools=c2a_gfx_modes["mode"+that.gfxMode];that.gfxModeTools.addHtml(that);that.searchObj=document.getElementById("cc_c2a");that.resultList=that.searchObj.getElementsByClassName("c2a_results")[0];that.errorObj=that.searchObj.getElementsByClassName("c2a_error")[0];that.getAvailableCountries(function(){that.serviceReady=1;that.setCountryChange();var country=null;if(that.getIpLocation&&that.ipLocation!==""){country=that.ipLocation}else{country=that.defaultCountry}if(that.enabledCountries.length&&that.validCountries.length){var defaultCountryIsValid=false;for(var i=0;i<that.validCountries.length;i++){if(that.validCountries[i].code==country){defaultCountryIsValid=true;break}}if(!defaultCountryIsValid){country=that.validCountries[0].code}}that.selectCountry(country)});if(that.searchObj.getElementsByClassName("cc-history").length){that.setHistoryActions()}ccEvent(that.searchObj,"mouseover",function(){that.hover=true});ccEvent(that.searchObj,"mouseout",function(){that.hover=false});ccEvent(document,"click",function(){that.hide()});ccEvent(document,"scroll",function(){if(that.visible&&that.focused){setTimeout(function(){that.gfxModeTools.reposition(that,that.activeInput)},100);that.hideKeyboard()}});ccEvent(window,"resize",function(){if(that.visible){setTimeout(function(){that.gfxModeTools.reposition(that,that.activeInput)},100)}});ccEvent(that.resultList,"scroll",function(){var scrollTop=parseInt(this.scrollTop);var innerHeight=parseInt(window.getComputedStyle(this,null).getPropertyValue("height"));if(that.searchStatus.inCountryMode!=1&&parseInt(this.scrollHeight)!==0&&scrollTop+innerHeight==parseInt(this.scrollHeight)){that.showResultsExtra()}});that.getStyleSheet();if(that.key=="xxxxx-xxxxx-xxxxx-xxxxx"){that.info("pre-trial")}if(typeof config.dom!="undefined"){that.attach(config.dom)}}clickToAddress.prototype.fillData=function(addressData){"use strict";if(typeof this.activeDom.country!="undefined"){var options=this.activeDom.country.getElementsByTagName("option");if(options.length){var target_val="";for(var i=0;i<options.length&&target_val==="";i++){if(options[i].innerHTML==this.validCountries[this.activeCountryId].country_name){target_val=options[i].value;break}if(options[i].value==this.activeCountry){target_val=options[i].value;break}}this.activeDom.country.value=target_val}else{this.activeDom.country.value=this.validCountries[this.activeCountryId].country_name}}if(typeof this.activeDom.line_1!="undefined"){var line_3=[];if(addressData.result.line_1===""&&addressData.result.company_name!==""){addressData.result.line_1=addressData.result.company_name}this.activeDom.line_1.value=addressData.result.line_1;if(typeof this.activeDom.line_2!="undefined"){this.activeDom.line_2.value=addressData.result.line_2}else{if(addressData.result.line_2!==""){line_3.push(addressData.result.line_2)}}if(typeof this.activeDom.company!="undefined"){this.activeDom.company.value=addressData.result.company_name}else{if(addressData.result.company_name!==""){this.activeDom.line_1.value=addressData.result.company_name+", "+this.activeDom.line_1.value}}if(typeof this.activeDom.postcode!="undefined"){this.activeDom.postcode.value=addressData.result.postal_code}else{line_3.push(addressData.result.postal_code)}if(typeof this.activeDom.town!="undefined"){if(addressData.result.locality!==""){this.activeDom.town.value=addressData.result.locality}else{this.activeDom.town.value=addressData.result.dependent_locality}}else{if(addressData.result.locality!==""){line_3.push(addressData.result.locality)}else{line_3.push(addressData.result.dependent_locality)}}if(addressData.result.province_code!==""||addressData.result.province_name!==""){var province_set={preferred:addressData.result.province,code:addressData.result.province_code,name:addressData.result.province_name};if(typeof this.onSetCounty=="function"){this.onSetCounty(this,this.activeDom,province_set)}else if(typeof this.activeDom.county!="undefined"){this.setCounty(this.activeDom.county,province_set)}}if(line_3.length){if(typeof this.activeDom.line_2!="undefined"){this.activeDom.line_2.value+=", "+line_3.join(", ")}else{this.activeDom.line_1.value+=", "+line_3.join(", ")}}}if(typeof this.onResultSelected=="function"){addressData.result.country=this.validCountries[this.activeCountryId];this.onResultSelected(this,this.activeDom,addressData.result)}this.hide(true)};clickToAddress.prototype.setCounty=function(element,province){"use strict";if(element.tagName=="SELECT"){var target_val=province.code;if(target_val===""){target_val=province.name}var options=element.getElementsByTagName("option");if(options.length){var found=0;var province_name=removeDiacritics(province.name);var province_code=removeDiacritics(province.code);for(var i=0;i<options.length;i++){var option_content=removeDiacritics(options[i].innerHTML);var option_value=removeDiacritics(options[i].value);if(option_content!==""&&(option_content==province_name||option_content==province_code)||option_value!==""&&(option_value==province_name||option_value==province_code)){target_val=options[i].value;found++;break}}if(!found){var province_text=province.name;if(province_text===""){province_text=province.code}var provinceMatchText=removeDiacritics(province_text);var bestMatch={id:0,rank:0};for(var i=0;i<options.length;i++){var option_text=removeDiacritics(options[i].innerHTML);var rank=0;for(var j=0;j<option_text.length&&j<provinceMatchText.length;j++){if(option_text[j]==provinceMatchText[j]){rank++}}if(rank>bestMatch.rank){bestMatch.rank=rank;bestMatch.id=i}}if(bestMatch.rank>0){target_val=options[bestMatch.id].value}}element.value=target_val}}else{var province_for_input=province.preferred;if(province_for_input==""){province_for_input=province.name}if(province_for_input==""){province_for_input=province.code}element.value=province_for_input}};clickToAddress.prototype.showResults=function(full){"use strict";this.scrollPosition=0;this.resetSelector();this.info("clear");var newHtml="";var limit=this.searchResults.results.length-this.scrollLimit*this.scrollPosition;for(var i=0;i<limit&&i<this.scrollLimit;i++){newHtml+="<li></li>"}this.resultList.innerHTML=newHtml;var listElements=this.resultList.getElementsByTagName("li");this.resultList.scrollTop=0;var that=this;for(var i=0;i<listElements.length&&i<this.scrollLimit;i++){var row=this.searchResults.results[i];var content="<div>";if(typeof row.labels[0]=="string"&&row.labels[0]!=="")content+="<span>"+row.labels[0]+"</span>";if(typeof row.labels[1]=="string"&&row.labels[1]!=="")content+='<span class="light">'+row.labels[1]+"</span>";if(typeof row.count=="number"&&row.count>1)content+='<span class="light">('+row.count+" more)</span>";content+="</div>";listElements[i].innerHTML=content;listElements[i].setAttribute("title",row.labels.join(", "));if(typeof row.count!=="undefined"&&typeof row.id!=="undefined"){ccData(listElements[i],"id",row.id.toString());ccData(listElements[i],"count",row.count.toString());if(row.count!=1){listElements[i].className="cc-filter"}}else{throw"server error"}}for(var i=0;i<listElements.length;i++){ccEvent(listElements[i],"click",function(){that.select(this)})}if(this.searchResults.results.length===0){this.info("no-results");this.hasContent=false}else{this.hasContent=true}};clickToAddress.prototype.showResultsExtra=function(){"use strict";this.scrollPosition++;var currentPosition=this.scrollLimit*this.scrollPosition;var newHtml="";var limit=this.searchResults.results.length-currentPosition;for(var i=0;i<limit&&i<this.scrollLimit;i++){newHtml+="<li></li>"}this.resultList.innerHTML+=newHtml;var listElements=this.resultList.getElementsByTagName("li");var that=this;for(var i=currentPosition;i<listElements.length;i++){var row=this.searchResults.results[i];var content="<div>";if(typeof row.labels[0]=="string"&&row.labels[0]!=="")content+="<span>"+row.labels[0]+"</span>";if(typeof row.labels[1]=="string"&&row.labels[1]!=="")content+='<span class="light">'+row.labels[1]+"</span>";if(typeof row.count=="number"&&row.count>1)content+='<span class="light">('+row.count+" more)</span>";content+="</div>";listElements[i].innerHTML=content;listElements[i].setAttribute("title",row.labels.join(", "));if(typeof row.count!=="undefined"&&typeof row.id!=="undefined"){ccData(listElements[i],"id",row.id.toString());ccData(listElements[i],"count",row.count.toString());if(row.count!=1){listElements[i].className="cc-filter"}}else{throw"server error"}}for(var i=0;i<listElements.length;i++){ccEvent(listElements[i],"click",function(){that.select(this)})}};clickToAddress.prototype.select=function(li){"use strict";this.resetSelector();this.cleanHistory();li.id=ccData(li,"id");li.count=ccData(li,"count");if(li.count==="1"){this.getAddressDetails(li.id);this.hide();this.loseFocus();return}if(li.count!=="1"){this.sequence++;this.searchStatus.lastSearchId=this.sequence;var current_sequence=this.sequence;this.search(this.activeInput.value,li.id,current_sequence);this.getFocus();this.activeId=li.id;return}if(li.className!="deadend"){this.sequence++;this.searchStatus.lastSearchId=this.sequence;this.search(this.activeInput.value);this.getFocus();return}};clickToAddress.prototype.getGeo=function(){"use strict";var that=this;if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){that.coords=position.coords;that.showGeo()})}};clickToAddress.prototype.changeCountry=function(filter){"use strict";this.hideHistory();this.resetSelector();var newHtml="";var limit=this.validCountries.length;for(var i=0;i<limit;i++){newHtml+="<li></li>"}this.resultList.innerHTML=newHtml;var listElements=this.resultList.getElementsByTagName("li");this.resultList.scrollTop=0;var that=this;var skip=0;for(var i=0;i<listElements.length;i++){var row=this.validCountries[i+skip];var content="";if(typeof filter!=="undefined"&&filter!==""){var matchFound=false;for(var j=0;!matchFound&&j<Object.keys(row).length;j++){var rowElem=row[Object.keys(row)[j]];if(typeof rowElem=="object"&&Array.isArray(rowElem)){for(var k=0;!matchFound&&k<rowElem.length;k++){var text=rowElem[k].toString().toLowerCase();if(text.indexOf(filter.toLowerCase())===0){matchFound=true}}}else{var text=rowElem.toString().toLowerCase();if(text.indexOf(filter.toLowerCase())===0){matchFound=true}}}if(matchFound){content='<span class="cc-flag cc-flag-'+row.short_code+'"></span>'+"<span>"+row.country_name+"</span>"}else{listElements[i].parentNode.removeChild(listElements[i]);i--;skip++}}else{var content='<span class="cc-flag cc-flag-'+row.short_code+'"></span>'+"<span>"+row.country_name+"</span>"}if(content!=""){listElements[i].innerHTML=content;listElements[i].setAttribute("countryCode",row.code);that.hasContent=true;ccEvent(listElements[i],"click",function(){that.selectCountry(this.getAttribute("countryCode"))})}}this.searchStatus.inCountryMode=1;this.getFocus()};clickToAddress.prototype.selectCountry=function(countryCode){"use strict";var that=this;this.clear();var selectedCountry={};this.activeCountryId=0;for(var i=0;i<this.validCountries.length;i++){if(this.validCountries[i].code==countryCode){selectedCountry=this.validCountries[i];this.activeCountryId=i;break}}var countryObj=this.searchObj.getElementsByClassName("country_img")[0];countryObj.setAttribute("class","country_img cc-flag cc-flag-"+selectedCountry.short_code);if(!this.countrySelector){this.searchObj.getElementsByClassName("country_btn")[0].getElementsByTagName("span")[0].innerHTML=selectedCountry.country_name}this.activeCountry=countryCode;that.searchStatus.inCountryMode=0;this.getFocus();if(typeof this.activeInput.value!="undefined"&&typeof this.lastSearch!=""){this.activeInput.value=this.lastSearch;this.activeId="";this.sequence++;this.searchStatus.lastSearchId=this.sequence;var current_sequence=this.sequence;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence){if(that.activeInput.value!==""){that.search(that.activeInput.value,that.activeId,current_sequence);that.cleanHistory()}else{that.clear()}}},200);this.gfxModeTools.reposition(this,this.activeInput)}this.setHistoryStep();this.setPlaceholder(0)};clickToAddress.prototype.setCountryChange=function(){"use strict";if(this.enabledCountries.length!==0){for(var i=0;i<this.validCountries.length;i++){var row=this.validCountries[i];switch(this.countryMatchWith){case"iso_3":if(this.enabledCountries.indexOf(row.iso_3166_1_alpha_3)==-1){this.validCountries.splice(i,1);i--}break;case"iso_2":if(this.enabledCountries.indexOf(row.iso_3166_1_alpha_2)==-1){this.validCountries.splice(i,1);i--}break;default:this.error("JS401");case"text":var matchFound=false;for(var j=0;!matchFound&&j<Object.keys(row).length;j++){var rowElem=row[Object.keys(row)[j]];if(typeof rowElem!="array"){var text=rowElem.toString().toLowerCase();for(var k=0;k<this.enabledCountries.length;k++){if(text.indexOf(this.enabledCountries[k].toLowerCase())===0){matchFound=true}}}else{for(var k=0;k<this.enabledCountries.length;k++){for(var l=0;l<rowElem.length;l++){if(text.indexOf(this.enabledCountries[k].toLowerCase())===0){matchFound=true}}}}}if(!matchFound){this.validCountries.splice(i,1);i--}break}}}if(this.validCountries.length==0){throw"No valid countries left in the country list!"}if(this.countrySelector){var countryObj=this.searchObj.getElementsByClassName("country_btn")[0];var that=this;ccEvent(countryObj,"click",function(){if(that.searchStatus.inCountryMode===0){that.setPlaceholder(1);that.changeCountry();that.activeInput.value="";that.hasContent=true;that.info()}else{that.setPlaceholder(0);that.searchStatus.inCountryMode=0;that.hide(true);that.getFocus();that.hover=true}})}};if(typeof c2a_gfx_modes=="undefined"){var c2a_gfx_modes={}}c2a_gfx_modes["mode1"]={addHtml:function(that){var cc_dropdown=document.createElement("DIV");cc_dropdown.className="c2a_mode"+that.gfxMode+" c2a_"+that.style.ambient+" c2a_accent_"+that.style.accent;cc_dropdown.id="cc_c2a";var historyBar='<div class="cc-history"><div class="cc-back cc-disabled"></div>';historyBar+='<div class="cc-forward cc-disabled"></div></div>';var mainbar='<div class="mainbar">';var btnClass="country_btn";if(that.countrySelector){btnClass+=" country_btn_active"}mainbar+='<div class="'+btnClass+'"><div class="country_img"></div><span>'+that.texts.country_button+"</span></div>";if(that.historyTools){mainbar+=historyBar}if(that.showLogo){mainbar+='<div class="c2a_logo"></div>'}mainbar+="</div>";var progressBar='<div class="progressBar"></div>';var infoBar='<div class="infoBar"></div>';var footerHtml=progressBar+mainbar+infoBar;var footerClass="c2a_footer",title="";if(that.showLogo){footerHtml+='<div class="c2a_logo"></div>';title=' title="Provided by Crafty Clicks"'}var html='<div class="c2a_error"></div><ul class="c2a_results"></ul>'+'<div class="'+footerClass+'"'+title+">"+footerHtml+"</div>";cc_dropdown.innerHTML=html;document.body.appendChild(cc_dropdown)},reposition:function(that,target){var elemRect=target.getBoundingClientRect();var htmlRect=document.getElementsByTagName("html")[0].getBoundingClientRect();var topOffset=elemRect.top-htmlRect.top+target.offsetHeight-3;var leftOffset=elemRect.left-htmlRect.left;if(document.body.style.paddingLeft!==""){leftOffset+=parseInt(document.body.style.paddingLeft)}var htmlTop=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("margin-top"));htmlTop+=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("padding-top"));topOffset+=htmlTop;that.searchObj.style.left=leftOffset+3+"px";that.searchObj.style.top=topOffset+"px";that.searchObj.style.width=target.offsetWidth-6+"px";var activeClass="c2a_active";var activeElements=document.getElementsByClassName(activeClass);for(var i=0;i<activeElements.length;i++){activeElements[i].className=activeElements[i].className.replace(" "+activeClass,"")}target.className+=" "+activeClass}};if(typeof c2a_gfx_modes=="undefined"){var c2a_gfx_modes={}}c2a_gfx_modes["mode2"]={addHtml:function(that){var cc_dropdown=document.createElement("DIV");cc_dropdown.className="c2a_mode"+that.gfxMode+" c2a_"+that.style.ambient+" c2a_accent_"+that.style.accent;cc_dropdown.id="cc_c2a";var mainbar='<div class="mainbar">';var btnClass="country_btn";if(that.countrySelector){btnClass+=" country_btn_active"}mainbar+='<div class="'+btnClass+'"><div class="country_img"></div><span>'+that.texts.country_button+"</span></div>";if(that.historyTools){mainbar+='<div class="cc-history"><div class="cc-back disabled"></div>';mainbar+='<div class="cc-forward disabled"></div></div>'}if(that.showLogo){mainbar+='<div class="c2a_logo"></div>'}mainbar+="</div>";var progressBar='<div class="progressBar"></div>';var infoBar='<div class="infoBar"></div>';var footerClass="c2a_footer",title="";var footerHtml=progressBar+infoBar;var html=mainbar+'<div class="c2a_error"></div><ul class="c2a_results"></ul>'+'<div class="'+footerClass+'"'+title+">"+footerHtml+"</div>";cc_dropdown.innerHTML=html;document.body.appendChild(cc_dropdown)},reposition:function(that,target){var topElemHeight=22;var elemRect=target.getBoundingClientRect();var htmlRect=document.getElementsByTagName("html")[0].getBoundingClientRect();var topOffset=elemRect.top-htmlRect.top-(topElemHeight+10);var leftOffset=elemRect.left-htmlRect.left+document.body.style.paddingLeft;var htmlTop=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("margin-top"));htmlTop+=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("padding-top"));topOffset+=htmlTop;that.searchObj.style.left=leftOffset-5+"px";that.searchObj.style.top=topOffset+"px";that.searchObj.style.width=target.offsetWidth+10+"px";that.searchObj.getElementsByClassName("mainbar")[0].style.marginBottom=target.offsetHeight+10+"px";var activeClass="c2a_active";var activeElements=document.getElementsByClassName(activeClass);for(var i=0;i<activeElements.length;i++){activeElements[i].className=activeElements[i].className.replace(" "+activeClass,"")}target.className+=" "+activeClass}};clickToAddress.prototype.setupText=function(textCfg){"use strict";this.texts={default_placeholder:"Start with post/zip code or street",country_placeholder:"Type here to search for a country",country_button:"Change Country",generic_error:"An error occured. Please enter your address manually",no_results:"No results found"};if(typeof textCfg!="undefined"){var keys=Object.keys(this.texts);for(var i=0;i<keys.length;i++){if(typeof textCfg[keys[i]]!="undefined"&&textCfg[keys[i]]!=""){this.texts[keys[i]]=textCfg[keys[i]]}}}};clickToAddress.prototype.setCfg=function(config,name,defaultValue,cfgValue){"use strict";if(typeof cfgValue=="undefined"){cfgValue=name}if(typeof config[cfgValue]!="undefined"&&config[cfgValue]!==""){this[name]=config[cfgValue]}else{this[name]=defaultValue}};clickToAddress.prototype.preset=function(config){"use strict";this.jsVersion="1.1.1";this.serviceReady=0;this.activeCountry="";this.hover=false;this.visible=false;this.focused=false;this.hasContent=false;this.keyboardHideInProgress=false;this.coords=0;this.activeDom={};this.domLib=[];this.searchResults={};this.searchObj={};this.selectorPos=-1;this.activeInput="init";this.searchStatus={lastSearchId:0,lastResponseId:0,inCountryMode:0};this.sequence=0;this.cache={};this.cachePos=-1;this.scrollPosition=0;this.scrollLimit=20;this.activeId="";this.lastSearch="";this.funcStore={};this.setCfg(config,"gfxMode",1);this.setCfg(config,"baseURL","https://api.craftyclicks.co.uk/address/1.1","relay");if(this.baseURL[this.baseURL.length]!="/"){this.baseURL+="/"}this.setCfg(config,"key","","accessToken");this.setCfg(config,"defaultCountry","gbr");this.setCfg(config,"enabledCountries",[]);if(this.enabledCountries.length){for(var eci=0;eci<this.enabledCountries.length;eci++){this.enabledCountries[eci]=this.enabledCountries[eci].toUpperCase()}}this.setCfg(config,"style",{ambient:"light",accent:"default"});this.setCfg(config,"domMode","name");this.setCfg(config,"placeholders",true);this.setCfg(config,"onResultSelected");this.setCfg(config,"onCountryChange");this.setCfg(config,"onSearchFocus");this.setCfg(config,"onSetCounty");this.setCfg(config,"onError");this.setCfg(config,"historyTools",true);this.setCfg(config,"countrySelector",true);this.setCfg(config,"showLogo",true);this.setCfg(config,"getIpLocation",true);this.setCfg(config,"accessTokenOverride",{});this.setupText(config.texts);this.setCfg(config,"countryLanguage","en");this.setCfg(config,"countryMatchWith","iso_3");this.setCfg(config,"tag","");this.setCfg(config,"cssPath","https://cc-cdn.com/generic/styles/v1/cc_c2a.min.css");this.setFingerPrint()};var cc_debug=false;function ccEvent(target,event_to_react,function_to_call){target.addEventListener(event_to_react,function_to_call)}function ccData(target,attr,value){if(typeof target==="undefined"||typeof attr==="undefined"){return}if(typeof value!=="undefined"){target.setAttribute("data-"+attr,JSON.stringify({data:value}));return true}else{return JSON.parse(target.getAttribute("data-"+attr)).data}}var defaultDiacriticsRemovalMap=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
11
  },{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];var changes;function removeDiacritics(str){if(!changes){changes=defaultDiacriticsRemovalMap}for(var i=0;i<changes.length;i++){str=str.replace(changes[i].letters,changes[i].base)}return str.toLowerCase()}function binaryIndexOf(array,sequence){"use strict";var minIndex=0;var maxIndex=array.length-1;var currentIndex;var currentElement;var resultIndex;while(minIndex<=maxIndex){resultIndex=currentIndex=(minIndex+maxIndex)/2|0;currentElement=array[currentIndex];if(currentElement.sequence<sequence){minIndex=currentIndex+1}else if(currentElement.sequence>sequence){maxIndex=currentIndex-1}else{return currentIndex}}return~maxIndex}function getCountryCode(c2a,text,matchBy){switch(matchBy){case"iso_3":for(var i=0;i<c2a.validCountries.length;i++){var row=c2a.validCountries[i];if(row.iso_3166_1_alpha_3==text){return row.code}}break;case"iso_2":for(var i=0;i<c2a.validCountries.length;i++){var row=c2a.validCountries[i];if(row.iso_3166_1_alpha_2==text){return row.code}}break}}clickToAddress.prototype.setPlaceholder=function(country,target){"use strict";if(this.activeInput!="init"){target=this.activeInput}if(this.placeholders&&typeof target!="undefined"){var text=this.texts.default_placeholder;if(country){text=this.texts.country_placeholder}target.setAttribute("placeholder",text)}};clickToAddress.prototype.getFocus=function(){"use strict";if(this.activeInput!="init"){this.activeInput.focus()}this.focused=true};clickToAddress.prototype.loseFocus=function(){"use strict";if(this.activeInput!="init"){this.activeInput.blur()}this.focused=false};clickToAddress.prototype.clear=function(){"use strict";this.resultList.innerHTML="";this.searchStatus={lastSearchId:0,lastResponseId:0,inCountryMode:0}};clickToAddress.prototype.show=function(){"use strict";this.searchObj.style.display="block";this.visible=true;this.setHistoryStep();if(this.activeInput!="init"){this.activeInput.setAttribute("autocomplete","off")}};clickToAddress.prototype.hide=function(force_it){"use strict";if(this.keyboardHideInProgress){this.keyboardHideInProgress=false;return}if(force_it||this.visible&&!this.focused&&!this.hover){this.searchObj.style.display="none";this.visible=false;this.hover=false;if(this.searchStatus.inCountryMode&&typeof this.lastSearch!=="undefined"){this.activeInput.value=this.lastSearch}this.clear();this.cachePos=-1;this.resetSelector();this.setPlaceholder(0);if(this.activeInput!="init"){this.activeInput.className=this.activeInput.className.replace(" c2a_active","");this.activeInput.setAttribute("autocomplete","on")}}this.hideErrors()};clickToAddress.prototype.attach=function(dom){"use strict";var domElements={};var objectArray=["search","postcode","town","line_1","line_2","company","county","country"];var quickGet=null;switch(this.domMode){case"id":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementById(dom[obj_name])}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"class":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementsByClassName(dom[obj_name])[0]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"name":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementsByName(dom[obj_name])[0]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"object":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="object"&&dom[obj_name]!==null){return dom[obj_name]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break}var target=domElements.search;if(target.getAttribute("cc_applied")=="true"){throw"ClickToAddress already applied to this element!"}target.setAttribute("cc_applied","true");this.setPlaceholder(0,target);var domLibId=this.domLib.length;this.domLib.push(domElements);var that=this;ccEvent(target,"keydown",function(e){if(that.serviceReady===0)return;if(e.keyCode==38||e.keyCode==40){e.preventDefault();if(!that.hasContent){return}that.moveSelector(e.keyCode==40);return}if(e.keyCode==13){e.preventDefault()}});ccEvent(target,"keyup",function(e){if(that.serviceReady===0)return;if(e.keyCode==27){that.hide(true);that.loseFocus();that.resetSelector();return}var noActionKeys=[37,38,39,40,33,34,35,36,42,44,45,16,17,18,19,20];if(noActionKeys.indexOf(e.keyCode)!=-1){return}if(e.keyCode==13){e.preventDefault();if(!that.hasContent||that.selectorPos<0){return}var elem=that.searchObj.getElementsByTagName("LI")[that.selectorPos];if(that.searchStatus.inCountryMode==1){that.selectCountry(elem.getAttribute("countryCode"))}else{that.select(elem)}return}if(that.searchStatus.inCountryMode==1){that.changeCountry(this.value)}else{if(this.value.indexOf(that.lastSearch)!==0){that.activeId=""}that.lastSearch=this.value;that.sequence++;that.searchStatus.lastSearchId=that.sequence;var current_sequence_number=that.sequence;var searchVal=this.value;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence_number){if(searchVal!==""){that.cleanHistory();that.search(searchVal,that.activeId,current_sequence_number)}else{that.clear()}}},200);that.activeDom=that.domLib[domLibId];that.gfxModeTools.reposition(that,target)}});ccEvent(target,"focus",function(){that.activeDom=that.domLib[domLibId];that.onFocus(target);if(typeof that.onSearchFocus=="function"){that.onSearchFocus(that,that.activeDom)}});ccEvent(target,"blur",function(){if(that.serviceReady===0)return;that.focused=false;that.hide()});ccEvent(target,"c2a-search",function(){that.show();if(that.searchStatus.inCountryMode==1){that.changeCountry(this.value)}else{if(this.value.indexOf(that.lastSearch)!==0){that.activeId=""}that.lastSearch=this.value;that.sequence++;that.searchStatus.lastSearchId=that.sequence;var current_sequence_number=that.sequence;var searchVal=this.value;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence_number){if(searchVal!==""){that.cleanHistory();that.search(searchVal,that.activeId,current_sequence_number)}else{that.clear()}}},200);that.activeDom=that.domLib[domLibId];that.gfxModeTools.reposition(that,target)}});if(target===document.activeElement){this.onFocus(target)}};clickToAddress.prototype.onFocus=function(target){"use strict";var that=this;if(that.serviceReady===0){setTimeout(function(){that.onFocus(target)},250);return}var prestate=that.visible;that.gfxModeTools.reposition(that,target);that.activeInput=target;that.focused=true;that.show();if(target.value!==""&&!prestate){that.sequence++;that.searchStatus.lastSearchId=that.sequence;that.lastSearch=target.value;that.search(target.value,that.activeId,that.sequence)}};clickToAddress.prototype.resetSelector=function(){"use strict";this.hasContent=false;this.selectorPos=-1};clickToAddress.prototype.moveSelector=function(goDown){"use strict";if(!this.visible){return}var elems=this.searchObj.getElementsByTagName("LI");if(goDown&&this.selectorPos+1<elems.length){this.selectorPos++}if(!goDown&&this.selectorPos-1>=0){this.selectorPos--}for(var i=0;i<elems.length;i++){if(i!=this.selectorPos){elems[i].className=elems[i].className.replace(" active","")}else{if(elems[i].className.indexOf("active")==-1){elems[i].className=elems[i].className+" active"}}}var offset=30*(this.selectorPos+1);var list=this.searchObj.getElementsByTagName("UL")[0];if(offset>list.offsetHeight+list.scrollTop){list.scrollTop=offset-list.offsetHeight}if(offset<=list.scrollTop){list.scrollTop=offset-30}};clickToAddress.prototype.showGeo=function(){"use strict";this.searchObj.getElementsByClassName("geo")[0].style.display="block"};clickToAddress.prototype.hideKeyboard=function(){"use strict";var that=this;that.keyboardHideInProgress=true;that.activeInput.setAttribute("readonly","readonly");that.activeInput.setAttribute("disabled","true");setTimeout(function(){that.activeInput.blur();that.activeInput.removeAttribute("readonly");that.activeInput.removeAttribute("disabled")},100)};clickToAddress.prototype.getStyleSheet=function(){"use strict";if(this.cssPath===false){return}var cssId="crafty_css";if(!document.getElementById(cssId)){var head=document.getElementsByTagName("head")[0];var link=document.createElement("link");link.id=cssId;link.rel="stylesheet";link.type="text/css";link.href=this.cssPath;link.media="all";head.appendChild(link)}};clickToAddress.prototype.setProgressBar=function(state){"use strict";var pgbar=this.searchObj.getElementsByClassName("progressBar")[0];switch(state){case 0:pgbar.className="progressBar action";pgbar.style.width="50%";setTimeout(function(){if(pgbar.className=="progressBar action"){pgbar.className="progressBar";pgbar.style.width="0%"}},5e3);break;case 1:pgbar.className="progressBar finish";pgbar.style.width="100%";setTimeout(function(){pgbar.className="progressBar";pgbar.style.width="0%"},2e3);break}};clickToAddress.prototype.triggerSearch=function(target){"use strict";var that=this;if(that.serviceReady===0){setTimeout(function(){that.triggerSearch(target)},250);return}var event=document.createEvent("Event");event.initEvent("c2a-search",true,true);target.dispatchEvent(event)};
5
  * @link https://craftyclicks.co.uk
6
  * @copyright Copyright (c) 2016, Crafty Clicks Limited
7
  * @license Licensed under the terms of the MIT license.
8
+ * @version 1.1.2
9
  */
10
+ clickToAddress.prototype.search=function(searchText,id,sequence){"use strict";var that=this;if(searchText===""){return}this.setProgressBar(0);var parameters={key:this.key,query:searchText,id:id,country:this.activeCountry,fingerprint:this.fingerprint,integration:this.tag,js_version:this.jsVersion,sequence:sequence};if(typeof this.accessTokenOverride[this.activeCountry]!="undefined"){parameters.key=this.accessTokenOverride[this.activeCountry]}if(this.coords!={}){parameters.coords={};parameters.coords.lat=this.coords.latitude;parameters.coords.lng=this.coords.longitude}try{var data=this.cacheRetrieve(parameters);that.hideErrors();that.searchResults=data;that.showResults();if(!that.focused){that.activeInput.focus()}that.setProgressBar(1);return}catch(err){if(["cc/cr/01","cc/cr/02"].indexOf(err)==-1){throw err}}var url=this.baseURL+"find";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");request.onreadystatechange=function(){if(this.readyState!==4){return}if(this.status>=200&&this.status<400){if(this.status==200){var data="";try{data=JSON.parse(this.responseText);if(that.searchStatus.lastResponseId<=sequence){that.setProgressBar(1);that.clear();that.hideErrors();that.searchResults=data;that.showResults();if(!that.focused){that.activeInput.focus()}that.searchStatus.lastResponseId=sequence;that.cacheStore(parameters,data,sequence)}}catch(err){that.error("JS502")}}}else{that.handleApiError(this)}};request.send(JSON.stringify(parameters));request=null};clickToAddress.prototype.getAddressDetails=function(id){"use strict";var parameters={id:id,country:this.activeCountry,key:this.key,fingerprint:this.fingerprint,js_version:this.jsVersion,integration:this.tag};if(typeof this.accessTokenOverride[this.activeCountry]!="undefined"){parameters.key=this.accessTokenOverride[this.activeCountry]}if(this.coords!={}){parameters.coords=this.coords}var url=this.baseURL+"retrieve";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");var that=this;request.onreadystatechange=function(){if(this.readyState===4){if(this.status>=200&&this.status<400){try{that.fillData(JSON.parse(this.responseText));that.hideErrors();that.cleanHistory()}catch(e){that.error("JS503")}}else{that.handleApiError(this)}}};request.send(JSON.stringify(parameters));request=null};clickToAddress.prototype.getAvailableCountries=function(success_function){"use strict";var parameters={key:this.key,fingerprint:this.fingerprint,js_version:this.jsVersion,integration:this.tag,language:this.countryLanguage};var url=this.baseURL+"countries";var request=new XMLHttpRequest;request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.setRequestHeader("Accept","application/json");var that=this;request.onreadystatechange=function(){if(this.readyState===4){if(this.status==401){return}if(this.status>=200&&this.status<400){try{that.serviceReady=1;var respJson=JSON.parse(this.responseText);that.validCountries=respJson.countries;that.ipLocation=respJson.ip_location;that.hideErrors();success_function()}catch(e){that.error("JS505")}}else{that.handleApiError(this)}}};request.send(JSON.stringify(parameters));var xmlHttpTimeout=setTimeout(function(){if(request!==null&&request.readyState!==4){request.abort();that.error("JS501")}},1e4)};clickToAddress.prototype.handleApiError=function(ajax){"use strict";if([401,402].indexOf(ajax.status)!=-1){this.serviceReady=-1}var data={};try{data=JSON.parse(ajax.responseText)}catch(e){data={}}if(typeof data.error!="undefined"&&typeof data.error.status=="string"){this.error(data.error.status,data.error.message)}else{this.error("JS500")}};clickToAddress.prototype.cacheRetrieve=function(search){"use strict";if(typeof this.cache[search.country]=="undefined"){throw"cc/cr/01"}for(var i=0;i<this.cache[search.country].length;i++){if(this.cache[search.country][i].query==search.query&&this.cache[search.country][i].id==search.id){return this.cache[search.country][i].response}}throw"cc/cr/02"};clickToAddress.prototype.cacheStore=function(search,obj,sequence){"use strict";if(typeof this.cache[search.country]=="undefined"){this.cache[search.country]=[]}var splice_pos=Math.abs(binaryIndexOf(this.cache[search.country],sequence));this.cache[search.country].splice(splice_pos,0,{query:search.query,id:search.id,response:obj,sequence:sequence});if(this.cache[search.country].length>100){this.cache[search.country].shift()}this.setHistoryStep()};clickToAddress.prototype.history=function(dir){"use strict";if(!this.historyTools)return;if(this.cachePos<=-1){this.cachePos=0}var searchParams={};var cacheLength=Object.keys(this.cache[this.activeCountry]).length-1;if(dir===0){this.cachePos++;searchParams=this.cache[this.activeCountry][cacheLength-this.cachePos]}else{this.cachePos--;searchParams=this.cache[this.activeCountry][cacheLength-this.cachePos]}this.setHistoryStep();this.activeInput.value=searchParams.query;this.search(searchParams.query,searchParams.id)};clickToAddress.prototype.setHistoryActions=function(){"use strict";if(!this.historyTools)return;var that=this;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];ccEvent(backBtn,"click",function(){if(backBtn.className=="cc-back"){that.history(0)}});ccEvent(forwardBtn,"click",function(){if(forwardBtn.className=="cc-forward"){that.history(1)}})};clickToAddress.prototype.setHistoryStep=function(){"use strict";if(!this.historyTools)return;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];backBtn.className="cc-back";forwardBtn.className="cc-forward";var logo_visible=0;if(typeof this.cache[this.activeCountry]=="undefined"||this.cachePos>=Object.keys(this.cache[this.activeCountry]).length-1||Object.keys(this.cache[this.activeCountry]).length<=1){backBtn.className="cc-back cc-disabled";logo_visible++}if(typeof this.cache[this.activeCountry]=="undefined"||this.cachePos<=0||Object.keys(this.cache[this.activeCountry]).length<=1){forwardBtn.className="cc-forward cc-disabled";logo_visible++}var logo=this.searchObj.getElementsByClassName("c2a_logo");if(logo.length){if(logo_visible==2){logo[0].className="c2a_logo"}else{logo[0].className="c2a_logo hidden"}}};clickToAddress.prototype.hideHistory=function(){"use strict";if(!this.historyTools)return;var backBtn=this.searchObj.getElementsByClassName("cc-back")[0];var forwardBtn=this.searchObj.getElementsByClassName("cc-forward")[0];backBtn.className="cc-back cc-disabled";forwardBtn.className="cc-forward cc-disabled"};clickToAddress.prototype.cleanHistory=function(){"use strict";if(this.cachePos<=0||typeof this.cache[this.activeCountry]=="undefined"){return}var removeAt=Object.keys(this.cache[this.activeCountry]).length-this.cachePos;this.cache[this.activeCountry].splice(removeAt,this.cachePos);this.cachePos=-1;this.activeId=this.cache[this.activeCountry][Object.keys(this.cache[this.activeCountry]).length-1].id;this.setHistoryStep()};clickToAddress.prototype.error=function(code,message){"use strict";var errors={JS500:"Unknown Server Error",JS501:"API server seems unreachable",JS502:"API search request resulted in a JS error.",JS503:"API address retrieve request resulted in a JS error.",JS505:"API countrylist retrieve request resulted in a JS error.",JS401:'Invalid value for countryMatchWith. Fallback to "text"'};message=typeof message!=="undefined"?message:errors[code];if(cc_debug){console.warn("CraftyClicks Debug Error Message: ["+code+"] "+message)}if(this.serviceReady==-1){this.errorObj.innerHTML=message}else{this.errorObj.innerHTML=this.texts.generic_error}this.errorObj.className="c2a_error";if(typeof this.onError!="undefined"){this.onError(code,message)}};clickToAddress.prototype.hideErrors=function(){"use strict";if(this.serviceReady!=-1){this.errorObj.innerHTML="";this.errorObj.className="c2a_error c2a_error_hidden"}};clickToAddress.prototype.info=function(state,count){"use strict";var infoBar=this.searchObj.getElementsByClassName("infoBar")[0];switch(state){case"pre-trial":infoBar.className+=" infoActive infoTrial";infoBar.innerHTML='<h5>Access token is needed!</h5><p>To get a trial token, sign up for a <a href="https://account.craftyclicks.co.uk/login/signup">free trial</a>.</p><p>Then find the placeholder accessToken xxxxx-xxxxx-xxxxx-xxxxx in your HTML and replace it with a your own token.</p>';break;case"no-results":infoBar.className+=" infoActive infoWarning";infoBar.innerHTML=this.texts.no_results;break;default:infoBar.className="infoBar";infoBar.innerHTML="";break}};clickToAddress.prototype.setFingerPrint=function(){"use strict";var low=1e15;var high=1e16;var value=Math.floor(Math.random()*(high-low+1)+low);this.fingerprint=value.toString(16)};clickToAddress.prototype.getFingerPrint=function(){"use strict";return this.fingerprint};function clickToAddress(config){"use strict";var that=this;if(document.getElementById("cc_c2a")!==null){throw"Already initiated"}if(typeof that.preset=="undefined"){throw'Incorrect way to initialize this code. use "new ClickToAddress(config);"'}that.preset(config);that.gfxModeTools=c2a_gfx_modes["mode"+that.gfxMode];that.gfxModeTools.addHtml(that);that.searchObj=document.getElementById("cc_c2a");that.resultList=that.searchObj.getElementsByClassName("c2a_results")[0];that.errorObj=that.searchObj.getElementsByClassName("c2a_error")[0];that.getAvailableCountries(function(){that.serviceReady=1;that.setCountryChange();var country=null;if(that.getIpLocation&&that.ipLocation!==""){country=that.ipLocation}else{country=that.defaultCountry}if(that.enabledCountries.length&&that.validCountries.length){var defaultCountryIsValid=false;for(var i=0;i<that.validCountries.length;i++){if(that.validCountries[i].code==country){defaultCountryIsValid=true;break}}if(!defaultCountryIsValid){country=that.validCountries[0].code}}that.selectCountry(country)});if(that.searchObj.getElementsByClassName("cc-history").length){that.setHistoryActions()}ccEvent(that.searchObj,"mouseover",function(){that.hover=true});ccEvent(that.searchObj,"mouseout",function(){that.hover=false});ccEvent(document,"click",function(){that.hide()});ccEvent(document,"scroll",function(){if(that.visible&&that.focused){setTimeout(function(){that.gfxModeTools.reposition(that,that.activeInput)},100);that.hideKeyboard()}});ccEvent(window,"resize",function(){if(that.visible){setTimeout(function(){that.gfxModeTools.reposition(that,that.activeInput)},100)}});ccEvent(that.resultList,"scroll",function(){var scrollTop=parseInt(this.scrollTop);var innerHeight=parseInt(window.getComputedStyle(this,null).getPropertyValue("height"));if(that.searchStatus.inCountryMode!=1&&parseInt(this.scrollHeight)!==0&&scrollTop+innerHeight==parseInt(this.scrollHeight)){that.showResultsExtra()}});that.getStyleSheet();if(that.key=="xxxxx-xxxxx-xxxxx-xxxxx"){that.info("pre-trial")}if(typeof config.dom!="undefined"){that.attach(config.dom)}}clickToAddress.prototype.fillData=function(addressData){"use strict";if(typeof this.activeDom.country!="undefined"){var options=this.activeDom.country.getElementsByTagName("option");if(options.length){var target_val="";for(var i=0;i<options.length&&target_val==="";i++){if(options[i].innerHTML==this.validCountries[this.activeCountryId].country_name){target_val=options[i].value;break}if(options[i].value==this.activeCountry){target_val=options[i].value;break}}this.activeDom.country.value=target_val}else{this.activeDom.country.value=this.validCountries[this.activeCountryId].country_name}}if(typeof this.activeDom.line_1!="undefined"){var line_3=[];if(addressData.result.line_1===""&&addressData.result.company_name!==""){addressData.result.line_1=addressData.result.company_name}this.activeDom.line_1.value=addressData.result.line_1;if(typeof this.activeDom.line_2!="undefined"){this.activeDom.line_2.value=addressData.result.line_2}else{if(addressData.result.line_2!==""){line_3.push(addressData.result.line_2)}}if(addressData.result.company_name!==""){if(typeof this.activeDom.company!="undefined"){this.activeDom.company.value=addressData.result.company_name}else{this.activeDom.line_1.value=addressData.result.company_name+", "+this.activeDom.line_1.value}}if(typeof this.activeDom.postcode!="undefined"){this.activeDom.postcode.value=addressData.result.postal_code}else{line_3.push(addressData.result.postal_code)}if(typeof this.activeDom.town!="undefined"){if(addressData.result.locality!==""){this.activeDom.town.value=addressData.result.locality}else{this.activeDom.town.value=addressData.result.dependent_locality}}else{if(addressData.result.locality!==""){line_3.push(addressData.result.locality)}else{line_3.push(addressData.result.dependent_locality)}}if(addressData.result.province_code!==""||addressData.result.province_name!==""){var province_set={preferred:addressData.result.province,code:addressData.result.province_code,name:addressData.result.province_name};if(typeof this.onSetCounty=="function"){this.onSetCounty(this,this.activeDom,province_set)}else if(typeof this.activeDom.county!="undefined"){this.setCounty(this.activeDom.county,province_set)}}if(line_3.length){if(typeof this.activeDom.line_2!="undefined"){this.activeDom.line_2.value+=", "+line_3.join(", ")}else{this.activeDom.line_1.value+=", "+line_3.join(", ")}}}if(typeof this.onResultSelected=="function"){addressData.result.country=this.validCountries[this.activeCountryId];this.onResultSelected(this,this.activeDom,addressData.result)}this.hide(true)};clickToAddress.prototype.setCounty=function(element,province){"use strict";if(element.tagName=="SELECT"){var target_val=province.code;if(target_val===""){target_val=province.name}var options=element.getElementsByTagName("option");if(options.length){var found=0;var province_name=removeDiacritics(province.name);var province_code=removeDiacritics(province.code);for(var i=0;i<options.length;i++){var option_content=removeDiacritics(options[i].innerHTML);var option_value=removeDiacritics(options[i].value);if(option_content!==""&&(option_content==province_name||option_content==province_code)||option_value!==""&&(option_value==province_name||option_value==province_code)){target_val=options[i].value;found++;break}}if(!found){var province_text=province.name;if(province_text===""){province_text=province.code}var provinceMatchText=removeDiacritics(province_text);var bestMatch={id:0,rank:0};for(var i=0;i<options.length;i++){var option_text=removeDiacritics(options[i].innerHTML);var rank=0;for(var j=0;j<option_text.length&&j<provinceMatchText.length;j++){if(option_text[j]==provinceMatchText[j]){rank++}}if(rank>bestMatch.rank){bestMatch.rank=rank;bestMatch.id=i}}if(bestMatch.rank>0){target_val=options[bestMatch.id].value}}element.value=target_val}}else{var province_for_input=province.preferred;if(province_for_input==""){province_for_input=province.name}if(province_for_input==""){province_for_input=province.code}element.value=province_for_input}};clickToAddress.prototype.showResults=function(full){"use strict";this.scrollPosition=0;this.resetSelector();this.info("clear");var newHtml="";var limit=this.searchResults.results.length-this.scrollLimit*this.scrollPosition;for(var i=0;i<limit&&i<this.scrollLimit;i++){newHtml+="<li></li>"}this.resultList.innerHTML=newHtml;var listElements=this.resultList.getElementsByTagName("li");this.resultList.scrollTop=0;var that=this;for(var i=0;i<listElements.length&&i<this.scrollLimit;i++){var row=this.searchResults.results[i];var content="<div>";if(typeof row.labels[0]=="string"&&row.labels[0]!=="")content+="<span>"+row.labels[0]+"</span>";if(typeof row.labels[1]=="string"&&row.labels[1]!=="")content+='<span class="light">'+row.labels[1]+"</span>";if(typeof row.count=="number"&&row.count>1)content+='<span class="light">('+row.count+" more)</span>";content+="</div>";listElements[i].innerHTML=content;listElements[i].setAttribute("title",row.labels.join(", "));if(typeof row.count!=="undefined"&&typeof row.id!=="undefined"){ccData(listElements[i],"id",row.id.toString());ccData(listElements[i],"count",row.count.toString());if(row.count!=1){listElements[i].className="cc-filter"}}else{throw"server error"}}for(var i=0;i<listElements.length;i++){ccEvent(listElements[i],"click",function(){that.select(this)})}if(this.searchResults.results.length===0){this.info("no-results");this.hasContent=false}else{this.hasContent=true}};clickToAddress.prototype.showResultsExtra=function(){"use strict";this.scrollPosition++;var currentPosition=this.scrollLimit*this.scrollPosition;var newHtml="";var limit=this.searchResults.results.length-currentPosition;for(var i=0;i<limit&&i<this.scrollLimit;i++){newHtml+="<li></li>"}this.resultList.innerHTML+=newHtml;var listElements=this.resultList.getElementsByTagName("li");var that=this;for(var i=currentPosition;i<listElements.length;i++){var row=this.searchResults.results[i];var content="<div>";if(typeof row.labels[0]=="string"&&row.labels[0]!=="")content+="<span>"+row.labels[0]+"</span>";if(typeof row.labels[1]=="string"&&row.labels[1]!=="")content+='<span class="light">'+row.labels[1]+"</span>";if(typeof row.count=="number"&&row.count>1)content+='<span class="light">('+row.count+" more)</span>";content+="</div>";listElements[i].innerHTML=content;listElements[i].setAttribute("title",row.labels.join(", "));if(typeof row.count!=="undefined"&&typeof row.id!=="undefined"){ccData(listElements[i],"id",row.id.toString());ccData(listElements[i],"count",row.count.toString());if(row.count!=1){listElements[i].className="cc-filter"}}else{throw"server error"}}for(var i=0;i<listElements.length;i++){ccEvent(listElements[i],"click",function(){that.select(this)})}};clickToAddress.prototype.select=function(li){"use strict";this.resetSelector();this.cleanHistory();li.id=ccData(li,"id");li.count=ccData(li,"count");if(li.count==="1"){this.getAddressDetails(li.id);this.hide();this.loseFocus();return}if(li.count!=="1"){this.sequence++;this.searchStatus.lastSearchId=this.sequence;var current_sequence=this.sequence;this.search(this.activeInput.value,li.id,current_sequence);this.getFocus();this.activeId=li.id;return}if(li.className!="deadend"){this.sequence++;this.searchStatus.lastSearchId=this.sequence;this.search(this.activeInput.value);this.getFocus();return}};clickToAddress.prototype.getGeo=function(){"use strict";var that=this;if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){that.coords=position.coords;that.showGeo()})}};clickToAddress.prototype.changeCountry=function(filter){"use strict";this.hideHistory();this.resetSelector();var newHtml="";var limit=this.validCountries.length;for(var i=0;i<limit;i++){newHtml+="<li></li>"}this.resultList.innerHTML=newHtml;var listElements=this.resultList.getElementsByTagName("li");this.resultList.scrollTop=0;var that=this;var skip=0;for(var i=0;i<listElements.length;i++){var row=this.validCountries[i+skip];var content="";if(typeof filter!=="undefined"&&filter!==""){var matchFound=false;for(var j=0;!matchFound&&j<Object.keys(row).length;j++){var rowElem=row[Object.keys(row)[j]];if(typeof rowElem=="object"&&Array.isArray(rowElem)){for(var k=0;!matchFound&&k<rowElem.length;k++){var text=rowElem[k].toString().toLowerCase();if(text.indexOf(filter.toLowerCase())===0){matchFound=true}}}else{var text=rowElem.toString().toLowerCase();if(text.indexOf(filter.toLowerCase())===0){matchFound=true}}}if(matchFound){content='<span class="cc-flag cc-flag-'+row.short_code+'"></span>'+"<span>"+row.country_name+"</span>"}else{listElements[i].parentNode.removeChild(listElements[i]);i--;skip++}}else{var content='<span class="cc-flag cc-flag-'+row.short_code+'"></span>'+"<span>"+row.country_name+"</span>"}if(content!=""){listElements[i].innerHTML=content;listElements[i].setAttribute("countryCode",row.code);that.hasContent=true;ccEvent(listElements[i],"click",function(){that.selectCountry(this.getAttribute("countryCode"))})}}this.searchStatus.inCountryMode=1;this.getFocus()};clickToAddress.prototype.selectCountry=function(countryCode){"use strict";var that=this;this.clear();var selectedCountry={};this.activeCountryId=0;for(var i=0;i<this.validCountries.length;i++){if(this.validCountries[i].code==countryCode){selectedCountry=this.validCountries[i];this.activeCountryId=i;break}}var countryObj=this.searchObj.getElementsByClassName("country_img")[0];countryObj.setAttribute("class","country_img cc-flag cc-flag-"+selectedCountry.short_code);if(!this.countrySelector){this.searchObj.getElementsByClassName("country_btn")[0].getElementsByTagName("span")[0].innerHTML=selectedCountry.country_name}this.activeCountry=countryCode;that.searchStatus.inCountryMode=0;this.getFocus();if(typeof this.activeInput.value!="undefined"&&typeof this.lastSearch!=""){this.activeInput.value=this.lastSearch;this.activeId="";this.sequence++;this.searchStatus.lastSearchId=this.sequence;var current_sequence=this.sequence;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence){if(that.activeInput.value!==""){that.search(that.activeInput.value,that.activeId,current_sequence);that.cleanHistory()}else{that.clear()}}},200);this.gfxModeTools.reposition(this,this.activeInput)}this.setHistoryStep();this.setPlaceholder(0)};clickToAddress.prototype.setCountryChange=function(){"use strict";if(this.enabledCountries.length!==0){for(var i=0;i<this.validCountries.length;i++){var row=this.validCountries[i];switch(this.countryMatchWith){case"iso_3":if(this.enabledCountries.indexOf(row.iso_3166_1_alpha_3)==-1){this.validCountries.splice(i,1);i--}break;case"iso_2":if(this.enabledCountries.indexOf(row.iso_3166_1_alpha_2)==-1){this.validCountries.splice(i,1);i--}break;default:this.error("JS401");case"text":var matchFound=false;for(var j=0;!matchFound&&j<Object.keys(row).length;j++){var rowElem=row[Object.keys(row)[j]];if(typeof rowElem!="array"){var text=rowElem.toString().toLowerCase();for(var k=0;k<this.enabledCountries.length;k++){if(text.indexOf(this.enabledCountries[k].toLowerCase())===0){matchFound=true}}}else{for(var k=0;k<this.enabledCountries.length;k++){for(var l=0;l<rowElem.length;l++){if(text.indexOf(this.enabledCountries[k].toLowerCase())===0){matchFound=true}}}}}if(!matchFound){this.validCountries.splice(i,1);i--}break}}}if(this.validCountries.length==0){throw"No valid countries left in the country list!"}if(this.countrySelector){var countryObj=this.searchObj.getElementsByClassName("country_btn")[0];var that=this;ccEvent(countryObj,"click",function(){if(that.searchStatus.inCountryMode===0){that.setPlaceholder(1);that.changeCountry();that.activeInput.value="";that.hasContent=true;that.info()}else{that.setPlaceholder(0);that.searchStatus.inCountryMode=0;that.hide(true);that.getFocus();that.hover=true}})}};if(typeof c2a_gfx_modes=="undefined"){var c2a_gfx_modes={}}c2a_gfx_modes["mode1"]={addHtml:function(that){var cc_dropdown=document.createElement("DIV");cc_dropdown.className="c2a_mode"+that.gfxMode+" c2a_"+that.style.ambient+" c2a_accent_"+that.style.accent;cc_dropdown.id="cc_c2a";var historyBar='<div class="cc-history"><div class="cc-back cc-disabled"></div>';historyBar+='<div class="cc-forward cc-disabled"></div></div>';var mainbar='<div class="mainbar">';var btnClass="country_btn";if(that.countrySelector){btnClass+=" country_btn_active"}mainbar+='<div class="'+btnClass+'"><div class="country_img"></div><span>'+that.texts.country_button+"</span></div>";if(that.historyTools){mainbar+=historyBar}if(that.showLogo){mainbar+='<div class="c2a_logo"></div>'}mainbar+="</div>";var progressBar='<div class="progressBar"></div>';var infoBar='<div class="infoBar"></div>';var footerHtml=progressBar+mainbar+infoBar;var footerClass="c2a_footer",title="";if(that.showLogo){footerHtml+='<div class="c2a_logo"></div>';title=' title="Provided by Crafty Clicks"'}var html='<div class="c2a_error"></div><ul class="c2a_results"></ul>'+'<div class="'+footerClass+'"'+title+">"+footerHtml+"</div>";cc_dropdown.innerHTML=html;document.body.appendChild(cc_dropdown)},reposition:function(that,target){var elemRect=target.getBoundingClientRect();var htmlRect=document.getElementsByTagName("html")[0].getBoundingClientRect();var topOffset=elemRect.top-htmlRect.top+target.offsetHeight-3;var leftOffset=elemRect.left-htmlRect.left;if(document.body.style.paddingLeft!==""){leftOffset+=parseInt(document.body.style.paddingLeft)}var htmlTop=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("margin-top"));htmlTop+=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("padding-top"));topOffset+=htmlTop;that.searchObj.style.left=leftOffset+3+"px";that.searchObj.style.top=topOffset+"px";that.searchObj.style.width=target.offsetWidth-6+"px";var activeClass="c2a_active";var activeElements=document.getElementsByClassName(activeClass);for(var i=0;i<activeElements.length;i++){activeElements[i].className=activeElements[i].className.replace(" "+activeClass,"")}target.className+=" "+activeClass}};if(typeof c2a_gfx_modes=="undefined"){var c2a_gfx_modes={}}c2a_gfx_modes["mode2"]={addHtml:function(that){var cc_dropdown=document.createElement("DIV");cc_dropdown.className="c2a_mode"+that.gfxMode+" c2a_"+that.style.ambient+" c2a_accent_"+that.style.accent;cc_dropdown.id="cc_c2a";var mainbar='<div class="mainbar">';var btnClass="country_btn";if(that.countrySelector){btnClass+=" country_btn_active"}mainbar+='<div class="'+btnClass+'"><div class="country_img"></div><span>'+that.texts.country_button+"</span></div>";if(that.historyTools){mainbar+='<div class="cc-history"><div class="cc-back disabled"></div>';mainbar+='<div class="cc-forward disabled"></div></div>'}if(that.showLogo){mainbar+='<div class="c2a_logo"></div>'}mainbar+="</div>";var progressBar='<div class="progressBar"></div>';var infoBar='<div class="infoBar"></div>';var footerClass="c2a_footer",title="";var footerHtml=progressBar+infoBar;var html=mainbar+'<div class="c2a_error"></div><ul class="c2a_results"></ul>'+'<div class="'+footerClass+'"'+title+">"+footerHtml+"</div>";cc_dropdown.innerHTML=html;document.body.appendChild(cc_dropdown)},reposition:function(that,target){var topElemHeight=22;var elemRect=target.getBoundingClientRect();var htmlRect=document.getElementsByTagName("html")[0].getBoundingClientRect();var topOffset=elemRect.top-htmlRect.top-(topElemHeight+10);var leftOffset=elemRect.left-htmlRect.left+document.body.style.paddingLeft;var htmlTop=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("margin-top"));htmlTop+=parseInt(window.getComputedStyle(document.getElementsByTagName("html")[0]).getPropertyValue("padding-top"));topOffset+=htmlTop;that.searchObj.style.left=leftOffset-5+"px";that.searchObj.style.top=topOffset+"px";that.searchObj.style.width=target.offsetWidth+10+"px";that.searchObj.getElementsByClassName("mainbar")[0].style.marginBottom=target.offsetHeight+10+"px";var activeClass="c2a_active";var activeElements=document.getElementsByClassName(activeClass);for(var i=0;i<activeElements.length;i++){activeElements[i].className=activeElements[i].className.replace(" "+activeClass,"")}target.className+=" "+activeClass}};clickToAddress.prototype.setupText=function(textCfg){"use strict";this.texts={default_placeholder:"Start with post/zip code or street",country_placeholder:"Type here to search for a country",country_button:"Change Country",generic_error:"An error occured. Please enter your address manually",no_results:"No results found"};if(typeof textCfg!="undefined"){var keys=Object.keys(this.texts);for(var i=0;i<keys.length;i++){if(typeof textCfg[keys[i]]!="undefined"&&textCfg[keys[i]]!=""){this.texts[keys[i]]=textCfg[keys[i]]}}}};clickToAddress.prototype.setCfg=function(config,name,defaultValue,cfgValue){"use strict";if(typeof cfgValue=="undefined"){cfgValue=name}if(typeof config[cfgValue]!="undefined"&&config[cfgValue]!==""){this[name]=config[cfgValue]}else{this[name]=defaultValue}};clickToAddress.prototype.preset=function(config){"use strict";this.jsVersion="1.1.2";this.serviceReady=0;this.activeCountry="";this.hover=false;this.visible=false;this.focused=false;this.hasContent=false;this.keyboardHideInProgress=false;this.coords=0;this.activeDom={};this.domLib=[];this.searchResults={};this.searchObj={};this.selectorPos=-1;this.activeInput="init";this.searchStatus={lastSearchId:0,lastResponseId:0,inCountryMode:0};this.sequence=0;this.cache={};this.cachePos=-1;this.scrollPosition=0;this.scrollLimit=20;this.activeId="";this.lastSearch="";this.funcStore={};this.setCfg(config,"gfxMode",1);this.setCfg(config,"baseURL","https://api.craftyclicks.co.uk/address/1.1","relay");if(this.baseURL[this.baseURL.length]!="/"){this.baseURL+="/"}this.setCfg(config,"key","","accessToken");this.setCfg(config,"defaultCountry","gbr");this.setCfg(config,"enabledCountries",[]);if(this.enabledCountries.length){for(var eci=0;eci<this.enabledCountries.length;eci++){this.enabledCountries[eci]=this.enabledCountries[eci].toUpperCase()}}this.setCfg(config,"style",{ambient:"light",accent:"default"});this.setCfg(config,"domMode","name");this.setCfg(config,"placeholders",true);this.setCfg(config,"onResultSelected");this.setCfg(config,"onCountryChange");this.setCfg(config,"onSearchFocus");this.setCfg(config,"onSetCounty");this.setCfg(config,"onError");this.setCfg(config,"historyTools",true);this.setCfg(config,"countrySelector",true);this.setCfg(config,"showLogo",true);this.setCfg(config,"getIpLocation",true);this.setCfg(config,"accessTokenOverride",{});this.setupText(config.texts);this.setCfg(config,"countryLanguage","en");this.setCfg(config,"countryMatchWith","iso_3");this.setCfg(config,"tag","");this.setCfg(config,"cssPath","https://cc-cdn.com/generic/styles/v1/cc_c2a.min.css");this.setFingerPrint()};var cc_debug=false;function ccEvent(target,event_to_react,function_to_call){target.addEventListener(event_to_react,function_to_call)}function ccData(target,attr,value){if(typeof target==="undefined"||typeof attr==="undefined"){return}if(typeof value!=="undefined"){target.setAttribute("data-"+attr,JSON.stringify({data:value}));return true}else{return JSON.parse(target.getAttribute("data-"+attr)).data}}var defaultDiacriticsRemovalMap=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
11
  },{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];var changes;function removeDiacritics(str){if(!changes){changes=defaultDiacriticsRemovalMap}for(var i=0;i<changes.length;i++){str=str.replace(changes[i].letters,changes[i].base)}return str.toLowerCase()}function binaryIndexOf(array,sequence){"use strict";var minIndex=0;var maxIndex=array.length-1;var currentIndex;var currentElement;var resultIndex;while(minIndex<=maxIndex){resultIndex=currentIndex=(minIndex+maxIndex)/2|0;currentElement=array[currentIndex];if(currentElement.sequence<sequence){minIndex=currentIndex+1}else if(currentElement.sequence>sequence){maxIndex=currentIndex-1}else{return currentIndex}}return~maxIndex}function getCountryCode(c2a,text,matchBy){switch(matchBy){case"iso_3":for(var i=0;i<c2a.validCountries.length;i++){var row=c2a.validCountries[i];if(row.iso_3166_1_alpha_3==text){return row.code}}break;case"iso_2":for(var i=0;i<c2a.validCountries.length;i++){var row=c2a.validCountries[i];if(row.iso_3166_1_alpha_2==text){return row.code}}break}}clickToAddress.prototype.setPlaceholder=function(country,target){"use strict";if(this.activeInput!="init"){target=this.activeInput}if(this.placeholders&&typeof target!="undefined"){var text=this.texts.default_placeholder;if(country){text=this.texts.country_placeholder}target.setAttribute("placeholder",text)}};clickToAddress.prototype.getFocus=function(){"use strict";if(this.activeInput!="init"){this.activeInput.focus()}this.focused=true};clickToAddress.prototype.loseFocus=function(){"use strict";if(this.activeInput!="init"){this.activeInput.blur()}this.focused=false};clickToAddress.prototype.clear=function(){"use strict";this.resultList.innerHTML="";this.searchStatus={lastSearchId:0,lastResponseId:0,inCountryMode:0}};clickToAddress.prototype.show=function(){"use strict";this.searchObj.style.display="block";this.visible=true;this.setHistoryStep();if(this.activeInput!="init"){this.activeInput.setAttribute("autocomplete","off")}};clickToAddress.prototype.hide=function(force_it){"use strict";if(this.keyboardHideInProgress){this.keyboardHideInProgress=false;return}if(force_it||this.visible&&!this.focused&&!this.hover){this.searchObj.style.display="none";this.visible=false;this.hover=false;if(this.searchStatus.inCountryMode&&typeof this.lastSearch!=="undefined"){this.activeInput.value=this.lastSearch}this.clear();this.cachePos=-1;this.resetSelector();this.setPlaceholder(0);if(this.activeInput!="init"){this.activeInput.className=this.activeInput.className.replace(" c2a_active","");this.activeInput.setAttribute("autocomplete","on")}}this.hideErrors()};clickToAddress.prototype.attach=function(dom){"use strict";var domElements={};var objectArray=["search","postcode","town","line_1","line_2","company","county","country"];var quickGet=null;switch(this.domMode){case"id":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementById(dom[obj_name])}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"class":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementsByClassName(dom[obj_name])[0]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"name":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="string"&&dom[obj_name]!==""){return document.getElementsByName(dom[obj_name])[0]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break;case"object":quickGet=function(dom,obj_name){if(typeof dom[obj_name]=="object"&&dom[obj_name]!==null){return dom[obj_name]}};for(var i=0;i<objectArray.length;i++){domElements[objectArray[i]]=quickGet(dom,objectArray[i])}break}var target=domElements.search;if(target.getAttribute("cc_applied")=="true"){throw"ClickToAddress already applied to this element!"}target.setAttribute("cc_applied","true");this.setPlaceholder(0,target);var domLibId=this.domLib.length;this.domLib.push(domElements);var that=this;ccEvent(target,"keydown",function(e){if(that.serviceReady===0)return;if(e.keyCode==38||e.keyCode==40){e.preventDefault();if(!that.hasContent){return}that.moveSelector(e.keyCode==40);return}if(e.keyCode==13){e.preventDefault()}});ccEvent(target,"keyup",function(e){if(that.serviceReady===0)return;if(e.keyCode==27){that.hide(true);that.loseFocus();that.resetSelector();return}var noActionKeys=[37,38,39,40,33,34,35,36,42,44,45,16,17,18,19,20];if(noActionKeys.indexOf(e.keyCode)!=-1){return}if(e.keyCode==13){e.preventDefault();if(!that.hasContent||that.selectorPos<0){return}var elem=that.searchObj.getElementsByTagName("LI")[that.selectorPos];if(that.searchStatus.inCountryMode==1){that.selectCountry(elem.getAttribute("countryCode"))}else{that.select(elem)}return}if(that.searchStatus.inCountryMode==1){that.changeCountry(this.value)}else{if(this.value.indexOf(that.lastSearch)!==0){that.activeId=""}that.lastSearch=this.value;that.sequence++;that.searchStatus.lastSearchId=that.sequence;var current_sequence_number=that.sequence;var searchVal=this.value;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence_number){if(searchVal!==""){that.cleanHistory();that.search(searchVal,that.activeId,current_sequence_number)}else{that.clear()}}},200);that.activeDom=that.domLib[domLibId];that.gfxModeTools.reposition(that,target)}});ccEvent(target,"focus",function(){that.activeDom=that.domLib[domLibId];that.onFocus(target);if(typeof that.onSearchFocus=="function"){that.onSearchFocus(that,that.activeDom)}});ccEvent(target,"blur",function(){if(that.serviceReady===0)return;that.focused=false;that.hide()});ccEvent(target,"c2a-search",function(){that.show();if(that.searchStatus.inCountryMode==1){that.changeCountry(this.value)}else{if(this.value.indexOf(that.lastSearch)!==0){that.activeId=""}that.lastSearch=this.value;that.sequence++;that.searchStatus.lastSearchId=that.sequence;var current_sequence_number=that.sequence;var searchVal=this.value;setTimeout(function(){if(that.searchStatus.lastSearchId<=current_sequence_number){if(searchVal!==""){that.cleanHistory();that.search(searchVal,that.activeId,current_sequence_number)}else{that.clear()}}},200);that.activeDom=that.domLib[domLibId];that.gfxModeTools.reposition(that,target)}});if(target===document.activeElement){this.onFocus(target)}};clickToAddress.prototype.onFocus=function(target){"use strict";var that=this;if(that.serviceReady===0){setTimeout(function(){that.onFocus(target)},250);return}var prestate=that.visible;that.gfxModeTools.reposition(that,target);that.activeInput=target;that.focused=true;that.show();if(target.value!==""&&!prestate){that.sequence++;that.searchStatus.lastSearchId=that.sequence;that.lastSearch=target.value;that.search(target.value,that.activeId,that.sequence)}};clickToAddress.prototype.resetSelector=function(){"use strict";this.hasContent=false;this.selectorPos=-1};clickToAddress.prototype.moveSelector=function(goDown){"use strict";if(!this.visible){return}var elems=this.searchObj.getElementsByTagName("LI");if(goDown&&this.selectorPos+1<elems.length){this.selectorPos++}if(!goDown&&this.selectorPos-1>=0){this.selectorPos--}for(var i=0;i<elems.length;i++){if(i!=this.selectorPos){elems[i].className=elems[i].className.replace(" active","")}else{if(elems[i].className.indexOf("active")==-1){elems[i].className=elems[i].className+" active"}}}var offset=30*(this.selectorPos+1);var list=this.searchObj.getElementsByTagName("UL")[0];if(offset>list.offsetHeight+list.scrollTop){list.scrollTop=offset-list.offsetHeight}if(offset<=list.scrollTop){list.scrollTop=offset-30}};clickToAddress.prototype.showGeo=function(){"use strict";this.searchObj.getElementsByClassName("geo")[0].style.display="block"};clickToAddress.prototype.hideKeyboard=function(){"use strict";var that=this;that.keyboardHideInProgress=true;that.activeInput.setAttribute("readonly","readonly");that.activeInput.setAttribute("disabled","true");setTimeout(function(){that.activeInput.blur();that.activeInput.removeAttribute("readonly");that.activeInput.removeAttribute("disabled")},100)};clickToAddress.prototype.getStyleSheet=function(){"use strict";if(this.cssPath===false){return}var cssId="crafty_css";if(!document.getElementById(cssId)){var head=document.getElementsByTagName("head")[0];var link=document.createElement("link");link.id=cssId;link.rel="stylesheet";link.type="text/css";link.href=this.cssPath;link.media="all";head.appendChild(link)}};clickToAddress.prototype.setProgressBar=function(state){"use strict";var pgbar=this.searchObj.getElementsByClassName("progressBar")[0];switch(state){case 0:pgbar.className="progressBar action";pgbar.style.width="50%";setTimeout(function(){if(pgbar.className=="progressBar action"){pgbar.className="progressBar";pgbar.style.width="0%"}},5e3);break;case 1:pgbar.className="progressBar finish";pgbar.style.width="100%";setTimeout(function(){pgbar.className="progressBar";pgbar.style.width="0%"},2e3);break}};clickToAddress.prototype.triggerSearch=function(target){"use strict";var that=this;if(that.serviceReady===0){setTimeout(function(){that.triggerSearch(target)},250);return}var event=document.createEvent("Event");event.initEvent("c2a-search",true,true);target.dispatchEvent(event)};
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_Clicktoaddress</name>
4
- <version>0.5.6</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
@@ -15,7 +15,11 @@ Benefits&#xD;
15
  &#xD;
16
  Faster checkout/registration experience - a boost for conversions&#xD;
17
  More accurate addresses captured - fewer missed deliveries</description>
18
- <notes>v0.5.6&#xD;
 
 
 
 
19
  - Core JS v1.1.1&#xD;
20
  - New feature: Lock country to dropdown&#xD;
21
  - Fix: "no results" and the "generic error" messages weren't passed correctly.&#xD;
@@ -40,9 +44,9 @@ v0.5.2&#xD;
40
  v0.5.0&#xD;
41
  - Initial release for our global address endpoint.</notes>
42
  <authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
43
- <date>2016-07-14</date>
44
- <time>16:02:20</time>
45
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><file name="Feedback.php" hash="e4470dcbe52e00586e2ab6c1d7daa62f"/><file name="Gridlight.php" hash="a13aefca2c8e9b47836468fba4935b00"/><file name="Integration.php" hash="9096083cb0649710f289bb920dba715a"/><file name="Ordergrid.php" hash="edc2c351992cf6c54fd953c1e38c56e0"/></dir><dir name="Helper"><file name="Data.php" hash="cab127b8e36bc60c6d1fd191b2cd2f2c"/></dir><dir name="Model"><file name="Address.php" hash="9e2d6ece83d4aedd9a1218b2023fdfaa"/><file name="Ambient.php" hash="f165ad641db7de86123107394aaee4a3"/><file name="Countrylanguage.php" hash="459bd3d9cf0e1138e91668434d71113c"/><file name="Mode.php" hash="777e339aad59783ddea82de1277c3ae8"/><file name="Position.php" hash="d70c139a43e738edce192bc5ecd8b04d"/><dir name="Resource"><dir name="Address"><file name="Collection.php" hash="3d05eacf7cd64263a2c5b617e5030dbb"/></dir><file name="Address.php" hash="844e3043e575b515d04e49a1f4541784"/></dir></dir><dir name="controllers"><file name="HashController.php" hash="c8fb17f7ece7ff7ed6e7b2b80df91799"/></dir><dir name="data"><dir name="craftyclicks_c2a_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="aeca3eaad1229c41333e0cb1412e0a36"/></dir></dir><dir name="etc"><file name="config.xml" hash="abc45dae5b69e9f7c5b7bb090ed9f586"/><file name="system.xml" hash="909f28338507d857527460ef07c245f3"/></dir><dir name="sql"><dir name="craftyclicks_c2a_setup"><file name="install-0.5.0.php" hash="2fd9db9f51d68ef519cdbd21d94cb96d"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Craftyclicks_C2a.xml" hash="c768961bc22f68c72f3841dba8fec054"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="f570f7a4b992bb92f5860aa712579f54"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="644f9e6b875d5850c5505fb0892396e4"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="7b3a73917e8ff880deb419427c259224"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="a446cb4a249131acc656fbe45a75ee0a"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><dir name="c2a"><dir name="admin"><file name="enhance.js" hash="d520d6bde03e697a978f2661fd01aad1"/></dir><file name="admin.js" hash="38aa32cb83576da5dc380e7c1a9423bd"/><file name="default.js" hash="998daf6317eba34f2622a903dcd89223"/><dir name="lib"><file name="cc_c2a.min.js" hash="61d7f43c5c023d7ee4ca8f944ccf8464"/></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.min.css" hash="a9c1ed397f3908c1732ccc740d370d72"/><file name="enhance.css" hash="53d7a61bf3b953c31c8bdbccfacddb8b"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.min.css" hash="a9c1ed397f3908c1732ccc740d370d72"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
46
  <compatible/>
47
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
48
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_Clicktoaddress</name>
4
+ <version>0.5.7</version>
5
  <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
15
  &#xD;
16
  Faster checkout/registration experience - a boost for conversions&#xD;
17
  More accurate addresses captured - fewer missed deliveries</description>
18
+ <notes>v0.5.7&#xD;
19
+ - Core JS v1.1.2&#xD;
20
+ - Change: the company input field will stay unmodified if there's no company data available for the selected address.&#xD;
21
+ &#xD;
22
+ v0.5.6&#xD;
23
  - Core JS v1.1.1&#xD;
24
  - New feature: Lock country to dropdown&#xD;
25
  - Fix: "no results" and the "generic error" messages weren't passed correctly.&#xD;
44
  v0.5.0&#xD;
45
  - Initial release for our global address endpoint.</notes>
46
  <authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
47
+ <date>2016-07-22</date>
48
+ <time>14:25:56</time>
49
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><file name="Feedback.php" hash="e4470dcbe52e00586e2ab6c1d7daa62f"/><file name="Gridlight.php" hash="a13aefca2c8e9b47836468fba4935b00"/><file name="Integration.php" hash="9096083cb0649710f289bb920dba715a"/><file name="Ordergrid.php" hash="edc2c351992cf6c54fd953c1e38c56e0"/></dir><dir name="Helper"><file name="Data.php" hash="cab127b8e36bc60c6d1fd191b2cd2f2c"/></dir><dir name="Model"><file name="Address.php" hash="9e2d6ece83d4aedd9a1218b2023fdfaa"/><file name="Ambient.php" hash="f165ad641db7de86123107394aaee4a3"/><file name="Countrylanguage.php" hash="459bd3d9cf0e1138e91668434d71113c"/><file name="Mode.php" hash="777e339aad59783ddea82de1277c3ae8"/><file name="Position.php" hash="d70c139a43e738edce192bc5ecd8b04d"/><dir name="Resource"><dir name="Address"><file name="Collection.php" hash="3d05eacf7cd64263a2c5b617e5030dbb"/></dir><file name="Address.php" hash="844e3043e575b515d04e49a1f4541784"/></dir></dir><dir name="controllers"><file name="HashController.php" hash="c8fb17f7ece7ff7ed6e7b2b80df91799"/></dir><dir name="data"><dir name="craftyclicks_c2a_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="aeca3eaad1229c41333e0cb1412e0a36"/></dir></dir><dir name="etc"><file name="config.xml" hash="edd20f799fd964ff768b8f51b684c27c"/><file name="system.xml" hash="909f28338507d857527460ef07c245f3"/></dir><dir name="sql"><dir name="craftyclicks_c2a_setup"><file name="install-0.5.0.php" hash="2fd9db9f51d68ef519cdbd21d94cb96d"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Craftyclicks_C2a.xml" hash="c768961bc22f68c72f3841dba8fec054"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="f570f7a4b992bb92f5860aa712579f54"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="644f9e6b875d5850c5505fb0892396e4"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="7b3a73917e8ff880deb419427c259224"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="a446cb4a249131acc656fbe45a75ee0a"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><dir name="c2a"><dir name="admin"><file name="enhance.js" hash="d520d6bde03e697a978f2661fd01aad1"/></dir><file name="admin.js" hash="38aa32cb83576da5dc380e7c1a9423bd"/><file name="default.js" hash="998daf6317eba34f2622a903dcd89223"/><dir name="lib"><file name="cc_c2a.min.js" hash="dbea3077e0c24fb62876594f286b5daa"/></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.min.css" hash="a9c1ed397f3908c1732ccc740d370d72"/><file name="enhance.css" hash="53d7a61bf3b953c31c8bdbccfacddb8b"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.min.css" hash="a9c1ed397f3908c1732ccc740d370d72"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
50
  <compatible/>
51
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
52
  </package>