geo plugin updates (#117)

* fixed regex to detect pasted negative coordinates (e.g. -0.4454 54.2215)

* osm.js fix

* updated to openlayers v6.5.0

* updated event_osm to v0.3.3

Co-authored-by: surrim <surrim@happyhydro.org>
This commit is contained in:
surrim 2021-01-01 11:58:45 +01:00 committed by GitHub
parent d76337e697
commit 7804bd3790
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 6 deletions

View file

@ -354,7 +354,7 @@ class serendipity_event_geotag extends serendipity_event
function paste(event) {
if (Math.abs(this.selectionEnd - this.selectionStart) === this.value.length) {
const geo = event.clipboardData.getData('text/plain');
const found = geo.match(/^\s*(\d+(\.\d+))\s*[ ,/]\s*(\d+(\.\d+)?)\s*$/);
const found = geo.match(/^\s*([+-]?([0-9]+([.][0-9]*)?|[.][0-9]+))\s*[ ,\/]\s*([+-]?([0-9]+([.][0-9]*)?|[.][0-9]+))\s*$/);
if (found !== null) {
this.value = found[1];
document.getElementById(this.id === "properties_geo_lat" ? "properties_geo_long" : "properties_geo_lat").value = found[3];

View file

@ -1,3 +1,9 @@
0.3.3:
---
* OpenLayers updated to v6.5.0
* Fixed JavaScript bug with category ids
0.3.2:
---

View file

@ -1,4 +1,4 @@
<?php
@define('PLUGIN_EVENT_OSM_VERSION', '0.3.2');
@define('PLUGIN_EVENT_OSM_VERSION', '0.3.3');
@define('PLUGIN_EVENT_OSM_AUTHOR', 'Martin Sewelies');
?>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,7 @@ window.addEventListener("load", () => {
});
const data = divMap.dataset;
const entries = geo.entries.filter(x => ["all", "none"].includes(data.category) || x.categories.includes(data.category));
const entries = geo.entries.filter(x => ["all", "none"].includes(data.category) || x.categories.includes(parseInt(data.category)));
const uploads = geo.uploads.filter(x => data.path.split("\n").some(y => x.url.startsWith(y)));
const features = entries.map((entry, id) => {
const feature = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(entry.pos.reverse())));