Skip to content

Instantly share code, notes, and snippets.

Created January 28, 2016 17:55
Show Gist options
  • Save anonymous/bb939bf7da816bebb33e to your computer and use it in GitHub Desktop.
Save anonymous/bb939bf7da816bebb33e to your computer and use it in GitHub Desktop.
Around The World Aaron's version // source http://jsbin.com/dukawo
<html>
<head>
<title> Around The World Aaron's version </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<style id="jsbin-css">
body {
margin-top: 4em;
font-family: "Courier New", Courier, monospace;
}
.media-object {
width: 220px;
}
.media {
display: none;
}
.mention {
color: gray;
font-size: 11pt;
text-align: center;
margin-top: 7px;
margin-bottom: 4em;
}
h1 {
text-transform: capitalize;
text-align: center;
color: Red;
}
</style>
</head>
<body>
<div class="container">
<h1>Around The World</h1>
<hr><br />
<div class="row" id="search-bar">
<div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
<input type="text" class="form-control input-lg " id="country" placeholder="Search For Country">
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2">
<button type="button" class="btn btn-info btn-lg">
<span class="glyphicon glyphicon-search" aria-hidden="true">
</span>
</button>
</div>
<div class="col-xs-11 col-sm-11 col-md-11 col-lg-11 mention"></div>
<div class="col-xs-11 col-sm-11 col-md-11 col-lg-11">
<div class="media">
<div class="media-left media-middle">
<a href="#">
<img class="media-object flag" src="..." />
</a>
</div>
<div class="media-body">
<h4 class="media-heading">Media Heading</h4>
<table class="table table-striped">
<tbody>
<tr>
<td class="animalName">Animal Name</td>
</tr><tr>
<td class="population">Population</td>
</tr><tr>
<td class="capital">Capital</td>
</tr><tr>
<td class="language">Language</td>
</tr>
</tbody>
</table>
</div>
<div class="media-right media-middle">
<a href="#">
<img class="media-object animal" src="..." alt="...">
</a>
</div>
</div>
</div>
</div>
<body>
</html>
<script id="jsbin-javascript">
// DATA MODEL
var country = ["Aruba", "Bahamas", "Dominican Republic", "Jamaica", "Japan", "United Kingdom", "USA"];
var details = {
aruba: {
name: "Aruba",
population: "101,000",
capital: "Oranjestad",
"national animal": "Shoco (burrowing Owl)",
language: [
"Dutch", "English", "Portuguese", "Papiamento"
],
images: {
flag: "http://www.kingdommovement.nl/opmaak/Flag_of_Aruba.png",
animal: "https://repeatingislands.files.wordpress.com/2011/03/shocolarge.jpg?w=500",
images: [
"http://rickyleepotts.com/wp-content/uploads/2012/03/four-seasons-bora-bora.jpg",
"http://www.wanderingfools.com/images/travel/aruba/sights2.jpg",
"http://cdn1.projectwedding.com/1375587884_84f9521415a7711f24336695eb97fd1a_m"
]
}
},
bahamas: {
name: "Bahamas",
population: "354,000",
capital: " Nassau on the Island New Providence",
"national animal": "Flamingo",
language: [
"English", "Creole"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/bahamas-flag-49-p.jpg",
animal: "http://library.sandiegozoo.org/factsheets/caribbean_flamingo/images/flamingo.jpg",
images: [
"http://www.coldwellbankerislands.com/seo/islands/bah3.jpg",
"http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/eb/nassau.jpg",
"http://app.frommers.com/system/photos/photos500/0253-64159.jpg"
]
}
},
"dominican republic": {
name: "Dominican Republic (República Dominicana)",
population: "9,400,000",
capital: "Santo Domingo",
"national animal": "Palm Chat",
language: [
"Spanish"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/dominican-republic-flag-90-p.gif",
animal: "http://www.1000birds.com/images/Palm-ChatC17087.jpg",
images: [
"http://www.planetware.com/photos-large/DOM/dominican-republic-santo-domingo.jpg",
"http://www.holidaycheck.com//data/urlaubsbilder/images/5/1157119636.jpg",
"http://www.goseewrite.com/wp-content/uploads/2012/11/costa_del_coco_punta_cana.jpeg"
]
}
},
jamaica: {
name: "Jamaica",
population: "2,700,000",
capital: "Kingston",
"national animal": "Jamaican Mango Humming Bird",
language: [
"Patois", "English"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/jamaica-flag-3ft-x-2ft-3858-p.png",
animal: "http://farm5.static.flickr.com/4093/4881305474_694e891270.jpg",
images: [
"http://www.planetware.com/photos-large/JAM/jamaica-negril-negril-beach.jpg",
"http://www.visitjamaica.com/Media/Default/Things%20To%20Do/00_0_Things_to_do_Active-&-Relaxing_OffthebeatenPath_Feature.jpg",
"http://mostbeautifulplaces.org/wp-content/uploads/Wonderful-Montego-Bay-Beach.jpg"
]
}
},
japan: {
name: "Japan (Nippon-koku)",
population: "128,000,000",
capital: "Tokyo",
"national animal": "Koi (Green pheasant)",
language: [
"Japanese"
],
images: {
flag: "http://www.mapsofworld.com/images/world-countries-flags/japan-flag.gif",
animal: "https://illostrophy.files.wordpress.com/2012/09/09-japanese-or-green-pheasant.jpg",
images: [
"http://static.au.groupon-content.net/59/46/1367454254659.jpg",
"http://m5.paperblog.com/i/22/222122/5-incredible-train-routes-for-sightseeing-L-OngTK0.jpeg",
"http://www.metchamatcha.at/wp-content/uploads/2015/05/japanese-traditional-dress.jpg"
]
}
},
"united kingdom": {
name: "United Kingdom (of Great Britain and Northern Ireland)",
population: "62,000,000",
capital: "London",
"national animal": "Lion",
language: [
"English", "Welsh", "Irish Gaelic", "Scottish Gaelic"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/first-union-jack-flag-1606-1801-472-p.jpg",
animal: "http://cdn.animals-zone.com/wp-content/uploads/2012/10/Lion-Great-Britan-National-Animal.jpg",
images: [
"http://www.best-of-european-union.eu/wp-content/uploads/2011/04/top-sights-to-see-in-london-united-kongdom.jpg",
"http://www.traveller.com.au/content/dam/images/1/2/q/n/5/e/image.related.articleLeadwide.620x349.12wz2i.png/1421989912320.jpg",
"https://www.visitbritainshop.com/world/~/media/images/articles/top%2010%20english%20tourist%20destinations/pi-top-10-english-tourist-d.ashx?h=377&w=670"
]
}
},
usa: {
name: "United States of America",
population: "313,478,000",
capital: "Washington D.C. (D.C. -> District of Columbia) ",
"national animal": "Bald Eagle",
language: [
"English", "Spanish", "Indo-European", "Asian and Pacific Island"
],
images: {
flag: "http://www.webweaver.nu/clipart/img/misc/usa/american-flag.gif",
animal: "http://www.nearfamous.com/Images/NearFamousWebImagesOptimized/BaldEagles/3469-13BaldEaglePerched.jpg",
images: [
"http://www.chansworld.com.my/wp-content/uploads/2014/11/Hollywood_Sign.jpg",
"http://usercontent2.hubimg.com/12099259_f520.jpg",
"http://resources.touropia.com/gfx/d/famous-official-residences/white_house.jpg"
]
}
}
};
// GLOBAL
var info = {};
// CONTROLLER
function getCountry(name){
return details[name];
}
function getAllCountries(){
var c = "";
for(var i = 0; i < country.length; i++) {
c += country[i] + ", ";
}
return c.slice(0,-2);
}
function getAllLanguages(){
var langString = "Spoken Language: ", len = info.language.length;
if(len > 1) {
langString = "(" + len + ") Spoken Langauges: ";
}
for(var i = 0; i < info.language.length; i++) {
langString += info.language[i] + ", ";
}
return langString.slice(0,-2);
}
function updateUI(){
// flag
$(".flag").attr("src", info.images.flag);
// animal
$(".animal").attr("src", info.images.animal);
$(".animal").attr("alt", info["national animal"]);
// media list
$(".media-heading").text(info.name);
$(".animalName").html(info["national animal"]);
$(".population").html("Population: " + info.population + " people");
$(".capital").html("Capital: " + info.capital);
$(".language").html( getAllLanguages() );
// snazzy ui
$(".media").show();
$(".glyphicon").removeClass('glyphicon-search').addClass('glyphicon-repeat');
}
function search() {
var searchString = $("#country").val();
if (searchString === "" || searchString.length < 2 ) {
alert("Nothing to search for!? Please try again!");
return;
}
info = getCountry(searchString.toLowerCase());
updateUI();
}
$(document).ready(function(){
$(".mention").text("ex. " + getAllCountries() );
// MIGHT BE ANNOYING DURING DEV - COMMENT FOCUS LINE OUT
$('#country').focus();
$('#country').keypress(function(e) {
var key = e.which;
// the enter key code
if (key === 13) {
search();
}
});
$("button").click(function(){
search();
});
});
</script>
<script id="jsbin-source-css" type="text/css">body {
margin-top: 4em;
font-family: "Courier New", Courier, monospace;
}
.media-object {
width: 220px;
}
.media {
display: none;
}
.mention {
color: gray;
font-size: 11pt;
text-align: center;
margin-top: 7px;
margin-bottom: 4em;
}
h1 {
text-transform: capitalize;
text-align: center;
color: Red;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">// DATA MODEL
var country = ["Aruba", "Bahamas", "Dominican Republic", "Jamaica", "Japan", "United Kingdom", "USA"];
var details = {
aruba: {
name: "Aruba",
population: "101,000",
capital: "Oranjestad",
"national animal": "Shoco (burrowing Owl)",
language: [
"Dutch", "English", "Portuguese", "Papiamento"
],
images: {
flag: "http://www.kingdommovement.nl/opmaak/Flag_of_Aruba.png",
animal: "https://repeatingislands.files.wordpress.com/2011/03/shocolarge.jpg?w=500",
images: [
"http://rickyleepotts.com/wp-content/uploads/2012/03/four-seasons-bora-bora.jpg",
"http://www.wanderingfools.com/images/travel/aruba/sights2.jpg",
"http://cdn1.projectwedding.com/1375587884_84f9521415a7711f24336695eb97fd1a_m"
]
}
},
bahamas: {
name: "Bahamas",
population: "354,000",
capital: " Nassau on the Island New Providence",
"national animal": "Flamingo",
language: [
"English", "Creole"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/bahamas-flag-49-p.jpg",
animal: "http://library.sandiegozoo.org/factsheets/caribbean_flamingo/images/flamingo.jpg",
images: [
"http://www.coldwellbankerislands.com/seo/islands/bah3.jpg",
"http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/eb/nassau.jpg",
"http://app.frommers.com/system/photos/photos500/0253-64159.jpg"
]
}
},
"dominican republic": {
name: "Dominican Republic (República Dominicana)",
population: "9,400,000",
capital: "Santo Domingo",
"national animal": "Palm Chat",
language: [
"Spanish"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/dominican-republic-flag-90-p.gif",
animal: "http://www.1000birds.com/images/Palm-ChatC17087.jpg",
images: [
"http://www.planetware.com/photos-large/DOM/dominican-republic-santo-domingo.jpg",
"http://www.holidaycheck.com//data/urlaubsbilder/images/5/1157119636.jpg",
"http://www.goseewrite.com/wp-content/uploads/2012/11/costa_del_coco_punta_cana.jpeg"
]
}
},
jamaica: {
name: "Jamaica",
population: "2,700,000",
capital: "Kingston",
"national animal": "Jamaican Mango Humming Bird",
language: [
"Patois", "English"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/jamaica-flag-3ft-x-2ft-3858-p.png",
animal: "http://farm5.static.flickr.com/4093/4881305474_694e891270.jpg",
images: [
"http://www.planetware.com/photos-large/JAM/jamaica-negril-negril-beach.jpg",
"http://www.visitjamaica.com/Media/Default/Things%20To%20Do/00_0_Things_to_do_Active-&-Relaxing_OffthebeatenPath_Feature.jpg",
"http://mostbeautifulplaces.org/wp-content/uploads/Wonderful-Montego-Bay-Beach.jpg"
]
}
},
japan: {
name: "Japan (Nippon-koku)",
population: "128,000,000",
capital: "Tokyo",
"national animal": "Koi (Green pheasant)",
language: [
"Japanese"
],
images: {
flag: "http://www.mapsofworld.com/images/world-countries-flags/japan-flag.gif",
animal: "https://illostrophy.files.wordpress.com/2012/09/09-japanese-or-green-pheasant.jpg",
images: [
"http://static.au.groupon-content.net/59/46/1367454254659.jpg",
"http://m5.paperblog.com/i/22/222122/5-incredible-train-routes-for-sightseeing-L-OngTK0.jpeg",
"http://www.metchamatcha.at/wp-content/uploads/2015/05/japanese-traditional-dress.jpg"
]
}
},
"united kingdom": {
name: "United Kingdom (of Great Britain and Northern Ireland)",
population: "62,000,000",
capital: "London",
"national animal": "Lion",
language: [
"English", "Welsh", "Irish Gaelic", "Scottish Gaelic"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/first-union-jack-flag-1606-1801-472-p.jpg",
animal: "http://cdn.animals-zone.com/wp-content/uploads/2012/10/Lion-Great-Britan-National-Animal.jpg",
images: [
"http://www.best-of-european-union.eu/wp-content/uploads/2011/04/top-sights-to-see-in-london-united-kongdom.jpg",
"http://www.traveller.com.au/content/dam/images/1/2/q/n/5/e/image.related.articleLeadwide.620x349.12wz2i.png/1421989912320.jpg",
"https://www.visitbritainshop.com/world/~/media/images/articles/top%2010%20english%20tourist%20destinations/pi-top-10-english-tourist-d.ashx?h=377&w=670"
]
}
},
usa: {
name: "United States of America",
population: "313,478,000",
capital: "Washington D.C. (D.C. -> District of Columbia) ",
"national animal": "Bald Eagle",
language: [
"English", "Spanish", "Indo-European", "Asian and Pacific Island"
],
images: {
flag: "http://www.webweaver.nu/clipart/img/misc/usa/american-flag.gif",
animal: "http://www.nearfamous.com/Images/NearFamousWebImagesOptimized/BaldEagles/3469-13BaldEaglePerched.jpg",
images: [
"http://www.chansworld.com.my/wp-content/uploads/2014/11/Hollywood_Sign.jpg",
"http://usercontent2.hubimg.com/12099259_f520.jpg",
"http://resources.touropia.com/gfx/d/famous-official-residences/white_house.jpg"
]
}
}
};
// GLOBAL
var info = {};
// CONTROLLER
function getCountry(name){
return details[name];
}
function getAllCountries(){
var c = "";
for(var i = 0; i < country.length; i++) {
c += country[i] + ", ";
}
return c.slice(0,-2);
}
function getAllLanguages(){
var langString = "Spoken Language: ", len = info.language.length;
if(len > 1) {
langString = "(" + len + ") Spoken Langauges: ";
}
for(var i = 0; i < info.language.length; i++) {
langString += info.language[i] + ", ";
}
return langString.slice(0,-2);
}
function updateUI(){
// flag
$(".flag").attr("src", info.images.flag);
// animal
$(".animal").attr("src", info.images.animal);
$(".animal").attr("alt", info["national animal"]);
// media list
$(".media-heading").text(info.name);
$(".animalName").html(info["national animal"]);
$(".population").html("Population: " + info.population + " people");
$(".capital").html("Capital: " + info.capital);
$(".language").html( getAllLanguages() );
// snazzy ui
$(".media").show();
$(".glyphicon").removeClass('glyphicon-search').addClass('glyphicon-repeat');
}
function search() {
var searchString = $("#country").val();
if (searchString === "" || searchString.length < 2 ) {
alert("Nothing to search for!? Please try again!");
return;
}
info = getCountry(searchString.toLowerCase());
updateUI();
}
$(document).ready(function(){
$(".mention").text("ex. " + getAllCountries() );
// MIGHT BE ANNOYING DURING DEV - COMMENT FOCUS LINE OUT
$('#country').focus();
$('#country').keypress(function(e) {
var key = e.which;
// the enter key code
if (key === 13) {
search();
}
});
$("button").click(function(){
search();
});
});
</script>
body {
margin-top: 4em;
font-family: "Courier New", Courier, monospace;
}
.media-object {
width: 220px;
}
.media {
display: none;
}
.mention {
color: gray;
font-size: 11pt;
text-align: center;
margin-top: 7px;
margin-bottom: 4em;
}
h1 {
text-transform: capitalize;
text-align: center;
color: Red;
}
// DATA MODEL
var country = ["Aruba", "Bahamas", "Dominican Republic", "Jamaica", "Japan", "United Kingdom", "USA"];
var details = {
aruba: {
name: "Aruba",
population: "101,000",
capital: "Oranjestad",
"national animal": "Shoco (burrowing Owl)",
language: [
"Dutch", "English", "Portuguese", "Papiamento"
],
images: {
flag: "http://www.kingdommovement.nl/opmaak/Flag_of_Aruba.png",
animal: "https://repeatingislands.files.wordpress.com/2011/03/shocolarge.jpg?w=500",
images: [
"http://rickyleepotts.com/wp-content/uploads/2012/03/four-seasons-bora-bora.jpg",
"http://www.wanderingfools.com/images/travel/aruba/sights2.jpg",
"http://cdn1.projectwedding.com/1375587884_84f9521415a7711f24336695eb97fd1a_m"
]
}
},
bahamas: {
name: "Bahamas",
population: "354,000",
capital: " Nassau on the Island New Providence",
"national animal": "Flamingo",
language: [
"English", "Creole"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/bahamas-flag-49-p.jpg",
animal: "http://library.sandiegozoo.org/factsheets/caribbean_flamingo/images/flamingo.jpg",
images: [
"http://www.coldwellbankerislands.com/seo/islands/bah3.jpg",
"http://media-cdn.tripadvisor.com/media/photo-s/03/9b/2f/eb/nassau.jpg",
"http://app.frommers.com/system/photos/photos500/0253-64159.jpg"
]
}
},
"dominican republic": {
name: "Dominican Republic (República Dominicana)",
population: "9,400,000",
capital: "Santo Domingo",
"national animal": "Palm Chat",
language: [
"Spanish"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/dominican-republic-flag-90-p.gif",
animal: "http://www.1000birds.com/images/Palm-ChatC17087.jpg",
images: [
"http://www.planetware.com/photos-large/DOM/dominican-republic-santo-domingo.jpg",
"http://www.holidaycheck.com//data/urlaubsbilder/images/5/1157119636.jpg",
"http://www.goseewrite.com/wp-content/uploads/2012/11/costa_del_coco_punta_cana.jpeg"
]
}
},
jamaica: {
name: "Jamaica",
population: "2,700,000",
capital: "Kingston",
"national animal": "Jamaican Mango Humming Bird",
language: [
"Patois", "English"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/jamaica-flag-3ft-x-2ft-3858-p.png",
animal: "http://farm5.static.flickr.com/4093/4881305474_694e891270.jpg",
images: [
"http://www.planetware.com/photos-large/JAM/jamaica-negril-negril-beach.jpg",
"http://www.visitjamaica.com/Media/Default/Things%20To%20Do/00_0_Things_to_do_Active-&-Relaxing_OffthebeatenPath_Feature.jpg",
"http://mostbeautifulplaces.org/wp-content/uploads/Wonderful-Montego-Bay-Beach.jpg"
]
}
},
japan: {
name: "Japan (Nippon-koku)",
population: "128,000,000",
capital: "Tokyo",
"national animal": "Koi (Green pheasant)",
language: [
"Japanese"
],
images: {
flag: "http://www.mapsofworld.com/images/world-countries-flags/japan-flag.gif",
animal: "https://illostrophy.files.wordpress.com/2012/09/09-japanese-or-green-pheasant.jpg",
images: [
"http://static.au.groupon-content.net/59/46/1367454254659.jpg",
"http://m5.paperblog.com/i/22/222122/5-incredible-train-routes-for-sightseeing-L-OngTK0.jpeg",
"http://www.metchamatcha.at/wp-content/uploads/2015/05/japanese-traditional-dress.jpg"
]
}
},
"united kingdom": {
name: "United Kingdom (of Great Britain and Northern Ireland)",
population: "62,000,000",
capital: "London",
"national animal": "Lion",
language: [
"English", "Welsh", "Irish Gaelic", "Scottish Gaelic"
],
images: {
flag: "http://www.theflagshop.co.uk/ekmps/shops/speed/images/first-union-jack-flag-1606-1801-472-p.jpg",
animal: "http://cdn.animals-zone.com/wp-content/uploads/2012/10/Lion-Great-Britan-National-Animal.jpg",
images: [
"http://www.best-of-european-union.eu/wp-content/uploads/2011/04/top-sights-to-see-in-london-united-kongdom.jpg",
"http://www.traveller.com.au/content/dam/images/1/2/q/n/5/e/image.related.articleLeadwide.620x349.12wz2i.png/1421989912320.jpg",
"https://www.visitbritainshop.com/world/~/media/images/articles/top%2010%20english%20tourist%20destinations/pi-top-10-english-tourist-d.ashx?h=377&w=670"
]
}
},
usa: {
name: "United States of America",
population: "313,478,000",
capital: "Washington D.C. (D.C. -> District of Columbia) ",
"national animal": "Bald Eagle",
language: [
"English", "Spanish", "Indo-European", "Asian and Pacific Island"
],
images: {
flag: "http://www.webweaver.nu/clipart/img/misc/usa/american-flag.gif",
animal: "http://www.nearfamous.com/Images/NearFamousWebImagesOptimized/BaldEagles/3469-13BaldEaglePerched.jpg",
images: [
"http://www.chansworld.com.my/wp-content/uploads/2014/11/Hollywood_Sign.jpg",
"http://usercontent2.hubimg.com/12099259_f520.jpg",
"http://resources.touropia.com/gfx/d/famous-official-residences/white_house.jpg"
]
}
}
};
// GLOBAL
var info = {};
// CONTROLLER
function getCountry(name){
return details[name];
}
function getAllCountries(){
var c = "";
for(var i = 0; i < country.length; i++) {
c += country[i] + ", ";
}
return c.slice(0,-2);
}
function getAllLanguages(){
var langString = "Spoken Language: ", len = info.language.length;
if(len > 1) {
langString = "(" + len + ") Spoken Langauges: ";
}
for(var i = 0; i < info.language.length; i++) {
langString += info.language[i] + ", ";
}
return langString.slice(0,-2);
}
function updateUI(){
// flag
$(".flag").attr("src", info.images.flag);
// animal
$(".animal").attr("src", info.images.animal);
$(".animal").attr("alt", info["national animal"]);
// media list
$(".media-heading").text(info.name);
$(".animalName").html(info["national animal"]);
$(".population").html("Population: " + info.population + " people");
$(".capital").html("Capital: " + info.capital);
$(".language").html( getAllLanguages() );
// snazzy ui
$(".media").show();
$(".glyphicon").removeClass('glyphicon-search').addClass('glyphicon-repeat');
}
function search() {
var searchString = $("#country").val();
if (searchString === "" || searchString.length < 2 ) {
alert("Nothing to search for!? Please try again!");
return;
}
info = getCountry(searchString.toLowerCase());
updateUI();
}
$(document).ready(function(){
$(".mention").text("ex. " + getAllCountries() );
// MIGHT BE ANNOYING DURING DEV - COMMENT FOCUS LINE OUT
$('#country').focus();
$('#country').keypress(function(e) {
var key = e.which;
// the enter key code
if (key === 13) {
search();
}
});
$("button").click(function(){
search();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment