From: Anthony Talarico Date: Tue, 22 Oct 2019 13:10:04 +0000 (-0400) Subject: inital commit X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;p=WP-Plugins%2Fglm-leaflet-theme.git inital commit --- 59a9039a59a7e18638a3a1efe9f0d78ce3fe4731 diff --git a/glm-leaflet-theme.php b/glm-leaflet-theme.php new file mode 100644 index 0000000..851fb4b --- /dev/null +++ b/glm-leaflet-theme.php @@ -0,0 +1,41 @@ + 'glm-leaflet-container'), $atts); + $out = '
'; + + return $out; + } +} +add_shortcode('glm-leaflet-theme', 'glm_leaflet_theme'); + +function glm_enqueue_leaflet(){ + global $post; + if(has_shortcode($post->post_content,'glm-leaflet-theme')){ + wp_enqueue_style('glm-leaflet-style', "https://unpkg.com/leaflet@1.3.3/dist/leaflet.css"); + wp_enqueue_script('glm-leaflet', "https://unpkg.com/leaflet@1.3.3/dist/leaflet.js"); + + wp_enqueue_style('glm-leaflet-gesture-style', "//unpkg.com/leaflet-gesture-handling/dist/leaflet-gesture-handling.min.css"); + wp_enqueue_script('glm-leaflet-gesture', "//unpkg.com/leaflet-gesture-handling"); + wp_enqueue_style('glm-leaflet-map-style', plugin_dir_url(__FILE__).'glm-map-style.css', '1.0.0',true); + wp_enqueue_script('glm-leaflet-map', plugin_dir_url(__FILE__).'glm-map.js', array('jquery'), '1.0.0',true); + } +} +add_action('wp_enqueue_scripts', 'glm_enqueue_leaflet'); \ No newline at end of file diff --git a/glm-map-style.css b/glm-map-style.css new file mode 100644 index 0000000..cbf9a0d --- /dev/null +++ b/glm-map-style.css @@ -0,0 +1,3 @@ +#glm-leaflet-container{ + height: 500px; +} \ No newline at end of file diff --git a/glm-map.js b/glm-map.js new file mode 100644 index 0000000..aeef261 --- /dev/null +++ b/glm-map.js @@ -0,0 +1,173 @@ +jQuery(function($){ + var leafletMap; + function initMap() { + + // var distancePath = new google.maps.Polyline(); + + // Styles a map in night mode. + + leafletMap = L.map('glm-leaflet-container', { + center: [45.431962, -84.990662], + zoom: 12, + // scrollWheelZoom: false,java + gestureHandling: true + }); + leafletMap.on('zoomend', function() { + console.log(leafletMap.getZoom()) + if(leafletMap.getZoom() < 12){ + $(".glm-theme-map-label").hide() + }else{ + $(".glm-theme-map-label").show() + } + }); + // leafletMap.on('mouseover', function() { leafletMap.scrollWheelZoom.enable(); }); + + var leafletTileServer = 'https://maps.gaslightmedia.com/08172018-4c95c314f0934e680190f27ef99c6dcc/{z}/{x}/{y}.png'; + var leafletMinZoom = 3; + var leafletMaxZoom = 19; + + // Init Map + L.tileLayer(leafletTileServer, { + attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Gaslight Media', + minZoom: leafletMinZoom, + maxZoom: leafletMaxZoom, + id: 'nothot' + }).addTo(leafletMap); + + // add border around the downtown coordinates + var WestTraverse = [ + [45.478742, -85.091747], + [45.478468, -84.975119], + [ 45.438964, -84.975014], + [ 45.439205, -84.982389], + [ 45.442578, -84.982384], + [ 45.442821, -84.985474], + [ 45.439087, -84.985651], + [ 45.438974, -84.995437], + [ 45.435361, -84.996128], + [ 45.435007, -85.006085], + [ 45.431875, -85.006089], + [ 45.430674, -85.011754], + [ 45.432209, -85.016373], + [ 45.436567, -85.041560], + [ 45.478742, -85.091747] + ]; + var WestTraverse2 = [ + [45.425129, -84.990858], + [45.424235, -84.992283], + [ 45.422448, -84.993132], + [ 45.421554, -84.991252], + [ 45.421554, -84.989737], + [ 45.421448, -84.988979], + [ 45.421129, -84.987676], + [ 45.419831, -84.985463], + [ 45.419916, -84.984826], + [ 45.419299, -84.983523], + [ 45.419213, -84.982098], + [ 45.418553, -84.978764], + [ 45.418872, -84.977309], + [ 45.419468, -84.976733], + [ 45.420149, -84.977097], + [ 45.420319, -84.977438], + [ 45.420298, -84.977673], + [ 45.420107, -84.978612], + [ 45.420213, -84.979491], + [ 45.420128, -84.981189], + [ 45.420767, -84.984068], + [ 45.421767, -84.985341], + [ 45.423086, -84.987493], + [ 45.423980, -84.988463], + [ 45.424490, -84.990070], + [ 45.425129, -84.990858], + ]; + var LittleTraverse = [ + [45.464194, -84.975117], + [45.463556, -84.852660], + [ 45.422239, -84.853417], + [ 45.422857, -84.857617], + [ 45.421111, -84.862724], + [ 45.413400, -84.864484], + [ 45.413431, -84.914092], + [ 45.419624, -84.918171], + + [ 45.422417, -84.922754], + [ 45.427638, -84.955108], + [ 45.427420, -84.970904], + [ 45.429588, -84.970991], + [ 45.429528, -84.969188], + [ 45.431034, -84.969017], + [ 45.430794, -84.966098], + [ 45.431818, -84.965841], + [ 45.431697, -84.970734], + [ 45.435289, -84.970942], + + [ 45.435491, -84.974856], + [45.464194, -84.975117] + ]; + var harborSprings = []; + var geoCoords = [[-85.010767,45.431269],[-85.010582,45.431046],[-85.010328,45.430811],[-85.010128,45.430483],[-85.010413,45.430264],[-85.010503,45.430197],[-85.010365,45.430118],[-85.009822,45.429739],[-85.009434,45.429406],[-85.008783,45.429121],[-85.008502,45.428998],[-85.007045,45.428027],[-85.006712,45.427929],[-85.006047,45.42787],[-85.005885,45.427813],[-85.00548,45.4276],[-85.005018,45.427233],[-85.004776,45.426963],[-85.004444,45.426699],[-85.004233,45.426676],[-85.003794,45.426823],[-85.003648,45.426812],[-85.003437,45.426754],[-85.003226,45.426742],[-85.002967,45.426678],[-85.002634,45.426649],[-85.00239,45.426671],[-85.001805,45.426841],[-85.001481,45.426869],[-85.000636,45.42689],[-85.000425,45.426872],[-85.00028,45.42682],[-85.000003,45.426814],[-84.999726,45.426584],[-84.999265,45.426342],[-84.999014,45.426159],[-84.998562,45.425751],[-84.997261,45.424958],[-84.997034,45.42478],[-84.995077,45.423803],[-84.994729,45.423591],[-84.994681,45.423561],[-84.993623,45.422723],[-84.993219,45.422465],[-84.992305,45.424294],[-84.992112,45.424354],[-84.991874,45.424428],[-84.991534,45.42456],[-84.990835,45.425099],[-84.991053,45.425439],[-84.991206,45.42572],[-84.991188,45.426],[-84.990971,45.427155],[-84.990652,45.427738],[-84.990326,45.427949],[-84.989903,45.428119],[-84.989562,45.428164],[-84.989165,45.428123],[-84.988735,45.428225],[-84.988463,45.428258],[-84.987209,45.428415],[-84.987096,45.428232],[-84.986893,45.428271],[-84.986949,45.428512],[-84.9867468,45.4287413],[-84.986688,45.428808],[-84.986085,45.429207],[-84.985939,45.429276],[-84.985524,45.4294],[-84.985119,45.429399],[-84.985054,45.429319],[-84.985031,45.429107],[-84.984942,45.429021],[-84.984821,45.429026],[-84.98448,45.429123],[-84.984179,45.429173],[-84.983903,45.429201],[-84.983432,45.429291],[-84.983205,45.429308],[-84.983035,45.429279],[-84.982889,45.429193],[-84.98276,45.429164],[-84.982459,45.429277],[-84.982346,45.429226],[-84.982273,45.42922],[-84.982143,45.429305],[-84.982027,45.429625],[-84.981654,45.429676],[-84.981598,45.429584],[-84.981362,45.429623],[-84.981169,45.429297],[-84.980958,45.429302],[-84.980847,45.42897],[-84.980449,45.428928],[-84.980416,45.429014],[-84.980506,45.42902],[-84.980421,45.429678],[-84.979172,45.429611],[-84.979173,45.42944],[-84.978955,45.429342],[-84.978999,45.428684],[-84.978317,45.428745],[-84.97768,45.428851],[-84.977417,45.42884],[-84.977225,45.428842],[-84.976903,45.428831],[-84.976442,45.428835],[-84.975335,45.428319],[-84.973708,45.427628],[-84.973247,45.427529],[-84.97272,45.42747],[-84.972079,45.427366],[-84.971593,45.42733],[-84.971068,45.427389],[-84.971068,45.427644],[-84.971026,45.4297],[-84.969919,45.429647],[-84.969736,45.429638],[-84.969584,45.429624],[-84.969136,45.429592],[-84.969127,45.42974],[-84.969089,45.431045],[-84.966095,45.430859],[-84.966092,45.431693],[-84.966207,45.431702],[-84.967344,45.431611],[-84.970627,45.431757],[-84.971006,45.432393],[-84.970963,45.43401],[-84.970975,45.435304],[-84.971188,45.435312],[-84.971638,45.435329],[-84.972298,45.43533],[-84.97242,45.435311],[-84.972538,45.43526],[-84.972689,45.43515],[-84.972921,45.43524],[-84.973106,45.435287],[-84.973302,45.435321],[-84.973528,45.435344],[-84.975068,45.435379],[-84.97505,45.439102],[-84.978502,45.439084],[-84.9786,45.439083],[-84.980841,45.439087],[-84.982663,45.439051],[-84.982597,45.440426],[-84.982586,45.440848],[-84.982574,45.441284],[-84.982574,45.441306],[-84.982534,45.442804],[-84.98538,45.442779],[-84.985506,45.439068],[-84.990569,45.439072],[-84.991756,45.439475],[-84.993215,45.438793],[-84.994523,45.438857],[-84.995798,45.43877],[-84.995785,45.437946],[-84.995816,45.437027],[-84.995787,45.436138],[-84.995785,45.435262],[-84.998336,45.43524],[-84.9983636,45.4352398],[-85.00001,45.435226],[-85.000902,45.435215],[-85.003459,45.435212],[-85.004631,45.435205],[-85.005489,45.4352],[-85.005837,45.435212],[-85.006123,45.435221],[-85.006083,45.43157],[-85.006449,45.431561],[-85.006829,45.431516],[-85.006932,45.431501],[-85.007588,45.431438],[-85.007747,45.431439],[-85.007969,45.431449],[-85.008594,45.431504],[-85.009207,45.431227],[-85.009456,45.431147],[-85.010722,45.431396],[-85.010767,45.431269]].forEach( function(val, index){ + harborSprings.push(val.reverse()); + }) + + + + + + // var polyline = L.polyline(downtown, {color: '#91311D', weight: 2}).addTo(leafletMap); + // var polyline = L.polyline(LittleTraverse, {color: '#91311D', weight: 2}).addTo(leafletMap); + + var ltPolygon = L.polygon(LittleTraverse, {color: '#343434',weight: 1}).addTo(leafletMap); + ltPolygon.setStyle({fillColor: '#343434', fillOpacity: .03}); + + var wtPolygon = L.polygon(WestTraverse, {color: '#950000',weight: 1}).addTo(leafletMap); + wtPolygon.setStyle({fillColor: '#950000', fillOpacity: .03}); + + var wtPolygon2 = L.polygon(WestTraverse2, {color: '#950000',weight: 1}).addTo(leafletMap); + wtPolygon2.setStyle({fillColor: '#950000', fillOpacity: .1}); + + var harborSpringsCity = L.polygon(harborSprings,{color: '#02528F',weight: 1}).addTo(leafletMap); + harborSpringsCity.setStyle({fillColor: 'transparent', fillOpacity: .1}); + var ltbInfo = '
Little Traverse Bay is a small bay, 170 feet (55 m) deep, off Lake Michigan in the northern area of the Lower Peninsula of Michigan. The cities of Harbor Springs and Petoskey are located on this bay.
'; + "Little Traverse Bay is a small bay, 170 feet (55 m) deep, off Lake Michigan in the northern area of the Lower Peninsula of Michigan. The cities of Harbor Springs and Petoskey are located on this bay." + new L.Marker([45.406518, -84.948100], { + icon: new L.DivIcon({ + className: 'my-div-icon', + html: 'Little Traverse Bay' + }) + }).addTo(leafletMap).bindPopup(ltbInfo); + + // Lake Michigan + var lmInfo = '
Lake Michigan is one of the five Great Lakes of North America and the only one located entirely within the United States. The other four Great Lakes are shared by the U.S. and Canada. It is the second-largest of the Great Lakes by volume and the third-largest by surface area."
'; + new L.Marker([45.416413, -85.144117], { + icon: new L.DivIcon({ + className: 'my-div-icon', + html: 'Lake Michigan' + }) + }).addTo(leafletMap).bindPopup(lmInfo); + + var ltInfo = '
Little Traverse Township is a civil township of Emmet County in the U.S. state of Michigan. The population was 2,426 at the 2000 census."
'; + // Little Traverse Township + new L.Marker([45.437909, -84.966940], { + icon: new L.DivIcon({ + className: 'my-div-icon', + html: 'Little Traverse Township' + }) + }).addTo(leafletMap).bindPopup(ltInfo); + + // Harbor Springs + var info = '
Harbor Springs is a city and resort community in Emmet County in the U.S. state of Michigan. The population was 1,194 at the 2010 census. Harbor Springs is in a sheltered bay on the north shore of the Little Traverse Bay on Lake Michigan
'; + var marker = new L.marker([45.431962, -84.990662]).bindPopup(info); //opacity may be set to zero + marker.addTo(leafletMap); + + + // West Traverse Township + var ltInfo = '
West Traverse Township is a civil township of Emmet County in the U.S. state of Michigan. The population was 1,448 at the 2000 census."
'; + new L.Marker([45.442881, -85.029999], { + icon: new L.DivIcon({ + className: 'my-div-icon', + html: 'West Traverse Township' + }) + }).addTo(leafletMap).bindPopup(ltInfo); + } + initMap(); +}); \ No newline at end of file