Projekt

Obecné

Profil

Stáhnout (25.2 KB) Statistiky
| Větev: | Revize:
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <meta charset="utf-8">
5
    <meta http-equiv="x-ua-compatible" content="ie=edge">
6
    <title>Demo</title>
7
    <meta name="description" content="">
8
    <meta name="viewport" content="width=device-width, initial-scale=1">
9
    <link rel="stylesheet" href="./vanillaSelectBox.css">
10
    <!-- internal css -->
11
    <style>
12
        body {
13
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
14
            margin: 0;
15
        }
16

    
17
        .darkRed {
18
            color: darkred;
19
        }
20

    
21
        .darkBlue {
22
            color: darkblue;
23
        }
24

    
25
        .navbar {
26
            position: relative;
27
            border: 1px solid #080808;
28
            background-color: #222;
29
            background-image: linear-gradient(to bottom,#3c3c3c 0,#222 100%);
30
            background-repeat: repeat-x;
31
            border-radius: 4px;
32
            margin: 0;
33
            padding: 0;
34
        }
35

    
36
        .navbar-brand {
37
            float: left;
38
            padding: 14px 15px;
39
            font-size: 18px;
40
            line-height: 20px;
41
            color: #fff;
42
            cursor: pointer;
43
            text-decoration: none;
44
        }
45

    
46
        a:hover {
47
            color: #fff;
48
        }
49

    
50
        .navbar-links {
51
            font-size: 14px;
52
            line-height: 20px;
53
            position: relative;
54
            margin: 0;
55
        }
56

    
57
            .navbar-links li {
58
                cursor: pointer;
59
                text-decoration: none;
60
            }
61

    
62
            .navbar-links li {
63
                display: inline-block;
64
                min-width: 120px;
65
                text-align: center;
66
                margin-top: 15px;
67
            }
68

    
69
                .navbar-links li.active {
70
                    background-image: #080808;
71
                    background: #080808;
72
                    color: #fff;
73
                    height: 100%;
74
                    padding-top: 15px;
75
                    padding-bottom: 15px;
76
                    margin: 0;
77
                }
78

    
79
        a {
80
            color: #9d9d9d;
81
            cursor: pointer;
82
            text-decoration: none;
83
        }
84

    
85
        @media (max-width: 640px) {
86
            .navbar-brand {
87
                width: 100%;
88
            }
89

    
90
            .navbar-links {
91
                padding-left: 0;
92
            }
93

    
94
            button.demo {
95
                margin-right: 100% !important;
96
            }
97
        }
98

    
99
        #container {
100
            padding-top: 30px;
101
            padding-left: 50px;
102
            width: 90%;
103
            font-size: 14px;
104
        }
105

    
106
        .demo-zone {
107
            display: block;
108
            width: 100%;
109
            min-height: 200px;
110
        }
111

    
112
        .mini-demo-zone {
113
            display: block;
114
            width: 100%;
115
            min-height: 100px;
116
        }
117

    
118
        .btns-active, .btns-inactive {
119
            margin-top: 20px;
120
        }
121

    
122
        label {
123
            display: inline-block;
124
            min-width: 220px;
125
            width: 220px;
126
        }
