/*! * CityPicker v1.3.2 * https://github.com/tshi0912/citypicker * * Copyright (c) 2015-2019 Tao Shi * Released under the MIT license * * Date: 2019-10-19T17:21:49.592Z */ (function(factory){if(typeof define==="function"&&define.amd){define(["jquery","ChineseDistricts"],factory)}else if(typeof exports==="object"){factory(require("jquery"),require("ChineseDistricts"))}else{factory(jQuery,ChineseDistricts)}})(function($,ChineseDistricts){"use strict";if(typeof ChineseDistricts==="undefined"){throw new Error('The file "city-picker.data.js" must be included first!')}var NAMESPACE="citypicker";var EVENT_CHANGE="change."+NAMESPACE;var PROVINCE="province";var CITY="city";var DISTRICT="district";function CityPicker(element,options){this.$element=$(element);this.$dropdown=null;this.options=$.extend({},CityPicker.DEFAULTS,$.isPlainObject(options)&&options);this.active=false;this.dems=[];this.needBlur=false;this.init()}CityPicker.prototype={constructor:CityPicker,init:function(){this.codeRender();this.defineDems();this.render();this.bind();this.active=true},codeRender:function(){var code=this.$element.attr("code");var value=this.$element.val();if(code!==undefined&&code!==""&&!isNaN(Number(code)))this.$element.val($.fn.citypicker.getAddressbyCodeId(code));if(value!==undefined&&value!==""&&!isNaN(Number(value)))this.$element.val($.fn.citypicker.getAddressbyCodeId(value))},render:function(){var p=this.getPosition(),placeholder=this.$element.attr("placeholder")||this.options.placeholder,textspan=''+(placeholder?''+placeholder+"":"")+''+"",dropdown='