🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

jquery-postcodes

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-postcodes - npm Package Compare versions

Comparing version

to
1.1.2

8

dist/postcodes.js

@@ -1,2 +0,2 @@

/*! Ideal Postcodes jQuery Plugin - v1.1.1 - 2014-03-20
/*! Ideal Postcodes jQuery Plugin - v1.1.2 - 2014-03-20
* https://github.com/ideal-postcodes/jquery.postcodes

@@ -282,6 +282,6 @@ * Copyright (c) 2014 Christopher Blanchard; Licensed MIT */

Idpc.populate_output_fields(data[index]);
if (Idpc.onAddressSelected) {
Idpc.onAddressSelected.call(this, data[index]);
}
}
if (Idpc.onAddressSelected) {
Idpc.onAddressSelected.call(this, data[index]);
}
});

@@ -288,0 +288,0 @@ return $address_dropdown;

@@ -1,4 +0,4 @@

/*! Ideal Postcodes jQuery Plugin - v1.1.1 - 2014-03-20
/*! Ideal Postcodes jQuery Plugin - v1.1.2 - 2014-03-20
* https://github.com/ideal-postcodes/jquery.postcodes
* Copyright (c) 2014 Christopher Blanchard; Licensed MIT */
!function(a){"use strict";var b={api_key:"",output_fields:{line_1:"#line_1",line_2:"#line_2",line_3:"#line_3",post_town:"#post_town",postcode:"#postcode",postcode_inward:void 0,postcode_outward:void 0,udprn:void 0,dependant_locality:void 0,double_dependant_locality:void 0,thoroughfare:void 0,dependant_thoroughfare:void 0,building_number:void 0,building_name:void 0,sub_building_name:void 0,po_box:void 0,department_name:void 0,organisation_name:void 0,postcode_type:void 0,su_organisation_indicator:void 0,delivery_point_suffix:void 0},api_endpoint:"https://api.ideal-postcodes.co.uk/v1",$input:void 0,input_label:"Please enter your postcode",input_muted_style:"color:#CBCBCB;",input_class:"",input_id:"idpc_input",$button:void 0,button_id:"idpc_button",button_label:"Find my Address",button_class:"",$dropdown:void 0,dropdown_id:"idpc_dropdown",dropdown_select_message:"Please select your address",dropdown_class:"",$error_message:void 0,error_message_id:"idpc_error_message",error_message_invalid_postcode:"Please check your postcode, it seems to be incorrect",error_message_not_found:"Your postcode could not be found. Please type in your address",error_message_default:"Sorry, we weren't able to get the address you were looking for. Please type your address manually",error_message_class:"",last_lookup:"",disable_interval:1e3,debug_mode:!1,onLookupSuccess:void 0,onLookupError:void 0,onAddressSelected:void 0},c={init:function(d){a.extend(c,b),d&&a.extend(c,d),c.rig_output_fields()},rig_output_fields:function(){var b={};for(var d in c.output_fields)void 0!==c.output_fields[d]&&(b[d]=a(c.output_fields[d]));c.output_fields=b},setupPostcodeInput:function(b,d){c.$context=b,d&&a.extend(c,d),c.$input=a("<input />",{type:"text",id:c.input_id,value:c.input_label,"class":c.input_class}).val(c.input_label).attr("style",c.input_muted_style).focus(function(){c.$input.removeAttr("style").val("")}).blur(function(){c.$input.val()||(c.$input.val(c.input_label),c.$input.attr("style",c.input_muted_style))}).submit(function(){return!1}).keypress(function(a){13===a.which&&c.$button.trigger("click")}).appendTo(c.$context),c.$button=a("<button />",{html:c.button_label,id:c.button_id,"class":c.button_class}).attr("type","button").attr("onclick","return false;").submit(function(){return!1}).click(function(){var a=c.$input.val();return c.last_lookup!==a&&(c.last_lookup=a,c.disable_lookup_button(),c.clear_existing_fields(),c.lookupPostcode(a)),!1}).appendTo(c.$context)},lookupPostcode:function(b){if(a.idealPostcodes.validatePostcodeFormat(b)){var d=function(a){c.handle_api_success(a),c.onLookupSuccess&&c.onLookupSuccess(a)},e=function(){c.show_error("Unable to connect to server"),c.onLookupError&&c.onLookupError()};a.idealPostcodes.lookupPostcode(b,c.api_key,d,e)}else c.show_error(c.error_message_invalid_postcode)},disable_lookup_button:function(a){c.$button.prop("disabled",!0).html(a||"Looking up postcode...")},enable_lookup_button:function(){setTimeout(function(){c.$button.prop("disabled",!1).html(c.button_label)},c.disable_interval)},handle_api_success:function(a){c.response_code=a.code,c.response_message=a.message,c.result=a.result,2e3===c.response_code?(c.last_lookup=c.$input.val(),c.show_dropdown(c.result).appendTo(c.$context),c.enable_lookup_button()):c.handle_api_error()},handle_api_error:function(){4040===c.response_code?c.show_error(c.error_message_not_found):c.debug_mode?c.show_error("("+c.response_code+") "+c.response_message):c.show_error(c.error_message_default),c.enable_lookup_button()},clear_existing_fields:function(){c.clear_dropdown_menu(),c.clear_error_messages(),c.clear_input_fields()},clear_dropdown_menu:function(){c.$dropdown&&c.$dropdown.length&&c.$dropdown.remove()},clear_error_messages:function(){c.$error_message&&c.$error_message.length&&c.$error_message.remove()},clear_input_fields:function(){for(var a in c.output_fields)c.output_fields[a].val("")},show_dropdown:function(b){var d=b.length,e=a("<select />",{id:c.dropdown_id,"class":c.dropdown_class});a("<option />",{value:"ideal",text:c.dropdown_select_message}).appendTo(e);for(var f=0;d>f;f+=1)a("<option />",{value:f,text:b[f].line_1+" "+b[f].line_2}).appendTo(e);return c.link_to_fields(e),c.$dropdown=e,e},link_to_fields:function(b){var d=c.result;return b.change(function(){var b=a(this).val();b>=0&&c.populate_output_fields(d[b]),c.onAddressSelected&&c.onAddressSelected.call(this,d[b])}),b},populate_output_fields:function(a){for(var b in c.output_fields)c.output_fields[b].val(a[b])},show_error:function(b){c.enable_lookup_button(),c.$error_message=a("<p />",{html:b,id:c.error_message_id,"class":c.error_message_class}).appendTo(c.$context)}};a.idealPostcodes={defaults:function(){return b},setup:function(a){c.init(a)},validatePostcodeFormat:function(a){return!!a.match(/^[a-zA-Z0-9]{1,4}\s?\d[a-zA-Z]{2}$/)},lookupPostcode:function(d,e,f,g){var h=c.api_endpoint||b.api_endpoint,i="postcodes",j=[h,i,d].join("/"),k={url:j,data:{api_key:e},dataType:"jsonp",timeout:5e3,success:f};g&&(k.error=g),a.ajax(k)},clearAll:function(){c.$context=null,c.$input&&c.$input.remove(),c.$button&&c.$button.remove(),c.$dropdown&&c.$dropdown.remove(),c.$error_message&&c.$error_message.remove()}},a.fn.setupPostcodeLookup=function(b){return c.setupPostcodeInput(a(this),b),this}}(jQuery);
!function(a){"use strict";var b={api_key:"",output_fields:{line_1:"#line_1",line_2:"#line_2",line_3:"#line_3",post_town:"#post_town",postcode:"#postcode",postcode_inward:void 0,postcode_outward:void 0,udprn:void 0,dependant_locality:void 0,double_dependant_locality:void 0,thoroughfare:void 0,dependant_thoroughfare:void 0,building_number:void 0,building_name:void 0,sub_building_name:void 0,po_box:void 0,department_name:void 0,organisation_name:void 0,postcode_type:void 0,su_organisation_indicator:void 0,delivery_point_suffix:void 0},api_endpoint:"https://api.ideal-postcodes.co.uk/v1",$input:void 0,input_label:"Please enter your postcode",input_muted_style:"color:#CBCBCB;",input_class:"",input_id:"idpc_input",$button:void 0,button_id:"idpc_button",button_label:"Find my Address",button_class:"",$dropdown:void 0,dropdown_id:"idpc_dropdown",dropdown_select_message:"Please select your address",dropdown_class:"",$error_message:void 0,error_message_id:"idpc_error_message",error_message_invalid_postcode:"Please check your postcode, it seems to be incorrect",error_message_not_found:"Your postcode could not be found. Please type in your address",error_message_default:"Sorry, we weren't able to get the address you were looking for. Please type your address manually",error_message_class:"",last_lookup:"",disable_interval:1e3,debug_mode:!1,onLookupSuccess:void 0,onLookupError:void 0,onAddressSelected:void 0},c={init:function(d){a.extend(c,b),d&&a.extend(c,d),c.rig_output_fields()},rig_output_fields:function(){var b={};for(var d in c.output_fields)void 0!==c.output_fields[d]&&(b[d]=a(c.output_fields[d]));c.output_fields=b},setupPostcodeInput:function(b,d){c.$context=b,d&&a.extend(c,d),c.$input=a("<input />",{type:"text",id:c.input_id,value:c.input_label,"class":c.input_class}).val(c.input_label).attr("style",c.input_muted_style).focus(function(){c.$input.removeAttr("style").val("")}).blur(function(){c.$input.val()||(c.$input.val(c.input_label),c.$input.attr("style",c.input_muted_style))}).submit(function(){return!1}).keypress(function(a){13===a.which&&c.$button.trigger("click")}).appendTo(c.$context),c.$button=a("<button />",{html:c.button_label,id:c.button_id,"class":c.button_class}).attr("type","button").attr("onclick","return false;").submit(function(){return!1}).click(function(){var a=c.$input.val();return c.last_lookup!==a&&(c.last_lookup=a,c.disable_lookup_button(),c.clear_existing_fields(),c.lookupPostcode(a)),!1}).appendTo(c.$context)},lookupPostcode:function(b){if(a.idealPostcodes.validatePostcodeFormat(b)){var d=function(a){c.handle_api_success(a),c.onLookupSuccess&&c.onLookupSuccess(a)},e=function(){c.show_error("Unable to connect to server"),c.onLookupError&&c.onLookupError()};a.idealPostcodes.lookupPostcode(b,c.api_key,d,e)}else c.show_error(c.error_message_invalid_postcode)},disable_lookup_button:function(a){c.$button.prop("disabled",!0).html(a||"Looking up postcode...")},enable_lookup_button:function(){setTimeout(function(){c.$button.prop("disabled",!1).html(c.button_label)},c.disable_interval)},handle_api_success:function(a){c.response_code=a.code,c.response_message=a.message,c.result=a.result,2e3===c.response_code?(c.last_lookup=c.$input.val(),c.show_dropdown(c.result).appendTo(c.$context),c.enable_lookup_button()):c.handle_api_error()},handle_api_error:function(){4040===c.response_code?c.show_error(c.error_message_not_found):c.debug_mode?c.show_error("("+c.response_code+") "+c.response_message):c.show_error(c.error_message_default),c.enable_lookup_button()},clear_existing_fields:function(){c.clear_dropdown_menu(),c.clear_error_messages(),c.clear_input_fields()},clear_dropdown_menu:function(){c.$dropdown&&c.$dropdown.length&&c.$dropdown.remove()},clear_error_messages:function(){c.$error_message&&c.$error_message.length&&c.$error_message.remove()},clear_input_fields:function(){for(var a in c.output_fields)c.output_fields[a].val("")},show_dropdown:function(b){var d=b.length,e=a("<select />",{id:c.dropdown_id,"class":c.dropdown_class});a("<option />",{value:"ideal",text:c.dropdown_select_message}).appendTo(e);for(var f=0;d>f;f+=1)a("<option />",{value:f,text:b[f].line_1+" "+b[f].line_2}).appendTo(e);return c.link_to_fields(e),c.$dropdown=e,e},link_to_fields:function(b){var d=c.result;return b.change(function(){var b=a(this).val();b>=0&&(c.populate_output_fields(d[b]),c.onAddressSelected&&c.onAddressSelected.call(this,d[b]))}),b},populate_output_fields:function(a){for(var b in c.output_fields)c.output_fields[b].val(a[b])},show_error:function(b){c.enable_lookup_button(),c.$error_message=a("<p />",{html:b,id:c.error_message_id,"class":c.error_message_class}).appendTo(c.$context)}};a.idealPostcodes={defaults:function(){return b},setup:function(a){c.init(a)},validatePostcodeFormat:function(a){return!!a.match(/^[a-zA-Z0-9]{1,4}\s?\d[a-zA-Z]{2}$/)},lookupPostcode:function(d,e,f,g){var h=c.api_endpoint||b.api_endpoint,i="postcodes",j=[h,i,d].join("/"),k={url:j,data:{api_key:e},dataType:"jsonp",timeout:5e3,success:f};g&&(k.error=g),a.ajax(k)},clearAll:function(){c.$context=null,c.$input&&c.$input.remove(),c.$button&&c.$button.remove(),c.$dropdown&&c.$dropdown.remove(),c.$error_message&&c.$error_message.remove()}},a.fn.setupPostcodeLookup=function(b){return c.setupPostcodeInput(a(this),b),this}}(jQuery);
{
"name": "jquery-postcodes",
"version": "1.1.1",
"version": "1.1.2",
"engines": {

@@ -5,0 +5,0 @@ "node": ">= 0.8.0"

@@ -5,3 +5,3 @@ {

"description": "Add UK Address lookups using postcodes on any address form using Royal Mail's addressing database",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://github.com/ideal-postcodes/jquery.postcodes",

@@ -8,0 +8,0 @@ "author": {

@@ -125,3 +125,4 @@ # Postcodes jQuery Plugin

***v1.1.1***
- Callbacks for successful lookup, erroneous lookup, address selection added
*v1.1.2*
- Minor fix for when label is selected in address dropdown

@@ -290,6 +290,6 @@ /*

Idpc.populate_output_fields(data[index]);
if (Idpc.onAddressSelected) {
Idpc.onAddressSelected.call(this, data[index]);
}
}
if (Idpc.onAddressSelected) {
Idpc.onAddressSelected.call(this, data[index]);
}
});

@@ -296,0 +296,0 @@ return $address_dropdown;