<commit_before>var UI = require('ui');
var ajax = require( 'ajax' );

var Cards = {
	gettingLocation: new UI.Card( {
		title: 'Nearby',
		subtitle: 'Getting location…'
	} ),

	loadingArticles: new UI.Card( {
		title: 'Nearby',
		subtitle: 'Loading Wikipedia articles…'
	} ),

	error: new UI.Card( {
		title: 'Error',
		subtitle: 'There was some problem'
	} )
};

var Location = {
	options: {
		enableHighAccuracy: true,
		maximumAge: 10000,
		timeout: 10000
	},

	successCallback: function ( pos ) {
		console.log('lat= ' + pos.coords.latitude + ' lon= ' + pos.coords.longitude);
		Cards.loadingArticles.show();
		Cards.gettingLocation.hide();
		WP.loadArticles( pos.coords.latitude, pos.coords.longitude );
	},

	errorCallback: function ( err ) {
		console.log('location error (' + err.code + '): ' + err.message);
		Cards.error.show();
	},

	getCurrentLocation: function () {
		Cards.gettingLocation.show();
		console.log( 'getting location ');
		navigator.geolocation.getCurrentPosition(
			Location.successCallback,
			Location.errorCallback,
			Location.options
		);
	}
};

var WP = {
	loadArticles: function ( lat, lon ) {
		var url = 'https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gscoord=' + lat + '|' + lon + '&format=json';
		ajax( { url: url, type: 'json' },
							function(json) {<commit_msg>Set gslimit in API call<commit_after>var UI = require('ui');
var ajax = require( 'ajax' );

var Cards = {
	gettingLocation: new UI.Card( {
		title: 'Nearby',
		subtitle: 'Getting location…'
	} ),

	loadingArticles: new UI.Card( {
		title: 'Nearby',
		subtitle: 'Loading Wikipedia articles…'
	} ),

	error: new UI.Card( {
		title: 'Error',
		subtitle: 'There was some problem'
	} )
};

var Location = {
	options: {
		enableHighAccuracy: true,
		maximumAge: 10000,
		timeout: 10000
	},

	successCallback: function ( pos ) {
		console.log('lat= ' + pos.coords.latitude + ' lon= ' + pos.coords.longitude);
		Cards.loadingArticles.show();
		Cards.gettingLocation.hide();
		WP.loadArticles( pos.coords.latitude, pos.coords.longitude );
	},

	errorCallback: function ( err ) {
		console.log('location error (' + err.code + '): ' + err.message);
		Cards.error.show();
	},

	getCurrentLocation: function () {
		Cards.gettingLocation.show();
		console.log( 'getting location ');
		navigator.geolocation.getCurrentPosition(
			Location.successCallback,
			Location.errorCallback,
			Location.options
		);
	}
};

var WP = {
	loadArticles: function ( lat, lon ) {
		var url = 'https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=10000&gscoord=' + lat + '|' + lon + '&gslimit=10&format=json';
		ajax( { url: url, type: 'json' },
							function(json) {
{'fraction_non_alphanumeric': 0.1640074211502783, 'fraction_numerical': 0.011873840445269016, 'mean_word_length': 3.946788990825688, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1721279', 'n_tokens_mistral': 1072, 'n_tokens_neox': 945, 'n_words': 190}