webgpsmap: load extern resources over https, show current position on https context (for self hosted/offlinemap)

This commit is contained in:
xenDE 2020-01-18 16:46:35 +01:00 committed by GitHub
parent 0764304be9
commit c5d6f6d362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,10 +3,10 @@
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/xml; charset=utf-8" />
<title>GPS MAP</title> <title>GPS MAP</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"/> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"/>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.css" /> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.css" />
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css" /> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css" />
<script type='text/javascript' src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script> <script type='text/javascript' src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script type='text/javascript' src='http://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/leaflet.markercluster.js'></script> <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/leaflet.markercluster.js'></script>
<style type="text/css"> <style type="text/css">
/* for map */ /* for map */
html, body { height: 100%; width: 100%; margin:0; background-color:#000;} html, body { height: 100%; width: 100%; margin:0; background-color:#000;}
@ -270,7 +270,8 @@
positionsLoaded = true; positionsLoaded = true;
drawPositions(); drawPositions();
}); });
// get current position and set marker in interval // get current position and set marker in interval if https request
if (location.protocol === 'https:') {
var myLocationMarker = {}; var myLocationMarker = {};
function onLocationFound(e) { function onLocationFound(e) {
if (myLocationMarker != undefined) { if (myLocationMarker != undefined) {
@ -281,5 +282,6 @@
} }
mymap.on('locationfound', onLocationFound); mymap.on('locationfound', onLocationFound);
mymap.locate({setView: true}); mymap.locate({setView: true});
}
</script> </script>
</body></html> </body></html>