Skip to content

Commit

Permalink
v2.10.0
Browse files Browse the repository at this point in the history
POI result list
  • Loading branch information
Dr-Mx committed Jun 2, 2017
1 parent 649c7ad commit ee655b7
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 112 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## v2.10.0 - POI result list

**Date:** 02/06/2017

Site changes
- Added list of results when selecting a group POI, colours show current open state. Mouse-over an item to see tooltip, click to open popup.
- Removed 'facilities open right now' checkbox
- Use alternative method to get thumbnail from wikimedia without MD5 plugin


## v2.9.0 - RSS feed of latest edits

**Date:** 22/05/2017
Expand Down Expand Up @@ -204,7 +214,7 @@ Site changes
- Changed URL encoding to not use unsafe characters and less parameters, old links will no longer work.
- Added a Historic Tour tab. Contains controls linking to an iframe containing various articles that interact with the map
- Suggested walks now use switch statement
- Wikipedia images now display proper attribution through their api
- Wikimedia images now display proper attribution through their api
- Added 'shelter' POI
- Customised 404 page
- Various code improvements
Expand Down
60 changes: 46 additions & 14 deletions web/assets/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ html, body, #map {

#feedRss {
font-size: 85%;
color:#777;
color: #777;
}
#feedRss a:link, #feedRss a:hover, #feedRss a:visited {
color:#777;
color: #777;
}
#feedRss > ul {
padding-left: 10px;
Expand Down Expand Up @@ -196,7 +196,49 @@ hr {
}

