Skip to content

Commit

Permalink
Replaced font awesome with dedicated SVG for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
brendan-ward committed Aug 29, 2016
1 parent 8e5dee8 commit 8ba64f0
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 20 deletions.
34 changes: 28 additions & 6 deletions L.Control.Geonames.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
background-color: #FFF;
}
.leaflet-geonames-search a{
font-size: 18px;
border-radius: 4px;
display: inline-block;
float:right;
}
.leaflet-geonames-search a {
background: none !important;
background-color: transparent !important;
border: none !important;
}
.leaflet-geonames-search form {
Expand Down Expand Up @@ -39,10 +38,6 @@
.leaflet-geonames-search input:focus {
outline: 0;
}
.leaflet-geonames-search.active a {
border-radius: 0 4px 4px 0;
border-bottom-color: #FFF;
}
.leaflet-geonames-search.active input {
display: inline-block;
}
Expand All @@ -53,4 +48,31 @@
.leaflet-geonames-search ul.noResults {
color: #999;
font-style: italic;
}
.leaflet-geonames-icon {
background: url(ic_directions_black_24px.svg) no-repeat center center;
background-size: 24px 24px;
background-color: transparent;
}
.leaflet-geonames-icon-working {
background-image: url(ic_cached_black_24px.svg);
animation: spin 2s infinite linear;
}
@-webkit-keyframes spin{
0%{
-webkit-transform:rotate(0deg);
transform:rotate(0deg)
}
100%{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)}
}
@keyframes spin{
0%{
-webkit-transform:rotate(0deg);
transform:rotate(0deg)
}
100%{
-webkit-transform:rotate(359deg);
transform:rotate(359deg)}
}
4 changes: 2 additions & 2 deletions L.Control.Geonames.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ L.Control.Geonames = L.Control.extend({
username: '', //Geonames account username. Must be provided
maxresults: 5, //Maximum number of results to display per search
zoomLevel: null, //Max zoom level to zoom to for location. If null, will use the map's max zoom level.
className: 'fa fa-search', //class for icon
workingClass: 'fa-spin', //class for search underway
className: 'leaflet-geonames-icon', //class for icon
workingClass: 'leaflet-geonames-icon-working', //class for search underway
featureClasses: ['A', 'H', 'L', 'P', 'R', 'T', 'U', 'V'], //feature classes to search against. See: http://www.geonames.org/export/codes.html
baseQuery: 'isNameRequired=true', //The core query sent to GeoNames, later combined with other parameters above
position: 'topleft',
Expand Down
2 changes: 1 addition & 1 deletion L.Control.Geonames.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ Include the CSS:
<link rel="stylesheet" href="L.Control.Geonames.css" />
```

This control uses [Font Awesome](http://fontawesome.io/) for the icon by default. To use, include:

```
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" />
```
This control uses [Google Material Icons](https://design.google.com/icons) by default.


Include the JavaScript:
Expand All @@ -54,8 +50,8 @@ var control = L.control.geonames({
username: '', // Geonames account username. Must be provided
zoomLevel: null, // Max zoom level to zoom to for location. If null, will use the map's max zoom level.
maxresults: 5, // Maximum number of results to display per search
className: 'fa fa-crosshairs', // class for icon
workingClass: 'fa-spin', // class for search underway
className: 'leaflet-geonames-icon', //class for icon
workingClass: 'leaflet-geonames-icon-working', //class for search underway
featureClasses: ['A', 'H', 'L', 'P', 'R', 'T', 'U', 'V'], // feature classes to search against. See: http://www.geonames.org/export/codes.html
baseQuery: 'isNameRequired=true', // The core query sent to GeoNames, later combined with other parameters above
position: 'topleft',
Expand Down
1 change: 0 additions & 1 deletion examples/adminCodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Leaflet Geonames Search Control</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.3/leaflet.css"/>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="../L.Control.Geonames.css"/>
<style>
#Nav li {
Expand Down
1 change: 0 additions & 1 deletion examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Leaflet Geonames Search Control</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.3/leaflet.css" />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="../L.Control.Geonames.css" />
<style>
#Nav li {
Expand Down
1 change: 0 additions & 1 deletion examples/bbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Leaflet Geonames Search Control</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.3/leaflet.css"/>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="../L.Control.Geonames.css"/>
<style>
#Nav li {
Expand Down
1 change: 0 additions & 1 deletion examples/locale.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Leaflet Geonames Search Control</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.3/leaflet.css"/>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="../L.Control.Geonames.css"/>
<style>
#Nav li {
Expand Down
4 changes: 4 additions & 0 deletions ic_cached_black_24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions ic_directions_black_24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8ba64f0

Please sign in to comment.