From 260bb653f5e26555ffbd646ac7ca046cf9bdeb18 Mon Sep 17 00:00:00 2001 From: Alexis Markwick Date: Sun, 19 Sep 2021 19:49:53 +0100 Subject: [PATCH] v6.2.0 Pannellum --- CHANGELOG.md | 48 +- web/assets/css/dark-theme.css | 54 +- web/assets/css/plugins/jquery.fancybox.css | 1 + web/assets/css/plugins/leaflet-sidebar.css | 6 +- web/assets/css/site.css | 67 +- web/assets/data/streetnames.xml | 4 +- web/assets/js/OverPassLayer.js | 16 +- web/assets/js/plugins/leaflet-osm.min.js | 27 - web/assets/js/pois-type.js | 12 +- web/assets/js/site.js | 260 +- web/assets/js/tags-parsers.js | 199 +- web/assets/pannellum/config.json | 5 + web/assets/pannellum/css/img/background.svg | 3 + web/assets/pannellum/css/img/compass.svg | 3 + web/assets/pannellum/css/img/grab.svg | 3 + web/assets/pannellum/css/img/grabbing.svg | 3 + web/assets/pannellum/css/img/sprites.svg | 14 + web/assets/pannellum/css/pannellum.css | 479 +++ web/assets/pannellum/css/standalone.css | 13 + web/assets/pannellum/js/jquery.md5.js | 28 + web/assets/pannellum/js/libpannellum.js | 1867 ++++++++++ web/assets/pannellum/js/pannellum.js | 3401 +++++++++++++++++++ web/assets/pannellum/js/standalone.js | 111 + web/assets/pannellum/pannellum.htm | 23 + web/index.html | 97 +- web/tour/listRailways/index.html | 2 +- web/tour/tour.css | 2 +- web/tour/tour.js | 7 +- 28 files changed, 6383 insertions(+), 372 deletions(-) delete mode 100644 web/assets/js/plugins/leaflet-osm.min.js create mode 100644 web/assets/pannellum/config.json create mode 100644 web/assets/pannellum/css/img/background.svg create mode 100644 web/assets/pannellum/css/img/compass.svg create mode 100644 web/assets/pannellum/css/img/grab.svg create mode 100644 web/assets/pannellum/css/img/grabbing.svg create mode 100644 web/assets/pannellum/css/img/sprites.svg create mode 100644 web/assets/pannellum/css/pannellum.css create mode 100644 web/assets/pannellum/css/standalone.css create mode 100644 web/assets/pannellum/js/jquery.md5.js create mode 100644 web/assets/pannellum/js/libpannellum.js create mode 100644 web/assets/pannellum/js/pannellum.js create mode 100644 web/assets/pannellum/js/standalone.js create mode 100644 web/assets/pannellum/pannellum.htm diff --git a/CHANGELOG.md b/CHANGELOG.md index ab7d4b3..915cef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # CHANGELOG +## v6.2.0 - Pannellum + +**Date:** 19/09/2021 + +Added + - Pannellum + +Site changes + - Switch to self-hosted Pannellum photosphere viewer + - Option to use OSM Area ID for OverPass bounding box + - Remove leaflet-osm.js in favour of getting geometry from OverPass + - Only load POI image thumbnails on popup open + - Stop some single-clicks on overlays by adding layerNoClick class + - Let some baselayers be inverted for darkmode using layerDark class + - Create lightbox gallery from images in tour pages + - Tidied up Settings tab + - Permalinks for custom queries + - More of the usual bug fixes and code improvements + + ## v6.1.0 **Date:** 06/08/2021 @@ -13,7 +33,7 @@ Site changes - Remove jquery animate scrolling in favour of js scroll/scollIntoView - Support for 'elevator' tags for facilities parser - Support semicolon separated wikimedia_commons:video videos - - Retry overpass query if time-out occurs + - Retry OverPass query if time-out occurs - Icon for 'entrance' key - Add Boreholes and Other Maps to Tour @@ -45,7 +65,7 @@ Updated js - jquery.mobile.custom.min.js 1.5.0rc1 - URI.js 1.19.6 - L.Control.Locate.min.js 0.72.2 - + Site changes - Proper support for a dark theme, auto switching if user prefers a dark colour scheme - Custom OverPass queries can now include osm elements @@ -63,7 +83,7 @@ Site changes Updated js - URI.js 1.19.4 - + Site changes - Offsets for baselayers - Add annual scarecrow competition to Tour @@ -81,7 +101,7 @@ Updated js - leaflet.js 1.7.1 - jquery.js 3.5.1 - L.Control.Locate.min.js 0.72.1 - + Site changes - Show OSM notes and comment history - Added OpenCageData server for reverse lookups @@ -98,7 +118,7 @@ Site changes Updated js - L.Control.Locate.min.js 0.72.0 - + Site changes - Right-click 'Panoramic view' opens a panoramic Mapillary Street Level iframe, if not found use Google Street View - Hide back-to-top anchor button when at top of tab @@ -117,11 +137,11 @@ Site changes Added js - geotools.min.js - + Updated js - Control.Geocoder.min.js 1.12.0 - L.Control.Locate.min.js 0.70.0 - + Site changes - Right-click on the map to directly copy coordinates (LatLng & NationalGridRef) - Direct links to property records on UK Land Registry @@ -401,10 +421,10 @@ Site changes Added js - config.js - + Updated js - opening_hours+deps.min.js [removed other localisations] - + Site changes - Get next bus times from NaPTAN codes on bus-stops using API from Traveline - Images show as thumbnails until hovered or tapped @@ -427,7 +447,7 @@ Updated js - jQuery 3.3.1 - jquery.mobile.custom.min.js 1.5.0a - easy-button.min.js 3.0.0 - + Site changes - Larger overlay opacity slider with added close button - Show Overpass 'attic data' for a certain date in development options @@ -554,7 +574,7 @@ Site changes **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. + - 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 @@ -760,7 +780,7 @@ Updated js Site changes - Re-write of creating POI checkbox tables, now a single tab with page jump links. Complete automated import from pois-types.js - - Changed URL encoding to not use unsafe characters and less parameters, old links will no longer work. + - 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 - Wikimedia images now display proper attribution through their api @@ -1003,11 +1023,11 @@ Site changes Updated js - jQuery 3.0.0 - + Added js - jquery-ui.min.js - jquery.easy-autocomplete.js - + Site changes - New 'find interest' input that finds POIs based on keywords - Checkboxes briefly highlight when selected by 'find interest' or returning from link diff --git a/web/assets/css/dark-theme.css b/web/assets/css/dark-theme.css index 5f2c460..40a865e 100644 --- a/web/assets/css/dark-theme.css +++ b/web/assets/css/dark-theme.css @@ -1,16 +1,16 @@ :root { --text-color: #aaa; --hover-color: #ccc; - --bg-color: #111; - --bg-color2: rgba(20, 20, 20, 0.9); - --scr-track: #222; - --scr-thumb: #777; + --bg-color: #0c0c0d; + --bg-color2: rgba(35, 35, 39, 0.95); + --scr-track: #0c0c0d; + --scr-thumb: #555; } .spinner { filter: invert(100%) hue-rotate(180deg); } html, body, input, select, #map, .leaflet-control-layers-expanded, #msgStatusHead, .leaflet-control-attribution, .leaflet-tooltip, -.leaflet-contextmenu a.leaflet-contextmenu-item, .leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-control-scale-line { +.leaflet-contextmenu a.leaflet-contextmenu-item, .leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-control-scale-line, .leaflet-routing-remove-waypoint:hover::after { color: var(--text-color) !important; } .anchor:hover, select:hover:enabled, #poi-results button:hover, #home .sidebar-body a i:hover, #inputWw2 div, .leaflet-control-attribution .fa-info-circle:hover, @@ -18,19 +18,26 @@ button:hover, .leaflet-bar a:hover, .navigateItem a:hover, .leaflet-container a. .leaflet-routing-geocoders button:hover::after, #poi-filter-cl:hover::after, #devTools h3:hover::after, .popup-ohContainer .popup-tagValue:hover::after { color: var(--hover-color) !important; } -.sidebar-tabs, .anchor, input:not([type="range"]), select, button, .leaflet-bar > a, .leaflet-tooltip, .leaflet-control-geocoder input, .slider::before, #inputOpacity, .leaflet-control-geocoder, .leaflet-contextmenu, #msgStatusHead, -.leaflet-container a.leaflet-popup-close-button, .leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected { +.sidebar-tabs, #homeBox, #xmasMsg, .anchor, input:not([type="range"]), hr, select, button, .leaflet-bar > a, .leaflet-tooltip, .leaflet-control-geocoder input, +.slider::before, #inputOpacity, .leaflet-control-geocoder, .leaflet-contextmenu, #msgStatusHead, .leaflet-container a.leaflet-popup-close-button, +.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected, #poi-results-list tr:hover, .poi-checkbox-selected, .poi-checkbox > label:hover, +.leaflet-touch .leaflet-bar { background-color: var(--bg-color) !important; } -.poi-checkbox-selected, #poi-results-list tr:hover, #msgStatusBody, .leaflet-popup-content-wrapper, .leaflet-popup-tip, .sidebar-content, -.leaflet-control-layers-expanded, #homeBox, #xmasMsg, hr, .poi-checkbox > label:hover, .leaflet-control-layers, .sidebar.collapsed .sidebar-tabs, .leaflet-control-geocoder { +#msgStatusBody, .leaflet-popup-content-wrapper, .leaflet-popup-tip, .sidebar-content, .leaflet-control-layers-expanded, .leaflet-control-layers, +.leaflet-control-geocoder { background-color: var(--bg-color2) !important; } +@media (min-width: 1300px) { + .sidebar.collapsed .sidebar-tabs { + background-color: rgba(0, 0, 0, 0.5) !important; + } +} #weather, #newFeed ul { color: #688c81; } .leaflet-bar a, .leaflet-bar a:hover { - border-bottom: 1px solid #555; + border-bottom: 1px solid #333; } .leaflet-bar a:last-child { border-bottom: none; @@ -38,8 +45,8 @@ button:hover, .leaflet-bar a:hover, .navigateItem a:hover, .leaflet-container a. .custscroll { scrollbar-color: var(--scr-thumb) var(--scr-track) !important; } -.baselayer { - opacity: 0.85 !important; +.layerDark { + filter: invert(90%) hue-rotate(180deg); } .sidebar-header { color: #ddd; @@ -79,13 +86,16 @@ input, select, #sidebar button:not(.modalButton), .leaflet-tooltip { background: none repeat scroll 0 0 #000; } .sidebar-tabs > ul > li:hover, .slider { - background-color: #555; + background-color: #444; } .slider:hover { background-color: #666; } .popup-header { - background-color: rgba(55, 55, 55, 0.5); + background-color: rgba(12, 12, 13, 0.5) !important; +} +.popup-fhrs > a > img { + filter: brightness(0.75); } .leaflet-container a.leaflet-popup-close-button { border: 3px solid #333; @@ -93,19 +103,16 @@ input, select, #sidebar button:not(.modalButton), .leaflet-tooltip { .leaflet-tooltip-right::before { border-right-color: var(--bg-color); } -#gotocontrols .fa-border, .leaflet-touch .leaflet-bar { - background-color: black; -} -.modalTutor { - color: black; -} .modalButton { box-shadow: 1px 1px #000; background-color: #222 !important; } .leaflet-contextmenu a.leaflet-contextmenu-item.over { background-color: #222; - border-top: 1px solid #333; + border-top: 1px solid #222; + border-bottom: 1px solid #222; +} +.leaflet-contextmenu-separator { border-bottom: 1px solid #333; } .popup-ohTable tr, .popup-bsTable tr { border: 1px solid black; } @@ -124,3 +131,8 @@ input, select, #sidebar button:not(.modalButton), .leaflet-tooltip { .custscroll::-webkit-scrollbar-thumb { background-color: var(--scr-thumb); } +#gotocontrols .fa-border, #gotoprivacy .fa-border { + border: 1px solid #333; + border-radius: 5px; + background-color: var(--bg-color); +} diff --git a/web/assets/css/plugins/jquery.fancybox.css b/web/assets/css/plugins/jquery.fancybox.css index 371360d..ad13e07 100644 --- a/web/assets/css/plugins/jquery.fancybox.css +++ b/web/assets/css/plugins/jquery.fancybox.css @@ -266,6 +266,7 @@ body.compensate-for-scrollbar { } .fancybox-slide--iframe .fancybox-content { + height: 100% !important; background: #fff; } diff --git a/web/assets/css/plugins/leaflet-sidebar.css b/web/assets/css/plugins/leaflet-sidebar.css index 67ae20a..de9aafc 100644 --- a/web/assets/css/plugins/leaflet-sidebar.css +++ b/web/assets/css/plugins/leaflet-sidebar.css @@ -22,7 +22,8 @@ opacity : 0; } @media (min-width: 1300px) { .sidebar.collapsed .sidebar-tabs { - background-color: rgba(204, 204, 204, 0.5); } + background-color: rgba(204, 204, 204, 0.5); + transition: background-color 400ms ease-out; } .sidebar.collapsed { width: 40px; } } .sidebar-left { @@ -34,8 +35,7 @@ top: 0; bottom: 0; height: 100%; - background-color: #ddd; - transition: background-color 300ms ease-out; } + background-color: #ddd; } .sidebar-left .sidebar-tabs { left: 0; } .sidebar-tabs, .sidebar-tabs > ul { diff --git a/web/assets/css/site.css b/web/assets/css/site.css index 005c351..ee18e3b 100644 --- a/web/assets/css/site.css +++ b/web/assets/css/site.css @@ -1,5 +1,5 @@ :root { - --main-color: #b05000; + --main-color: #b05000; --second-color: #be6f2e; --bg-hover-color: #f4f4f4; --scr-thumb: #cdcdcd; @@ -46,6 +46,9 @@ html, body, #map { #map { transition: margin-left 400ms ease-out; } + #weather { + font-size: 8.7pt; + } #weather .fa-2x { font-size: 1.8em; } @@ -58,6 +61,11 @@ input[type=text], input[type=date], input[type=number] { height: 28px; } +button:disabled { + opacity: 50%; + pointer-events: none; +} + #sidebar { display: none; } @@ -272,9 +280,6 @@ h3 { transform: rotate(90deg); } -.baselayer { - transition: opacity 300ms linear; -} .leaflet-touch .leaflet-bar { background-color: white; } @@ -391,6 +396,12 @@ h3 { .leaflet-left .leaflet-control-scale { margin: 0 0 3px 10px; } +.leaflet-fade-anim .leaflet-popup { + opacity: 0; + -webkit-transition: opacity 0.1s linear; + -moz-transition: opacity 0.1s linear; + transition: opacity 0.1s linear; +} #noscript { color: #f4e6d3; @@ -904,12 +915,20 @@ input:indeterminate + .slider::before { margin-right: 5px; } .buttonLabel { + display: table-cell; + vertical-align: middle; font-size: 90%; - line-height: 20px; - padding-top: 5px; + height: 40px; +} +#inputOpServer, #inputRevServer { + width: 210px; } -#inputOverpass, #inputOpServer, #inputRevServer { - width: calc(100% - 100px); +#inputOverpass { + width: calc(100% - 32px); + max-width: 350px; + min-width: 210px; + padding-right: 20px !important; + position: relative; } #inputAttic, #inputOverpass, #inputOpServer, #inputOpCache, #inputRevServer { margin: 5px 0 5px 5px; @@ -921,6 +940,7 @@ input:indeterminate + .slider::before { line-height: 28px; } #inputOpCache { + float: left; width: 50px; margin-right: 5px; } @@ -929,7 +949,7 @@ input:indeterminate + .slider::before { position: relative; } #devTools > div { - padding: 5px 0 15px 15px; + padding: 0 5%; } /* help tab */ @@ -945,8 +965,8 @@ input:indeterminate + .slider::before { height: 15px; padding: 0 5px 0 0; } -#gotocontrols .fa-border { - border: 1px solid #aaa; +#gotocontrols .fa-border, #gotoprivacy .fa-border { + border: 1px solid #ccc; border-radius: 5px; background-color: white; } @@ -1021,6 +1041,7 @@ input:indeterminate + .slider::before { } .leaflet-popup-content { margin: 0 15px 10px 15px; + min-width: 75px; } .leaflet-container a.leaflet-popup-close-button { top: -14px; @@ -1060,23 +1081,19 @@ input:indeterminate + .slider::before { background-color: rgba(200, 200, 200, 0.2); } .popup-header h3 { - padding-right: 60px; margin: 0 auto 0; } -.popup-t .popup-header h3 { - padding-right: 0; -} .popup-header-sub { display: table-cell; font-style: oblique; font-weight: bold; - padding-right: 60px; width: 100%; vertical-align: bottom; } .popup-fhrs { display: table-cell; line-height: 0; + padding-left: 5px; } .popup-fhrs > a > img { white-space: nowrap; @@ -1112,7 +1129,7 @@ input:indeterminate + .slider::before { text-align: justify; padding-right: 3px; } -@media (max-height: 500px) { +@media (max-height: 640px) { .popup-longDesc { max-height: calc(var(--popup-long-desc-height) / 2); } @@ -1128,7 +1145,6 @@ input:indeterminate + .slider::before { cursor: pointer; } .popup-ohTable, .popup-bsTable { - font: 80%/1.2 monospace; text-align: center; } .popup-ohTable { @@ -1145,7 +1161,7 @@ input:indeterminate + .slider::before { -webkit-overflow-scrolling: touch; } .popup-ohTable table { width: 100%; border-collapse: collapse; } -.popup-ohTable tr, .popup-bsTable tr { border: 1px solid white; } +.popup-ohTable tr, .popup-bsTable tr { font: 80%/1.2 monospace; border: 1px solid white; } .popup-ohTable td { padding: 2px 0; } .popup-ohTable tr.today { font-weight: bold; } .popup-ohTable td.weekend { background-color: #ccc; } @@ -1209,7 +1225,7 @@ input:indeterminate + .slider::before { .fancybox-button .fa-2x:hover { opacity: 1; } -.fancybox-button--pause .fas:first-child, .fancybox-button--play .fas:nth-child(2) { +.fancybox-button--pause .fas:first-child, .fancybox-button--play .fas:nth-child(2), .noslideshow .fancybox-button--play { display: none; } @@ -1288,7 +1304,7 @@ input:indeterminate + .slider::before { padding: 0 5px; } .popup-xmas .leaflet-popup-content-wrapper, .leaflet-tooltip.popup-xmas, #xmasMsg { - background-image: url('../../tour/tourXmas/popup-bg.png'); + background-image: url('../../tour/itemXmas/popup-bg.png'); background-position: center; background-repeat: no-repeat; background-size: cover; @@ -1377,3 +1393,12 @@ input:indeterminate + .slider::before { input:focus, select:focus, textarea:focus, button:focus { outline: none; } +kbd { + border-radius: 3px; + border: 1px solid rgba(180, 180, 180, 0.5); + font-size: .85em; + font-weight: 700; + padding: 0 2px; + margin: 0 2px; + white-space: nowrap; +} diff --git a/web/assets/data/streetnames.xml b/web/assets/data/streetnames.xml index 3ece4bc..7806f4f 100644 --- a/web/assets/data/streetnames.xml +++ b/web/assets/data/streetnames.xml @@ -1132,7 +1132,7 @@ Village in West Sussex, 4 miles north of Worthing. (Adopted by Borough of Bexhill 3rd February 1969). - Fir Tree Close + Firtree Close 1971 Firs belong to the genus Abies and comprise around 50 species of evergreen coniferous trees. (Date of adoption by Borough of Bexhill or later East Sussex County Council not known). @@ -3550,7 +3550,7 @@ Unadopted Dec 2020 - Brackerne Close + Brackern Close Unadopted Dec 2020 diff --git a/web/assets/js/OverPassLayer.js b/web/assets/js/OverPassLayer.js index 7073444..374f49b 100644 --- a/web/assets/js/OverPassLayer.js +++ b/web/assets/js/OverPassLayer.js @@ -9,18 +9,18 @@ function show_overpass_layer(query, cacheId, bound) { $('.poi-checkbox').addClass('poi-loading'); queryBbox = '[out:json]'; if ($('#inputAttic').val()) queryBbox += '[date:"' + new Date($('#inputAttic').val()).toISOString() + '"]'; - // select within relation - work in progress + // select within area if (bound) - if (osmRelation) { - queryBbox += ';rel(' + osmRelation + ');map_to_area'; - query = query.replace(/];/g, '](area);'); + if (osmAreaId) { + queryBbox += ';area(' + osmAreaId + ')->.b'; + query = query.replace(/\[/g, '(area.b)['); } else queryBbox += '[bbox:' + [mapBounds.south, mapBounds.west, mapBounds.north, mapBounds.east].join(',') + ']'; queryBbox += ';' + query; } var opl = new L.OverPassLayer({ debug: $('#inputDebug').is(':checked'), - query: queryBbox + 'out tags center qt ' + maxOpResults + ';', + query: queryBbox + 'out geom qt ' + maxOpResults + ';', endpoint: 'https://' + $('#inputOpServer').val() + '/api/interpreter', callback: callback, cacheId: cacheId ? 'OPL' + cacheId : '' @@ -79,11 +79,11 @@ L.OverPassLayer = L.FeatureGroup.extend({ }, complete: function(e) { if (e.status === 0 || (e.status >= 400 && e.status <= 504)) { - var erMsg = 'Something unknown happened. Please try again later.'; + var erMsg = 'Something went wrong. Please try again later.'; switch (e.status) { case 0: erMsg = 'Data server not responding. Please try again later.'; e.status = 1; break; case 400: erMsg = 'Bad Request. Check the URL or query is valid.'; break; - case 429: erMsg = 'Too Many Requests. Please try a smaller selection.'; break; + case 429: erMsg = 'Too Many Requests. Please wait a few moments before trying again.'; break; case 504: // retry on timeout if (this.retryLimit) { @@ -95,7 +95,7 @@ L.OverPassLayer = L.FeatureGroup.extend({ break; } self.options.statusMsg('exclamation-triangle', 'ERROR #' + e.status, erMsg); - self.options.callback.call(reference, {elements: []}); + self.options.callback.call(reference, { elements: [] }); this.error(); } }, diff --git a/web/assets/js/plugins/leaflet-osm.min.js b/web/assets/js/plugins/leaflet-osm.min.js deleted file mode 100644 index a100ae0..0000000 --- a/web/assets/js/plugins/leaflet-osm.min.js +++ /dev/null @@ -1,27 +0,0 @@ -L.OSM={};L.OSM.DataLayer=L.FeatureGroup.extend({initialize:function(xml){L.Util.setOptions(this,{areaTags:['area','building','leisure','tourism','ruins','historic','landuse','military','natural','sport'],uninterestingTags:['source','source_ref','source:ref','history','attribution','created_by','tiger:county','tiger:tlid','tiger:upload_uuid'],styles:{node:{stroke:false,fill:false,interactive:false},area:{color:$('html').css('--main-color'),weight:5,opacity:0.5,fillColor:$('html').css('--main-color'),fillOpacity:0.3,interactive:false},highway:{color:$('html').css('--main-color'),opacity:0.5,weight:10,interactive:false}}});L.FeatureGroup.prototype.initialize.call(this);if(xml) -this.addData(xml);},addData:function(features){if(!(features instanceof Array)) -features=this.buildFeatures(features);for(var i=0;i=0){used=true;break;}} -if(!used) -return true;for(i=0;i=0) -return true;} -for(var key in node.tags){if(this.options.uninterestingTags.indexOf(key)<0) -return true;} -return false;}});L.Util.extend(L.OSM,{getChangesets:function(xml){var result=[];var nodes=xml.getElementsByTagName("changeset");for(var i=0;i= 15 && !$('.leaflet-marker-draggable, .leaflet-control-layers-expanded').length && !imageOverlay.getLayers().length && !actOverlayLayer && !spinner && - !($('.leaflet-popup').length && map.getBounds().contains(map.layerPointToLatLng($('.leaflet-popup')[0]._leaflet_pos)))) { + // ignore map click if... low zoom / dragging walk markers / overlay control is open / layerNoclick / spinner is shown / popup is open on screen + else if (map.getZoom() >= 15 && !$('.leaflet-marker-draggable, .leaflet-control-layers-expanded, .layerNoclick').length && !imageOverlay.getLayers().length && + !spinner && !($('.leaflet-popup').length && map.getBounds().contains(map.layerPointToLatLng($('.leaflet-popup')[0]._leaflet_pos)))) { that.fire('visualclick', L.Util.extend(e, { type: 'visualclick' })); // drop marker and reverse lookup on single click h = setTimeout(function() { @@ -137,7 +137,7 @@ L.Map.addInitHook(function() { weight: 2, color: $('html').css('--main-color'), opacity: 1, - fillColor: '#fff', + fillColor: $('#inputDark').is(':checked') ? '#222' : '#fff', fillOpacity: 0.5, interactive: noTouch ? true : false, bubblingMouseEvents: false @@ -188,7 +188,7 @@ var map = new L.map('map', { index: 5, callback: fixMyStreet }, { - text: ' Panoramic view', + text: ' Photosphere view', index: 6, callback: panoView }, '-', { @@ -252,7 +252,7 @@ var map = new L.map('map', { showModalTutor($('.leaflet-control-layers'), 'modalT1', '-160', 'Choose from a growing number of modern and historical maps to overlay.', 'right'); showModalTutor($('#btnClearmap'), 'modalT2', '40', 'Clean up any map markers using this button. Try clicking the map to find information on almost any place.', 'left'); showModalTutor($('.sidebar-tabs ul li').eq(3), 'modalT3', '40', 'Display articles on the history of the area. From dinosaur footprints to WW2 incidents.', 'left'); - showModalTutor($('#inputOpacity input'), 'modalT4', '-160', 'This slider changes the opacity of the overlay.' + (noTouch ? ' Tapping CTRL will fade the overlay in and out.' : ''), 'right'); + showModalTutor($('#inputOpacity input'), 'modalT4', '-160', 'This slider changes the opacity of the overlay.' + (noTouch ? ' Tapping CTRL will fade the overlay in and out.' : ''), 'right'); } // holiday decorations overlay //if (new Date().getMonth() === 3 && new Date().getDate() >= 10 && new Date().getDate() <= 13) sidebar.append(''); @@ -310,6 +310,7 @@ var map = new L.map('map', { }).on('popupopen', function(e) { var popupThis = $(e.popup._container); var osmId = e.popup._source._leaflet_id; + if (popupThis.find($('.popup-header > a').length)) popupThis.find($($('.popup-header h3').length ? '.popup-header h3' : '.popup-header-sub')).css('padding-right', 25*$('.popup-header > a').length + 'px'); // add/remove favourites if ($('.popup-bookm').length) { if (!window.localStorage.favourites) window.localStorage.favourites = ''; @@ -390,7 +391,7 @@ var map = new L.map('map', { popupThis.find($('.popup-bsTable')).append( '' + $(xml).find('PublishedLineName').eq(c).text() + '' + '' + $(xml).find('DirectionName').eq(c).text() + '' + - '' + (departTimer === -1 ? 'Due' : departTimer + ' (' + new Date(departTime).toLocaleTimeString(navigator.language, { hour: '2-digit', minute: '2-digit' })) + ')' + '' + (departTimer === -1 ? 'Due' : (departTimer + ' (' + new Date(departTime).toLocaleTimeString(navigator.language, { hour: '2-digit', minute: '2-digit' }) + ')')) + '' ); } popupThis.find($('.popup-bsTable')).after(''); @@ -415,9 +416,14 @@ var map = new L.map('map', { // reduce height of long descriptions if image exists if (popupThis.find($('.popup-longDesc')).length) popupThis.find($('.popup-longDesc')).css('--popup-long-desc-height', '150px'); setTimeout(function() { - popupThis.find($('.popup-imgContainer').each(function(i, element) { if (!popupThis.find($(element).find('.attribd')).length) getWikiAttrib(popupThis.find($(element))); })); - }, 500); - $('.popup-imgContainer img') + popupThis.find($('.popup-imgContainer').each(function(i, element) { + // dynamically load images and attribution + $(element).find('img').attr('src', $(element).find('a').attr('href') + ($(element).find('a').data('srcset') ? '&width=' + imgSize : '')); + if (!popupThis.find($(element).find('.attribd')).length) getWikiAttrib(popupThis.find($(element))); + //map._layers[osmId].setPopupContent(popupThis.find('.leaflet-popup-content').html()); + })); + }, 200); + popupThis.find($('.popup-imgContainer img')) .on('swiperight', function() { navImg(0); }) .on('swipeleft', function() { navImg(1); }) .on('wheel', function(e) { @@ -431,20 +437,20 @@ var map = new L.map('map', { popupThis.find($('.popup-imgContainer').css('pointer-events', 'none')); popupThis.find($('.popup-imgAttrib')).empty(); }); - $('.popup-imgContainer, .navigateItem') + popupThis.find($('.popup-imgContainer, .navigateItem')) .on('dragstart', false) .on('selectstart', false); - $('#img0 img') + popupThis.find($('#img0 img')) .on('load', function() { // stop placeholder images from being zoomed if (popupThis.find($('.popup-imgContainer img')).attr('src').indexOf('000placehldr') >= 0) popupThis.find($('.popup-imgContainer').css('pointer-events', 'none')); popupThis.find($('.popup-imgContainer img')).attr('alt', 'Image of ' + popupThis.find($('.popup-header h3')).text()); // add padding on attribution for navigation buttons - if (popupThis.find($('.navigateItem')).length) popupThis.find($('.popup-imgAttrib')).css('padding-right', 20*$('.navigateItem i:visible').length + 'px'); + if (popupThis.find($('.navigateItem')).length) popupThis.find($('.popup-imgAttrib')).css('padding-right', 20*popupThis.find($('.navigateItem i:visible')).length + 'px'); if (e.popup.options.autoPan && map.getBounds().contains(e.popup._latlng)) e.popup._adjustPan(); }); } - // panorama and video attribution + // photosphere and video attribution $('.pano, .vid').each(function(i, element) { $(element).data('caption', 'Wikimedia Commons'); }); @@ -584,8 +590,8 @@ function reverseQuery(e, singlemapclick) { var wgs84 = new GT_WGS84(); wgs84.setDegrees(e.latlng.lat, e.latlng.lng); var osgb = wgs84.getOSGB(); - var landRegUrl = 'https://eservices.landregistry.gov.uk/eservices/FindAProperty/view/MapEnquiryRadiusSearch.do?findPropertiesGroup=on&radius=5&mapType=r&ukMapX=' + osgb.eastings + '&ukMapY=' + osgb.northings + '&zoomLevel=' + map.getZoom(); - msgStatusBody += '
Land Registry Lookup'; + var landRegUrl = 'https://eservices.landregistry.gov.uk/eservices/FindAProperty/view/MapEnquiryRadiusSearch.do?findPropertiesGroup=on&radius=5&mapType=r&ukMapX=' + osgb.eastings + '&ukMapY=' + osgb.northings + '&zoomLevel=' + map.getZoom() + '#LL_DataServer'; + msgStatusBody += '
Land Registry Lookup '; } setMsgStatus(msgStatusIcon, msgStatusHead, msgStatusBody); // move click location to address location on hover @@ -638,7 +644,7 @@ function fixMyStreet(e) { popupWindow('https://osm.fixmystreet.com/around?zoom=4&latitude=' + e.latlng.lat + '&longitude=' + e.latlng.lng, 'fmsWindow', 1024, 768); } function panoView(e, fromSequence) { - // tries to find panoramic photos from Mapillary, if none default to Google + // tries to find photospheres from Mapillary, if none default to Google var mpllryRad = fromSequence ? 30 : 15; $('.spinner').show(); $.ajax({ @@ -799,7 +805,15 @@ $('#tourList').change(function() { $(this).fadeIn(); $(this).contents().find('sup').click(function() { tourRef(tourVal, this.innerText); }); $(this).contents().find('sup').attr('title', 'View reference'); - $(this).contents().find('img').not('h3 img').off('click').click(function() { $.fancybox.open([{ src: $(this)[0].currentSrc, caption: $(this).attr('alt') }]); }); + $(this).contents().find('img').not('h3 img').off('click').click(function() { + // create fancybox gallery from iframe images + var currentSrc = $(this)[0].currentSrc; + $.fancybox.open({ src: currentSrc, type: 'image', opts: { caption: $(this).attr('alt'), beforeLoad: function() { + if ($.fancybox.getInstance().firstRun) $.each($('#tourFrame').contents().find('img').not('h3 img'), function() { + if (this.src !== currentSrc) $.fancybox.getInstance().addContent({ src: this.src, caption: this.alt }); + }); + }}}); + }); $('#tourControls').children().prop('disabled', false); }); permalinkSet(); @@ -846,33 +860,39 @@ function setLeaflet() { bosm: { name: 'Bexhill-OSM', url: 'https://api.mapbox.com/styles/v1/drmx/cjyfrglvo1v3c1cqqlcvzyd07/tiles/256/{z}/{x}/{y}@2x?access_token=' + BOSM.mapboxKey, - attribution: attribution + ', MapBox' + attribution: attribution + ', MapBox', + className: 'layerDark' }, osmstd: { name: 'OpenStreetMap', url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - maxNativeZoom: 19 + maxNativeZoom: 19, + className: 'layerDark' }, general: { name: 'General Purpose', url: 'https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png', attribution: attribution + ', HOTOSM', - maxNativeZoom: 20 + maxNativeZoom: 20, + className: 'layerDark' }, osmuk: { name: 'OpenStreetMap UK', url: 'https://map.atownsend.org.uk/hot/{z}/{x}/{y}.png', - attribution: attribution + ', Andy Townsend' + attribution: attribution + ', Andy Townsend', + className: 'layerDark' }, cycle: { name: 'OpenCycleMap', url: 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + BOSM.thuforKey, - attribution: attribution + ', ThunderForest' + attribution: attribution + ', ThunderForest', + className: 'layerDark' }, trnsprt: { name: 'Public Transport', url: 'https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + BOSM.thuforKey, - attribution: attribution + ', ThunderForest' + attribution: attribution + ', ThunderForest', + className: 'layerDark' }, bing: { name: 'Bing Aerial', @@ -892,7 +912,7 @@ function setLeaflet() { maxZoom: map.getMaxZoom(), maxNativeZoom: tileBaseLayer[tile].maxNativeZoom, errorTileUrl: tileBaseLayer[tile].errorTileUrl, - className: 'baselayer' + className: tileBaseLayer[tile].className || '' }; if (tileBaseLayer[tile].quadkey) tileBaseLayers[tileBaseLayer[tile].name] = new L.TileLayer.QuadKeyTileLayer(tileBaseLayer[tile].url, bOptions); else tileBaseLayers[tileBaseLayer[tile].name] = L.tileLayer(tileBaseLayer[tile].url, bOptions); @@ -902,12 +922,6 @@ function setLeaflet() { } // overlays, set an offset by using metres (offset: [left, top]) tileOverlayLayer = { - osm2012: { - name: 'OpenStreetMap 2012', - url: 'http://map.fosm.org/default/{z}/{x}/{y}.png', - opacity: 1, - hide: 1 - }, lidar: { name: 'Lidar DTM 2m', url: 'https://environment.data.gov.uk/spatialdata/lidar-composite-digital-surface-model-dtm-2m/wms', @@ -920,33 +934,7 @@ function setLeaflet() { opacity: 0.8, className: 'layerLidar' }, -/* prow: { - name: 'Rights of Way', - url: 'http://inspire.misoportal.com:80/geoserver/east_sussex_county_council_east_sussex_rights_of_way/ows?resid=8886ba7d-a785-470d-be18-3e425', - wms: { - layers: 'east_sussex_county_council_east_sussex_rights_of_way', - format: 'image/png', - transparent: true - }, - attribution: 'East Sussex County Council', - opacity: 1, - maxNativeZoom: 18, - className: 'layerProw' - }, landreg: { - name: 'Land Registry', - url: 'http://inspire.landregistry.gov.uk/inspire/ows', - wmsOverlay: { - layers: 'inspire:CP.CadastralParcel', - format: 'image/png', - transparent: true - }, - attribution: 'HM Land Registry', - opacity: 0.7, - minZoom: 17, - offset: [1, 1.5] - }, -*/ landreg: { name: 'Land Registry', url: 'https://tiles.osmuk.org/PropertyBoundaries/{z}/{x}/{y}.png', attribution: 'HM Land Registry', @@ -954,7 +942,18 @@ function setLeaflet() { minNativeZoom: 18, maxNativeZoom: 20, minZoom: 16, - offset: [-1, 1], + offset: [-1, 1] + }, + tpo: { + name: 'Tree Preservation Orders', + url: 'https://policiesmap.rother.gov.uk/geoserver/re/wms', + wms: { + layers: 're:Tree_Preservation_Orders', + format: 'image/png', + transparent: true + }, + attribution: 'Rother District Council', + opacity: 1 }, bing: { name: 'Bing Aerial', @@ -967,13 +966,21 @@ function setLeaflet() { offset: [2, 3] }, // historic + osm2012: { + name: 'OpenStreetMap 2012', + url: 'https://map.fosm.org/default/{z}/{x}/{y}.png', + opacity: 1, + hide: 1, + className: 'layerNoclick' + }, bm1975: { name: '1975 Aerial (coast)', url: 'https://tiles.bexhillheritage.org.uk/bm1975/{z}/{x}/{y}.png', attribution: 'Meridian Airmaps Ltd, Bexhill Museum', bounds: LBounds, opacity: 1, - maxNativeZoom: 18 + maxNativeZoom: 18, + className: 'layerNoclick' }, bm1967: { name: '1967 Aerial', @@ -981,7 +988,8 @@ function setLeaflet() { attribution: 'BKS Surveys, Bexhill Museum', bounds: LBounds, opacity: 1, - maxNativeZoom: 18 + maxNativeZoom: 18, + className: 'layerNoclick' }, os1962: { name: '1962 Ordnance Survey', @@ -990,7 +998,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 16, - offset: [5, 3] + offset: [5, 3], + className: 'layerNoclick' }, br1959: { name: '1959 Aerial (west branch)', @@ -998,7 +1007,8 @@ function setLeaflet() { attribution: 'British Rail, Michael Pannell', bounds: L.latLngBounds([50.83722, 0.45732], [50.8907, 0.5134]), opacity: 1, - maxNativeZoom: 18 + maxNativeZoom: 18, + className: 'layerNoclick' }, os1955: { name: '1955 Ordnance Survey', @@ -1007,7 +1017,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 19, - offset: [1, 1] + offset: [1, 1], + className: 'layerNoclick' }, bm1946: { name: '1946 Aerial (p.levels)', @@ -1017,7 +1028,8 @@ function setLeaflet() { opacity: 1, minNativeZoom: 14, maxNativeZoom: 18, - hide: 1 + hide: 1, + className: 'layerNoclick' }, arp1942: { name: '1942 Air Raid Precautions', @@ -1026,7 +1038,8 @@ function setLeaflet() { bounds: L.latLngBounds([50.8292, 0.4157], [50.8713, 0.5098]), opacity: 1, maxNativeZoom: 18, - hide: 1 + hide: 1, + className: 'layerNoclick' }, ob1944: { name: '1944 Observer Bomb Map', @@ -1034,7 +1047,8 @@ function setLeaflet() { bounds: L.latLngBounds([50.826, 0.411], [50.878, 0.508]), opacity: 1, maxNativeZoom: 16, - hide: 1 + hide: 1, + className: 'layerNoclick' }, os1930: { name: '1930 Ordnance Survey', @@ -1043,7 +1057,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 17, - offset: [-2, -2] + offset: [-2, -2], + className: 'layerNoclick' }, mc1925: { name: '1925 Maynards Chronicle', @@ -1052,7 +1067,8 @@ function setLeaflet() { bounds: L.latLngBounds([50.869, 0.417], [50.827, 0.509]), opacity: 1, maxNativeZoom: 17, - hide: 1 + hide: 1, + className: 'layerNoclick' }, os1909: { name: '1909 Ordnance Survey', @@ -1061,7 +1077,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 18, - offset: [2, 2] + offset: [2, 2], + className: 'layerNoclick' }, mt1902: { name: '1902 Motor Track', @@ -1071,7 +1088,8 @@ function setLeaflet() { opacity: 1, minNativeZoom: 12, maxNativeZoom: 19, - hide: 1 + hide: 1, + className: 'layerNoclick' }, os1899: { name: '1899 Ordnance Survey', @@ -1080,7 +1098,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 17, - offset: [7, 2] + offset: [7, 2], + className: 'layerNoclick' }, os1878: { name: '1878 Ordnance Survey', @@ -1089,7 +1108,8 @@ function setLeaflet() { bounds: LBounds, opacity: 1, maxNativeZoom: 16, - offset: [5, -7] + offset: [5, -7], + className: 'layerNoclick' }, os1873: { name: '1873 Ordnance Survey', @@ -1097,7 +1117,8 @@ function setLeaflet() { attribution: 'Crown Copyright Ordnance Survey', bounds: LBounds, opacity: 1, - maxNativeZoom: 17 + maxNativeZoom: 17, + className: 'layerNoclick' }, bt1839: { name: '1839 Bexhill Tithe', @@ -1105,7 +1126,8 @@ function setLeaflet() { attribution: 'ESRO TDE 141', bounds: L.latLngBounds([50.815, 0.351], [50.890, 0.536]), opacity: 1, - maxNativeZoom: 17 + maxNativeZoom: 17, + className: 'layerNoclick' }, mb1805: { name: '1805 Manor of Bexhill', @@ -1113,7 +1135,8 @@ function setLeaflet() { attribution: 'ESRO AMS 5819', bounds: L.latLngBounds([50.805, 0.376], [50.883, 0.511]), opacity: 1, - maxNativeZoom: 17 + maxNativeZoom: 17, + className: 'layerNoclick' }, yg1778: { name: '1778 Yeakell & Gardner', @@ -1121,13 +1144,15 @@ function setLeaflet() { attribution: 'University of Portsmouth', bounds: L.latLngBounds([50.810, 0.320], [50.890, 0.631]), opacity: 1, - maxNativeZoom: 15 + maxNativeZoom: 15, + className: 'layerNoclick' }, xmas: { name: 'Xmas Snow', url: 'tour/itemXmas/overlay-snow.gif', opacity: 0.75, - hide: 1 + hide: 1, + className: 'layerNoclick' } }; for (tile in tileOverlayLayer) { @@ -1267,12 +1292,12 @@ var fcnStLvl = L.easyButton({ states: [{ stateName: 'offStLvl', icon: 'fas fa-street-view', - title: 'Panoramic views', + title: 'Photosphere views', onClick: function() { tour('pano'); } }, { stateName: 'onStLvl', icon: 'fas fa-street-view', - title: 'Panoramic Views', + title: 'Photosphere views', onClick: function() { zoom_area(); if ($(window).width() >= 1300) $('.sidebar-close:visible').click(); @@ -1280,8 +1305,7 @@ var fcnStLvl = L.easyButton({ }] }).addTo(map); -// bookmarks bypass poi filter with oQuery -var oQuery = false; +// bookmarks L.easyButton({ id: 'btnBookm', states: [{ @@ -1290,7 +1314,6 @@ L.easyButton({ onClick: function() { if (window.localStorage.favourites) { clear_map('markers'); - oQuery = true; show_overpass_layer('(' + window.localStorage.favourites + ');'); } else setMsgStatus('fas fa-info-circle', 'Bookmarks', 'Add your favourite places by clicking within a popup.', 1); @@ -1299,7 +1322,7 @@ L.easyButton({ }).addTo(map); $('#btnBookm').bind('contextmenu', function() { if (window.localStorage && window.localStorage.favourites) { - var bmlink = encodeURI(window.location.origin + '?data=(' + window.localStorage.favourites +')'); + var bmlink = encodeURI((window.location.origin === 'null' ? window.location.pathname : window.location.origin) + '?data=(' + window.localStorage.favourites +')'); navigator.clipboard.writeText(bmlink).then( function() { setMsgStatus('fas fa-copy', 'Clipboard', 'Bookmarks permalink copied successfully.

