Skip to content

Commit c224c65

Browse files
committed
v2.2
1 parent 66c7b46 commit c224c65

File tree

944 files changed

+310318
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

944 files changed

+310318
-17
lines changed

app.js

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
https://www.ipify.org
44
https://geo.ipify.org/docs
55
https://geo.ipify.org/api/v1?apiKey=KEY&ipAddress=8.8.8.8
6+
67
http://www.cualesmiip.com
7-
ej.: 192.212.174.101
88
99
----MAP API----
1010
---Leaflet---
@@ -15,19 +15,18 @@
1515
https://developers.google.com/maps/api-key-best-practices
1616
https://docs.mapbox.com/help/troubleshooting/how-to-use-mapbox-securely/
1717
*/
18-
1918
let button = document.querySelector(".btnSearch");
2019

2120
const ipValue = document.querySelector(".valueIp");
2221
const countryValue = document.querySelector(".valueCountry");
2322
const utcValue = document.querySelector(".valueUtc");
2423
const ispValue = document.querySelector(".valueIsp");
2524

26-
const mapDiv = document.querySelector("#map");
25+
//const mapDiv = document.querySelector("#map");
2726

2827
function getInputValue(){
2928
let ipInput = document.querySelector("#ipaddress").value;
30-
const key = process.env.api_key;
29+
const key = 'at_0iDoj4504blzc9hchqt0E6ogRuCgC';
3130
const url = 'https://geo.ipify.org/api/v1?apiKey='+key+'&ipAddress=';
3231

3332
urlUpdated = url + ipInput
@@ -38,7 +37,7 @@ function getInputValue(){
3837
fetch(urlUpdated)
3938
.then(response => response.json())
4039
.then(response => updateValues(response))
41-
.then(response => createMap(response))
40+
//.then(response => createMap(response))
4241
.catch(error => console.log(error));
4342
}
4443

@@ -59,31 +58,65 @@ function updateValues(response){
5958
}
6059

6160
function createMap(response) {
62-
//console.log("lat: " + response.location.lat + ", lng: " + response.location.lng)
63-
let map = L.map('map').setView([response.location.lat, response.location.lng], 16);
61+
let latitude = response.location.lat
62+
let longitude = response.location.lng
63+
console.log("lat: " + latitude + ", lng: " + longitude)
64+
/*
65+
let map = L.map('map').setView([latitude, longitude], 16);
6466
let myIcon = L.icon({
6567
iconUrl: '/images/icon-location.svg',
6668
iconSize: [28,30],
6769
iconAnchor: [17, 85],
6870
popupAnchor: [-3, -76]
6971
});
72+
*/
7073

74+
/*
7175
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
7276
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
7377
}).addTo(map);
7478
75-
L.marker([response.location.lat, response.location.lng], {icon: myIcon}).addTo(map)
79+
L.marker([latitude, longitude], {icon: myIcon}).addTo(map)
7680
.bindPopup('Here I Am!')
7781
.openPopup();
82+
*/
7883

7984
/*
80-
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
81-
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
82-
maxZoom: 18,
83-
id: 'mapbox/streets-v11',
84-
tileSize: 512,
85-
zoomOffset: -1,
86-
accessToken: 'your.mapbox.access.token'
87-
}).addTo(mymap);
85+
L.tileLayer('https://api.mapbox.com/styles/v1/mbellydo/ckjoa9yng3mlm19oa7kf5o3cs.html?fresh=true&title=copy&access_token=pk.eyJ1IjoibWJlbGx5ZG8iLCJhIjoiY2tqb2E1anFmMGx2djJ2bzhpeDRkdHFyayJ9.DEAvUgh9QjI7vbAWdxHeaw', {
86+
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
87+
maxZoom: 18,
88+
id: 'mapbox://styles/mbellydo/ckjoa9yng3mlm19oa7kf5o3cs',
89+
//'mapbox/streets-v11'
90+
tileSize: 512,
91+
zoomOffset: -1,
92+
accessToken: 'your.mapbox.access.token'
93+
}).addTo(map);
8894
*/
95+
96+
mapboxgl.accessToken = 'pk.eyJ1IjoibWJlbGx5ZG8iLCJhIjoiY2tqb2E1anFmMGx2djJ2bzhpeDRkdHFyayJ9.DEAvUgh9QjI7vbAWdxHeaw';
97+
var map = new mapboxgl.Map({
98+
container: 'map',
99+
style: 'mapbox://styles/mbellydo/ckjoa9yng3mlm19oa7kf5o3cs', // stylesheet location
100+
center: [longitude, latitude], // starting position [lng, lat]
101+
zoom: 15 // starting zoom
102+
});
103+
var marker = new mapboxgl.Marker({
104+
color: "#FFFFFF",
105+
draggable: true
106+
}).setLngLat([longitude, latitude])
107+
.addTo(map);
108+
map.addControl(new mapboxgl.NavigationControl());
109+
110+
//Add map view styles
111+
var layerList = document.getElementById('menu');
112+
var inputs = layerList.getElementsByTagName('input');
113+
114+
function switchLayer(layer) {
115+
var layerId = layer.target.id;
116+
map.setStyle('mapbox://styles/mapbox/' + layerId);
117+
}
118+
119+
for (var i = 0; i < inputs.length; i++) {
120+
inputs[i].onclick = switchLayer;
121+
}
89122
}

index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin=""/>
1515
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
1616

17+
<!--MAPBOXGL (MAP API)-->
18+
<script src='https://api.mapbox.com/mapbox-gl-js/v2.0.1/mapbox-gl.js'></script>
19+
<link href='https://api.mapbox.com/mapbox-gl-js/v2.0.1/mapbox-gl.css' rel='stylesheet' />
20+
1721
<title>IP Address Tracker | by Marc Bellido</title>
1822
</head>
1923

@@ -55,6 +59,22 @@ <h1 class="text-center text-white position-relative pb-2">IP Address Tracker</h1
5559

5660
<main class="position-relative w-100 h-75">
5761
<div id="map"></div>
62+
<div id="menu">
63+
<input id="streets-v11" type="radio" name="rtoggle" value="streets" checked="checked"/>
64+
<label for="streets-v11">streets</label>
65+
<input id="light-v10" type="radio" name="rtoggle" value="light" />
66+
67+
<label for="light-v10">light</label>
68+
<input id="dark-v10" type="radio" name="rtoggle" value="dark" />
69+
70+
<label for="dark-v10">dark</label>
71+
<input id="outdoors-v11" type="radio" name="rtoggle" value="outdoors" />
72+
73+
<label for="outdoors-v11">outdoors</label>
74+
<input id="satellite-v9" type="radio" name="rtoggle" value="satellite" />
75+
76+
<label for="satellite-v9">satellite</label>
77+
</div>
5878
</main>
5979

6080
<footer class="d-flex col-6 mx-auto justify-content-end flex-column mt-5">

node_modules/.bin/geojson-rewind

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/geojson-rewind.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/geojson-rewind.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/pbf

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/pbf.cmd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/pbf.ps1

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@mapbox/geojson-rewind/LICENSE.txt

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@mapbox/geojson-rewind/README.md

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@mapbox/geojson-rewind/geojson-rewind

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@mapbox/geojson-rewind/index.js

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)