/* poi tab */
#pois .sidebar-body > table {
.poi-results {
height: 0;
transition: height 500ms;
box-shadow: -1px 0 5px rgba(0, 0, 0, 0.65) inset;
}
.poi-results button {
display: none;
position: absolute;
box-shadow: none;
border: none;
right: 20px;
top: 20px;
width: 26px;
height: 26px;
background-color: #fff;
}
.poi-results-list {
font-size: 10pt;
}
.poi-results-list img {
height: 26px;
}
.poi-results-list table {
width: 100%;
}
.poi-results-list td {
border-bottom: 1px solid #ccc;
padding: 3px;
}
.poi-results-list td:first-child {
text-align: center;
border-radius: 10px;
width: 10px;
}
.poi-results-list tr:hover {
background-color: rgba(255,255,255,0.6);
cursor: pointer;
}
.poi-icons {
transition: height 500ms;
bottom: 0;
}
.poi-icons table {
width: 100%;
table-layout: fixed;
}
Expand All @@ -205,9 +247,6 @@ hr {
height: 32px;
margin: 2px 3px;
}
input[type="checkbox"] {
transform: scale(1.2);
}
.poi-checkbox > label {
display: inline-block;
width: 100%;
Expand All @@ -221,9 +260,6 @@ input[type="checkbox"] {
.poi-checkbox > label > input {
display: none;
}
.poi-checkbox > label > span, .opennow {
font-size: 90%;
}
.poi-checkbox > label > span {
line-height: 2.6;
display: inline-block;
Expand Down Expand Up @@ -275,7 +311,7 @@ input[type="checkbox"] {
width: 70%;
background-color: white;
}
#tourList:hover {
#tourList:hover, .poi-results button:hover {
background-color: #f4f4f4;
color: black;
}
Expand Down Expand Up @@ -305,9 +341,6 @@ input[type="checkbox"] {
.popup-streetDesc {
max-height: 200px !important;
}
.popup-truncate {
max-width: 170px !important;
}
.leaflet-control-layers-list, .leaflet-popup, .leaflet-control-minZoomIndicator,
.leaflet-control-geocoder-alternatives, .leaflet-control-geocoder-form-no-error {
font-size: 9pt !important;
Expand Down Expand Up @@ -373,7 +406,6 @@ input[type="checkbox"] {
}
.popup-truncate {
display: inline-block;
max-width: 220px;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand Down
Binary file added web/assets/img/results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion web/assets/js/OverPassLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ L.LatLngBounds.prototype.toOverpassBBoxString = function (){
L.OverPassLayer = L.FeatureGroup.extend({
options: {
beforeRequest: function() { if (this.options.debug) console.debug('about to query the OverPassAPI'); },
afterRequest: function() { if (this.options.debug) console.debug('all queries have finished!'); }
afterRequest: function() { if (this.options.debug) console.debug('all queries have finished!'); }
},
initialize: function (options) {
L.Util.setOptions(this, options);
Expand Down Expand Up @@ -182,6 +182,7 @@ L.OverPassLayer = L.FeatureGroup.extend({
if (++finishedCount == queryCount) self.options.afterRequest.call(self);
// show number of pois found
if ($('input.poi-checkbox:checked').length > 0) indicatorMsg = poiCounter();
if ($('.leaflet-marker-icon').length === 0) indicatorMsg = 'No POIs found, try another area';
}
else if (this.status >= 400 && this.status <= 504) {
indicatorMsg = '<i class="fa fa-exclamation-triangle fa-fw"></i> ERROR ' + this.status + ': ';
Expand Down
28 changes: 0 additions & 28 deletions web/assets/js/jquery.md5.min.js

This file was deleted.

58 changes: 29 additions & 29 deletions web/assets/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var defBaseTileLayer = 'bosm', actBaseTileLayer = defBaseTileLayer;
// tab to open
var defTab = 'home', actTab = defTab;
// image size for popups
var imgSize = ($(window).width() < 1024) ? 256 : 350;
var imgSize = ($(window).width() < 1024) ? 256 : 320;

// hack to get safari to scroll iframe
if (window.ontouchstart !== undefined && navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1) {
Expand Down Expand Up @@ -465,7 +465,7 @@ L.easyButton({
title: 'Share',
onClick: function () {
var uri = URI(window.location.href);
var selectedPois = '', walkCoords = '', tourPage, openNow;
var selectedPois = '', walkCoords = '', tourPage;
var walkWayp = routingControl.getWaypoints();
if (actTab === defTab) actTab = undefined;
if (actBaseTileLayer === defBaseTileLayer) actBaseTileLayer = undefined;
Expand All @@ -477,11 +477,10 @@ L.easyButton({
else if (walkWayp[0].latLng) walkCoords = Math.round(walkWayp[0].latLng.lat * 100000) / 100000 + 'x' + Math.round(walkWayp[0].latLng.lng * 100000) / 100000 + '_';
walkCoords = walkCoords ? walkCoords.slice(0, -1) : undefined;
if (actTab === 'tour' && $('#tourList option:selected').val() > 0) tourPage = $('#tourList option:selected').val();
if ($('.opennow input').is(':checked')) openNow = 1;
$('#pois input.poi-checkbox:checked').each(function (i, element) { selectedPois += element.dataset.key + '-'; });
$('.poi-icons input.poi-checkbox:checked').each(function (i, element) { selectedPois += element.dataset.key + '-'; });
selectedPois = selectedPois ? selectedPois.slice(0, -1) : undefined;
// M = basemap, T = tab, U = tour frame, G = image layer, O = opennow, P = grouped pois, I = single poi, W = walkpoints
uri.query({ 'M': actBaseTileLayer, 'T': actTab, 'U': tourPage, 'G': imgLayer, 'O': openNow, 'P': selectedPois, 'I': markerId, 'W': walkCoords });
// M = basemap, T = tab, U = tour frame, G = image layer, P = grouped pois, I = single poi, W = walkpoints
uri.query({ 'M': actBaseTileLayer, 'T': actTab, 'U': tourPage, 'G': imgLayer, 'P': selectedPois, 'I': markerId, 'W': walkCoords });
window.prompt('Copy this link to share current map:', uri.href());
}
}]
Expand All @@ -493,9 +492,7 @@ L.easyButton({
icon: 'fa fa-trash',
title: 'Clear map',
onClick: function () {
// clear overlay, clear walk points, collapse suggested walks, clear poi marker layers
imageOverlay.clearLayers();
imgLayer = undefined;
// clear walk points, collapse suggested walks, clear poi marker layers
routingControl.setWaypoints([]);
$('#walkContainer').accordion({ active: false });
clear_map();
Expand Down Expand Up @@ -572,11 +569,11 @@ function populate_tabs() {
var catSplit = $('.eac-category')[$('#autocomplete').getSelectedItemIndex()].textContent.split(' - ');
clear_map();
$('a[href="#pois"]').click();
$('#pois input[id="' + catSplit[1] + '"]').prop('checked', true);
$('.poi-icons input[id="' + catSplit[1] + '"]').prop('checked', true);
// scroll to checkbox
if ($(window).width() >= 768) {
$('#pois .sidebar-body').scrollTop(0);
$('#pois .sidebar-body').scrollTop($('#pois input[id="' + catSplit[1] + '"]').parent().position().top - 50);
$('.poi-icons').scrollTop(0);
$('.poi-icons').scrollTop($('.poi-icons input[id="' + catSplit[1] + '"]').parent().position().top - 50);
}
setting_changed();
$('#autocomplete').val('');
Expand Down Expand Up @@ -615,7 +612,7 @@ function populate_tabs() {
checkboxContent += '</table>';
checkboxContent += '<div class="anchor"><a href="#gototoppois" title="Back to top">| <i class="fa fa-arrow-up"></i> |</a></div>';
}
$('#pois .sidebar-body').append(checkboxContent);
$('.poi-icons').append(checkboxContent);
}
populate_tabs();

Expand All @@ -631,8 +628,10 @@ $('#autocomplete').on('focus', function () {
$(this).select();
});

// clear poi marker layers
// clear poi marker and overlay layers
function clear_map() {
imageOverlay.clearLayers();
imgLayer = undefined;
$('input.poi-checkbox').prop('checked', false);
setting_changed();
spinner = 0;
Expand All @@ -642,14 +641,17 @@ function clear_map() {
function setting_changed(newcheckbox) {
// limit number of active checkboxes
if ($('input.poi-checkbox:checked').length <= 3) {
// remove old poi markers
// remove old poi markers and results
iconLayer.clearLayers();
$('.poi-results').css('height', '');
$('.poi-icons').css('height', '');
$('.poi-results-list').html('');
poiList = [];
markerId = undefined;
if ($('input.poi-checkbox:checked').length > 0) {
if ($(window).width() < 768) sidebar.close();
//build overpass query
var query = '(';
$('#pois input.poi-checkbox:checked').each(function (i, element) {
$('.poi-icons input.poi-checkbox:checked').each(function (i, element) {
query += 'node' + pois[element.dataset.key].query + '(screenBbox);';
query += 'way' + pois[element.dataset.key].query + '(screenBbox);';
});
Expand Down Expand Up @@ -723,7 +725,7 @@ function suggWalk(walkName) {
}

// https://github.com/medialize/URI.js
// M = basemap, T = tab, U = tour frame, G = image layer, O = opennow, P = grouped pois, I = single poi, Q = geocode query, W = walkpoints
// M = basemap, T = tab, U = tour frame, G = image layer, P = grouped pois, I = single poi, Q = geocode query, W = walkpoints
var uri = URI(window.location.href);
if (uri.hasQuery('M')) actBaseTileLayer = uri.search(true).M;
if (uri.hasQuery('T')) actTab = uri.search(true).T;
Expand All @@ -732,7 +734,6 @@ if (uri.hasQuery('U')) {
$('#tourList').trigger('change');
}
if (uri.hasQuery('G')) tour(uri.search(true).G);
if (uri.hasQuery('O')) $('.opennow input').prop('checked', uri.search(true).O);
if (uri.hasQuery('W')) {
var walkCoords = uri.search(true).W;
walkCoords = walkCoords.split('_');
Expand All @@ -745,24 +746,23 @@ if (uri.hasQuery('P')) {
var selectedPois = uri.search(true).P;
if (selectedPois.indexOf('-') > -1) selectedPois = selectedPois.split('-');
if (!$.isArray(selectedPois)) {
$('#pois input[data-key=' + selectedPois + ']').prop('checked', true);
// open tab on bigger devices, scroll to checkbox
if ($(window).width() >= 768 && actTab !== 'none') {
$('.poi-icons input[data-key=' + selectedPois + ']').prop('checked', true);
// scroll to checkbox
if (actTab !== 'none') {
sidebar.open(actTab);
$('#pois .sidebar-body').scrollTop(0);
$('.poi-icons').scrollTop(0);
// add delay after load for sidebar to animate open, allows for scroll position
setTimeout(function () {
$('#pois .sidebar-body').scrollTop($('#pois input[data-key="' + selectedPois + '"]').parent().position().top - 50);
$('.poi-icons').scrollTop($('.poi-icons input[data-key="' + selectedPois + '"]').parent().position().top - 50);
}, 500);
}
}
else {
for (var c in selectedPois) {
// the last poi has a "/" on it because leaflet-hash
var multiplePois = selectedPois[c].replace('/', '');
$('#pois input[data-key=' + multiplePois + ']').prop('checked', true);
// open tab on bigger devices
if ($(window).width() >= 768 && actTab !== 'none') sidebar.open(actTab);
$('.poi-icons input[data-key=' + multiplePois + ']').prop('checked', true);
if (actTab !== 'none') sidebar.open(actTab);
}
}
setting_changed();
Expand All @@ -781,7 +781,7 @@ else if (uri.hasQuery('Q')) {
// if not returning from a permalink, give defaults
if (!uri.hasQuery('W') || !uri.hasQuery('P') || !uri.hasQuery('I')) {
if (window.location.hash.indexOf('/') !== 3) map.setView(mapCentre, mapZoom);
if (($(window).width() >= 768 || actTab === 'tour') && actTab !== 'none') sidebar.open(actTab);
if (($(window).width() >= 768 || actTab !== 'home') && actTab !== 'none') sidebar.open(actTab);
}

// https://github.com/enginkizil/FeedEk
Expand Down Expand Up @@ -814,4 +814,4 @@ if (!uri.hasQuery('W') || !uri.hasQuery('P') || !uri.hasQuery('I')) {
})(jQuery);
$('#feedRss').FeedEk({ FeedUrl: 'http://simon04.dev.openstreetmap.org/whodidit/scripts/rss.php?bbox=' + mapBounds.lef + ',' + mapBounds.bot + ',' + mapBounds.rig + ',' + mapBounds.top });

tileBaseLayers[tileBaseLayer[actBaseTileLayer].name].addTo(map);
tileBaseLayers[tileBaseLayer[actBaseTileLayer].name].addTo(map);
Loading

0 comments on commit ee655b7

Please sign in to comment.