Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remover html que já não é usado #50

Merged
merged 7 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Os contribuidores iniciais incluem membros de várias comunidades locais ligadas

### O que queremos mapear?

- [x] [bibliotecas](https://interruptorpt.github.io/ate-onde-chega-cultura/bibliotecas)
- [x] [teatros](https://interruptorpt.github.io/ate-onde-chega-cultura/teatros)
- [x] [cinemas](https://interruptorpt.github.io/ate-onde-chega-cultura/cinemas)
- [x] [museus](https://interruptorpt.github.io/ate-onde-chega-cultura/museus)
- [x] [recintos de espectáculo](https://interruptorpt.github.io/ate-onde-chega-cultura/recintos)
- [x] [galerias de arte](https://interruptorpt.github.io/ate-onde-chega-cultura/galerias)
- [x] [monumentos](https://interruptorpt.github.io/ate-onde-chega-cultura/monumentos)
- [x] [bibliotecas](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=bibliotecas)
- [x] [teatros](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=teatros)
- [x] [cinemas](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=cinemas)
- [x] [museus](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=museus)
- [x] [recintos de espectáculo](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=recintos)
- [x] [galerias de arte](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=galerias)
- [x] [monumentos](https://interruptorpt.github.io/ate-onde-chega-cultura/mapa?categories=monumentos)

## Contribuir

Expand Down
54 changes: 0 additions & 54 deletions cinemas.html

This file was deleted.

File renamed without changes.
54 changes: 0 additions & 54 deletions galerias.html

This file was deleted.

59 changes: 39 additions & 20 deletions mapa.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>

<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
}

</script>
</head>
<body>
<style>
Expand All @@ -16,14 +30,22 @@
<div id="mapid"></div>

<script>

var filterCategories = getQueryVariable("categories");
if (filterCategories != undefined){
filterCategories = filterCategories.split(',');
}

console.log(filterCategories);

var categories = [
{ name: "Bibliotecas", icon: "local_library", subclass: "Q7075" },
{ name: "Cinemas", icon: "movie", subclass: "Q41253" },
{ name: "Galerias", icon: "filter_frames", subclass: "Q1007870" },
{ name: "Monumentos", icon: "account_balance", subclass: "Q4989906" },
{ name: "Museus", icon: "museum", subclass: "Q33506" },
{ name: "Recintos", icon: "workspaces_filled", subclass: "Q18674739" },
{ name: "Teatros", icon: "theater_comedy", subclass: "Q24354" },
{ name: "Bibliotecas", icon: "local_library", url: "static-data/bibliotecas.json" },
{ name: "Cinemas", icon: "movie", url: "static-data/cinemas.json" },
{ name: "Galerias", icon: "filter_frames", url: "static-data/galerias.json" },
{ name: "Monumentos", icon: "account_balance", url: "static-data/monumentos.json" },
{ name: "Museus", icon: "museum", url: "static-data/museus.json" },
{ name: "Recintos", icon: "workspaces_filled", url: "static-data/recintos.json" },
{ name: "Teatros", icon: "theater_comedy", url: "static-data/teatros.json" },
];

var mymap = L.map('mapid').setView([41.14961, -8.61099], 13);
Expand All @@ -34,18 +56,13 @@
}).addTo(mymap);

async function loadCategoryLayer(category) {
const url = `https://query.wikidata.org/bigdata/namespace/wdq/sparql?format=json&query=${encodeURIComponent(`
SELECT ?item ?itemLabel ?geo WHERE {
# Item is an instance or subclass of the given category
?item wdt:P31/wdt:P279* wd:${category.subclass}.
# Store item's geographic coordinates in the ?geo variable
?item wdt:P625 ?geo.
# Item's country is Portugal
?item wdt:P17 wd:Q45.

SERVICE wikibase:label { bd:serviceParam wikibase:language "pt,en" }.
}
`)}`;

var url = category.url;

// Make it work on file://
if ( window.location.href.startsWith('file://') ) {
url = 'https://interruptorpt.github.io/ate-onde-chega-cultura/'+category.url;
}

const points = await fetch(url).then(r => r.json());

Expand All @@ -66,7 +83,9 @@
layer.addLayer(L.marker(coords, { icon }).bindPopup(label));
});

layer.addTo(mymap);
if ( filterCategories == undefined || filterCategories.indexOf(category.name.toLowerCase()) >= 0 ){
layer.addTo(mymap);
}

return { ...category, layer };
}
Expand Down
54 changes: 0 additions & 54 deletions monumentos.html

This file was deleted.

54 changes: 0 additions & 54 deletions museus.html

This file was deleted.

54 changes: 0 additions & 54 deletions recintos.html

This file was deleted.

Loading