/*! * CityPicker v1.0.2 * http://github.com/tshi0912/citypicker * * Copyright (c) 2015-2016 Tao Shi * Released under the MIT license * * Date: 2016-02-29T12:11:36.477Z */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as anonymous module. define(['jquery', 'ChineseDistricts'], factory); } else if (typeof exports === 'object') { // Node / CommonJS factory(require('jquery'), require('ChineseDistricts')); } else { // Browser globals. 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.defineDems(); this.render(); this.bind(); this.active = true; }, render: function () { var p = this.getPosition(), placeholder = this.$element.attr('placeholder') || this.options.placeholder, textspan = '' + (placeholder ? '' + placeholder + '' : '') + '' + '', dropdown = '