127

    
128
        button.demo,a.demo {
129
            margin-right: 0;
130
            margin-left: 4px;
131
            text-align: center;
132
            white-space: nowrap;
133
            vertical-align: middle;
134
            user-select: none;
135
            border-radius: 4px;
136
            z-index: 1;
137
            color: #333;
138
            background: white;
139
            background-image: linear-gradient(to bottom,#fff 0,#e0e0e0 100%);
140
            border: 1px solid #ccc !important;
141
            color: #333;
142
            line-height: 20px;
143
            font-size: 14px;
144
            padding: 4px 12px;
145
            margin-bottom: 2px;
146
        }
147

    
148
            button.demo:hover {
149
                background-image: linear-gradient(to top,#fff 0,#e0e0e0 100%);
150
            }
151

    
152
        .presentation {
153
            background: #eee;
154
            color: #2e44b9;
155
            border: 1px solid grey;
156
            border-radius: 8px;
157
            line-height: 20px;
158
            padding: 8px;
159
            margin-bottom: 40px;
160
            width: 90%;
161
            max-width: 800px;
162
            font-size: 14px;
163
        }
164
    </style>
165
</head>
166
<body>
167
    <nav class="navbar">
168
            <div class="navbar-header">
169
                <a class="navbar-brand" href="#">
170
                    Experiments with vanilla js
171
                </a>
172
            </div>
173
            <ul class="navbar-links">
174
                <li id="vanillaSelectBox" class="active"><a href="#vanillaSelectBox">vanillaSelectBox</a></li>
175
                <li id="blog"><a href="https://philippemarcmeyer.github.io#vanillajs">Github Blog</a></li>
176
                <li id="repos"><a href="https://github.com/PhilippeMarcMeyer/vanillaSelectBox">Github repos</a></li>
177
            </ul>
178
    </nav>
179
<div id="container">
180
	<p class="presentation">
181
	<b>vanillaSelectBox()</b> <br/>
182
    To train my vanilla js skills I redid my bootStrapSelect jQuery plugin without jQuery and without Bootstrap
183
	</p>
184
    <p><a id="ajaxDemoLink" class="demo" href="ajaxDemo.html">AJAX DEMO</a></p>
185

    
186
	<div class="demo-zone" style="text-align:left;" id="demo-single">
187
		<label>Choose a brand in list : </label><select id="brandsOne"></select> 
188
		<div class="btns-active">
189
			<button class="demo" onClick="empty('brandsOne')">empty()</button>
190
			<button class="demo" onClick="setValues('brandsOne','Alpine')">setValue('Alpine')</button>
191
			<button class="demo" onClick="setEnable('brandsOne',false)">disable()</button>
192
			<button class="demo" onClick="setEnable('brandsOne',true)">enable()</button>
193
            <button class="demo" onClick="doDestroy('brandsOne')">destroy()</button>
194
            <button class="demo" onClick="disableItems('brandsOne','Alpine,Bentley')">disableItems('Alpine,Bentley')</button>
195
            <button class="demo" onClick="enableItems('brandsOne','Alpine,Bentley')">enableItems('Alpine,Bentley')</button>
196
			<br/><br/>
197
			<button class="demo" style="width:140px;" onClick="document.getElementById('brandsOneChoice').innerHTML=document.getElementById('brandsOne').value;">get select value</button>
198
			<span id="brandsOneChoice"></span>
199
		</div>
200
		<div class="btns-inactive"  style="display:none">;
201
			<button class="demo" onClick="init('brandsOne')">vanillaSelectBox()</button>
202
		</div>
203
    </div>
204

    
205
    <div id="mini-demo-zone" class="demo-zone"> 
206
        <div>optgroup support : </div>
207
        <div> 
208
            <label for="dino-select">Choose a dinosaur:</label>
209
            <select id="dino-select">
210
                <optgroup label="Theropods">
211
                    <option>Tyrannosaurus</option>
212
                    <option>Velociraptor</option>
213
                    <option>Deinonychus</option>
214
                </optgroup>
215
                <optgroup label="Sauropods">
216
                    <option>Diplodocus</option>
217
                    <option>Saltasaurus</option>
218
                    <option>Apatosaurus</option>
219
                </optgroup>
220
            </select>
221
        </div>
222
    </div>
223

    
224
	<div class="demo-zone" id="demo-multiple">
225
		<label>Choose several brands : </label><select id="brandsMulti" multiple size="3"></select>
226
		<div class="btns-active">
227
			<button class="demo" onClick="empty('brandsMulti')">empty()</button>
228
			<button class="demo" onClick="setValues('brandsMulti',['Lamborghini','Land Rover'])">setValue(['Lamborghini','Land Rover'])</button>
229
			<button class="demo" onClick="setValues('brandsMulti','all')">setValue('all')</button>
230
			<button class="demo" onClick="setEnable('brandsMulti',false)">disable()</button>
231
			<button class="demo" onClick="setEnable('brandsMulti',true)">enable()</button>
232
			<button class="demo" onClick="doDestroy('brandsMulti')">destroy()</button>
233
			<br/><br/>
234
			<button  class="demo" style="width:140px;" onClick="document.getElementById('brandsMultiChoice').innerHTML=(getValues('brandsMulti')).join(',');">get select values</button>&nbsp;
235
&nbsp;
236
&nbsp;
237
<span id="brandsMultiChoice"></span>
238
		</div>
239
		<div class="btns-inactive" style="display:none";>
240
			<button class="demo" onClick="init('brandsMulti')">vanillaSelectBox()</button>
241
		</div>
242
    </div>
243
    
244
    <div class="demo-zone">
245
        <label><b>All selected test : </b></label>
246
        <select id="demoShort" multiple="" size="3" style="display: inline-block;">
247
            <option value="Abarth" selected="true">Abarth</option>
248
            <option value="Alfa Romeo"  selected="true">Alfa Romeo</option>
249
            <option value="Alpine" data-test="example" selected="true">Alpine</option>
250
            <option value="Aston Martin" selected="true">Aston Martin</option>
251
            <option value="Audi" selected="true">Audi</option>
252
            <option value="Bentley" selected="true">Bentley</option>
253
            <option value="BMW" selected="true">BMW</option>
254
            <option value="Cadillac" selected="true">Cadillac</option>
255
            <option value="Chevrolet" selected="true">Chevrolet</option>
256
            <option value="Citroën" selected="true">Citroën</option>
257
            <option value="Cupra" selected="true">Cupra</option>
258
            <option value="DACIA" selected="true">DACIA</option>
259
        </select>
260
    
261
    </div>
262
    <div style="width:100%;">
263
        <div class="demo-zone" id="demo-stay" style="width:40%;display:inline-block;">
264
            <label>Stay open : </label><br/><select id="brandsMultiStay" multiple size="3"></select>
265
        </div>
266
    
267
        <div class="demo-zone" id="demo-stay-right" style="width:50%;text-align:right;display:inline-block;">
268
            <label>All countries : </label><br/><select id="allCountries" multiple size="4"></select>
269
        </div>
270
    </div>
271
</div>
272

    
273
<script src="./vanillaSelectBox.js"></script>
274
<script>
275

    
276
    let brands = ["Abarth", "Alfa Romeo", "Alpine", "Aston Martin", "Audi", "Bentley", "BMW", "Cadillac", "Chevrolet", "Citroën", "Cupra", "DACIA", "DS", "Ferrari", "Fiat", "Ford", "Honda", "Hyundai", "Infiniti", "Jaguar", "Jeep", "KIA", "Lamborghini", "Land Rover", "Lexus", "Lotus", "Maserati", "Mazda", "McLaren", "Mercedes-Benz", "MINI", "Mitsubishi", "Nissan", "Opel", "Peugeot", "Porsche", "Renault", "Rolls-Royce", "SEAT", "Skoda", "smart", "Ssangyong", "Subaru", "Suzuki", "Tesla", "Toyota", "Volkswagen", "Volvo"];
277
    let select1 = document.getElementById("brandsOne");
278
    var option = document.createElement("option");
279
    option.value = "";
280
    option.text = "";
281
    select1.appendChild(option);
282
    for (var i = 0;
283
     i < brands.length;
284
     i++) {
285
        var option = document.createElement("option");
286
        option.value = brands[i];
287
        option.text = brands[i];
288
		if (i == 5) option.setAttribute("disabled", "");
289

    
290
        if (i == 23) option.setAttribute("selected", true);
291
        let colorClass = "";
292
        if (i > 2)
293
            option.classList.add(i % 2 == 0 ? "darkRed" : "darkBlue")
294
        select1.appendChild(option);
295
    }
296
    let select2 = document.getElementById("brandsMulti");
297
    for (var i = 0;
298
     i < brands.length;
299
     i++) {
300
        var option = document.createElement("option");
301
        option.value = brands[i];
302
        option.text = brands[i];
303
        if (i == 5) option.setAttribute("disabled", "");
304

    
305
        if (i == 23) option.setAttribute("selected", true);
306
        if (i >= 3 && i <= 7) option.setAttribute("selected", true);
307
        select2.appendChild(option);
308
    }
309
	    let select3 = document.getElementById("brandsMultiStay");
310
    for (var i = 0;
311
     i < brands.length;
312
     i++) {
313
        var option = document.createElement("option");
314
        option.value = brands[i];
315
        option.text = brands[i];
316
        if (i == 15) option.setAttribute("selected", true);
317
        if (i >= 3 && i <= 7) option.setAttribute("selected", true);
318
        select3.appendChild(option);
319
    }
320
    let selectBox = null;
321
    let selectBox2 = null;
322
	let selectBox3 = null;
323
    function setEnable(id, isEnabled) {
324
        if (id == "brandsOne" && selectBox != null) {
325
            if (isEnabled) {
326
                selectBox.enable();
327
            } else {
328
                selectBox.disable();
329
            }
330

    
331
        } else if (id == "brandsMulti" && selectBox2 != null) {
332
            if (isEnabled) {
333
                selectBox2.enable();
334
            } else {
335
                selectBox2.disable();
336
            }
337
        }
338
    }
339
    function empty(id) {
340
        if (id == "brandsOne" && selectBox != null) {
341
            selectBox.empty();
342
        } else if (id == "brandsMulti" && selectBox2 != null) {
343
            selectBox2.empty();
344
        }
345
    }
346
    function doDestroy(id) {
347
        if (id == "brandsOne" && selectBox != null) {
348
            selectBox.destroy();
349
            let zone = document.getElementById("demo-single");
350
            buttons = zone.querySelector(".btns-active");
351
            buttons.style.display = "none";
352
            buttons = zone.querySelector(".btns-inactive");
353
            buttons.style.display = "block";
354

    
355

    
356
        } else if (id == "brandsMulti" && selectBox2 != null) {
357
            selectBox2.destroy();
358
            let zone = document.getElementById("demo-multiple");
359
            buttons = zone.querySelector(".btns-active");
360
            buttons.style.display = "none";
361
            buttons = zone.querySelector(".btns-inactive");
362
            buttons.style.display = "block";
363

    
364
        }
365
    }
366
    function init(id) {
367
        if (id == "brandsOne") {
368
            selectBox = new vanillaSelectBox("#brandsOne", { "maxHeight": 200,"maxWidth":178,"minWidth":178, "search": true, "placeHolder": "Choose a brand..." });
369
            let zone = document.getElementById("demo-single");
370
            buttons = zone.querySelector(".btns-active");
371
            buttons.style.display = "block";
372
            buttons = zone.querySelector(".btns-inactive");
373
            buttons.style.display = "none";
374
        } else if (id == "brandsMulti") {
375
        
376
            selectBox2 = new vanillaSelectBox("#brandsMulti", {"disableSelectAll": true, "maxHeight": 200, "search": true ,"translations": { "all": "All", "items": "items","selectAll":"Check All","clearAll":"Clear All"}});
377
            let zone = document.getElementById("demo-multiple");
378
            buttons = zone.querySelector(".btns-active");
379
            buttons.style.display = "block";
380
            buttons = zone.querySelector(".btns-inactive");
381
            buttons.style.display = "none";
382

    
383
        }else if (id == "brandsMultiStay") {
384
            selectBox3 = new vanillaSelectBox("#brandsMultiStay", { "maxHeight": 200, "search": true,"stayOpen":true });
385
        }
386
    }
387
    function setValues(id, value) {
388
        if (id == "brandsOne" && selectBox != null) {
389
            selectBox.setValue(value);
390
        } else if (id == "brandsMulti" && selectBox2 != null) {
391
            selectBox2.setValue(value);
392
        }
393
    }
394
    function getValues(id) {
395
        let result = [];
396
        let collection = document.querySelectorAll("#" + id + " option");
397
        collection.forEach(function (x) {
398
            if (x.selected) {
399
                result.push(x.value);
400
            }
401
        });
402
        return result;
403
    }
404

    
405
    function disableItems(id,value){
406
        if (id == "brandsOne" && selectBox != null) {
407
            selectBox.disableItems(value);
408
        } 
409
    }
410

    
411
    function enableItems(id,value){
412
        if (id == "brandsOne" && selectBox != null) {
413
            selectBox.enableItems(value);
414
        } 
415
    }
416

    
417
    init("brandsOne");
418
    init("brandsMulti");
419
	init("brandsMultiStay");
420
    selectBoxTest = new vanillaSelectBox("#demoShort", {
421
        "maxHeight": 200, 
422
        "search": true ,
423
        "translations": { "all": "All", "items": "items","selectAll":"Check All","clearAll":"Clear All"}
424
    });
425
	
426
let allCountries = [
427
{"name": "Afghanistan", "code": "AF"},
428
{"name": "Åland Islands", "code": "AX"},
429
{"name": "Albania", "code": "AL"},
430
{"name": "Algeria", "code": "DZ"},
431
{"name": "American Samoa", "code": "AS"},
432
{"name": "AndorrA", "code": "AD"},
433
{"name": "Angola", "code": "AO"},
434
{"name": "Anguilla", "code": "AI"},
435
{"name": "Antarctica", "code": "AQ"},
436
{"name": "Antigua and Barbuda", "code": "AG"},
437
{"name": "Argentina", "code": "AR"},
438
{"name": "Armenia", "code": "AM"},
439
{"name": "Aruba", "code": "AW"},
440
{"name": "Australia", "code": "AU"},
441
{"name": "Austria", "code": "AT"},
442
{"name": "Azerbaijan", "code": "AZ"},
443
{"name": "Bahamas", "code": "BS"},
444
{"name": "Bahrain", "code": "BH"},
445
{"name": "Bangladesh", "code": "BD"},
446
{"name": "Barbados", "code": "BB"},
447
{"name": "Belarus", "code": "BY"},
448
{"name": "Belgium", "code": "BE"},
449
{"name": "Belize", "code": "BZ"},
450
{"name": "Benin", "code": "BJ"},
451
{"name": "Bermuda", "code": "BM"},
452
{"name": "Bhutan", "code": "BT"},
453
{"name": "Bolivia", "code": "BO"},
454
{"name": "Bosnia and Herzegovina", "code": "BA"},
455
{"name": "Botswana", "code": "BW"},
456
{"name": "Bouvet Island", "code": "BV"},
457
{"name": "Brazil", "code": "BR"},
458
{"name": "British Indian Ocean Territory", "code": "IO"},
459
{"name": "Brunei Darussalam", "code": "BN"},
460
{"name": "Bulgaria", "code": "BG"},
461
{"name": "Burkina Faso", "code": "BF"},
462
{"name": "Burundi", "code": "BI"},
463
{"name": "Cambodia", "code": "KH"},
464
{"name": "Cameroon", "code": "CM"},
465
{"name": "Canada", "code": "CA"},
466
{"name": "Cape Verde", "code": "CV"},
467
{"name": "Cayman Islands", "code": "KY"},
468
{"name": "Central African Republic", "code": "CF"},
469
{"name": "Chad", "code": "TD"},
470
{"name": "Chile", "code": "CL"},
471
{"name": "China", "code": "CN"},
472
{"name": "Christmas Island", "code": "CX"},
473
{"name": "Cocos (Keeling) Islands", "code": "CC"},
474
{"name": "Colombia", "code": "CO"},
475
{"name": "Comoros", "code": "KM"},
476
{"name": "Congo", "code": "CG"},
477
{"name": "Congo, The Democratic Republic of the", "code": "CD"},
478
{"name": "Cook Islands", "code": "CK"},
479
{"name": "Costa Rica", "code": "CR"},
480
{"name": "Cote D\'Ivoire", "code": "CI"},
481
{"name": "Croatia", "code": "HR"},
482
{"name": "Cuba", "code": "CU"},
483
{"name": "Cyprus", "code": "CY"},
484
{"name": "Czech Republic", "code": "CZ"},
485
{"name": "Denmark", "code": "DK"},
486
{"name": "Djibouti", "code": "DJ"},
487
{"name": "Dominica", "code": "DM"},
488
{"name": "Dominican Republic", "code": "DO"},
489
{"name": "Ecuador", "code": "EC"},
490
{"name": "Egypt", "code": "EG"},
491
{"name": "El Salvador", "code": "SV"},
492
{"name": "Equatorial Guinea", "code": "GQ"},
493
{"name": "Eritrea", "code": "ER"},
494
{"name": "Estonia", "code": "EE"},
495
{"name": "Ethiopia", "code": "ET"},
496
{"name": "Falkland Islands (Malvinas)", "code": "FK"},
497
{"name": "Faroe Islands", "code": "FO"},
498
{"name": "Fiji", "code": "FJ"},
499
{"name": "Finland", "code": "FI"},
500
{"name": "France", "code": "FR"},
501
{"name": "French Guiana", "code": "GF"},
502
{"name": "French Polynesia", "code": "PF"},
503
{"name": "French Southern Territories", "code": "TF"},
504
{"name": "Gabon", "code": "GA"},
505
{"name": "Gambia", "code": "GM"},
506
{"name": "Georgia", "code": "GE"},
507
{"name": "Germany", "code": "DE"},
508
{"name": "Ghana", "code": "GH"},
509
{"name": "Gibraltar", "code": "GI"},
510
{"name": "Greece", "code": "GR"},
511
{"name": "Greenland", "code": "GL"},
512
{"name": "Grenada", "code": "GD"},
513
{"name": "Guadeloupe", "code": "GP"},
514
{"name": "Guam", "code": "GU"},
515
{"name": "Guatemala", "code": "GT"},
516
{"name": "Guernsey", "code": "GG"},
517
{"name": "Guinea", "code": "GN"},
518
{"name": "Guinea-Bissau", "code": "GW"},
519
{"name": "Guyana", "code": "GY"},
520
{"name": "Haiti", "code": "HT"},
521
{"name": "Heard Island and Mcdonald Islands", "code": "HM"},
522
{"name": "Holy See (Vatican City State)", "code": "VA"},
523
{"name": "Honduras", "code": "HN"},
524
{"name": "Hong Kong", "code": "HK"},
525
{"name": "Hungary", "code": "HU"},
526
{"name": "Iceland", "code": "IS"},
527
{"name": "India", "code": "IN"},
528
{"name": "Indonesia", "code": "ID"},
529
{"name": "Iran, Islamic Republic Of", "code": "IR"},
530
{"name": "Iraq", "code": "IQ"},
531
{"name": "Ireland", "code": "IE"},
532
{"name": "Isle of Man", "code": "IM"},
533
{"name": "Israel", "code": "IL"},
534
{"name": "Italy", "code": "IT"},
535
{"name": "Jamaica", "code": "JM"},
536
{"name": "Japan", "code": "JP"},
537
{"name": "Jersey", "code": "JE"},
538
{"name": "Jordan", "code": "JO"},
539
{"name": "Kazakhstan", "code": "KZ"},
540
{"name": "Kenya", "code": "KE"},
541
{"name": "Kiribati", "code": "KI"},
542
{"name": "Korea, Democratic People\'S Republic of", "code": "KP"},
543
{"name": "Korea, Republic of", "code": "KR"},
544
{"name": "Kuwait", "code": "KW"},
545
{"name": "Kyrgyzstan", "code": "KG"},
546
{"name": "Lao People\'S Democratic Republic", "code": "LA"},
547
{"name": "Latvia", "code": "LV"},
548
{"name": "Lebanon", "code": "LB"},
549
{"name": "Lesotho", "code": "LS"},
550
{"name": "Liberia", "code": "LR"},
551
{"name": "Libyan Arab Jamahiriya", "code": "LY"},
552
{"name": "Liechtenstein", "code": "LI"},
553
{"name": "Lithuania", "code": "LT"},
554
{"name": "Luxembourg", "code": "LU"},
555
{"name": "Macao", "code": "MO"},
556
{"name": "Macedonia, The Former Yugoslav Republic of", "code": "MK"},
557
{"name": "Madagascar", "code": "MG"},
558
{"name": "Malawi", "code": "MW"},
559
{"name": "Malaysia", "code": "MY"},
560
{"name": "Maldives", "code": "MV"},
561
{"name": "Mali", "code": "ML"},
562
{"name": "Malta", "code": "MT"},
563
{"name": "Marshall Islands", "code": "MH"},
564
{"name": "Martinique", "code": "MQ"},
565
{"name": "Mauritania", "code": "MR"},
566
{"name": "Mauritius", "code": "MU"},
567
{"name": "Mayotte", "code": "YT"},
568
{"name": "Mexico", "code": "MX"},
569
{"name": "Micronesia, Federated States of", "code": "FM"},
570
{"name": "Moldova, Republic of", "code": "MD"},
571
{"name": "Monaco", "code": "MC"},
572
{"name": "Mongolia", "code": "MN"},
573
{"name": "Montserrat", "code": "MS"},
574
{"name": "Morocco", "code": "MA"},
575
{"name": "Mozambique", "code": "MZ"},
576
{"name": "Myanmar", "code": "MM"},
577
{"name": "Namibia", "code": "NA"},
578
{"name": "Nauru", "code": "NR"},
579
{"name": "Nepal", "code": "NP"},
580
{"name": "Netherlands", "code": "NL"},
581
{"name": "Netherlands Antilles", "code": "AN"},
582
{"name": "New Caledonia", "code": "NC"},
583
{"name": "New Zealand", "code": "NZ"},
584
{"name": "Nicaragua", "code": "NI"},
585
{"name": "Niger", "code": "NE"},
586
{"name": "Nigeria", "code": "NG"},
587
{"name": "Niue", "code": "NU"},
588
{"name": "Norfolk Island", "code": "NF"},
589
{"name": "Northern Mariana Islands", "code": "MP"},
590
{"name": "Norway", "code": "NO"},
591
{"name": "Oman", "code": "OM"},
592
{"name": "Pakistan", "code": "PK"},
593
{"name": "Palau", "code": "PW"},
594
{"name": "Palestinian Territory, Occupied", "code": "PS"},
595
{"name": "Panama", "code": "PA"},
596
{"name": "Papua New Guinea", "code": "PG"},
597
{"name": "Paraguay", "code": "PY"},
598
{"name": "Peru", "code": "PE"},
599
{"name": "Philippines", "code": "PH"},
600
{"name": "Pitcairn", "code": "PN"},
601
{"name": "Poland", "code": "PL"},
602
{"name": "Portugal", "code": "PT"},
603
{"name": "Puerto Rico", "code": "PR"},
604
{"name": "Qatar", "code": "QA"},
605
{"name": "Reunion", "code": "RE"},
606
{"name": "Romania", "code": "RO"},
607
{"name": "Russian Federation", "code": "RU"},
608
{"name": "RWANDA", "code": "RW"},
609
{"name": "Saint Helena", "code": "SH"},
610
{"name": "Saint Kitts and Nevis", "code": "KN"},
611
{"name": "Saint Lucia", "code": "LC"},
612
{"name": "Saint Pierre and Miquelon", "code": "PM"},
613
{"name": "Saint Vincent and the Grenadines", "code": "VC"},
614
{"name": "Samoa", "code": "WS"},
615
{"name": "San Marino", "code": "SM"},
616
{"name": "Sao Tome and Principe", "code": "ST"},
617
{"name": "Saudi Arabia", "code": "SA"},
618
{"name": "Senegal", "code": "SN"},
619
{"name": "Serbia and Montenegro", "code": "CS"},
620
{"name": "Seychelles", "code": "SC"},
621
{"name": "Sierra Leone", "code": "SL"},
622
{"name": "Singapore", "code": "SG"},
623
{"name": "Slovakia", "code": "SK"},
624
{"name": "Slovenia", "code": "SI"},
625
{"name": "Solomon Islands", "code": "SB"},
626
{"name": "Somalia", "code": "SO"},
627
{"name": "South Africa", "code": "ZA"},
628
{"name": "South Georgia and the South Sandwich Islands", "code": "GS"},
629
{"name": "Spain", "code": "ES"},
630
{"name": "Sri Lanka", "code": "LK"},
631
{"name": "Sudan", "code": "SD"},
632
{"name": "Suriname", "code": "SR"},
633
{"name": "Svalbard and Jan Mayen", "code": "SJ"},
634
{"name": "Swaziland", "code": "SZ"},
635
{"name": "Sweden", "code": "SE"},
636
{"name": "Switzerland", "code": "CH"},
637
{"name": "Syrian Arab Republic", "code": "SY"},
638
{"name": "Taiwan, Province of China", "code": "TW"},
639
{"name": "Tajikistan", "code": "TJ"},
640
{"name": "Tanzania, United Republic of", "code": "TZ"},
641
{"name": "Thailand", "code": "TH"},
642
{"name": "Timor-Leste", "code": "TL"},
643
{"name": "Togo", "code": "TG"},
644
{"name": "Tokelau", "code": "TK"},
645
{"name": "Tonga", "code": "TO"},
646
{"name": "Trinidad and Tobago", "code": "TT"},
647
{"name": "Tunisia", "code": "TN"},
648
{"name": "Turkey", "code": "TR"},
649
{"name": "Turkmenistan", "code": "TM"},
650
{"name": "Turks and Caicos Islands", "code": "TC"},
651
{"name": "Tuvalu", "code": "TV"},
652
{"name": "Uganda", "code": "UG"},
653
{"name": "Ukraine", "code": "UA"},
654
{"name": "United Arab Emirates", "code": "AE"},
655
{"name": "United Kingdom", "code": "GB"},
656
{"name": "United States", "code": "US"},
657
{"name": "United States Minor Outlying Islands", "code": "UM"},
658
{"name": "Uruguay", "code": "UY"},
659
{"name": "Uzbekistan", "code": "UZ"},
660
{"name": "Vanuatu", "code": "VU"},
661
{"name": "Venezuela", "code": "VE"},
662
{"name": "Viet Nam", "code": "VN"},
663
{"name": "Virgin Islands, British", "code": "VG"},
664
{"name": "Virgin Islands, U.S.", "code": "VI"},
665
{"name": "Wallis and Futuna", "code": "WF"},
666
{"name": "Western Sahara", "code": "EH"},
667
{"name": "Yemen", "code": "YE"},
668
{"name": "Zambia", "code": "ZM"},
669
{"name": "Zimbabwe", "code": "ZW"}
670
];
671
let timeTag = new Date().getTime();
672
document.getElementById("ajaxDemoLink").setAttribute('href','ajaxDemo.html?v='+timeTag);
673
let selectCountries = document.getElementById("allCountries");
674
for (var i = 0;i < allCountries.length;i++) {
675
    var option = document.createElement("option");
676
    option.value = allCountries[i].code;
677
    option.text = allCountries[i].name;
678
    selectCountries.appendChild(option);
679
}
680
let selectBox4 = new vanillaSelectBox("#allCountries", { "maxHeight": 200, "search": true,"stayOpen":true,translations: { "all": "All", "items": "Countries" } });
681
let selecDino = new vanillaSelectBox("#dino-select",{ "maxHeight": 200, translations: { "all": "All", "items": "Dinos" } });
682
        </script>
683
</html>
(4-4/9)