Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • e656d4a171ef9141ecebd567494b5d767c76dfb7
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

module_repo.c

Blame
  • index.js 1,24 Kio
    "use strict";
    import 'bootstrap/dist/css/bootstrap.min.css'
    import 'bootstrap/dist/css/bootstrap-theme.min.css'
    import 'bootstrap'
    import './style.css'
    
    var latOffset = 1;
    var lonOffset = 1;
    
    var getTraffic = (lat, lon) => {
    	/*
    	severity:	1: LowImpact
    				2: Minor
    				3: Moderate
    				4: Serious
    	type:	1: Accident
    			2: Congestion
    			3: DisabledVehicle
    			4: MassTransit
    			5: Miscellaneous
    			6: OtherNews
    			7: PlannedEvent
    			8: RoadHazard
    			9: Construction
    			10: Alert
    			11: Weather
    	*/
    	var options = ["o=json", "severity=2,3,4", "type=2"];
    	var coords = [lat - latOffset, lon - lonOffset, lat + latOffset, lon + lonOffset];
    	//var url = "https://dev.virtualearth.net/REST/V1/Traffic/Incidents/" + coords.join(',') + "/true?" + options.join('&') + "&key=" + key;
    	var url = "src/traffic.php?coords=" + coords.join(',') + "&" + options.join('&');
    
    	console.log("latitude: " + lat);
    	console.log("longitude: " + lon);
    
    	fetch(url)
    	.then(response => {
    		console.log(response.json());
    	})
    	.catch(() => {
    		console.log("oups");
    	});
    }
    
    if ("geolocation" in navigator) {
    	navigator.geolocation.getCurrentPosition(function(position) {
    		getTraffic(position.coords.latitude, position.coords.longitude)
    	});
    }
    else {
    	console.log("Geolocation isn't available");
    }