<commit_before>// # SwissGuesser
// 
// (Story Map 5)
// 
// A game to look for historical pictures on a map.

// Main closure
var guesser = {

	// Default language is German
	lang: 'DE',

	// Set up anonymous user profile
	user: { score: 0, collection: [] },

	// State variables
	config: null, 
	overlay: null, 
	overlayhtml: null,
	collection: null, 
	currentIndex: 0,
	currentAnswer: null, 
	active: false,
	layers: [], 

	// DOM references
	domOverlay: 	$('#map-overlay'),
	domResults: 	$('#d-result'),
	domLocator: 	$('#d-locator'),
	domBtnNext: 	$('#btn-continue'),
	domBtnStart: 	$('#btn-start'), 
	domBtnClose: 	$('#btn-close'), 
	domBtnGuess:  	$('#btn-guess'), 
	domStartBox: 	$('#d-start'),
	domPhotoBox: 	$('#d-photobox'), 
	domLightBox: 	$('#d-lightbox'), 
	domPhotoInf: 	$('#row-info'),

	// ### Initial setup
	configure: function(json) {

		var self = this;
		self.config = json.conf;
		self.collection = json.data;

		// Check for anchor and clear it
		if (location.href.indexOf('#')>0) 
			  location.href = location.href.substring(0, 
			  	location.href.lastIndexOf('/'));

		// New window all external links
		$('a[href^="http:"]').attr('target', '_blank');

		// Ensure appropriate browser warning
		$('.browsehappy a').attr('href','http://browsehappy.com/?locale='
			+ self.lang.toLowerCase());

		// Fullscreen
		$('.lightbox').on('shown.bs.modal', function () {
			$('.modal-backdrop.in').css('opacity', 1);
		}).on('hidden.bs.modal', function () {
			// Clear backdrops properly (bug?)
			$('.modal-backdrop.in').remove();
		});

		// Init resizing
		self.resize();
		$(window).on('resize', function() { self.resize(); });

		// Init photo zoom and tooltip
		$('.d-photo', self.domPhotoBox).click(function() {
			self.domLightBox.modal();
		}).tooltip({
			title: $('.d-photo-text').text(),
			placement: 'bottom',<commit_msg>Query parsing<commit_after>// # SwissGuesser
// 
// (Story Map 5)
// 
// A game to look for historical pictures on a map.

// Main closure
var guesser = {

	// Default language is German
	lang: 'DE',

	// Set up anonymous user profile
	user: { score: 0, collection: [] },

	// State variables
	config: null, 
	overlay: null, 
	overlayhtml: null,
	collection: null, 
	currentIndex: 0,
	currentAnswer: null, 
	active: false,
	layers: [], 
	query: [],

	// DOM references
	domOverlay: 	$('#map-overlay'),
	domResults: 	$('#d-result'),
	domLocator: 	$('#d-locator'),
	domBtnNext: 	$('#btn-continue'),
	domBtnStart: 	$('#btn-start'), 
	domBtnClose: 	$('#btn-close'), 
	domBtnGuess:  	$('#btn-guess'), 
	domStartBox: 	$('#d-start'),
	domPhotoBox: 	$('#d-photobox'), 
	domLightBox: 	$('#d-lightbox'), 
	domPhotoInf: 	$('#row-info'),

	// ### Initial setup
	configure: function(json) {

		this.config = json.conf;
		this.collection = json.data;

		// Check for anchor and clear it
		if (location.href.indexOf('#')>0) 
			  location.href = location.href.substring(0, 
			  	location.href.lastIndexOf('/'));

		// New window all external links
		$('a[href^="http:"]').attr('target', '_blank');

		// Ensure appropriate browser warning
		$('.browsehappy a').attr('href','http://browsehappy.com/?locale='
			+ this.lang.toLowerCase());

		this.parsequery();
		this.uisetup(this);

	},

	// ### GET variables from request query
	parsequery: function() {
		var sSearch = window.location.search;
		if (sSearch.length > 1) {
			for (var aItKey, nKeyId = 0, aCouples = sSearch.substr(1).split("&"); 
					nKeyId < aCouples.length; nKeyId++) {
				aItKey = aCouples[nKeyId].split("=");
				this.query[unescape(aItKey[0])] = 
					aItKey.length > 1 ? unescape(aItKey[1]) : "";
			}
		}
		console.log(this.query);
	},

	// ### User Interface setup
	uisetup: function(self) {

		// Window resizing
		self.resize();
		$(window).on('resize', function() { self.resize(); });

		// Fullscreen
		$('.lightbox').on('shown.bs.modal', function () {
			$('.modal-backdrop.in').css('opacity', 1);
		}).on('hidden.bs.modal', function () {
			// Clear backdrops properly (bug?)
			$('.modal-backdrop.in').remove();
		});

		// Init photo zoom and tooltip
		$('.d-photo', self.domPhotoBox).click(function() {
			self.domLightBox.modal();
		}).tooltip({
			title: $('.d-photo-text').text(),
			placement: 'bottom',
{'fraction_non_alphanumeric': 0.20723062381852553, 'fraction_numerical': 0.004253308128544423, 'mean_word_length': 3.4464285714285716, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '1535202', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1492, 'n_words': 319}