diff --git a/README.md b/README.md index a11b46a..c6312c1 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,12 @@ Specify the countries to appear at the top of the list. Type: `Boolean` Default: `false` Set the dropdown's width to be the same as the input. This is automatically enabled for small screens. +**localizedCountries** +Type: `Object` Default: `{}` +Allows to translate the countries by its given iso code e.g.: + ```js +{ 'de': 'Deutschland' } +``` ## Public Methods **destroy** diff --git a/build/css/countrySelect.css b/build/css/countrySelect.css index 2a5dd07..a0ca94d 100644 --- a/build/css/countrySelect.css +++ b/build/css/countrySelect.css @@ -1,1205 +1,1205 @@ -.country-select{ - position:relative; - display:inline-block -} -.country-select *{ - -webkit-box-sizing:border-box; - box-sizing:border-box -} -.country-select .hide{ - display:none -} -.country-select .v-hide{ - visibility:hidden -} -.country-select input, -.country-select input[type=text]{ - position:relative; - z-index:0; - margin-top:0 !important; - margin-bottom:0 !important; - padding-right:36px; - margin-right:0 -} -.country-select .flag-dropdown{ - position:absolute; - top:0; - bottom:0; - right:0; - padding:1px -} -.country-select .selected-flag{ - z-index:1; - position:relative; - width:36px; - height:100%; - padding:0 0 0 8px -} -.country-select .selected-flag .flag{ - position:absolute; - top:0; - bottom:0; - margin:auto -} -.country-select .selected-flag .arrow{ - position:absolute; - top:50%; - margin-top:-2px; - right:6px; - width:0; - height:0; - border-left:3px solid transparent; - border-right:3px solid transparent; - border-top:4px solid #555 -} -.country-select .selected-flag .arrow.up{ - border-top:none; - border-bottom:4px solid #555 -} -.country-select .country-list{ - position:absolute; - z-index:2; - list-style:none; - text-align:left; - padding:0; - margin:0 0 0 -1px; - -webkit-box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); - box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); - background-color:white; - border:1px solid #ccc; - white-space:nowrap; - max-height:200px; - overflow-y:scroll -} -.country-select .country-list .flag{ - display:inline-block; - width:20px -} -@media (max-width: 500px){ - .country-select .country-list{ - white-space:normal - } -} -.country-select .country-list .divider{ - padding-bottom:5px; - margin-bottom:5px; - border-bottom:1px solid #ccc -} -.country-select .country-list .country{ - padding:5px 10px -} -.country-select .country-list .country.highlight{ - background-color:rgba(0, 0, 0, 0.05) -} -.country-select .country-list .flag, -.country-select .country-list .country-name{ - vertical-align:middle -} -.country-select .country-list .flag{ - margin-right:6px -} -.country-select.inside input, -.country-select.inside input[type=text]{ - padding-right:6px; - padding-left:52px; - margin-left:0 -} -.country-select.inside .flag-dropdown{ - right:auto; - left:0 -} -.country-select.inside .selected-flag{ - width:46px -} -.country-select.inside .flag-dropdown:hover{ - cursor:pointer -} -.country-select.inside .flag-dropdown:hover .selected-flag{ - background-color:rgba(0, 0, 0, 0.05) -} -.country-select.inside input[disabled] + .flag-dropdown:hover, -.country-select.inside input[readonly] + .flag-dropdown:hover{ - cursor:default -} -.country-select.inside input[disabled] + .flag-dropdown:hover .selected-flag, -.country-select.inside input[readonly] + .flag-dropdown:hover .selected-flag{ - background-color:transparent -} -.country-select .flag{ - width:20px; - height:15px; - -webkit-box-shadow:0px 0px 1px 0px #888; - box-shadow:0px 0px 1px 0px #888; - background-image:url("../../build/img/flags.png"); - background-repeat:no-repeat; - background-color:#dbdbdb; - background-position:20px 0 -} -@media only screen and (-webkit-min-device-pixel-ratio: 2), -only screen and (min--moz-device-pixel-ratio: 2), -only screen and (min-device-pixel-ratio: 2), -only screen and (min-resolution: 192dpi), -only screen and (min-resolution: 2dppx){ - .country-select .flag{ - background-image:url("../../build/img/flags@2x.png") - } -} -.country-select .flag{ - width:20px -} -.country-select .flag.be{ - width:18px -} -.country-select .flag.ch{ - width:15px -} -.country-select .flag.mc{ - width:19px -} -.country-select .flag.ne{ - width:18px -} -.country-select .flag.np{ - width:13px -} -.country-select .flag.va{ - width:15px -} -@media only screen and (-webkit-min-device-pixel-ratio: 2), -only screen and (min--moz-device-pixel-ratio: 2), -only screen and (min-device-pixel-ratio: 2), -only screen and (min-resolution: 192dpi), -only screen and (min-resolution: 2dppx){ - .country-select .flag{ - background-size:5630px 15px - } -} -.country-select .flag.ac{ - height:10px; - background-position:0px 0px -} -.country-select .flag.ad{ - height:14px; - background-position:-22px 0px -} -.country-select .flag.ae{ - height:10px; - background-position:-44px 0px -} -.country-select .flag.af{ - height:14px; - background-position:-66px 0px -} -.country-select .flag.ag{ - height:14px; - background-position:-88px 0px -} -.country-select .flag.ai{ - height:10px; - background-position:-110px 0px -} -.country-select .flag.al{ - height:15px; - background-position:-132px 0px -} -.country-select .flag.am{ - height:10px; - background-position:-154px 0px -} -.country-select .flag.ao{ - height:14px; - background-position:-176px 0px -} -.country-select .flag.aq{ - height:14px; - background-position:-198px 0px -} -.country-select .flag.ar{ - height:13px; - background-position:-220px 0px -} -.country-select .flag.as{ - height:10px; - background-position:-242px 0px -} -.country-select .flag.at{ - height:14px; - background-position:-264px 0px -} -.country-select .flag.au{ - height:10px; - background-position:-286px 0px -} -.country-select .flag.aw{ - height:14px; - background-position:-308px 0px -} -.country-select .flag.ax{ - height:13px; - background-position:-330px 0px -} -.country-select .flag.az{ - height:10px; - background-position:-352px 0px -} -.country-select .flag.ba{ - height:10px; - background-position:-374px 0px -} -.country-select .flag.bb{ - height:14px; - background-position:-396px 0px -} -.country-select .flag.bd{ - height:12px; - background-position:-418px 0px -} -.country-select .flag.be{ - height:15px; - background-position:-440px 0px -} -.country-select .flag.bf{ - height:14px; - background-position:-460px 0px -} -.country-select .flag.bg{ - height:12px; - background-position:-482px 0px -} -.country-select .flag.bh{ - height:12px; - background-position:-504px 0px -} -.country-select .flag.bi{ - height:12px; - background-position:-526px 0px -} -.country-select .flag.bj{ - height:14px; - background-position:-548px 0px -} -.country-select .flag.bl{ - height:14px; - background-position:-570px 0px -} -.country-select .flag.bm{ - height:10px; - background-position:-592px 0px -} -.country-select .flag.bn{ - height:10px; - background-position:-614px 0px -} -.country-select .flag.bo{ - height:14px; - background-position:-636px 0px -} -.country-select .flag.bq{ - height:14px; - background-position:-658px 0px -} -.country-select .flag.br{ - height:14px; - background-position:-680px 0px -} -.country-select .flag.bs{ - height:10px; - background-position:-702px 0px -} -.country-select .flag.bt{ - height:14px; - background-position:-724px 0px -} -.country-select .flag.bv{ - height:15px; - background-position:-746px 0px -} -.country-select .flag.bw{ - height:14px; - background-position:-768px 0px -} -.country-select .flag.by{ - height:10px; - background-position:-790px 0px -} -.country-select .flag.bz{ - height:14px; - background-position:-812px 0px -} -.country-select .flag.ca{ - height:10px; - background-position:-834px 0px -} -.country-select .flag.cc{ - height:10px; - background-position:-856px 0px -} -.country-select .flag.cd{ - height:15px; - background-position:-878px 0px -} -.country-select .flag.cf{ - height:14px; - background-position:-900px 0px -} -.country-select .flag.cg{ - height:14px; - background-position:-922px 0px -} -.country-select .flag.ch{ - height:15px; - background-position:-944px 0px -} -.country-select .flag.ci{ - height:14px; - background-position:-961px 0px -} -.country-select .flag.ck{ - height:10px; - background-position:-983px 0px -} -.country-select .flag.cl{ - height:14px; - background-position:-1005px 0px -} -.country-select .flag.cm{ - height:14px; - background-position:-1027px 0px -} -.country-select .flag.cn{ - height:14px; - background-position:-1049px 0px -} -.country-select .flag.co{ - height:14px; - background-position:-1071px 0px -} -.country-select .flag.cp{ - height:14px; - background-position:-1093px 0px -} -.country-select .flag.cr{ - height:12px; - background-position:-1115px 0px -} -.country-select .flag.cu{ - height:10px; - background-position:-1137px 0px -} -.country-select .flag.cv{ - height:12px; - background-position:-1159px 0px -} -.country-select .flag.cw{ - height:14px; - background-position:-1181px 0px -} -.country-select .flag.cx{ - height:10px; - background-position:-1203px 0px -} -.country-select .flag.cy{ - height:13px; - background-position:-1225px 0px -} -.country-select .flag.cz{ - height:14px; - background-position:-1247px 0px -} -.country-select .flag.de{ - height:12px; - background-position:-1269px 0px -} -.country-select .flag.dg{ - height:10px; - background-position:-1291px 0px -} -.country-select .flag.dj{ - height:14px; - background-position:-1313px 0px -} -.country-select .flag.dk{ - height:15px; - background-position:-1335px 0px -} -.country-select .flag.dm{ - height:10px; - background-position:-1357px 0px -} -.country-select .flag.do{ - height:13px; - background-position:-1379px 0px -} -.country-select .flag.dz{ - height:14px; - background-position:-1401px 0px -} -.country-select .flag.ea{ - height:14px; - background-position:-1423px 0px -} -.country-select .flag.ec{ - height:14px; - background-position:-1445px 0px -} -.country-select .flag.ee{ - height:13px; - background-position:-1467px 0px -} -.country-select .flag.eg{ - height:14px; - background-position:-1489px 0px -} -.country-select .flag.eh{ - height:10px; - background-position:-1511px 0px -} -.country-select .flag.er{ - height:10px; - background-position:-1533px 0px -} -.country-select .flag.es{ - height:14px; - background-position:-1555px 0px -} -.country-select .flag.et{ - height:10px; - background-position:-1577px 0px -} -.country-select .flag.eu{ - height:14px; - background-position:-1599px 0px -} -.country-select .flag.fi{ - height:12px; - background-position:-1621px 0px -} -.country-select .flag.fj{ - height:10px; - background-position:-1643px 0px -} -.country-select .flag.fk{ - height:10px; - background-position:-1665px 0px -} -.country-select .flag.fm{ - height:11px; - background-position:-1687px 0px -} -.country-select .flag.fo{ - height:15px; - background-position:-1709px 0px -} -.country-select .flag.fr{ - height:14px; - background-position:-1731px 0px -} -.country-select .flag.ga{ - height:15px; - background-position:-1753px 0px -} -.country-select .flag.gb{ - height:10px; - background-position:-1775px 0px -} -.country-select .flag.gd{ - height:12px; - background-position:-1797px 0px -} -.country-select .flag.ge{ - height:14px; - background-position:-1819px 0px -} -.country-select .flag.gf{ - height:14px; - background-position:-1841px 0px -} -.country-select .flag.gg{ - height:14px; - background-position:-1863px 0px -} -.country-select .flag.gh{ - height:14px; - background-position:-1885px 0px -} -.country-select .flag.gi{ - height:10px; - background-position:-1907px 0px -} -.country-select .flag.gl{ - height:14px; - background-position:-1929px 0px -} -.country-select .flag.gm{ - height:14px; - background-position:-1951px 0px -} -.country-select .flag.gn{ - height:14px; - background-position:-1973px 0px -} -.country-select .flag.gp{ - height:14px; - background-position:-1995px 0px -} -.country-select .flag.gq{ - height:14px; - background-position:-2017px 0px -} -.country-select .flag.gr{ - height:14px; - background-position:-2039px 0px -} -.country-select .flag.gs{ - height:10px; - background-position:-2061px 0px -} -.country-select .flag.gt{ - height:13px; - background-position:-2083px 0px -} -.country-select .flag.gu{ - height:11px; - background-position:-2105px 0px -} -.country-select .flag.gw{ - height:10px; - background-position:-2127px 0px -} -.country-select .flag.gy{ - height:12px; - background-position:-2149px 0px -} -.country-select .flag.hk{ - height:14px; - background-position:-2171px 0px -} -.country-select .flag.hm{ - height:10px; - background-position:-2193px 0px -} -.country-select .flag.hn{ - height:10px; - background-position:-2215px 0px -} -.country-select .flag.hr{ - height:10px; - background-position:-2237px 0px -} -.country-select .flag.ht{ - height:12px; - background-position:-2259px 0px -} -.country-select .flag.hu{ - height:10px; - background-position:-2281px 0px -} -.country-select .flag.ic{ - height:14px; - background-position:-2303px 0px -} -.country-select .flag.id{ - height:14px; - background-position:-2325px 0px -} -.country-select .flag.ie{ - height:10px; - background-position:-2347px 0px -} -.country-select .flag.il{ - height:15px; - background-position:-2369px 0px -} -.country-select .flag.im{ - height:10px; - background-position:-2391px 0px -} -.country-select .flag.in{ - height:14px; - background-position:-2413px 0px -} -.country-select .flag.io{ - height:10px; - background-position:-2435px 0px -} -.country-select .flag.iq{ - height:14px; - background-position:-2457px 0px -} -.country-select .flag.ir{ - height:12px; - background-position:-2479px 0px -} -.country-select .flag.is{ - height:15px; - background-position:-2501px 0px -} -.country-select .flag.it{ - height:14px; - background-position:-2523px 0px -} -.country-select .flag.je{ - height:12px; - background-position:-2545px 0px -} -.country-select .flag.jm{ - height:10px; - background-position:-2567px 0px -} -.country-select .flag.jo{ - height:10px; - background-position:-2589px 0px -} -.country-select .flag.jp{ - height:14px; - background-position:-2611px 0px -} -.country-select .flag.ke{ - height:14px; - background-position:-2633px 0px -} -.country-select .flag.kg{ - height:12px; - background-position:-2655px 0px -} -.country-select .flag.kh{ - height:13px; - background-position:-2677px 0px -} -.country-select .flag.ki{ - height:10px; - background-position:-2699px 0px -} -.country-select .flag.km{ - height:12px; - background-position:-2721px 0px -} -.country-select .flag.kn{ - height:14px; - background-position:-2743px 0px -} -.country-select .flag.kp{ - height:10px; - background-position:-2765px 0px -} -.country-select .flag.kr{ - height:14px; - background-position:-2787px 0px -} -.country-select .flag.kw{ - height:10px; - background-position:-2809px 0px -} -.country-select .flag.ky{ - height:10px; - background-position:-2831px 0px -} -.country-select .flag.kz{ - height:10px; - background-position:-2853px 0px -} -.country-select .flag.la{ - height:14px; - background-position:-2875px 0px -} -.country-select .flag.lb{ - height:14px; - background-position:-2897px 0px -} -.country-select .flag.lc{ - height:10px; - background-position:-2919px 0px -} -.country-select .flag.li{ - height:12px; - background-position:-2941px 0px -} -.country-select .flag.lk{ - height:10px; - background-position:-2963px 0px -} -.country-select .flag.lr{ - height:11px; - background-position:-2985px 0px -} -.country-select .flag.ls{ - height:14px; - background-position:-3007px 0px -} -.country-select .flag.lt{ - height:12px; - background-position:-3029px 0px -} -.country-select .flag.lu{ - height:12px; - background-position:-3051px 0px -} -.country-select .flag.lv{ - height:10px; - background-position:-3073px 0px -} -.country-select .flag.ly{ - height:10px; - background-position:-3095px 0px -} -.country-select .flag.ma{ - height:14px; - background-position:-3117px 0px -} -.country-select .flag.mc{ - height:15px; - background-position:-3139px 0px -} -.country-select .flag.md{ - height:10px; - background-position:-3160px 0px -} -.country-select .flag.me{ - height:10px; - background-position:-3182px 0px -} -.country-select .flag.mf{ - height:14px; - background-position:-3204px 0px -} -.country-select .flag.mg{ - height:14px; - background-position:-3226px 0px -} -.country-select .flag.mh{ - height:11px; - background-position:-3248px 0px -} -.country-select .flag.mk{ - height:10px; - background-position:-3270px 0px -} -.country-select .flag.ml{ - height:14px; - background-position:-3292px 0px -} -.country-select .flag.mm{ - height:14px; - background-position:-3314px 0px -} -.country-select .flag.mn{ - height:10px; - background-position:-3336px 0px -} -.country-select .flag.mo{ - height:14px; - background-position:-3358px 0px -} -.country-select .flag.mp{ - height:10px; - background-position:-3380px 0px -} -.country-select .flag.mq{ - height:14px; - background-position:-3402px 0px -} -.country-select .flag.mr{ - height:14px; - background-position:-3424px 0px -} -.country-select .flag.ms{ - height:10px; - background-position:-3446px 0px -} -.country-select .flag.mt{ - height:14px; - background-position:-3468px 0px -} -.country-select .flag.mu{ - height:14px; - background-position:-3490px 0px -} -.country-select .flag.mv{ - height:14px; - background-position:-3512px 0px -} -.country-select .flag.mw{ - height:14px; - background-position:-3534px 0px -} -.country-select .flag.mx{ - height:12px; - background-position:-3556px 0px -} -.country-select .flag.my{ - height:10px; - background-position:-3578px 0px -} -.country-select .flag.mz{ - height:14px; - background-position:-3600px 0px -} -.country-select .flag.na{ - height:14px; - background-position:-3622px 0px -} -.country-select .flag.nc{ - height:10px; - background-position:-3644px 0px -} -.country-select .flag.ne{ - height:15px; - background-position:-3666px 0px -} -.country-select .flag.nf{ - height:10px; - background-position:-3686px 0px -} -.country-select .flag.ng{ - height:10px; - background-position:-3708px 0px -} -.country-select .flag.ni{ - height:12px; - background-position:-3730px 0px -} -.country-select .flag.nl{ - height:14px; - background-position:-3752px 0px -} -.country-select .flag.no{ - height:15px; - background-position:-3774px 0px -} -.country-select .flag.np{ - height:15px; - background-position:-3796px 0px; - background-color:transparent -} -.country-select .flag.nr{ - height:10px; - background-position:-3811px 0px -} -.country-select .flag.nu{ - height:10px; - background-position:-3833px 0px -} -.country-select .flag.nz{ - height:10px; - background-position:-3855px 0px -} -.country-select .flag.om{ - height:10px; - background-position:-3877px 0px -} -.country-select .flag.pa{ - height:14px; - background-position:-3899px 0px -} -.country-select .flag.pe{ - height:14px; - background-position:-3921px 0px -} -.country-select .flag.pf{ - height:14px; - background-position:-3943px 0px -} -.country-select .flag.pg{ - height:15px; - background-position:-3965px 0px -} -.country-select .flag.ph{ - height:10px; - background-position:-3987px 0px -} -.country-select .flag.pk{ - height:14px; - background-position:-4009px 0px -} -.country-select .flag.pl{ - height:13px; - background-position:-4031px 0px -} -.country-select .flag.pm{ - height:14px; - background-position:-4053px 0px -} -.country-select .flag.pn{ - height:10px; - background-position:-4075px 0px -} -.country-select .flag.pr{ - height:14px; - background-position:-4097px 0px -} -.country-select .flag.ps{ - height:10px; - background-position:-4119px 0px -} -.country-select .flag.pt{ - height:14px; - background-position:-4141px 0px -} -.country-select .flag.pw{ - height:13px; - background-position:-4163px 0px -} -.country-select .flag.py{ - height:11px; - background-position:-4185px 0px -} -.country-select .flag.qa{ - height:8px; - background-position:-4207px 0px -} -.country-select .flag.re{ - height:14px; - background-position:-4229px 0px -} -.country-select .flag.ro{ - height:14px; - background-position:-4251px 0px -} -.country-select .flag.rs{ - height:14px; - background-position:-4273px 0px -} -.country-select .flag.ru{ - height:14px; - background-position:-4295px 0px -} -.country-select .flag.rw{ - height:14px; - background-position:-4317px 0px -} -.country-select .flag.sa{ - height:14px; - background-position:-4339px 0px -} -.country-select .flag.sb{ - height:10px; - background-position:-4361px 0px -} -.country-select .flag.sc{ - height:10px; - background-position:-4383px 0px -} -.country-select .flag.sd{ - height:10px; - background-position:-4405px 0px -} -.country-select .flag.se{ - height:13px; - background-position:-4427px 0px -} -.country-select .flag.sg{ - height:14px; - background-position:-4449px 0px -} -.country-select .flag.sh{ - height:10px; - background-position:-4471px 0px -} -.country-select .flag.si{ - height:10px; - background-position:-4493px 0px -} -.country-select .flag.sj{ - height:15px; - background-position:-4515px 0px -} -.country-select .flag.sk{ - height:14px; - background-position:-4537px 0px -} -.country-select .flag.sl{ - height:14px; - background-position:-4559px 0px -} -.country-select .flag.sm{ - height:15px; - background-position:-4581px 0px -} -.country-select .flag.sn{ - height:14px; - background-position:-4603px 0px -} -.country-select .flag.so{ - height:14px; - background-position:-4625px 0px -} -.country-select .flag.sr{ - height:14px; - background-position:-4647px 0px -} -.country-select .flag.ss{ - height:10px; - background-position:-4669px 0px -} -.country-select .flag.st{ - height:10px; - background-position:-4691px 0px -} -.country-select .flag.sv{ - height:12px; - background-position:-4713px 0px -} -.country-select .flag.sx{ - height:14px; - background-position:-4735px 0px -} -.country-select .flag.sy{ - height:14px; - background-position:-4757px 0px -} -.country-select .flag.sz{ - height:14px; - background-position:-4779px 0px -} -.country-select .flag.ta{ - height:10px; - background-position:-4801px 0px -} -.country-select .flag.tc{ - height:10px; - background-position:-4823px 0px -} -.country-select .flag.td{ - height:14px; - background-position:-4845px 0px -} -.country-select .flag.tf{ - height:14px; - background-position:-4867px 0px -} -.country-select .flag.tg{ - height:13px; - background-position:-4889px 0px -} -.country-select .flag.th{ - height:14px; - background-position:-4911px 0px -} -.country-select .flag.tj{ - height:10px; - background-position:-4933px 0px -} -.country-select .flag.tk{ - height:10px; - background-position:-4955px 0px -} -.country-select .flag.tl{ - height:10px; - background-position:-4977px 0px -} -.country-select .flag.tm{ - height:14px; - background-position:-4999px 0px -} -.country-select .flag.tn{ - height:14px; - background-position:-5021px 0px -} -.country-select .flag.to{ - height:10px; - background-position:-5043px 0px -} -.country-select .flag.tr{ - height:14px; - background-position:-5065px 0px -} -.country-select .flag.tt{ - height:12px; - background-position:-5087px 0px -} -.country-select .flag.tv{ - height:10px; - background-position:-5109px 0px -} -.country-select .flag.tw{ - height:14px; - background-position:-5131px 0px -} -.country-select .flag.tz{ - height:14px; - background-position:-5153px 0px -} -.country-select .flag.ua{ - height:14px; - background-position:-5175px 0px -} -.country-select .flag.ug{ - height:14px; - background-position:-5197px 0px -} -.country-select .flag.um{ - height:11px; - background-position:-5219px 0px -} -.country-select .flag.us{ - height:11px; - background-position:-5241px 0px -} -.country-select .flag.uy{ - height:14px; - background-position:-5263px 0px -} -.country-select .flag.uz{ - height:10px; - background-position:-5285px 0px -} -.country-select .flag.va{ - height:15px; - background-position:-5307px 0px -} -.country-select .flag.vc{ - height:14px; - background-position:-5324px 0px -} -.country-select .flag.ve{ - height:14px; - background-position:-5346px 0px -} -.country-select .flag.vg{ - height:10px; - background-position:-5368px 0px -} -.country-select .flag.vi{ - height:14px; - background-position:-5390px 0px -} -.country-select .flag.vn{ - height:14px; - background-position:-5412px 0px -} -.country-select .flag.vu{ - height:12px; - background-position:-5434px 0px -} -.country-select .flag.wf{ - height:14px; - background-position:-5456px 0px -} -.country-select .flag.ws{ - height:10px; - background-position:-5478px 0px -} -.country-select .flag.xk{ - height:15px; - background-position:-5500px 0px -} -.country-select .flag.ye{ - height:14px; - background-position:-5522px 0px -} -.country-select .flag.yt{ - height:14px; - background-position:-5544px 0px -} -.country-select .flag.za{ - height:14px; - background-position:-5566px 0px -} -.country-select .flag.zm{ - height:14px; - background-position:-5588px 0px -} -.country-select .flag.zw{ - height:10px; - background-position:-5610px 0px +.country-select{ + position:relative; + display:inline-block +} +.country-select *{ + -webkit-box-sizing:border-box; + box-sizing:border-box +} +.country-select .hide{ + display:none +} +.country-select .v-hide{ + visibility:hidden +} +.country-select input, +.country-select input[type=text]{ + position:relative; + z-index:0; + margin-top:0 !important; + margin-bottom:0 !important; + padding-right:36px; + margin-right:0 +} +.country-select .flag-dropdown{ + position:absolute; + top:0; + bottom:0; + right:0; + padding:1px +} +.country-select .selected-flag{ + z-index:1; + position:relative; + width:36px; + height:100%; + padding:0 0 0 8px +} +.country-select .selected-flag .flag{ + position:absolute; + top:0; + bottom:0; + margin:auto +} +.country-select .selected-flag .arrow{ + position:absolute; + top:50%; + margin-top:-2px; + right:6px; + width:0; + height:0; + border-left:3px solid transparent; + border-right:3px solid transparent; + border-top:4px solid #555 +} +.country-select .selected-flag .arrow.up{ + border-top:none; + border-bottom:4px solid #555 +} +.country-select .country-list{ + position:absolute; + z-index:2; + list-style:none; + text-align:left; + padding:0; + margin:0 0 0 -1px; + -webkit-box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); + box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2); + background-color:white; + border:1px solid #ccc; + white-space:nowrap; + max-height:200px; + overflow-y:scroll +} +.country-select .country-list .flag{ + display:inline-block; + width:20px +} +@media (max-width: 500px){ + .country-select .country-list{ + white-space:normal + } +} +.country-select .country-list .divider{ + padding-bottom:5px; + margin-bottom:5px; + border-bottom:1px solid #ccc +} +.country-select .country-list .country{ + padding:5px 10px +} +.country-select .country-list .country.highlight{ + background-color:rgba(0, 0, 0, 0.05) +} +.country-select .country-list .flag, +.country-select .country-list .country-name{ + vertical-align:middle +} +.country-select .country-list .flag{ + margin-right:6px +} +.country-select.inside input, +.country-select.inside input[type=text]{ + padding-right:6px; + padding-left:52px; + margin-left:0 +} +.country-select.inside .flag-dropdown{ + right:auto; + left:0 +} +.country-select.inside .selected-flag{ + width:46px +} +.country-select.inside .flag-dropdown:hover{ + cursor:pointer +} +.country-select.inside .flag-dropdown:hover .selected-flag{ + background-color:rgba(0, 0, 0, 0.05) +} +.country-select.inside input[disabled] + .flag-dropdown:hover, +.country-select.inside input[readonly] + .flag-dropdown:hover{ + cursor:default +} +.country-select.inside input[disabled] + .flag-dropdown:hover .selected-flag, +.country-select.inside input[readonly] + .flag-dropdown:hover .selected-flag{ + background-color:transparent +} +.country-select .flag{ + width:20px; + height:15px; + -webkit-box-shadow:0px 0px 1px 0px #888; + box-shadow:0px 0px 1px 0px #888; + background-image:url("../../build/img/flags.png"); + background-repeat:no-repeat; + background-color:#dbdbdb; + background-position:20px 0 +} +@media only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and (min--moz-device-pixel-ratio: 2), +only screen and (min-device-pixel-ratio: 2), +only screen and (min-resolution: 192dpi), +only screen and (min-resolution: 2dppx){ + .country-select .flag{ + background-image:url("../../build/img/flags@2x.png") + } +} +.country-select .flag{ + width:20px +} +.country-select .flag.be{ + width:18px +} +.country-select .flag.ch{ + width:15px +} +.country-select .flag.mc{ + width:19px +} +.country-select .flag.ne{ + width:18px +} +.country-select .flag.np{ + width:13px +} +.country-select .flag.va{ + width:15px +} +@media only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and (min--moz-device-pixel-ratio: 2), +only screen and (min-device-pixel-ratio: 2), +only screen and (min-resolution: 192dpi), +only screen and (min-resolution: 2dppx){ + .country-select .flag{ + background-size:5630px 15px + } +} +.country-select .flag.ac{ + height:10px; + background-position:0px 0px +} +.country-select .flag.ad{ + height:14px; + background-position:-22px 0px +} +.country-select .flag.ae{ + height:10px; + background-position:-44px 0px +} +.country-select .flag.af{ + height:14px; + background-position:-66px 0px +} +.country-select .flag.ag{ + height:14px; + background-position:-88px 0px +} +.country-select .flag.ai{ + height:10px; + background-position:-110px 0px +} +.country-select .flag.al{ + height:15px; + background-position:-132px 0px +} +.country-select .flag.am{ + height:10px; + background-position:-154px 0px +} +.country-select .flag.ao{ + height:14px; + background-position:-176px 0px +} +.country-select .flag.aq{ + height:14px; + background-position:-198px 0px +} +.country-select .flag.ar{ + height:13px; + background-position:-220px 0px +} +.country-select .flag.as{ + height:10px; + background-position:-242px 0px +} +.country-select .flag.at{ + height:14px; + background-position:-264px 0px +} +.country-select .flag.au{ + height:10px; + background-position:-286px 0px +} +.country-select .flag.aw{ + height:14px; + background-position:-308px 0px +} +.country-select .flag.ax{ + height:13px; + background-position:-330px 0px +} +.country-select .flag.az{ + height:10px; + background-position:-352px 0px +} +.country-select .flag.ba{ + height:10px; + background-position:-374px 0px +} +.country-select .flag.bb{ + height:14px; + background-position:-396px 0px +} +.country-select .flag.bd{ + height:12px; + background-position:-418px 0px +} +.country-select .flag.be{ + height:15px; + background-position:-440px 0px +} +.country-select .flag.bf{ + height:14px; + background-position:-460px 0px +} +.country-select .flag.bg{ + height:12px; + background-position:-482px 0px +} +.country-select .flag.bh{ + height:12px; + background-position:-504px 0px +} +.country-select .flag.bi{ + height:12px; + background-position:-526px 0px +} +.country-select .flag.bj{ + height:14px; + background-position:-548px 0px +} +.country-select .flag.bl{ + height:14px; + background-position:-570px 0px +} +.country-select .flag.bm{ + height:10px; + background-position:-592px 0px +} +.country-select .flag.bn{ + height:10px; + background-position:-614px 0px +} +.country-select .flag.bo{ + height:14px; + background-position:-636px 0px +} +.country-select .flag.bq{ + height:14px; + background-position:-658px 0px +} +.country-select .flag.br{ + height:14px; + background-position:-680px 0px +} +.country-select .flag.bs{ + height:10px; + background-position:-702px 0px +} +.country-select .flag.bt{ + height:14px; + background-position:-724px 0px +} +.country-select .flag.bv{ + height:15px; + background-position:-746px 0px +} +.country-select .flag.bw{ + height:14px; + background-position:-768px 0px +} +.country-select .flag.by{ + height:10px; + background-position:-790px 0px +} +.country-select .flag.bz{ + height:14px; + background-position:-812px 0px +} +.country-select .flag.ca{ + height:10px; + background-position:-834px 0px +} +.country-select .flag.cc{ + height:10px; + background-position:-856px 0px +} +.country-select .flag.cd{ + height:15px; + background-position:-878px 0px +} +.country-select .flag.cf{ + height:14px; + background-position:-900px 0px +} +.country-select .flag.cg{ + height:14px; + background-position:-922px 0px +} +.country-select .flag.ch{ + height:15px; + background-position:-944px 0px +} +.country-select .flag.ci{ + height:14px; + background-position:-961px 0px +} +.country-select .flag.ck{ + height:10px; + background-position:-983px 0px +} +.country-select .flag.cl{ + height:14px; + background-position:-1005px 0px +} +.country-select .flag.cm{ + height:14px; + background-position:-1027px 0px +} +.country-select .flag.cn{ + height:14px; + background-position:-1049px 0px +} +.country-select .flag.co{ + height:14px; + background-position:-1071px 0px +} +.country-select .flag.cp{ + height:14px; + background-position:-1093px 0px +} +.country-select .flag.cr{ + height:12px; + background-position:-1115px 0px +} +.country-select .flag.cu{ + height:10px; + background-position:-1137px 0px +} +.country-select .flag.cv{ + height:12px; + background-position:-1159px 0px +} +.country-select .flag.cw{ + height:14px; + background-position:-1181px 0px +} +.country-select .flag.cx{ + height:10px; + background-position:-1203px 0px +} +.country-select .flag.cy{ + height:13px; + background-position:-1225px 0px +} +.country-select .flag.cz{ + height:14px; + background-position:-1247px 0px +} +.country-select .flag.de{ + height:12px; + background-position:-1269px 0px +} +.country-select .flag.dg{ + height:10px; + background-position:-1291px 0px +} +.country-select .flag.dj{ + height:14px; + background-position:-1313px 0px +} +.country-select .flag.dk{ + height:15px; + background-position:-1335px 0px +} +.country-select .flag.dm{ + height:10px; + background-position:-1357px 0px +} +.country-select .flag.do{ + height:13px; + background-position:-1379px 0px +} +.country-select .flag.dz{ + height:14px; + background-position:-1401px 0px +} +.country-select .flag.ea{ + height:14px; + background-position:-1423px 0px +} +.country-select .flag.ec{ + height:14px; + background-position:-1445px 0px +} +.country-select .flag.ee{ + height:13px; + background-position:-1467px 0px +} +.country-select .flag.eg{ + height:14px; + background-position:-1489px 0px +} +.country-select .flag.eh{ + height:10px; + background-position:-1511px 0px +} +.country-select .flag.er{ + height:10px; + background-position:-1533px 0px +} +.country-select .flag.es{ + height:14px; + background-position:-1555px 0px +} +.country-select .flag.et{ + height:10px; + background-position:-1577px 0px +} +.country-select .flag.eu{ + height:14px; + background-position:-1599px 0px +} +.country-select .flag.fi{ + height:12px; + background-position:-1621px 0px +} +.country-select .flag.fj{ + height:10px; + background-position:-1643px 0px +} +.country-select .flag.fk{ + height:10px; + background-position:-1665px 0px +} +.country-select .flag.fm{ + height:11px; + background-position:-1687px 0px +} +.country-select .flag.fo{ + height:15px; + background-position:-1709px 0px +} +.country-select .flag.fr{ + height:14px; + background-position:-1731px 0px +} +.country-select .flag.ga{ + height:15px; + background-position:-1753px 0px +} +.country-select .flag.gb{ + height:10px; + background-position:-1775px 0px +} +.country-select .flag.gd{ + height:12px; + background-position:-1797px 0px +} +.country-select .flag.ge{ + height:14px; + background-position:-1819px 0px +} +.country-select .flag.gf{ + height:14px; + background-position:-1841px 0px +} +.country-select .flag.gg{ + height:14px; + background-position:-1863px 0px +} +.country-select .flag.gh{ + height:14px; + background-position:-1885px 0px +} +.country-select .flag.gi{ + height:10px; + background-position:-1907px 0px +} +.country-select .flag.gl{ + height:14px; + background-position:-1929px 0px +} +.country-select .flag.gm{ + height:14px; + background-position:-1951px 0px +} +.country-select .flag.gn{ + height:14px; + background-position:-1973px 0px +} +.country-select .flag.gp{ + height:14px; + background-position:-1995px 0px +} +.country-select .flag.gq{ + height:14px; + background-position:-2017px 0px +} +.country-select .flag.gr{ + height:14px; + background-position:-2039px 0px +} +.country-select .flag.gs{ + height:10px; + background-position:-2061px 0px +} +.country-select .flag.gt{ + height:13px; + background-position:-2083px 0px +} +.country-select .flag.gu{ + height:11px; + background-position:-2105px 0px +} +.country-select .flag.gw{ + height:10px; + background-position:-2127px 0px +} +.country-select .flag.gy{ + height:12px; + background-position:-2149px 0px +} +.country-select .flag.hk{ + height:14px; + background-position:-2171px 0px +} +.country-select .flag.hm{ + height:10px; + background-position:-2193px 0px +} +.country-select .flag.hn{ + height:10px; + background-position:-2215px 0px +} +.country-select .flag.hr{ + height:10px; + background-position:-2237px 0px +} +.country-select .flag.ht{ + height:12px; + background-position:-2259px 0px +} +.country-select .flag.hu{ + height:10px; + background-position:-2281px 0px +} +.country-select .flag.ic{ + height:14px; + background-position:-2303px 0px +} +.country-select .flag.id{ + height:14px; + background-position:-2325px 0px +} +.country-select .flag.ie{ + height:10px; + background-position:-2347px 0px +} +.country-select .flag.il{ + height:15px; + background-position:-2369px 0px +} +.country-select .flag.im{ + height:10px; + background-position:-2391px 0px +} +.country-select .flag.in{ + height:14px; + background-position:-2413px 0px +} +.country-select .flag.io{ + height:10px; + background-position:-2435px 0px +} +.country-select .flag.iq{ + height:14px; + background-position:-2457px 0px +} +.country-select .flag.ir{ + height:12px; + background-position:-2479px 0px +} +.country-select .flag.is{ + height:15px; + background-position:-2501px 0px +} +.country-select .flag.it{ + height:14px; + background-position:-2523px 0px +} +.country-select .flag.je{ + height:12px; + background-position:-2545px 0px +} +.country-select .flag.jm{ + height:10px; + background-position:-2567px 0px +} +.country-select .flag.jo{ + height:10px; + background-position:-2589px 0px +} +.country-select .flag.jp{ + height:14px; + background-position:-2611px 0px +} +.country-select .flag.ke{ + height:14px; + background-position:-2633px 0px +} +.country-select .flag.kg{ + height:12px; + background-position:-2655px 0px +} +.country-select .flag.kh{ + height:13px; + background-position:-2677px 0px +} +.country-select .flag.ki{ + height:10px; + background-position:-2699px 0px +} +.country-select .flag.km{ + height:12px; + background-position:-2721px 0px +} +.country-select .flag.kn{ + height:14px; + background-position:-2743px 0px +} +.country-select .flag.kp{ + height:10px; + background-position:-2765px 0px +} +.country-select .flag.kr{ + height:14px; + background-position:-2787px 0px +} +.country-select .flag.kw{ + height:10px; + background-position:-2809px 0px +} +.country-select .flag.ky{ + height:10px; + background-position:-2831px 0px +} +.country-select .flag.kz{ + height:10px; + background-position:-2853px 0px +} +.country-select .flag.la{ + height:14px; + background-position:-2875px 0px +} +.country-select .flag.lb{ + height:14px; + background-position:-2897px 0px +} +.country-select .flag.lc{ + height:10px; + background-position:-2919px 0px +} +.country-select .flag.li{ + height:12px; + background-position:-2941px 0px +} +.country-select .flag.lk{ + height:10px; + background-position:-2963px 0px +} +.country-select .flag.lr{ + height:11px; + background-position:-2985px 0px +} +.country-select .flag.ls{ + height:14px; + background-position:-3007px 0px +} +.country-select .flag.lt{ + height:12px; + background-position:-3029px 0px +} +.country-select .flag.lu{ + height:12px; + background-position:-3051px 0px +} +.country-select .flag.lv{ + height:10px; + background-position:-3073px 0px +} +.country-select .flag.ly{ + height:10px; + background-position:-3095px 0px +} +.country-select .flag.ma{ + height:14px; + background-position:-3117px 0px +} +.country-select .flag.mc{ + height:15px; + background-position:-3139px 0px +} +.country-select .flag.md{ + height:10px; + background-position:-3160px 0px +} +.country-select .flag.me{ + height:10px; + background-position:-3182px 0px +} +.country-select .flag.mf{ + height:14px; + background-position:-3204px 0px +} +.country-select .flag.mg{ + height:14px; + background-position:-3226px 0px +} +.country-select .flag.mh{ + height:11px; + background-position:-3248px 0px +} +.country-select .flag.mk{ + height:10px; + background-position:-3270px 0px +} +.country-select .flag.ml{ + height:14px; + background-position:-3292px 0px +} +.country-select .flag.mm{ + height:14px; + background-position:-3314px 0px +} +.country-select .flag.mn{ + height:10px; + background-position:-3336px 0px +} +.country-select .flag.mo{ + height:14px; + background-position:-3358px 0px +} +.country-select .flag.mp{ + height:10px; + background-position:-3380px 0px +} +.country-select .flag.mq{ + height:14px; + background-position:-3402px 0px +} +.country-select .flag.mr{ + height:14px; + background-position:-3424px 0px +} +.country-select .flag.ms{ + height:10px; + background-position:-3446px 0px +} +.country-select .flag.mt{ + height:14px; + background-position:-3468px 0px +} +.country-select .flag.mu{ + height:14px; + background-position:-3490px 0px +} +.country-select .flag.mv{ + height:14px; + background-position:-3512px 0px +} +.country-select .flag.mw{ + height:14px; + background-position:-3534px 0px +} +.country-select .flag.mx{ + height:12px; + background-position:-3556px 0px +} +.country-select .flag.my{ + height:10px; + background-position:-3578px 0px +} +.country-select .flag.mz{ + height:14px; + background-position:-3600px 0px +} +.country-select .flag.na{ + height:14px; + background-position:-3622px 0px +} +.country-select .flag.nc{ + height:10px; + background-position:-3644px 0px +} +.country-select .flag.ne{ + height:15px; + background-position:-3666px 0px +} +.country-select .flag.nf{ + height:10px; + background-position:-3686px 0px +} +.country-select .flag.ng{ + height:10px; + background-position:-3708px 0px +} +.country-select .flag.ni{ + height:12px; + background-position:-3730px 0px +} +.country-select .flag.nl{ + height:14px; + background-position:-3752px 0px +} +.country-select .flag.no{ + height:15px; + background-position:-3774px 0px +} +.country-select .flag.np{ + height:15px; + background-position:-3796px 0px; + background-color:transparent +} +.country-select .flag.nr{ + height:10px; + background-position:-3811px 0px +} +.country-select .flag.nu{ + height:10px; + background-position:-3833px 0px +} +.country-select .flag.nz{ + height:10px; + background-position:-3855px 0px +} +.country-select .flag.om{ + height:10px; + background-position:-3877px 0px +} +.country-select .flag.pa{ + height:14px; + background-position:-3899px 0px +} +.country-select .flag.pe{ + height:14px; + background-position:-3921px 0px +} +.country-select .flag.pf{ + height:14px; + background-position:-3943px 0px +} +.country-select .flag.pg{ + height:15px; + background-position:-3965px 0px +} +.country-select .flag.ph{ + height:10px; + background-position:-3987px 0px +} +.country-select .flag.pk{ + height:14px; + background-position:-4009px 0px +} +.country-select .flag.pl{ + height:13px; + background-position:-4031px 0px +} +.country-select .flag.pm{ + height:14px; + background-position:-4053px 0px +} +.country-select .flag.pn{ + height:10px; + background-position:-4075px 0px +} +.country-select .flag.pr{ + height:14px; + background-position:-4097px 0px +} +.country-select .flag.ps{ + height:10px; + background-position:-4119px 0px +} +.country-select .flag.pt{ + height:14px; + background-position:-4141px 0px +} +.country-select .flag.pw{ + height:13px; + background-position:-4163px 0px +} +.country-select .flag.py{ + height:11px; + background-position:-4185px 0px +} +.country-select .flag.qa{ + height:8px; + background-position:-4207px 0px +} +.country-select .flag.re{ + height:14px; + background-position:-4229px 0px +} +.country-select .flag.ro{ + height:14px; + background-position:-4251px 0px +} +.country-select .flag.rs{ + height:14px; + background-position:-4273px 0px +} +.country-select .flag.ru{ + height:14px; + background-position:-4295px 0px +} +.country-select .flag.rw{ + height:14px; + background-position:-4317px 0px +} +.country-select .flag.sa{ + height:14px; + background-position:-4339px 0px +} +.country-select .flag.sb{ + height:10px; + background-position:-4361px 0px +} +.country-select .flag.sc{ + height:10px; + background-position:-4383px 0px +} +.country-select .flag.sd{ + height:10px; + background-position:-4405px 0px +} +.country-select .flag.se{ + height:13px; + background-position:-4427px 0px +} +.country-select .flag.sg{ + height:14px; + background-position:-4449px 0px +} +.country-select .flag.sh{ + height:10px; + background-position:-4471px 0px +} +.country-select .flag.si{ + height:10px; + background-position:-4493px 0px +} +.country-select .flag.sj{ + height:15px; + background-position:-4515px 0px +} +.country-select .flag.sk{ + height:14px; + background-position:-4537px 0px +} +.country-select .flag.sl{ + height:14px; + background-position:-4559px 0px +} +.country-select .flag.sm{ + height:15px; + background-position:-4581px 0px +} +.country-select .flag.sn{ + height:14px; + background-position:-4603px 0px +} +.country-select .flag.so{ + height:14px; + background-position:-4625px 0px +} +.country-select .flag.sr{ + height:14px; + background-position:-4647px 0px +} +.country-select .flag.ss{ + height:10px; + background-position:-4669px 0px +} +.country-select .flag.st{ + height:10px; + background-position:-4691px 0px +} +.country-select .flag.sv{ + height:12px; + background-position:-4713px 0px +} +.country-select .flag.sx{ + height:14px; + background-position:-4735px 0px +} +.country-select .flag.sy{ + height:14px; + background-position:-4757px 0px +} +.country-select .flag.sz{ + height:14px; + background-position:-4779px 0px +} +.country-select .flag.ta{ + height:10px; + background-position:-4801px 0px +} +.country-select .flag.tc{ + height:10px; + background-position:-4823px 0px +} +.country-select .flag.td{ + height:14px; + background-position:-4845px 0px +} +.country-select .flag.tf{ + height:14px; + background-position:-4867px 0px +} +.country-select .flag.tg{ + height:13px; + background-position:-4889px 0px +} +.country-select .flag.th{ + height:14px; + background-position:-4911px 0px +} +.country-select .flag.tj{ + height:10px; + background-position:-4933px 0px +} +.country-select .flag.tk{ + height:10px; + background-position:-4955px 0px +} +.country-select .flag.tl{ + height:10px; + background-position:-4977px 0px +} +.country-select .flag.tm{ + height:14px; + background-position:-4999px 0px +} +.country-select .flag.tn{ + height:14px; + background-position:-5021px 0px +} +.country-select .flag.to{ + height:10px; + background-position:-5043px 0px +} +.country-select .flag.tr{ + height:14px; + background-position:-5065px 0px +} +.country-select .flag.tt{ + height:12px; + background-position:-5087px 0px +} +.country-select .flag.tv{ + height:10px; + background-position:-5109px 0px +} +.country-select .flag.tw{ + height:14px; + background-position:-5131px 0px +} +.country-select .flag.tz{ + height:14px; + background-position:-5153px 0px +} +.country-select .flag.ua{ + height:14px; + background-position:-5175px 0px +} +.country-select .flag.ug{ + height:14px; + background-position:-5197px 0px +} +.country-select .flag.um{ + height:11px; + background-position:-5219px 0px +} +.country-select .flag.us{ + height:11px; + background-position:-5241px 0px +} +.country-select .flag.uy{ + height:14px; + background-position:-5263px 0px +} +.country-select .flag.uz{ + height:10px; + background-position:-5285px 0px +} +.country-select .flag.va{ + height:15px; + background-position:-5307px 0px +} +.country-select .flag.vc{ + height:14px; + background-position:-5324px 0px +} +.country-select .flag.ve{ + height:14px; + background-position:-5346px 0px +} +.country-select .flag.vg{ + height:10px; + background-position:-5368px 0px +} +.country-select .flag.vi{ + height:14px; + background-position:-5390px 0px +} +.country-select .flag.vn{ + height:14px; + background-position:-5412px 0px +} +.country-select .flag.vu{ + height:12px; + background-position:-5434px 0px +} +.country-select .flag.wf{ + height:14px; + background-position:-5456px 0px +} +.country-select .flag.ws{ + height:10px; + background-position:-5478px 0px +} +.country-select .flag.xk{ + height:15px; + background-position:-5500px 0px +} +.country-select .flag.ye{ + height:14px; + background-position:-5522px 0px +} +.country-select .flag.yt{ + height:14px; + background-position:-5544px 0px +} +.country-select .flag.za{ + height:14px; + background-position:-5566px 0px +} +.country-select .flag.zm{ + height:14px; + background-position:-5588px 0px +} +.country-select .flag.zw{ + height:10px; + background-position:-5610px 0px } \ No newline at end of file diff --git a/build/js/countrySelect.js b/build/js/countrySelect.js index 6fda99b..fc6e349 100644 --- a/build/js/countrySelect.js +++ b/build/js/countrySelect.js @@ -23,6 +23,8 @@ onlyCountries: [], // The countries at the top of the list. Defaults to United States and United Kingdom preferredCountries: [ "us", "gb" ], + // localized country names e.g. { 'de': 'Deutschland' } + localizedCountries: null, // Set the dropdown's width to be the same as the input. This is automatically enabled for small screens. responsiveDropdown: ($(window).width() < 768 ? true : false), }, keys = { @@ -78,6 +80,12 @@ this._setInstanceCountryData(); // set the preferredCountries property this._setPreferredCountries(); + // translate countries according to localizedCountries option + if (this.options.localizedCountries) this._translateCountriesByLocale(); + // sort countries by name + if (this.options.onlyCountries.length || this.options.localizedCountries) { + this.countries.sort(this._countryNameSort); + } }, // process onlyCountries array if present _setInstanceCountryData: function() { @@ -114,6 +122,19 @@ } }); }, + // Translate Countries by object literal provided on config + _translateCountriesByLocale() { + for (let i = 0; i < this.countries.length; i++) { + const iso = this.countries[i].iso2.toLowerCase(); + if (this.options.localizedCountries.hasOwnProperty(iso)) { + this.countries[i].name = this.options.localizedCountries[iso]; + } + } + }, + // sort by country name + _countryNameSort(a, b) { + return a.name.localeCompare(b.name); + }, // generate all of the markup for the plugin: the selected flag overlay, and the dropdown _generateMarkup: function() { // Country input @@ -413,10 +434,21 @@ var value = this.countryInput.val().replace(/(?=[() ])/g, '\\'); if (value) { var countryCodes = []; - var matcher = new RegExp("^"+value, "i"); - for (var i = 0; i < this.countries.length; i++) { - if (this.countries[i].name.match(matcher)) { - countryCodes.push(this.countries[i].iso2); + var matcher = new RegExp(value, "i"); + // Check for ISO codes only + if(value.length <= 2) { + for (var i = 0; i < this.countries.length; i++) { + if (this.countries[i].iso2.match(matcher)) { + countryCodes.push(this.countries[i].iso2); + } + } + } + // If no previous matches / larger than 2 chars, then search country name + if(countryCodes.length == 0) { + for (var i = 0; i < this.countries.length; i++) { + if (this.countries[i].name.match(matcher)) { + countryCodes.push(this.countries[i].iso2); + } } } // Check if one of the matching countries is already selected @@ -637,6 +669,9 @@ }, { n: "Anguilla", i: "ai" + }, { + n: "Antarctica", + i: "aq" }, { n: "Antigua and Barbuda", i: "ag" @@ -697,6 +732,9 @@ }, { n: "Botswana", i: "bw" + }, { + n: "Bouvet Island (Bouvetøya)", + i: "bv" }, { n: "Brazil (Brasil)", i: "br" @@ -844,6 +882,9 @@ }, { n: "French Polynesia (Polynésie française)", i: "pf" + }, { + n: "French Southern Territories (Terres australes françaises)", + i: "tf" }, { n: "Gabon", i: "ga" @@ -895,6 +936,9 @@ }, { n: "Haiti", i: "ht" + }, { + n: "Heard Island and Mcdonald Islands", + i: "hm" }, { n: "Honduras", i: "hn" diff --git a/build/js/countrySelect.min.js b/build/js/countrySelect.min.js index 34a537b..997bcb0 100644 --- a/build/js/countrySelect.min.js +++ b/build/js/countrySelect.min.js @@ -1 +1 @@ -!function(n){"function"==typeof define&&define.amd?define(["jquery"],function(i){n(i,window,document)}):"object"==typeof module&&module.exports?module.exports=n(require("jquery"),window,document):n(jQuery,window,document)}(function(n,i,t,e){"use strict";var a="countrySelect",s=1,o={defaultCountry:"",defaultStyling:"inside",excludeCountries:[],onlyCountries:[],preferredCountries:["us","gb"],responsiveDropdown:n(i).width()<768},r=38,u=40,l=13,h=27,c=8,d=32,p=65,y=90;function f(i,t){this.element=i,this.options=n.extend({},o,t),this._defaults=o,this.ns="."+a+s++,this._name=a,this.init()}n(i).on("load",function(){!0}),f.prototype={init:function(){return this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this.autoCountryDeferred=new n.Deferred,this._initAutoCountry(),this.typedLetters="",this.autoCountryDeferred},_processCountryData:function(){this._setInstanceCountryData(),this._setPreferredCountries()},_setInstanceCountryData:function(){var i=this;if(this.options.onlyCountries.length){var t=[];n.each(this.options.onlyCountries,function(n,e){var a=i._getCountryData(e,!0);a&&t.push(a)}),this.countries=t}else if(this.options.excludeCountries.length){var e=this.options.excludeCountries.map(function(n){return n.toLowerCase()});this.countries=g.filter(function(n){return-1===e.indexOf(n.iso2)})}else this.countries=g},_setPreferredCountries:function(){var i=this;this.preferredCountries=[],n.each(this.options.preferredCountries,function(n,t){var e=i._getCountryData(t,!1);e&&i.preferredCountries.push(e)})},_generateMarkup:function(){this.countryInput=n(this.element);var t="country-select";this.options.defaultStyling&&(t+=" "+this.options.defaultStyling),this.countryInput.wrap(n("
",{class:t}));var e=n("
",{class:"flag-dropdown"}).insertAfter(this.countryInput),a=n("
",{class:"selected-flag"}).appendTo(e);this.selectedFlagInner=n("
",{class:"flag"}).appendTo(a),n("
",{class:"arrow"}).appendTo(a),this.countryList=n("
    ",{class:"country-list v-hide"}).appendTo(e),this.preferredCountries.length&&(this._appendListItems(this.preferredCountries,"preferred"),n("
  • ",{class:"divider"}).appendTo(this.countryList)),this._appendListItems(this.countries,""),this.countryCodeInput=n("#"+this.countryInput.attr("id")+"_code"),this.countryCodeInput||(this.countryCodeInput=n(''),this.countryCodeInput.insertAfter(this.countryInput)),this.dropdownHeight=this.countryList.outerHeight(),this.options.responsiveDropdown&&n(i).resize(function(){n(".country-select").each(function(){var i=this.offsetWidth;n(this).find(".country-list").css("width",i+"px")})}).resize(),this.countryList.removeClass("v-hide").addClass("hide"),this.countryListItems=this.countryList.children(".country")},_appendListItems:function(i,t){var e="";n.each(i,function(n,i){e+='
  • ',e+='
    ',e+=''+i.name+"",e+="
  • "}),this.countryList.append(e)},_setInitialState:function(){var n=!1;this.countryInput.val()&&(n=this._updateFlagFromInputVal());var i,t=this.countryCodeInput.val();(t&&this.selectCountry(t),n)||(this.options.defaultCountry&&(i=this._getCountryData(this.options.defaultCountry,!1))||(i=this.preferredCountries.length?this.preferredCountries[0]:this.countries[0]),this.defaultCountry=i.iso2)},_initListeners:function(){var n=this;this.countryInput.on("keyup"+this.ns,function(){n._updateFlagFromInputVal()}),this.selectedFlagInner.parent().on("click"+this.ns,function(i){n.countryList.hasClass("hide")&&!n.countryInput.prop("disabled")&&n._showDropdown()}),this.countryInput.on("blur"+this.ns,function(){n.countryInput.val()!=n.getSelectedCountryData().name&&n.setCountry(n.countryInput.val()),n.countryInput.val(n.getSelectedCountryData().name)})},_initAutoCountry:function(){"auto"===this.options.initialCountry?this._loadAutoCountry():(this.defaultCountry&&this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},_loadAutoCountry:function(){n.fn[a].autoCountry?this.handleAutoCountry():n.fn[a].startedLoadingAutoCountry||(n.fn[a].startedLoadingAutoCountry=!0,"function"==typeof this.options.geoIpLookup&&this.options.geoIpLookup(function(i){n.fn[a].autoCountry=i.toLowerCase(),setTimeout(function(){n(".country-select input").countrySelect("handleAutoCountry")})}))},_focus:function(){this.countryInput.focus();var n=this.countryInput[0];if(n.setSelectionRange){var i=this.countryInput.val().length;n.setSelectionRange(i,i)}},_showDropdown:function(){this._setDropdownPosition();var n=this.countryList.children(".active");this._highlightListItem(n),this.countryList.removeClass("hide"),this._scrollTo(n),this._bindDropdownListeners(),this.selectedFlagInner.parent().children(".arrow").addClass("up")},_setDropdownPosition:function(){var t=this.countryInput.offset().top,e=n(i).scrollTop(),a=t+this.countryInput.outerHeight()+this.dropdownHeighte,o=!a&&s?"-"+(this.dropdownHeight-1)+"px":"";this.countryList.css("top",o)},_bindDropdownListeners:function(){var i=this;this.countryList.on("mouseover"+this.ns,".country",function(t){i._highlightListItem(n(this))}),this.countryList.on("click"+this.ns,".country",function(t){i._selectListItem(n(this))});var e=!0;n("html").on("click"+this.ns,function(n){n.preventDefault(),e||i._closeDropdown(),e=!1}),n(t).on("keydown"+this.ns,function(n){n.preventDefault(),n.which==r||n.which==u?i._handleUpDownKey(n.which):n.which==l?i._handleEnterKey():n.which==h?i._closeDropdown():n.which>=p&&n.which<=y||n.which===d?(i.typedLetters+=String.fromCharCode(n.which),i._filterCountries(i.typedLetters)):n.which===c&&(i.typedLetters=i.typedLetters.slice(0,-1),i._filterCountries(i.typedLetters))})},_handleUpDownKey:function(n){var i=this.countryList.children(".highlight").first(),t=n==r?i.prev():i.next();t.length&&(t.hasClass("divider")&&(t=n==r?t.prev():t.next()),this._highlightListItem(t),this._scrollTo(t))},_handleEnterKey:function(){var n=this.countryList.children(".highlight").first();n.length&&this._selectListItem(n)},_filterCountries:function(i){var t=this.countryListItems.filter(function(){return 0===n(this).text().toUpperCase().indexOf(i)&&!n(this).hasClass("preferred")});if(t.length){var e,a=t.filter(".highlight").first();e=a&&a.next()&&0===a.next().text().toUpperCase().indexOf(i)?a.next():t.first(),this._highlightListItem(e),this._scrollTo(e)}},_updateFlagFromInputVal:function(){var i=this,t=this.countryInput.val().replace(/(?=[() ])/g,"\\");if(t){for(var e=[],a=new RegExp("^"+t,"i"),s=0;sa){var l=t-s;i.scrollTop(u-l)}}},_updateName:function(n){this.countryCodeInput.val(n).trigger("change"),this.countryInput.val(this._getCountryData(n).name)},handleAutoCountry:function(){"auto"===this.options.initialCountry&&(this.defaultCountry=n.fn[a].autoCountry,this.countryInput.val()||this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},getSelectedCountryData:function(){var n=this.selectedFlagInner.attr("class").split(" ")[1];return this._getCountryData(n)},selectCountry:function(n){n=n.toLowerCase(),this.selectedFlagInner.hasClass(n)||(this._selectFlag(n),this._updateName(n))},setCountry:function(n){this.countryInput.val(n),this._updateFlagFromInputVal()},destroy:function(){this.countryInput.off(this.ns),this.selectedFlagInner.parent().off(this.ns),this.countryInput.parent().before(this.countryInput).remove()}},n.fn[a]=function(i){var t,s=arguments;return i===e||"object"==typeof i?this.each(function(){n.data(this,"plugin_"+a)||n.data(this,"plugin_"+a,new f(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var e=n.data(this,"plugin_"+a);e instanceof f&&"function"==typeof e[i]&&(t=e[i].apply(e,Array.prototype.slice.call(s,1))),"destroy"===i&&n.data(this,"plugin_"+a,null)}),t!==e?t:this):void 0},n.fn[a].getCountryData=function(){return g},n.fn[a].setCountryData=function(n){g=n};var g=n.each([{n:"Afghanistan (‫افغانستان‬‎)",i:"af"},{n:"Åland Islands (Åland)",i:"ax"},{n:"Albania (Shqipëri)",i:"al"},{n:"Algeria (‫الجزائر‬‎)",i:"dz"},{n:"American Samoa",i:"as"},{n:"Andorra",i:"ad"},{n:"Angola",i:"ao"},{n:"Anguilla",i:"ai"},{n:"Antigua and Barbuda",i:"ag"},{n:"Argentina",i:"ar"},{n:"Armenia (Հայաստան)",i:"am"},{n:"Aruba",i:"aw"},{n:"Australia",i:"au"},{n:"Austria (Österreich)",i:"at"},{n:"Azerbaijan (Azərbaycan)",i:"az"},{n:"Bahamas",i:"bs"},{n:"Bahrain (‫البحرين‬‎)",i:"bh"},{n:"Bangladesh (বাংলাদেশ)",i:"bd"},{n:"Barbados",i:"bb"},{n:"Belarus (Беларусь)",i:"by"},{n:"Belgium (België)",i:"be"},{n:"Belize",i:"bz"},{n:"Benin (Bénin)",i:"bj"},{n:"Bermuda",i:"bm"},{n:"Bhutan (འབྲུག)",i:"bt"},{n:"Bolivia",i:"bo"},{n:"Bosnia and Herzegovina (Босна и Херцеговина)",i:"ba"},{n:"Botswana",i:"bw"},{n:"Brazil (Brasil)",i:"br"},{n:"British Indian Ocean Territory",i:"io"},{n:"British Virgin Islands",i:"vg"},{n:"Brunei",i:"bn"},{n:"Bulgaria (България)",i:"bg"},{n:"Burkina Faso",i:"bf"},{n:"Burundi (Uburundi)",i:"bi"},{n:"Cambodia (កម្ពុជា)",i:"kh"},{n:"Cameroon (Cameroun)",i:"cm"},{n:"Canada",i:"ca"},{n:"Cape Verde (Kabu Verdi)",i:"cv"},{n:"Caribbean Netherlands",i:"bq"},{n:"Cayman Islands",i:"ky"},{n:"Central African Republic (République Centrafricaine)",i:"cf"},{n:"Chad (Tchad)",i:"td"},{n:"Chile",i:"cl"},{n:"China (中国)",i:"cn"},{n:"Christmas Island",i:"cx"},{n:"Cocos (Keeling) Islands (Kepulauan Cocos (Keeling))",i:"cc"},{n:"Colombia",i:"co"},{n:"Comoros (‫جزر القمر‬‎)",i:"km"},{n:"Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)",i:"cd"},{n:"Congo (Republic) (Congo-Brazzaville)",i:"cg"},{n:"Cook Islands",i:"ck"},{n:"Costa Rica",i:"cr"},{n:"Côte d’Ivoire",i:"ci"},{n:"Croatia (Hrvatska)",i:"hr"},{n:"Cuba",i:"cu"},{n:"Curaçao",i:"cw"},{n:"Cyprus (Κύπρος)",i:"cy"},{n:"Czech Republic (Česká republika)",i:"cz"},{n:"Denmark (Danmark)",i:"dk"},{n:"Djibouti",i:"dj"},{n:"Dominica",i:"dm"},{n:"Dominican Republic (República Dominicana)",i:"do"},{n:"Ecuador",i:"ec"},{n:"Egypt (‫مصر‬‎)",i:"eg"},{n:"El Salvador",i:"sv"},{n:"Equatorial Guinea (Guinea Ecuatorial)",i:"gq"},{n:"Eritrea",i:"er"},{n:"Estonia (Eesti)",i:"ee"},{n:"Ethiopia",i:"et"},{n:"Falkland Islands (Islas Malvinas)",i:"fk"},{n:"Faroe Islands (Føroyar)",i:"fo"},{n:"Fiji",i:"fj"},{n:"Finland (Suomi)",i:"fi"},{n:"France",i:"fr"},{n:"French Guiana (Guyane française)",i:"gf"},{n:"French Polynesia (Polynésie française)",i:"pf"},{n:"Gabon",i:"ga"},{n:"Gambia",i:"gm"},{n:"Georgia (საქართველო)",i:"ge"},{n:"Germany (Deutschland)",i:"de"},{n:"Ghana (Gaana)",i:"gh"},{n:"Gibraltar",i:"gi"},{n:"Greece (Ελλάδα)",i:"gr"},{n:"Greenland (Kalaallit Nunaat)",i:"gl"},{n:"Grenada",i:"gd"},{n:"Guadeloupe",i:"gp"},{n:"Guam",i:"gu"},{n:"Guatemala",i:"gt"},{n:"Guernsey",i:"gg"},{n:"Guinea (Guinée)",i:"gn"},{n:"Guinea-Bissau (Guiné Bissau)",i:"gw"},{n:"Guyana",i:"gy"},{n:"Haiti",i:"ht"},{n:"Honduras",i:"hn"},{n:"Hong Kong (香港)",i:"hk"},{n:"Hungary (Magyarország)",i:"hu"},{n:"Iceland (Ísland)",i:"is"},{n:"India (भारत)",i:"in"},{n:"Indonesia",i:"id"},{n:"Iran (‫ایران‬‎)",i:"ir"},{n:"Iraq (‫العراق‬‎)",i:"iq"},{n:"Ireland",i:"ie"},{n:"Isle of Man",i:"im"},{n:"Israel (‫ישראל‬‎)",i:"il"},{n:"Italy (Italia)",i:"it"},{n:"Jamaica",i:"jm"},{n:"Japan (日本)",i:"jp"},{n:"Jersey",i:"je"},{n:"Jordan (‫الأردن‬‎)",i:"jo"},{n:"Kazakhstan (Казахстан)",i:"kz"},{n:"Kenya",i:"ke"},{n:"Kiribati",i:"ki"},{n:"Kosovo (Kosovë)",i:"xk"},{n:"Kuwait (‫الكويت‬‎)",i:"kw"},{n:"Kyrgyzstan (Кыргызстан)",i:"kg"},{n:"Laos (ລາວ)",i:"la"},{n:"Latvia (Latvija)",i:"lv"},{n:"Lebanon (‫لبنان‬‎)",i:"lb"},{n:"Lesotho",i:"ls"},{n:"Liberia",i:"lr"},{n:"Libya (‫ليبيا‬‎)",i:"ly"},{n:"Liechtenstein",i:"li"},{n:"Lithuania (Lietuva)",i:"lt"},{n:"Luxembourg",i:"lu"},{n:"Macau (澳門)",i:"mo"},{n:"Macedonia (FYROM) (Македонија)",i:"mk"},{n:"Madagascar (Madagasikara)",i:"mg"},{n:"Malawi",i:"mw"},{n:"Malaysia",i:"my"},{n:"Maldives",i:"mv"},{n:"Mali",i:"ml"},{n:"Malta",i:"mt"},{n:"Marshall Islands",i:"mh"},{n:"Martinique",i:"mq"},{n:"Mauritania (‫موريتانيا‬‎)",i:"mr"},{n:"Mauritius (Moris)",i:"mu"},{n:"Mayotte",i:"yt"},{n:"Mexico (México)",i:"mx"},{n:"Micronesia",i:"fm"},{n:"Moldova (Republica Moldova)",i:"md"},{n:"Monaco",i:"mc"},{n:"Mongolia (Монгол)",i:"mn"},{n:"Montenegro (Crna Gora)",i:"me"},{n:"Montserrat",i:"ms"},{n:"Morocco (‫المغرب‬‎)",i:"ma"},{n:"Mozambique (Moçambique)",i:"mz"},{n:"Myanmar (Burma) (မြန်မာ)",i:"mm"},{n:"Namibia (Namibië)",i:"na"},{n:"Nauru",i:"nr"},{n:"Nepal (नेपाल)",i:"np"},{n:"Netherlands (Nederland)",i:"nl"},{n:"New Caledonia (Nouvelle-Calédonie)",i:"nc"},{n:"New Zealand",i:"nz"},{n:"Nicaragua",i:"ni"},{n:"Niger (Nijar)",i:"ne"},{n:"Nigeria",i:"ng"},{n:"Niue",i:"nu"},{n:"Norfolk Island",i:"nf"},{n:"North Korea (조선 민주주의 인민 공화국)",i:"kp"},{n:"Northern Mariana Islands",i:"mp"},{n:"Norway (Norge)",i:"no"},{n:"Oman (‫عُمان‬‎)",i:"om"},{n:"Pakistan (‫پاکستان‬‎)",i:"pk"},{n:"Palau",i:"pw"},{n:"Palestine (‫فلسطين‬‎)",i:"ps"},{n:"Panama (Panamá)",i:"pa"},{n:"Papua New Guinea",i:"pg"},{n:"Paraguay",i:"py"},{n:"Peru (Perú)",i:"pe"},{n:"Philippines",i:"ph"},{n:"Pitcairn Islands",i:"pn"},{n:"Poland (Polska)",i:"pl"},{n:"Portugal",i:"pt"},{n:"Puerto Rico",i:"pr"},{n:"Qatar (‫قطر‬‎)",i:"qa"},{n:"Réunion (La Réunion)",i:"re"},{n:"Romania (România)",i:"ro"},{n:"Russia (Россия)",i:"ru"},{n:"Rwanda",i:"rw"},{n:"Saint Barthélemy (Saint-Barthélemy)",i:"bl"},{n:"Saint Helena",i:"sh"},{n:"Saint Kitts and Nevis",i:"kn"},{n:"Saint Lucia",i:"lc"},{n:"Saint Martin (Saint-Martin (partie française))",i:"mf"},{n:"Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)",i:"pm"},{n:"Saint Vincent and the Grenadines",i:"vc"},{n:"Samoa",i:"ws"},{n:"San Marino",i:"sm"},{n:"São Tomé and Príncipe (São Tomé e Príncipe)",i:"st"},{n:"Saudi Arabia (‫المملكة العربية السعودية‬‎)",i:"sa"},{n:"Senegal (Sénégal)",i:"sn"},{n:"Serbia (Србија)",i:"rs"},{n:"Seychelles",i:"sc"},{n:"Sierra Leone",i:"sl"},{n:"Singapore",i:"sg"},{n:"Sint Maarten",i:"sx"},{n:"Slovakia (Slovensko)",i:"sk"},{n:"Slovenia (Slovenija)",i:"si"},{n:"Solomon Islands",i:"sb"},{n:"Somalia (Soomaaliya)",i:"so"},{n:"South Africa",i:"za"},{n:"South Georgia & South Sandwich Islands",i:"gs"},{n:"South Korea (대한민국)",i:"kr"},{n:"South Sudan (‫جنوب السودان‬‎)",i:"ss"},{n:"Spain (España)",i:"es"},{n:"Sri Lanka (ශ්‍රී ලංකාව)",i:"lk"},{n:"Sudan (‫السودان‬‎)",i:"sd"},{n:"Suriname",i:"sr"},{n:"Svalbard and Jan Mayen (Svalbard og Jan Mayen)",i:"sj"},{n:"Swaziland",i:"sz"},{n:"Sweden (Sverige)",i:"se"},{n:"Switzerland (Schweiz)",i:"ch"},{n:"Syria (‫سوريا‬‎)",i:"sy"},{n:"Taiwan (台灣)",i:"tw"},{n:"Tajikistan",i:"tj"},{n:"Tanzania",i:"tz"},{n:"Thailand (ไทย)",i:"th"},{n:"Timor-Leste",i:"tl"},{n:"Togo",i:"tg"},{n:"Tokelau",i:"tk"},{n:"Tonga",i:"to"},{n:"Trinidad and Tobago",i:"tt"},{n:"Tunisia (‫تونس‬‎)",i:"tn"},{n:"Turkey (Türkiye)",i:"tr"},{n:"Turkmenistan",i:"tm"},{n:"Turks and Caicos Islands",i:"tc"},{n:"Tuvalu",i:"tv"},{n:"Uganda",i:"ug"},{n:"Ukraine (Україна)",i:"ua"},{n:"United Arab Emirates (‫الإمارات العربية المتحدة‬‎)",i:"ae"},{n:"United Kingdom",i:"gb"},{n:"United States",i:"us"},{n:"U.S. Minor Outlying Islands",i:"um"},{n:"U.S. Virgin Islands",i:"vi"},{n:"Uruguay",i:"uy"},{n:"Uzbekistan (Oʻzbekiston)",i:"uz"},{n:"Vanuatu",i:"vu"},{n:"Vatican City (Città del Vaticano)",i:"va"},{n:"Venezuela",i:"ve"},{n:"Vietnam (Việt Nam)",i:"vn"},{n:"Wallis and Futuna",i:"wf"},{n:"Western Sahara (‫الصحراء الغربية‬‎)",i:"eh"},{n:"Yemen (‫اليمن‬‎)",i:"ye"},{n:"Zambia",i:"zm"},{n:"Zimbabwe",i:"zw"}],function(n,i){i.name=i.n,i.iso2=i.i,delete i.n,delete i.i})}); \ No newline at end of file +!function(n){"function"==typeof define&&define.amd?define(["jquery"],function(i){n(i,window,document)}):"object"==typeof module&&module.exports?module.exports=n(require("jquery"),window,document):n(jQuery,window,document)}(function(n,i,t,e){"use strict";var a="countrySelect",s=1,o={defaultCountry:"",defaultStyling:"inside",excludeCountries:[],onlyCountries:[],preferredCountries:["us","gb"],localizedCountries:null,responsiveDropdown:n(i).width()<768},r=38,u=40,l=13,h=27,c=8,d=32,p=65,y=90;function f(i,t){this.element=i,this.options=n.extend({},o,t),this._defaults=o,this.ns="."+a+s++,this._name=a,this.init()}n(i).on("load",function(){!0}),f.prototype={init:function(){return this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this.autoCountryDeferred=new n.Deferred,this._initAutoCountry(),this.typedLetters="",this.autoCountryDeferred},_processCountryData:function(){this._setInstanceCountryData(),this._setPreferredCountries(),this.options.localizedCountries&&this._translateCountriesByLocale(),(this.options.onlyCountries.length||this.options.localizedCountries)&&this.countries.sort(this._countryNameSort)},_setInstanceCountryData:function(){var i=this;if(this.options.onlyCountries.length){var t=[];n.each(this.options.onlyCountries,function(n,e){var a=i._getCountryData(e,!0);a&&t.push(a)}),this.countries=t}else if(this.options.excludeCountries.length){var e=this.options.excludeCountries.map(function(n){return n.toLowerCase()});this.countries=g.filter(function(n){return-1===e.indexOf(n.iso2)})}else this.countries=g},_setPreferredCountries:function(){var i=this;this.preferredCountries=[],n.each(this.options.preferredCountries,function(n,t){var e=i._getCountryData(t,!1);e&&i.preferredCountries.push(e)})},_translateCountriesByLocale(){for(let n=0;nn.name.localeCompare(i.name),_generateMarkup:function(){this.countryInput=n(this.element);var t="country-select";this.options.defaultStyling&&(t+=" "+this.options.defaultStyling),this.countryInput.wrap(n("
    ",{class:t}));var e=n("
    ",{class:"flag-dropdown"}).insertAfter(this.countryInput),a=n("
    ",{class:"selected-flag"}).appendTo(e);this.selectedFlagInner=n("
    ",{class:"flag"}).appendTo(a),n("
    ",{class:"arrow"}).appendTo(a),this.countryList=n("
      ",{class:"country-list v-hide"}).appendTo(e),this.preferredCountries.length&&(this._appendListItems(this.preferredCountries,"preferred"),n("
    • ",{class:"divider"}).appendTo(this.countryList)),this._appendListItems(this.countries,""),this.countryCodeInput=n("#"+this.countryInput.attr("id")+"_code"),this.countryCodeInput||(this.countryCodeInput=n(''),this.countryCodeInput.insertAfter(this.countryInput)),this.dropdownHeight=this.countryList.outerHeight(),this.options.responsiveDropdown&&n(i).resize(function(){n(".country-select").each(function(){var i=this.offsetWidth;n(this).find(".country-list").css("width",i+"px")})}).resize(),this.countryList.removeClass("v-hide").addClass("hide"),this.countryListItems=this.countryList.children(".country")},_appendListItems:function(i,t){var e="";n.each(i,function(n,i){e+='
    • ',e+='
      ',e+=''+i.name+"",e+="
    • "}),this.countryList.append(e)},_setInitialState:function(){var n=!1;this.countryInput.val()&&(n=this._updateFlagFromInputVal());var i,t=this.countryCodeInput.val();(t&&this.selectCountry(t),n)||(this.options.defaultCountry&&(i=this._getCountryData(this.options.defaultCountry,!1))||(i=this.preferredCountries.length?this.preferredCountries[0]:this.countries[0]),this.defaultCountry=i.iso2)},_initListeners:function(){var n=this;this.countryInput.on("keyup"+this.ns,function(){n._updateFlagFromInputVal()}),this.selectedFlagInner.parent().on("click"+this.ns,function(i){n.countryList.hasClass("hide")&&!n.countryInput.prop("disabled")&&n._showDropdown()}),this.countryInput.on("blur"+this.ns,function(){n.countryInput.val()!=n.getSelectedCountryData().name&&n.setCountry(n.countryInput.val()),n.countryInput.val(n.getSelectedCountryData().name)})},_initAutoCountry:function(){"auto"===this.options.initialCountry?this._loadAutoCountry():(this.defaultCountry&&this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},_loadAutoCountry:function(){n.fn[a].autoCountry?this.handleAutoCountry():n.fn[a].startedLoadingAutoCountry||(n.fn[a].startedLoadingAutoCountry=!0,"function"==typeof this.options.geoIpLookup&&this.options.geoIpLookup(function(i){n.fn[a].autoCountry=i.toLowerCase(),setTimeout(function(){n(".country-select input").countrySelect("handleAutoCountry")})}))},_focus:function(){this.countryInput.focus();var n=this.countryInput[0];if(n.setSelectionRange){var i=this.countryInput.val().length;n.setSelectionRange(i,i)}},_showDropdown:function(){this._setDropdownPosition();var n=this.countryList.children(".active");this._highlightListItem(n),this.countryList.removeClass("hide"),this._scrollTo(n),this._bindDropdownListeners(),this.selectedFlagInner.parent().children(".arrow").addClass("up")},_setDropdownPosition:function(){var t=this.countryInput.offset().top,e=n(i).scrollTop(),a=t+this.countryInput.outerHeight()+this.dropdownHeighte,o=!a&&s?"-"+(this.dropdownHeight-1)+"px":"";this.countryList.css("top",o)},_bindDropdownListeners:function(){var i=this;this.countryList.on("mouseover"+this.ns,".country",function(t){i._highlightListItem(n(this))}),this.countryList.on("click"+this.ns,".country",function(t){i._selectListItem(n(this))});var e=!0;n("html").on("click"+this.ns,function(n){n.preventDefault(),e||i._closeDropdown(),e=!1}),n(t).on("keydown"+this.ns,function(n){n.preventDefault(),n.which==r||n.which==u?i._handleUpDownKey(n.which):n.which==l?i._handleEnterKey():n.which==h?i._closeDropdown():n.which>=p&&n.which<=y||n.which===d?(i.typedLetters+=String.fromCharCode(n.which),i._filterCountries(i.typedLetters)):n.which===c&&(i.typedLetters=i.typedLetters.slice(0,-1),i._filterCountries(i.typedLetters))})},_handleUpDownKey:function(n){var i=this.countryList.children(".highlight").first(),t=n==r?i.prev():i.next();t.length&&(t.hasClass("divider")&&(t=n==r?t.prev():t.next()),this._highlightListItem(t),this._scrollTo(t))},_handleEnterKey:function(){var n=this.countryList.children(".highlight").first();n.length&&this._selectListItem(n)},_filterCountries:function(i){var t=this.countryListItems.filter(function(){return 0===n(this).text().toUpperCase().indexOf(i)&&!n(this).hasClass("preferred")});if(t.length){var e,a=t.filter(".highlight").first();e=a&&a.next()&&0===a.next().text().toUpperCase().indexOf(i)?a.next():t.first(),this._highlightListItem(e),this._scrollTo(e)}},_updateFlagFromInputVal:function(){var i=this,t=this.countryInput.val().replace(/(?=[() ])/g,"\\");if(t){var e=[],a=new RegExp(t,"i");if(t.length<=2)for(var s=0;sa){var l=t-s;i.scrollTop(u-l)}}},_updateName:function(n){this.countryCodeInput.val(n).trigger("change"),this.countryInput.val(this._getCountryData(n).name)},handleAutoCountry:function(){"auto"===this.options.initialCountry&&(this.defaultCountry=n.fn[a].autoCountry,this.countryInput.val()||this.selectCountry(this.defaultCountry),this.autoCountryDeferred.resolve())},getSelectedCountryData:function(){var n=this.selectedFlagInner.attr("class").split(" ")[1];return this._getCountryData(n)},selectCountry:function(n){n=n.toLowerCase(),this.selectedFlagInner.hasClass(n)||(this._selectFlag(n),this._updateName(n))},setCountry:function(n){this.countryInput.val(n),this._updateFlagFromInputVal()},destroy:function(){this.countryInput.off(this.ns),this.selectedFlagInner.parent().off(this.ns),this.countryInput.parent().before(this.countryInput).remove()}},n.fn[a]=function(i){var t,s=arguments;return i===e||"object"==typeof i?this.each(function(){n.data(this,"plugin_"+a)||n.data(this,"plugin_"+a,new f(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var e=n.data(this,"plugin_"+a);e instanceof f&&"function"==typeof e[i]&&(t=e[i].apply(e,Array.prototype.slice.call(s,1))),"destroy"===i&&n.data(this,"plugin_"+a,null)}),t!==e?t:this):void 0},n.fn[a].getCountryData=function(){return g},n.fn[a].setCountryData=function(n){g=n};var g=n.each([{n:"Afghanistan (‫افغانستان‬‎)",i:"af"},{n:"Åland Islands (Åland)",i:"ax"},{n:"Albania (Shqipëri)",i:"al"},{n:"Algeria (‫الجزائر‬‎)",i:"dz"},{n:"American Samoa",i:"as"},{n:"Andorra",i:"ad"},{n:"Angola",i:"ao"},{n:"Anguilla",i:"ai"},{n:"Antarctica",i:"aq"},{n:"Antigua and Barbuda",i:"ag"},{n:"Argentina",i:"ar"},{n:"Armenia (Հայաստան)",i:"am"},{n:"Aruba",i:"aw"},{n:"Australia",i:"au"},{n:"Austria (Österreich)",i:"at"},{n:"Azerbaijan (Azərbaycan)",i:"az"},{n:"Bahamas",i:"bs"},{n:"Bahrain (‫البحرين‬‎)",i:"bh"},{n:"Bangladesh (বাংলাদেশ)",i:"bd"},{n:"Barbados",i:"bb"},{n:"Belarus (Беларусь)",i:"by"},{n:"Belgium (België)",i:"be"},{n:"Belize",i:"bz"},{n:"Benin (Bénin)",i:"bj"},{n:"Bermuda",i:"bm"},{n:"Bhutan (འབྲུག)",i:"bt"},{n:"Bolivia",i:"bo"},{n:"Bosnia and Herzegovina (Босна и Херцеговина)",i:"ba"},{n:"Botswana",i:"bw"},{n:"Bouvet Island (Bouvetøya)",i:"bv"},{n:"Brazil (Brasil)",i:"br"},{n:"British Indian Ocean Territory",i:"io"},{n:"British Virgin Islands",i:"vg"},{n:"Brunei",i:"bn"},{n:"Bulgaria (България)",i:"bg"},{n:"Burkina Faso",i:"bf"},{n:"Burundi (Uburundi)",i:"bi"},{n:"Cambodia (កម្ពុជា)",i:"kh"},{n:"Cameroon (Cameroun)",i:"cm"},{n:"Canada",i:"ca"},{n:"Cape Verde (Kabu Verdi)",i:"cv"},{n:"Caribbean Netherlands",i:"bq"},{n:"Cayman Islands",i:"ky"},{n:"Central African Republic (République Centrafricaine)",i:"cf"},{n:"Chad (Tchad)",i:"td"},{n:"Chile",i:"cl"},{n:"China (中国)",i:"cn"},{n:"Christmas Island",i:"cx"},{n:"Cocos (Keeling) Islands (Kepulauan Cocos (Keeling))",i:"cc"},{n:"Colombia",i:"co"},{n:"Comoros (‫جزر القمر‬‎)",i:"km"},{n:"Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)",i:"cd"},{n:"Congo (Republic) (Congo-Brazzaville)",i:"cg"},{n:"Cook Islands",i:"ck"},{n:"Costa Rica",i:"cr"},{n:"Côte d’Ivoire",i:"ci"},{n:"Croatia (Hrvatska)",i:"hr"},{n:"Cuba",i:"cu"},{n:"Curaçao",i:"cw"},{n:"Cyprus (Κύπρος)",i:"cy"},{n:"Czech Republic (Česká republika)",i:"cz"},{n:"Denmark (Danmark)",i:"dk"},{n:"Djibouti",i:"dj"},{n:"Dominica",i:"dm"},{n:"Dominican Republic (República Dominicana)",i:"do"},{n:"Ecuador",i:"ec"},{n:"Egypt (‫مصر‬‎)",i:"eg"},{n:"El Salvador",i:"sv"},{n:"Equatorial Guinea (Guinea Ecuatorial)",i:"gq"},{n:"Eritrea",i:"er"},{n:"Estonia (Eesti)",i:"ee"},{n:"Ethiopia",i:"et"},{n:"Falkland Islands (Islas Malvinas)",i:"fk"},{n:"Faroe Islands (Føroyar)",i:"fo"},{n:"Fiji",i:"fj"},{n:"Finland (Suomi)",i:"fi"},{n:"France",i:"fr"},{n:"French Guiana (Guyane française)",i:"gf"},{n:"French Polynesia (Polynésie française)",i:"pf"},{n:"French Southern Territories (Terres australes françaises)",i:"tf"},{n:"Gabon",i:"ga"},{n:"Gambia",i:"gm"},{n:"Georgia (საქართველო)",i:"ge"},{n:"Germany (Deutschland)",i:"de"},{n:"Ghana (Gaana)",i:"gh"},{n:"Gibraltar",i:"gi"},{n:"Greece (Ελλάδα)",i:"gr"},{n:"Greenland (Kalaallit Nunaat)",i:"gl"},{n:"Grenada",i:"gd"},{n:"Guadeloupe",i:"gp"},{n:"Guam",i:"gu"},{n:"Guatemala",i:"gt"},{n:"Guernsey",i:"gg"},{n:"Guinea (Guinée)",i:"gn"},{n:"Guinea-Bissau (Guiné Bissau)",i:"gw"},{n:"Guyana",i:"gy"},{n:"Haiti",i:"ht"},{n:"Heard Island and Mcdonald Islands",i:"hm"},{n:"Honduras",i:"hn"},{n:"Hong Kong (香港)",i:"hk"},{n:"Hungary (Magyarország)",i:"hu"},{n:"Iceland (Ísland)",i:"is"},{n:"India (भारत)",i:"in"},{n:"Indonesia",i:"id"},{n:"Iran (‫ایران‬‎)",i:"ir"},{n:"Iraq (‫العراق‬‎)",i:"iq"},{n:"Ireland",i:"ie"},{n:"Isle of Man",i:"im"},{n:"Israel (‫ישראל‬‎)",i:"il"},{n:"Italy (Italia)",i:"it"},{n:"Jamaica",i:"jm"},{n:"Japan (日本)",i:"jp"},{n:"Jersey",i:"je"},{n:"Jordan (‫الأردن‬‎)",i:"jo"},{n:"Kazakhstan (Казахстан)",i:"kz"},{n:"Kenya",i:"ke"},{n:"Kiribati",i:"ki"},{n:"Kosovo (Kosovë)",i:"xk"},{n:"Kuwait (‫الكويت‬‎)",i:"kw"},{n:"Kyrgyzstan (Кыргызстан)",i:"kg"},{n:"Laos (ລາວ)",i:"la"},{n:"Latvia (Latvija)",i:"lv"},{n:"Lebanon (‫لبنان‬‎)",i:"lb"},{n:"Lesotho",i:"ls"},{n:"Liberia",i:"lr"},{n:"Libya (‫ليبيا‬‎)",i:"ly"},{n:"Liechtenstein",i:"li"},{n:"Lithuania (Lietuva)",i:"lt"},{n:"Luxembourg",i:"lu"},{n:"Macau (澳門)",i:"mo"},{n:"Macedonia (FYROM) (Македонија)",i:"mk"},{n:"Madagascar (Madagasikara)",i:"mg"},{n:"Malawi",i:"mw"},{n:"Malaysia",i:"my"},{n:"Maldives",i:"mv"},{n:"Mali",i:"ml"},{n:"Malta",i:"mt"},{n:"Marshall Islands",i:"mh"},{n:"Martinique",i:"mq"},{n:"Mauritania (‫موريتانيا‬‎)",i:"mr"},{n:"Mauritius (Moris)",i:"mu"},{n:"Mayotte",i:"yt"},{n:"Mexico (México)",i:"mx"},{n:"Micronesia",i:"fm"},{n:"Moldova (Republica Moldova)",i:"md"},{n:"Monaco",i:"mc"},{n:"Mongolia (Монгол)",i:"mn"},{n:"Montenegro (Crna Gora)",i:"me"},{n:"Montserrat",i:"ms"},{n:"Morocco (‫المغرب‬‎)",i:"ma"},{n:"Mozambique (Moçambique)",i:"mz"},{n:"Myanmar (Burma) (မြန်မာ)",i:"mm"},{n:"Namibia (Namibië)",i:"na"},{n:"Nauru",i:"nr"},{n:"Nepal (नेपाल)",i:"np"},{n:"Netherlands (Nederland)",i:"nl"},{n:"New Caledonia (Nouvelle-Calédonie)",i:"nc"},{n:"New Zealand",i:"nz"},{n:"Nicaragua",i:"ni"},{n:"Niger (Nijar)",i:"ne"},{n:"Nigeria",i:"ng"},{n:"Niue",i:"nu"},{n:"Norfolk Island",i:"nf"},{n:"North Korea (조선 민주주의 인민 공화국)",i:"kp"},{n:"Northern Mariana Islands",i:"mp"},{n:"Norway (Norge)",i:"no"},{n:"Oman (‫عُمان‬‎)",i:"om"},{n:"Pakistan (‫پاکستان‬‎)",i:"pk"},{n:"Palau",i:"pw"},{n:"Palestine (‫فلسطين‬‎)",i:"ps"},{n:"Panama (Panamá)",i:"pa"},{n:"Papua New Guinea",i:"pg"},{n:"Paraguay",i:"py"},{n:"Peru (Perú)",i:"pe"},{n:"Philippines",i:"ph"},{n:"Pitcairn Islands",i:"pn"},{n:"Poland (Polska)",i:"pl"},{n:"Portugal",i:"pt"},{n:"Puerto Rico",i:"pr"},{n:"Qatar (‫قطر‬‎)",i:"qa"},{n:"Réunion (La Réunion)",i:"re"},{n:"Romania (România)",i:"ro"},{n:"Russia (Россия)",i:"ru"},{n:"Rwanda",i:"rw"},{n:"Saint Barthélemy (Saint-Barthélemy)",i:"bl"},{n:"Saint Helena",i:"sh"},{n:"Saint Kitts and Nevis",i:"kn"},{n:"Saint Lucia",i:"lc"},{n:"Saint Martin (Saint-Martin (partie française))",i:"mf"},{n:"Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)",i:"pm"},{n:"Saint Vincent and the Grenadines",i:"vc"},{n:"Samoa",i:"ws"},{n:"San Marino",i:"sm"},{n:"São Tomé and Príncipe (São Tomé e Príncipe)",i:"st"},{n:"Saudi Arabia (‫المملكة العربية السعودية‬‎)",i:"sa"},{n:"Senegal (Sénégal)",i:"sn"},{n:"Serbia (Србија)",i:"rs"},{n:"Seychelles",i:"sc"},{n:"Sierra Leone",i:"sl"},{n:"Singapore",i:"sg"},{n:"Sint Maarten",i:"sx"},{n:"Slovakia (Slovensko)",i:"sk"},{n:"Slovenia (Slovenija)",i:"si"},{n:"Solomon Islands",i:"sb"},{n:"Somalia (Soomaaliya)",i:"so"},{n:"South Africa",i:"za"},{n:"South Georgia & South Sandwich Islands",i:"gs"},{n:"South Korea (대한민국)",i:"kr"},{n:"South Sudan (‫جنوب السودان‬‎)",i:"ss"},{n:"Spain (España)",i:"es"},{n:"Sri Lanka (ශ්‍රී ලංකාව)",i:"lk"},{n:"Sudan (‫السودان‬‎)",i:"sd"},{n:"Suriname",i:"sr"},{n:"Svalbard and Jan Mayen (Svalbard og Jan Mayen)",i:"sj"},{n:"Swaziland",i:"sz"},{n:"Sweden (Sverige)",i:"se"},{n:"Switzerland (Schweiz)",i:"ch"},{n:"Syria (‫سوريا‬‎)",i:"sy"},{n:"Taiwan (台灣)",i:"tw"},{n:"Tajikistan",i:"tj"},{n:"Tanzania",i:"tz"},{n:"Thailand (ไทย)",i:"th"},{n:"Timor-Leste",i:"tl"},{n:"Togo",i:"tg"},{n:"Tokelau",i:"tk"},{n:"Tonga",i:"to"},{n:"Trinidad and Tobago",i:"tt"},{n:"Tunisia (‫تونس‬‎)",i:"tn"},{n:"Turkey (Türkiye)",i:"tr"},{n:"Turkmenistan",i:"tm"},{n:"Turks and Caicos Islands",i:"tc"},{n:"Tuvalu",i:"tv"},{n:"Uganda",i:"ug"},{n:"Ukraine (Україна)",i:"ua"},{n:"United Arab Emirates (‫الإمارات العربية المتحدة‬‎)",i:"ae"},{n:"United Kingdom",i:"gb"},{n:"United States",i:"us"},{n:"U.S. Minor Outlying Islands",i:"um"},{n:"U.S. Virgin Islands",i:"vi"},{n:"Uruguay",i:"uy"},{n:"Uzbekistan (Oʻzbekiston)",i:"uz"},{n:"Vanuatu",i:"vu"},{n:"Vatican City (Città del Vaticano)",i:"va"},{n:"Venezuela",i:"ve"},{n:"Vietnam (Việt Nam)",i:"vn"},{n:"Wallis and Futuna",i:"wf"},{n:"Western Sahara (‫الصحراء الغربية‬‎)",i:"eh"},{n:"Yemen (‫اليمن‬‎)",i:"ye"},{n:"Zambia",i:"zm"},{n:"Zimbabwe",i:"zw"}],function(n,i){i.name=i.n,i.iso2=i.i,delete i.n,delete i.i})}); \ No newline at end of file diff --git a/src/js/countrySelect.js b/src/js/countrySelect.js index 2a98db4..fc6e349 100644 --- a/src/js/countrySelect.js +++ b/src/js/countrySelect.js @@ -23,6 +23,8 @@ onlyCountries: [], // The countries at the top of the list. Defaults to United States and United Kingdom preferredCountries: [ "us", "gb" ], + // localized country names e.g. { 'de': 'Deutschland' } + localizedCountries: null, // Set the dropdown's width to be the same as the input. This is automatically enabled for small screens. responsiveDropdown: ($(window).width() < 768 ? true : false), }, keys = { @@ -78,6 +80,12 @@ this._setInstanceCountryData(); // set the preferredCountries property this._setPreferredCountries(); + // translate countries according to localizedCountries option + if (this.options.localizedCountries) this._translateCountriesByLocale(); + // sort countries by name + if (this.options.onlyCountries.length || this.options.localizedCountries) { + this.countries.sort(this._countryNameSort); + } }, // process onlyCountries array if present _setInstanceCountryData: function() { @@ -114,6 +122,19 @@ } }); }, + // Translate Countries by object literal provided on config + _translateCountriesByLocale() { + for (let i = 0; i < this.countries.length; i++) { + const iso = this.countries[i].iso2.toLowerCase(); + if (this.options.localizedCountries.hasOwnProperty(iso)) { + this.countries[i].name = this.options.localizedCountries[iso]; + } + } + }, + // sort by country name + _countryNameSort(a, b) { + return a.name.localeCompare(b.name); + }, // generate all of the markup for the plugin: the selected flag overlay, and the dropdown _generateMarkup: function() { // Country input