' + bmlink + '

', 1); }, function() { setMsgStatus('fas fa-exclamation-triangle', 'Clipboard Error', 'Could not copy bookmark permalink.', 1); } @@ -1582,11 +1605,11 @@ $('#devTools').accordion({ animate: 150, collapsible: true, active: $('#inputDebug').is(':checked') ? 0 : false, - activate: function(event, ui) { if (ui.oldPanel[0]) $('#inputDebug').prop('checked', false).trigger('change'); } + activate: function(event, ui) { if (ui.oldPanel[0]) $('#inputOverpass, #inputAttic').val(''); } }); $('#inputDebug').change(function() { if ($(this).is(':checked')) { - setMsgStatus('fas fa-bug', 'Debug Mode Enabled', 'Check web console for output for details.', 1); + setMsgStatus('fas fa-bug', 'Debug Mode Enabled', 'Check web console for output for details.', 1); console.debug('%cDEBUG MODE%c\nAPI requests output to console, map bounds unlocked, custom queries available.', 'color: ' + $('html').css('--main-color') + ';font-weight:bold;'); $('#devTools').accordion({ collapsible: false }); $('.sidebar-tabs ul li [href="#settings"] .sidebar-notif').show(); @@ -1596,7 +1619,6 @@ $('#inputDebug').change(function() { else { $('#devTools').accordion({ collapsible: true }); $('.sidebar-tabs ul li [href="#settings"] .sidebar-notif').hide(); - $('#inputOverpass, #inputAttic').val(''); map.setMaxBounds(LBounds.pad(0.5)); map.options.minZoom = mapMinZoom; } @@ -1615,20 +1637,21 @@ $('#inputOverpass').keydown(function(e) { } }); function customQuery(q) { - if (!$('#inputDebug').is(':checked')) $('#inputDebug').prop('checked', true).trigger('change'); - if (q.charAt(0) === '[' && q.charAt(q.length-1) === ']') show_overpass_layer('(nw' + q + ';);', '', true); + spinner++; + if (q.charAt(0) === '[' && q.charAt(q.length-1) === ']') show_overpass_layer('(nwr' + q + ';);', '', true); else if (q.charAt(0) === '(' && q.charAt(q.length-1) === ')') show_overpass_layer(q + ';', '', true); - else setMsgStatus('fas fa-info-circle', 'Incorrect query', 'Enclose queries with [ ] for tags,
and ( ) for element ids.', 1); + else setMsgStatus('fas fa-info-circle', 'Incorrect query', 'Enclose queries with [ ] for tags,
and ( ) for element ids.', 1); } -$('#inputAttic').change(function() { if ($(this).val() && !$('#inputDebug').is(':checked')) $('#inputDebug').prop('checked', true).trigger('change'); }); -function exportQuery() { +$('#exportQuery').click(function() { // https://wiki.openstreetmap.org/wiki/Overpass_turbo/Development - if (queryBbox) window.open('https://overpass-turbo.eu/?Q=' + encodeURIComponent(queryBbox.replace('json]', 'xml]') + '(._;>;);out meta;') + '&C=' + mapCentre.join(';') + ';' + mapZoom + '&R', '_blank'); + if (queryBbox) window.open('https://overpass-turbo.eu/?Q=' + encodeURIComponent(queryBbox.replace('json]', 'xml]') + 'out geom qt;') + '&C=' + mapCentre.join(';') + ';' + mapZoom + '&R', '_blank'); else setMsgStatus('fas fa-info-circle', 'Nothing to export', 'Please select a query.', 1); -} -function downloadBB() { +}); +$('#downloadBB').click(function() { window.location = 'https://' + $('#inputOpServer').val() + '/api/map?bbox=' + [mapBounds.west, mapBounds.south, mapBounds.east, mapBounds.north].join(','); -} + $('#downloadBB').prop('disabled', true); + setTimeout(function() { $('#downloadBB').prop('disabled', false); }, 20000); +}); // clear layers function clear_map(layer) { @@ -1760,8 +1783,8 @@ function getTips(tip) { 'Get the latest Food Hygiene Ratings on every business in the area under Amenities.', 'Find your closest container and the materials it recycles under Amenities.', 'Have a look at our WW2 Incident Map under History .', - 'Some places have a panoramic view, click the icon to view it.', - 'Click the map control icon to see exclusive panoramic views of that street.', + 'Some places have a photosphere view, click the icon to view it.', + 'Click the map control icon to see exclusive photosphere views of that street.', 'View superimposed and colourised images of Bexhill past and present under Then and Now .', 'Notice something wrong or missing on the map? Right-click the area and Leave a note.', ' Over 1,100 photos, 20,000 buildings and 250 miles of roads/paths within 15 miles² have been mapped thus far!', @@ -1887,11 +1910,11 @@ function showEditFeed() { } // M = basemap, O = overlay, OP = overlay opacity, S = settings, T = tab, U = tour frame, G = image layer, P = grouped pois, I = single poi, W = walkpoints -// search = geocode query, data = overpass query, loc = location on +// QG = geocode query, QO = overpass query, QL = location query function permalinkSet() { // get clean url without parameters and hash var uri = new URL(window.location.href.split('?')[0].split('#')[0]); - var selectedPois = '', walkCoords = '', settingChk, overlayOpacity, c; + var selectedPois = '', walkCoords = '', setChk, overlayOpacity, c; var walkWayp = routingControl ? routingControl.getWaypoints() : undefined; if (actTab !== defTab) uri.searchParams.set('T', actTab); if (actBaseTileLayer !== defBaseTileLayer) uri.searchParams.set('M', actBaseTileLayer); @@ -1909,16 +1932,17 @@ function permalinkSet() { if (actTab === 'tour' && $('#tourList option').eq(0).val() !== $('#tourList option:selected').eq(0).val()) uri.searchParams.set('U', $('#tourList option:selected').val()); $('.poi-checkbox input:checked').each(function(i, element) { selectedPois += element.id + '-'; }); if (selectedPois) uri.searchParams.set('P', selectedPois.slice(0, -1)); - if ($('#settings input[data="uri"]:checkbox:checked').length) { - settingChk = ''; - for (c = 0; c < $('#settings input[data="uri"]:checkbox').length; c++) settingChk += $('#settings input[data="uri"]:checkbox').eq(c).is(':checked') ? '1' : '0'; - uri.searchParams.set('S', settingChk); + else if (queryBbox && queryBbox.indexOf($('#inputOverpass').val()) > 0) uri.searchParams.set('QO', $('#inputOverpass').val()); + if ($('#settings input[data-uri]:checkbox:checked').length) { + setChk = ''; + for (c = 0; c < $('#settings input[data-uri]:checkbox').length; c++) setChk += $('#settings input[data-uri]:checkbox').eq(c).is(':checked') ? '1' : '0'; + uri.searchParams.set('S', setChk); } if (noIframe && window.localStorage) { - window.localStorage.settingChk = ''; - for (c = 0; c < $('#settings input[data="cache"]:checkbox').length; c++) window.localStorage.settingChk += $('#settings input[data="cache"]:checkbox').eq(c).is(':checked') ? '1' : '0'; + window.localStorage.setChk = ''; + for (c = 0; c < $('#settings input[data-cache]:checkbox').length; c++) window.localStorage.setChk += $('#settings input[data-cache]:checkbox').eq(c).is(':checked') ? '1' : '0'; } - if (markerId && !actImgLayer) uri.searchParams.set('I', markerId); + if (markerId && !(rQuery && actImgLayer) && !$('#inputAttic').val()) uri.searchParams.set('I', markerId); window.history.replaceState(null, null, uri + window.location.hash); } function permalinkReturn() { @@ -1929,7 +1953,7 @@ function permalinkReturn() { window.history.replaceState(null, null, '?' + junkQ.slice(0, 2)[1]); } // check cookies for settings - if (noIframe && window.localStorage && window.localStorage.settingChk) for (c = 0; c < window.localStorage.settingChk.length; c++) $('#settings input[data="cache"]:checkbox').eq(c).prop('checked', parseInt(window.localStorage.settingChk.charAt(c), 10)); + if (noIframe && window.localStorage && window.localStorage.setChk) for (c = 0; c < window.localStorage.setChk.length; c++) $('#settings input[data-cache]:checkbox').eq(c).prop('checked', parseInt(window.localStorage.setChk.charAt(c), 10)); else if (noIframe && window.matchMedia("(prefers-color-scheme: dark)").matches) $('#inputDark').prop('checked', true); $('#inputDark').trigger('change'); if (!noPermalink) { @@ -1940,8 +1964,8 @@ function permalinkReturn() { if (uri.has('OP')) tileOverlayLayers[tileOverlayLayer[actOverlayLayer].name].setOpacity(uri.get('OP') / 100); } if (uri.has('S')) { - var settingChk = uri.get('S'); - for (c = 0; c < settingChk.length; c++) $('#settings input[data="uri"]:checkbox').eq(c).prop('checked', parseInt(settingChk.charAt(c), 10)); + var setChk = uri.get('S'); + for (c = 0; c < setChk.length; c++) $('#settings input[data-cache]:checkbox').eq(c).prop('checked', parseInt(setChk.charAt(c), 10)); if ($('#inputDebug').is(':checked')) $('#inputDebug').trigger('change'); } $('#inputUnit').trigger('change'); @@ -1974,17 +1998,19 @@ function permalinkReturn() { poi_changed(groupedPoi); }, 500); } + else if (uri.has('QO')) { + $('#inputOverpass').val(decodeURIComponent(uri.get('QO'))); + customQuery(decodeURIComponent(uri.get('QO'))); + if (uri.has('I')) markerId = uri.get('I'); + $('#devTools').accordion({ active: 0 }); + } else if (uri.has('I')) { var singlePoi = uri.get('I'); rQuery = true; setTimeout(function() { show_overpass_layer(elementType(singlePoi) + '(' + singlePoi.slice(1) + ');', singlePoi.toUpperCase()); }, 500); } - else if (uri.has('search')) searchAddr(decodeURIComponent(uri.get('search'))); - else if (uri.has('data')) { - $('#inputOverpass').val(decodeURIComponent(uri.get('data'))); - customQuery(decodeURIComponent(uri.get('data'))); - } - if (uri.has('loc')) setTimeout(function() { lc.start(); }, 500); + else if (uri.has('QG')) searchAddr(decodeURIComponent(uri.get('QG'))); + if (uri.has('QL')) setTimeout(function() { lc.start(); }, 500); } else { $('#inputUnit').trigger('change'); diff --git a/web/assets/js/tags-parsers.js b/web/assets/js/tags-parsers.js index 46a50ab..d445e2d 100644 --- a/web/assets/js/tags-parsers.js +++ b/web/assets/js/tags-parsers.js @@ -4,13 +4,13 @@ var spinner = 0, markerId, ohState, ctState, poiList = []; function parse_tags(element, titlePopup, poiParser) { var eName = element.tags['name:en'] || element.tags.name || undefined; if (eName && element.tags.ref) eName += ' (' + element.tags.ref + ')'; - var markerPopup = generic_header_parser((eName || element.tags.ref), titlePopup, element.tags['fhrs:id'], true); + var markerPopup = ''; // global callback parsers var address_parser = function(tags) { markerPopup = ''; if (tags['addr:street'] || tags['addr:place']) { var addr = ''; - if (tags.level <= 10) addr += '' + ['Ground', 'First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth'][tags.level] + '-floor, '; + if (tags.level > 0 && tags.level <= 10) addr += '' + ['Ground', 'First', 'Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth'][tags.level] + '-floor, '; if (tags['addr:unit']) addr += 'Unit ' + tags['addr:unit'] + ', '; if (tags['addr:flats']) addr += 'Flats ' + tags['addr:flats'] + ', '; if (tags['addr:housename'] && tags['addr:housename'] !== eName) addr += '' + tags['addr:housename'] + ', '; @@ -101,14 +101,18 @@ function parse_tags(element, titlePopup, poiParser) { markerPopup = ''; if (tags.disused === 'yes') tag += ''; if (tags.indoor === 'yes') tag += ''; - if (tags.wheelchair === 'yes') tag += ''; - else if (tags.wheelchair === 'limited') tag += ''; - else if (tags.wheelchair === 'no') tag += ''; - if (tags.elevator === 'yes') tag += ''; + if (tags.wheelchair === 'yes') tag += ''; + else if (tags.wheelchair === 'limited') tag += ''; + else if (tags.wheelchair === 'no') tag += ''; + if (tags.blind === 'yes') tag += ''; + else if (tags.blind === 'limited') tag += ''; + else if (tags.blind === 'no') tag += ''; + if (tags.elevator === 'yes') tag += ''; if (tags['hearing_impaired:induction_loop'] === 'yes') tag += ''; if (tags['tactile_writing:braille'] === 'yes') tag += ''; - if (tags.dog === 'yes') tag += ''; - else if (tags.dog === 'no') tag += ''; + if (tags.dog === 'yes') tag += ''; + else if (tags.dog === 'no') tag += ''; + else if (tags.dog === 'leashed') tag += ''; if (tags.internet_access === 'wlan') tag += ''; else if (tags.internet_access === 'terminal') tag += ''; if (tags['drinking_water:refill'] === 'yes') tag += ''; @@ -252,7 +256,7 @@ function parse_tags(element, titlePopup, poiParser) { dataType: 'xml', cache: true, success: function(xml) { - var street = $(xml).find('name').filter(function() { return $(this).text() === tags.name; }).closest('street'); + var street = $(xml).find('name').filter(function() { return ($(this).text() === tags.name || $(this).text() === tags.alt_name); }).closest('street'); var streetDate = $('date', street).text(); var streetDesc = $('desc', street).text(); if (streetDate && !tags.start_date) markerPopup += L.Util.template(tagTmpl, { tag: 'Start date', value: streetDate, iconName: 'fas fa-calendar-alt' }); @@ -266,6 +270,7 @@ function parse_tags(element, titlePopup, poiParser) { }, error: function() { if ($('#inputDebug').is(':checked')) console.debug('ERROR STREET-NAMES:', encodeURI(this.url)); } }); + if (tags.access === 'private') tag += 'private; '; if (tags.unadopted === 'yes') tag += 'unadopted; '; if (tags.surface) tag += tags.surface + '; '; if (tags.maxspeed) tag += tags.maxspeed + '; '; @@ -289,14 +294,14 @@ function parse_tags(element, titlePopup, poiParser) { var w = tags.wikipedia || tags['site:wikipedia']; tag += 'Wikipedia; '; } - if (tags['url:bexhillnature']) - tag += 'Bexhill Nature; '; + if (tags['ref:esher']) + tag += 'ESHER; '; if (tags['ref:publicsculpturesofsussex']) tag += 'Public Sculptures; '; if (tags['url:bexhillhistorytrail']) tag += 'History Trail; '; - if (tags['ref:thekeep']) - tag += 'The Keep; '; + if (tags['url:bexhillnature']) + tag += 'Bexhill Nature; '; if (tags['ref:edubase']) tag += 'URN ' + tags['ref:edubase'] + '; '; if (tags['ref:charity']) @@ -415,7 +420,7 @@ function parse_tags(element, titlePopup, poiParser) { ohState = oh.getState(); if (oh.getUnknown()) { ohState = (oh.getComment(new Date()) && oh.getNextChange() !== undefined) ? true : 'depends'; - strNextChange = comment; + strNextChange = '"' + comment + '"'; } else strNextChange = oh.prettifyValue(); if (oh.getNextChange()) { @@ -440,14 +445,14 @@ function parse_tags(element, titlePopup, poiParser) { if (comment) strNextChange += ' (' + comment + ')'; } // create readable table - var ohTable = drawTable(oh, new Date()), minWidth = ohTable ? '270px' : '100px'; - if (tags.opening_hours.indexOf('PH ') === -1) ohTable += '
Holiday periods may differ.
'; + var ohTable = drawTable(oh, new Date()); + if (tags.opening_hours.indexOf('PH ') === -1 && ohTable) ohTable += '
Holiday periods may differ.
'; // show tag and collapsible accordion if (ohState === true) openhrsState = 'Open until'; else if (ohState === false) openhrsState = 'Closed until'; else if (ohState === 'depends') openhrsState = 'Depends on'; if (openhrsState) { markerPopup = - '