Skip to content

Commit

Permalink
leaflet-hash added
Browse files Browse the repository at this point in the history
some more cities and countries added
  • Loading branch information
ricki-z committed Jul 18, 2017
1 parent ff70028 commit 4396cfa
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/webpack.base.conf.js
Expand Up @@ -21,7 +21,7 @@ module.exports = {
{ test: /\.js$/, loader: 'babel', include: projectRoot, exclude: /node_modules\/(?!buntpapier)/ },
{ test: /\.json$/, loader: 'json' },
{ test: /\.html$/, loader: 'vue-html' },
{test: /\.svg(\?.*)?/, loader: 'svg-url',
{ test: /\.svg(\?.*)?/, loader: 'svg-url',
query: {
noquotes: true,
limit: 10000,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -63,17 +63,18 @@
"vue-style-loader": "^1.0.0",
"vue-template-compiler": "2.1.x",
"webpack": "2.1.0-beta.22",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-middleware": "1.6.1",
"webpack-hot-middleware": "^2.10.0",
"webpack-merge": "^0.14.1",
"webpack-stream": "^3.2.0"
},
"dependencies": {
"buntpapier": "^0.9.0",
"d3": "^3.5.16",
"d3": "^3.5.17",
"d3-hexbin": "^0.2.0",
"d3-tip": "^0.6.7",
"leaflet": ">=1.0.0-rc.1",
"leaflet-hash": "^0.2.1",
"lodash": "^4.11.1",
"promise-polyfill": "^6.0.2",
"vue": "2.1.x",
Expand Down
5 changes: 5 additions & 0 deletions src/countries.txt
Expand Up @@ -7,18 +7,23 @@
// Europe BE Belgium
// Europe BG Bulgaria
// Asia BN Brunei
// America CA Canada
// Europe CH Suisse
// America CL Chile
// Africa CM Cameroon
// Europe CZ Czech Republic
// Europe DE Germany
// * Europe DK Denmark
// America DO Dominican Republic
// Europe ES Spain
// Europe FI Finland
// Europe FR France
// Europe GR Greece
// Europe HR Croatia
// Europe HU Hungary
// * Europe IE Ireland
// Europe IT Italy
// Europe LU Luxembourg
// Europe NL Netherlands
// Asia NP Nepal
// Europe PL Poland
Expand Down
5 changes: 5 additions & 0 deletions src/main.js
Expand Up @@ -30,13 +30,18 @@ window.onpopstate = function(event) {
if (query.center) {
const center = query.center.split(',').map((coord) => parseFloat(coord))
config.center = center
} else if (location.hash) {
var hash_params = location.hash.split("/");
config.center = [hash_params[1],hash_params[2]];
config.zoom = hash_params[0].substring(1);
} else {
var hostname = location.hostname;
var hostname_parts = hostname.split(".");
if (hostname_parts.length = 4) {
var place = hostname_parts[0].toLowerCase();
if (typeof places[place] !== 'undefined' && places[place] !== null) {
config.center = places[place];
config.zoom = 11;
}
if (typeof zooms[place] !== 'undefined' && zooms[place] !== null) {
config.zoom = zooms[place];
Expand Down
21 changes: 21 additions & 0 deletions src/places.js
Expand Up @@ -257,6 +257,9 @@ module.exports = {
"kardzhali": [41.65,25.3667],
"dimitrovgrad": [42.05,25.6],

// Croatia
"croatia": [45.166667,15.5],

// Czech Republic
"czech-republic": [49.8,15.5],
"prague": [50.0833,14.4167],
Expand Down Expand Up @@ -297,6 +300,9 @@ module.exports = {
"bologna": [44.4939,11.3428],
"turin": [45.0667,7.7],

// Luxembourg
"luxembourg": [49.85,6],

// Netherlands
"netherlands": [51.6,5.5667],

Expand All @@ -312,6 +318,12 @@ module.exports = {
"serbia": [44,21],
"belgrade": [44.8167,20.4667],

// Spain
"spain": [40,-1],
"barcelona":[41.3837,2.1829],
"mallorca": [39.6167,2.9833],
"majorca": [39.6167,2.9833],

// Suisse
"schweiz": [46.8,8.2333],
"suisse": [46.8,8.2333],
Expand All @@ -336,8 +348,17 @@ module.exports = {
"bristol": [51.45,-2.5833],
"london": [51.5072,-0.1275],

// ---- Africa ----

// Cameroon
"cameroon": [7.5,12],
"yaounde": [3.8667,11.5167],

// ---- America ----

// Canada
"canada": [70,-95],

// Chile
"chile": [-38,-71],
"santiago": [-33.46,-70.6],
Expand Down
22 changes: 21 additions & 1 deletion src/zooms.js
Expand Up @@ -34,6 +34,9 @@ module.exports = {
"bulgaria": 7,
"sofia": 12,

// Croatia
"croatia": 7,

// Czech Republic
"czech-republic": 8,

Expand All @@ -59,6 +62,9 @@ module.exports = {
// Italy
"italy": 6,
"sicily": 8,

// Luxembourg
"luxembourg": 9,

// Netherlands
"netherlands": 7,
Expand All @@ -71,7 +77,12 @@ module.exports = {

// Serbia
"serbia": 7,


// Spain
"spain": 6,
"mallorca": 10,
"majorca": 10,

// Suisse
"schweiz": 8,
"suisse": 8,
Expand All @@ -83,8 +94,17 @@ module.exports = {
"united-kingdom": 5,
"london": 10,

// ---- Africa ----

// Cameroon
"cameroon": 6,
"yaounde": 11,

// ---- America ----

// Canada
"canada": 3,

// Chile
"chile": 4,
"santiago": 10,
Expand Down

0 comments on commit 4396cfa

Please sign in to comment.