2020-05-21 23:43:17 +02:00
|
|
|
'use strict';
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
(function () {
|
|
|
|
var Core = {
|
2020-05-21 23:43:17 +02:00
|
|
|
NUMBER_OF_ROUNDS: 5,
|
2020-05-20 03:19:53 +02:00
|
|
|
MAX_SCORE: 1000,
|
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
rounds: [],
|
|
|
|
scoreSum: 0,
|
2020-05-25 19:51:02 +02:00
|
|
|
panoId: null,
|
2020-05-20 03:19:53 +02:00
|
|
|
panorama: null,
|
2020-05-22 23:23:54 +02:00
|
|
|
map: null,
|
2020-05-20 03:19:53 +02:00
|
|
|
guessMarker: null,
|
2020-05-21 23:43:17 +02:00
|
|
|
adaptGuess: false,
|
2020-05-20 03:19:53 +02:00
|
|
|
googleLink: null,
|
|
|
|
|
2020-05-22 01:31:32 +02:00
|
|
|
initialize: function () {
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('currentRound').innerHTML = '1/' + String(Core.NUMBER_OF_ROUNDS);
|
|
|
|
document.getElementById('currentScoreSum').innerHTML = '0/0';
|
|
|
|
|
|
|
|
Core.getNewPosition(function (response) {
|
|
|
|
if (response.history) {
|
|
|
|
for (var i = 0; i < response.history.length; ++i) {
|
|
|
|
var round = response.history[i];
|
|
|
|
Core.rounds.push({ position: round.position, guessPosition: round.guessPosition, realMarker: null, guessMarker: null, line: null });
|
|
|
|
Core.addRealGuessPair(round.position, round.guessPosition, true);
|
|
|
|
Core.scoreSum += round.score;
|
2020-05-22 01:31:32 +02:00
|
|
|
}
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('currentRound').innerHTML = String(Core.rounds.length) + '/' + String(Core.NUMBER_OF_ROUNDS);
|
|
|
|
document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String(Core.rounds.length * Core.MAX_SCORE);
|
|
|
|
}
|
2020-05-23 01:25:43 +02:00
|
|
|
|
2020-05-22 01:31:32 +02:00
|
|
|
Core.startNewRound();
|
2020-05-25 19:51:02 +02:00
|
|
|
});
|
2020-05-22 01:31:32 +02:00
|
|
|
},
|
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
startNewGame: function () {
|
|
|
|
for (var i = 0; i < Core.rounds.length; ++i) {
|
|
|
|
var round = Core.rounds[i];
|
|
|
|
|
|
|
|
round.realMarker.setMap(null);
|
|
|
|
round.guessMarker.setMap(null);
|
|
|
|
round.line.setMap(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
Core.rounds = [];
|
|
|
|
Core.scoreSum = 0;
|
|
|
|
|
|
|
|
var distanceInfo = document.getElementById('distanceInfo');
|
|
|
|
distanceInfo.children[0].style.display = null;
|
|
|
|
distanceInfo.children[1].style.display = null;
|
|
|
|
var scoreInfo = document.getElementById('scoreInfo');
|
|
|
|
scoreInfo.children[0].style.display = null;
|
|
|
|
scoreInfo.children[1].style.display = null;
|
|
|
|
document.getElementById('continueButton').style.display = null;
|
|
|
|
document.getElementById('startNewGameButton').style.display = null;
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('currentScoreSum').innerHTML = '0/0';
|
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
Core.prepareNewRound();
|
2020-05-23 01:25:43 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.getNewPosition(function () {
|
|
|
|
Core.startNewRound();
|
|
|
|
});
|
2020-05-21 23:43:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
prepareNewRound: function () {
|
|
|
|
document.getElementById('scoreBar').style.width = null;
|
|
|
|
|
2020-05-22 23:22:11 +02:00
|
|
|
if (Core.rounds.length > 0) {
|
|
|
|
var lastRound = Core.rounds[Core.rounds.length - 1];
|
|
|
|
|
|
|
|
lastRound.realMarker.setVisible(false);
|
|
|
|
lastRound.guessMarker.setVisible(false);
|
|
|
|
lastRound.line.setVisible(false);
|
2020-05-21 23:43:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById('showGuessButton').style.visibility = null;
|
|
|
|
document.getElementById('guess').style.visibility = null;
|
2020-05-22 23:22:11 +02:00
|
|
|
document.getElementById('guess').classList.remove('result')
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-22 23:23:54 +02:00
|
|
|
Core.map.setOptions({
|
2020-05-22 23:22:11 +02:00
|
|
|
draggableCursor: 'crosshair'
|
|
|
|
});
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.map.fitBounds(mapBounds);
|
2020-05-21 23:43:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
startNewRound: function () {
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.rounds.push({ position: null, guessPosition: null, realMarker: null, guessMarker: null, line: null });
|
2020-05-20 15:54:09 +02:00
|
|
|
|
2020-05-23 01:25:43 +02:00
|
|
|
document.getElementById('currentRound').innerHTML = String(Core.rounds.length) + '/' + String(Core.NUMBER_OF_ROUNDS);
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.loadPano(Core.panoId);
|
2020-05-21 23:43:17 +02:00
|
|
|
},
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
getNewPosition: function (callback) {
|
|
|
|
document.getElementById('loading').style.visibility = 'visible';
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
xhr.onreadystatechange = function () {
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('loading').style.visibility = 'hidden';
|
2020-05-20 03:19:53 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.panoId = this.response.panoId;
|
|
|
|
|
|
|
|
callback(this.response);
|
2020-05-20 03:19:53 +02:00
|
|
|
}
|
|
|
|
};
|
2020-05-25 19:51:02 +02:00
|
|
|
xhr.open('GET', 'position.json', true);
|
2020-05-20 03:19:53 +02:00
|
|
|
xhr.send();
|
|
|
|
},
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
loadPano: function (panoId) {
|
2020-05-21 03:24:09 +02:00
|
|
|
if (Core.adaptGuess) {
|
|
|
|
document.getElementById('guess').classList.add('adapt');
|
|
|
|
}
|
|
|
|
|
2020-05-21 12:17:18 +02:00
|
|
|
Core.panorama.setPov({ heading: 0, pitch: 0 });
|
|
|
|
Core.panorama.setZoom(0);
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.panorama.setPano(panoId);
|
2020-05-20 03:19:53 +02:00
|
|
|
},
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
evaluateGuess: function () {
|
|
|
|
var guessPosition = Core.guessMarker.getPosition().toJSON();
|
|
|
|
Core.rounds[Core.rounds.length - 1].guessPosition = guessPosition;
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
if (Core.adaptGuess) {
|
|
|
|
document.getElementById('guess').classList.remove('adapt');
|
|
|
|
}
|
|
|
|
document.getElementById('loading').style.visibility = 'visible';
|
2020-05-22 01:31:32 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.responseType = 'json';
|
|
|
|
xhr.onreadystatechange = function () {
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
Core.guessMarker.setMap(null);
|
|
|
|
Core.guessMarker = null;
|
2020-05-23 01:25:43 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('loading').style.visibility = 'hidden';
|
|
|
|
document.getElementById('guess').classList.add('result');
|
2020-05-22 01:31:32 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.scoreSum += this.response.result.score;
|
|
|
|
document.getElementById('currentScoreSum').innerHTML = String(Core.scoreSum) + '/' + String(Core.rounds.length * Core.MAX_SCORE);
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.rounds[Core.rounds.length - 1].position = this.response.result.position;
|
|
|
|
Core.addRealGuessPair(this.response.result.position, guessPosition);
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
var resultBounds = new google.maps.LatLngBounds();
|
|
|
|
resultBounds.extend(this.response.result.position);
|
|
|
|
resultBounds.extend(guessPosition);
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.map.setOptions({
|
|
|
|
draggableCursor: 'grab'
|
|
|
|
});
|
|
|
|
Core.map.fitBounds(resultBounds);
|
2020-05-22 23:22:11 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
document.getElementById('distance').innerHTML = Util.printDistanceForHuman(this.response.result.distance);
|
|
|
|
document.getElementById('score').innerHTML = this.response.result.score;
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
var scoreBarProperties = Core.calculateScoreBarProperties(this.response.result.score, Core.MAX_SCORE);
|
|
|
|
var scoreBar = document.getElementById('scoreBar');
|
|
|
|
scoreBar.style.backgroundColor = scoreBarProperties.backgroundColor;
|
|
|
|
scoreBar.style.width = scoreBarProperties.width;
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
if (Core.rounds.length == Core.NUMBER_OF_ROUNDS) {
|
|
|
|
document.getElementById('continueButton').style.display = 'none';
|
|
|
|
document.getElementById('showSummaryButton').style.display = 'block';
|
|
|
|
}
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.panoId = this.response.panoId;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhr.open('POST', 'position.json', true);
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
xhr.send('guess&lat=' + guessPosition.lat + '&lng=' + guessPosition.lng);
|
2020-05-21 23:43:17 +02:00
|
|
|
},
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
addRealGuessPair: function (position, guessPosition, hidden) {
|
2020-05-21 23:43:17 +02:00
|
|
|
var round = Core.rounds[Core.rounds.length - 1];
|
|
|
|
|
|
|
|
round.realMarker = new google.maps.Marker({
|
2020-05-22 23:23:54 +02:00
|
|
|
map: Core.map,
|
2020-05-22 23:22:11 +02:00
|
|
|
visible: !hidden,
|
2020-05-25 19:51:02 +02:00
|
|
|
position: position,
|
2020-05-22 23:55:09 +02:00
|
|
|
title: 'Open in Google Maps',
|
2020-05-24 15:00:58 +02:00
|
|
|
zIndex: Core.rounds.length * 2,
|
2020-05-21 23:43:17 +02:00
|
|
|
clickable: true,
|
|
|
|
draggable: false
|
|
|
|
});
|
|
|
|
|
|
|
|
round.realMarker.addListener('click', function () {
|
|
|
|
window.open('https://www.google.com/maps/search/?api=1&query=' + this.getPosition().toUrlValue(), '_blank');
|
|
|
|
});
|
|
|
|
|
|
|
|
round.guessMarker = new google.maps.Marker({
|
2020-05-22 23:23:54 +02:00
|
|
|
map: Core.map,
|
2020-05-22 23:22:11 +02:00
|
|
|
visible: !hidden,
|
2020-05-21 23:43:17 +02:00
|
|
|
position: guessPosition,
|
2020-05-24 15:00:58 +02:00
|
|
|
zIndex: Core.rounds.length,
|
2020-05-21 23:43:17 +02:00
|
|
|
clickable: false,
|
|
|
|
draggable: false,
|
|
|
|
label: {
|
|
|
|
color: '#ffffff',
|
|
|
|
fontFamily: 'Roboto',
|
|
|
|
fontSize: '18px',
|
|
|
|
fontWeight: '500',
|
|
|
|
text: '?'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
round.line = new google.maps.Polyline({
|
2020-05-22 23:23:54 +02:00
|
|
|
map: Core.map,
|
2020-05-22 23:22:11 +02:00
|
|
|
visible: !hidden,
|
2020-05-21 23:43:17 +02:00
|
|
|
path: [
|
2020-05-25 19:51:02 +02:00
|
|
|
position,
|
2020-05-21 23:43:17 +02:00
|
|
|
guessPosition
|
|
|
|
],
|
|
|
|
geodesic: true,
|
|
|
|
strokeOpacity: 0,
|
|
|
|
icons: [{
|
|
|
|
icon: {
|
|
|
|
path: 'M 0,-1 0,1',
|
|
|
|
strokeOpacity: 1,
|
|
|
|
strokeWeight: 2,
|
|
|
|
scale: 2
|
|
|
|
},
|
|
|
|
offset: '0',
|
|
|
|
repeat: '10px'
|
|
|
|
}],
|
|
|
|
clickable: false,
|
|
|
|
draggable: false,
|
|
|
|
editable: false
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
calculateScoreBarProperties: function (score, maxScore) {
|
|
|
|
var percent = Math.floor((score / maxScore) * 100);
|
2020-05-20 03:19:53 +02:00
|
|
|
|
|
|
|
var color;
|
|
|
|
if (percent >= 90) {
|
|
|
|
color = '#11ca00';
|
|
|
|
} else if (percent >= 10) {
|
|
|
|
color = '#ea9000';
|
|
|
|
} else {
|
|
|
|
color = '#ca1100';
|
|
|
|
}
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
return { width: percent + '%', backgroundColor: color };
|
|
|
|
},
|
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
showSummary: function () {
|
|
|
|
var distanceInfo = document.getElementById('distanceInfo');
|
|
|
|
distanceInfo.children[0].style.display = 'none';
|
|
|
|
distanceInfo.children[1].style.display = 'block';
|
|
|
|
var scoreInfo = document.getElementById('scoreInfo');
|
|
|
|
scoreInfo.children[0].style.display = 'none';
|
|
|
|
scoreInfo.children[1].style.display = 'block';
|
|
|
|
document.getElementById('showSummaryButton').style.display = null;
|
|
|
|
document.getElementById('startNewGameButton').style.display = 'block';
|
|
|
|
|
|
|
|
var resultBounds = new google.maps.LatLngBounds();
|
|
|
|
|
|
|
|
for (var i = 0; i < Core.rounds.length; ++i) {
|
|
|
|
var round = Core.rounds[i];
|
|
|
|
|
2020-05-22 21:08:36 +02:00
|
|
|
round.realMarker.setLabel({
|
|
|
|
color: '#812519',
|
|
|
|
fontFamily: 'Roboto',
|
|
|
|
fontSize: '16px',
|
|
|
|
fontWeight: '500',
|
2020-05-24 14:47:15 +02:00
|
|
|
text: String(i + 1)
|
2020-05-22 21:08:36 +02:00
|
|
|
});
|
2020-05-21 23:43:17 +02:00
|
|
|
round.realMarker.setVisible(true);
|
|
|
|
round.guessMarker.setVisible(true);
|
|
|
|
round.line.setVisible(true);
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
resultBounds.extend(round.position);
|
2020-05-21 23:43:17 +02:00
|
|
|
resultBounds.extend(round.guessPosition);
|
|
|
|
}
|
|
|
|
|
2020-05-22 23:23:54 +02:00
|
|
|
Core.map.fitBounds(resultBounds);
|
2020-05-21 23:43:17 +02:00
|
|
|
|
2020-05-23 01:25:43 +02:00
|
|
|
document.getElementById('scoreSum').innerHTML = String(Core.scoreSum);
|
2020-05-21 23:43:17 +02:00
|
|
|
|
|
|
|
var scoreBarProperties = Core.calculateScoreBarProperties(Core.scoreSum, Core.NUMBER_OF_ROUNDS * Core.MAX_SCORE);
|
|
|
|
var scoreBar = document.getElementById('scoreBar');
|
|
|
|
scoreBar.style.backgroundColor = scoreBarProperties.backgroundColor;
|
|
|
|
scoreBar.style.width = scoreBarProperties.width;
|
|
|
|
},
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
rewriteGoogleLink: function () {
|
|
|
|
if (!Core.googleLink) {
|
|
|
|
var anchors = document.getElementById('panorama').getElementsByTagName('a');
|
|
|
|
for (var i = 0; i < anchors.length; i++) {
|
|
|
|
var a = anchors[i];
|
|
|
|
if (a.href.indexOf('maps.google.com/maps') !== -1) {
|
|
|
|
Core.googleLink = a;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
setTimeout(function () {
|
2020-05-22 23:32:17 +02:00
|
|
|
if (Core.googleLink) {
|
|
|
|
Core.googleLink.title = 'Google Maps';
|
|
|
|
Core.googleLink.href = 'https://maps.google.com/maps';
|
|
|
|
}
|
2020-05-20 03:19:53 +02:00
|
|
|
}, 1);
|
2020-05-19 19:01:35 +02:00
|
|
|
}
|
2020-05-20 03:19:53 +02:00
|
|
|
};
|
2020-05-19 19:01:35 +02:00
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
var Util = {
|
|
|
|
printDistanceForHuman: function (distance) {
|
|
|
|
if (distance < 1000) {
|
|
|
|
return Number.parseFloat(distance).toFixed(0) + ' m';
|
|
|
|
} else if (distance < 10000) {
|
|
|
|
return Number.parseFloat(distance / 1000).toFixed(2) + ' km';
|
|
|
|
} else if (distance < 100000) {
|
|
|
|
return Number.parseFloat(distance / 1000).toFixed(1) + ' km';
|
|
|
|
} else {
|
|
|
|
return Number.parseFloat(distance / 1000).toFixed(0) + ' km';
|
2020-05-17 19:29:06 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-20 03:19:53 +02:00
|
|
|
};
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-21 03:24:09 +02:00
|
|
|
if (!('ontouchstart' in document.documentElement)) {
|
|
|
|
Core.adaptGuess = true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 23:23:54 +02:00
|
|
|
Core.map = new google.maps.Map(document.getElementById('map'), {
|
2020-05-17 19:29:06 +02:00
|
|
|
disableDefaultUI: true,
|
|
|
|
clickableIcons: false,
|
2020-05-22 23:22:11 +02:00
|
|
|
draggableCursor: 'crosshair',
|
|
|
|
draggingCursor: 'grabbing'
|
2020-05-17 19:29:06 +02:00
|
|
|
});
|
|
|
|
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.map.fitBounds(mapBounds);
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-22 23:23:54 +02:00
|
|
|
Core.map.addListener('click', function (e) {
|
2020-05-22 23:22:11 +02:00
|
|
|
if (Core.rounds[Core.rounds.length - 1].guessPosition) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
if (Core.guessMarker) {
|
|
|
|
Core.guessMarker.setPosition(e.latLng);
|
2020-05-17 19:29:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
Core.guessMarker = new google.maps.Marker({
|
2020-05-22 23:23:54 +02:00
|
|
|
map: Core.map,
|
2020-05-17 19:29:06 +02:00
|
|
|
position: e.latLng,
|
2020-05-19 16:18:12 +02:00
|
|
|
clickable: false,
|
|
|
|
draggable: true,
|
|
|
|
label: {
|
|
|
|
color: '#ffffff',
|
|
|
|
fontFamily: 'Roboto',
|
|
|
|
fontSize: '18px',
|
|
|
|
fontWeight: '500',
|
|
|
|
text: '?'
|
|
|
|
}
|
2020-05-17 19:29:06 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById('guessButton').disabled = false;
|
|
|
|
});
|
2020-05-19 16:18:12 +02:00
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
Core.panorama = new google.maps.StreetViewPanorama(document.getElementById('panorama'), {
|
2020-05-19 16:18:12 +02:00
|
|
|
disableDefaultUI: true,
|
|
|
|
linksControl: true,
|
2020-05-21 12:17:53 +02:00
|
|
|
showRoadLabels: false,
|
|
|
|
motionTracking: false
|
2020-05-19 16:18:12 +02:00
|
|
|
});
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
Core.panorama.addListener('position_changed', function () {
|
|
|
|
Core.rewriteGoogleLink();
|
2020-05-19 16:18:12 +02:00
|
|
|
});
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
Core.panorama.addListener('pov_changed', function () {
|
|
|
|
Core.rewriteGoogleLink();
|
2020-05-19 16:18:12 +02:00
|
|
|
});
|
|
|
|
|
2020-05-22 01:31:32 +02:00
|
|
|
Core.initialize();
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-21 01:59:31 +02:00
|
|
|
document.getElementById('showGuessButton').onclick = function () {
|
|
|
|
this.style.visibility = 'hidden';
|
|
|
|
document.getElementById('guess').style.visibility = 'visible';
|
|
|
|
}
|
|
|
|
|
|
|
|
document.getElementById('closeGuessButton').onclick = function () {
|
|
|
|
document.getElementById('showGuessButton').style.visibility = null;
|
|
|
|
document.getElementById('guess').style.visibility = null;
|
|
|
|
}
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
document.getElementById('guessButton').onclick = function () {
|
|
|
|
if (!Core.guessMarker) {
|
|
|
|
return;
|
2020-05-19 03:25:42 +02:00
|
|
|
}
|
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
this.disabled = true;
|
2020-05-20 01:08:01 +02:00
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
Core.evaluateGuess();
|
2020-05-20 03:19:53 +02:00
|
|
|
}
|
2020-05-19 16:18:12 +02:00
|
|
|
|
2020-05-20 03:19:53 +02:00
|
|
|
document.getElementById('continueButton').onclick = function () {
|
2020-05-21 23:43:17 +02:00
|
|
|
Core.prepareNewRound();
|
2020-05-25 19:51:02 +02:00
|
|
|
Core.startNewRound();
|
2020-05-21 23:43:17 +02:00
|
|
|
}
|
2020-05-19 16:18:12 +02:00
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
document.getElementById('showSummaryButton').onclick = function () {
|
|
|
|
Core.showSummary();
|
|
|
|
}
|
2020-05-17 19:29:06 +02:00
|
|
|
|
2020-05-21 23:43:17 +02:00
|
|
|
document.getElementById('startNewGameButton').onclick = function () {
|
|
|
|
Core.startNewGame();
|
2020-05-20 03:19:53 +02:00
|
|
|
}
|
2020-05-24 14:47:15 +02:00
|
|
|
|
|
|
|
window.onbeforeunload = function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.returnValue = '';
|
|
|
|
};
|
2020-05-20 03:19:53 +02:00
|
|
|
})();
|