<commit_before>/*--------------------------------------------*/
/*---> GEOLOCATION <--------------------------*/
/*--------------------------------------------*/

var userPosition = {
	latitude: 0,
	longitude: 0
};

function updatePosition(position){
	userPosition.latitude = position.coords.latitude;
	userPosition.longitude = position.coords.longitude;
}

function getGeolocation(callback){
	navigator.geolocation.getCurrentPosition(function(position){
		updatePosition(position);
		console.log('CALLED GEOLOCATOR');
		if(callback){
			callback();
		}
	});
}

function getUserLat(){
	return userPosition.latitude;
}

function getUserLon(){
	return userPosition.longitude;
}

function updateUserMarker(){
	var objects = map.getObjects();
	var target;
	var size = objects.length;
	for(var o = 0; o < size; o++){
		if(objects[o] instanceof H.map.Marker){
			target = objects[o];
			console.log('found one!');
			break;
		}
	}
	function moveUserMarker(){
		target.setPosition({
			lat: userPosition.latitude,
			lng: userPosition.longitude
		});
	}
	getGeolocation(moveUserMarker);
}

console.log('LOADED geolocation.js');<commit_msg>Update geolocation onclick anywhere<commit_after>/*--------------------------------------------*/
/*---> GEOLOCATION <--------------------------*/
/*--------------------------------------------*/

var userPosition = {
	latitude: 0,
	longitude: 0
};

function updatePosition(position){
	userPosition.latitude = position.coords.latitude;
	userPosition.longitude = position.coords.longitude;
}

function getGeolocation(callback){
	navigator.geolocation.getCurrentPosition(function(position){
		updatePosition(position);
		console.log('CALLED GEOLOCATOR');
		if(callback){
			callback();
		}
	});
}

function getUserLat(){
	return userPosition.latitude;
}

function getUserLon(){
	return userPosition.longitude;
}

function updateUserMarker(){
	var objects = map.getObjects();
	var target;
	var size = objects.length;
	for(var o = 0; o < size; o++){
		if(objects[o] instanceof H.map.Marker){
			target = objects[o];
			console.log('Found User Marker!');
			break;
		}
	}
	function moveUserMarker(){
		target.setPosition({
			lat: userPosition.latitude,
			lng: userPosition.longitude
		});
		console.log('Update with: ' + userPosition.toString());
	}
	getGeolocation(moveUserMarker);
}

$(document).click(function(){
	updateUserMarker();
});

console.log('LOADED geolocation.js');
{'fraction_non_alphanumeric': 0.22965116279069767, 'fraction_numerical': 0.0024916943521594683, 'mean_word_length': 3.041946308724832, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2679236', 'n_tokens_mistral': 784, 'n_tokens_neox': 734, 'n_words': 136}