-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
140 lines (117 loc) · 6.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<html>
<head>
<script src="niceCountryInput.js"></script>
<link rel="stylesheet" type="text/css" href="niceCountryInput.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-exp.min.css">
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
</head>
<body>
<div class="panel" style="margin: 50px;">
<h2>Welcome to nicecountryinput</h2>
<p>An easy-to-use country picker.</p>
<div class="container">
<div class="columns">
<div class="column col-xs-12">
<h3>Dependencies and requirements</h3>
<ul>
<li>Javascript, CSS</li>
<li><span style="text-decoration: line-through;">jQuery 2.x / 3.x</span> Removed as of v2.0.0</li>
<li>HTML data-* Attributes</li>
<li>Base64 img source support</li>
</ul>
</div>
<div class="column col-xs-12">
<h3>Features</h3>
<ul>
<li>English and Native country name</li>
<li>Selected country is set by ISO code</li>
<li>Additional selectors for Continents</li>
<li>Additional selectors for All / None</li>
<li>Filter input (works with native and english country name)</li>
<li>No global namespace pollution, everything is in one prototype “NiceCountryInput”</li>
<li>No image files (Every image is saved in the JS file)</li>
</ul>
</div>
</div>
</div>
<h3>Examples</h3>
<p>With flags:
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="US" data-showspecial="false" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
<pre class="code" data-lang="HTML">
<code>
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="US" data-showspecial="false" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
</code>
</pre>
</p>
<p>Without flags, showing ISO
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="US" data-showspecial="false" data-showflags="false" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
<pre class="code" data-lang="HTML">
<code>
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="US" data-showspecial="false" data-showflags="false" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
</code>
</pre>
</p>
<p>Continent selection
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="_EU" data-showcontinentsonly="true" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
<pre class="code" data-lang="HTML">
<code>
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="_EU" data-showcontinentsonly="true" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" />
</div>
</code>
</pre>
</p>
<p>Country selection with "All" and "None" option. e.g. Used when filtering data by country.
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="_AL" data-showcontinentsonly="false" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" data-showspecial="true"/>
</div>
<pre class="code" data-lang="HTML">
<code>
<div class="niceCountryInputSelector" style="width: 300px;" data-selectedcountry="_AL" data-showcontinentsonly="false" data-showflags="true" data-i18nall="All selected"
data-i18nnofilter="No selection" data-i18nfilter="Filter" data-onchangecallback="onChangeCallback" data-showspecial="true"/>
</div>
</code>
</pre>
</p>
<h3>Initialisation via JS</h3>
<pre class="code" data-lang="JavaScript">
<code>
//call back function (optional)
function onChangeCallback(ctr){
console.log("The country was changed: " + ctr);
}
//init picker when document is ready
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelectorAll(".niceCountryInputSelector").forEach(element => new NiceCountryInput(element).init());
});
</code>
</pre>
<script>
function onChangeCallback(ctr){
console.log("The country was changed: " + ctr);
//$("#selectionSpan").text(ctr);
}
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelectorAll(".niceCountryInputSelector").forEach(element => new NiceCountryInput(element).init());
});
</script>
<!--
<div>
<span>Selected country:</span>
<span id="selectionSpan"></span>
</div>
-->
</div>
</body>
</html>