
// Handle guesses from the child frames
var current_game = 0;
var all_games = [‘grand-junction’, ‘hotchkiss’, ‘gunnison’, ‘crested-butte’, ‘salida’, ‘canon-city’, ‘westcliffe’];
window.addEventListener(‘message’, function(event) {
if ( event.origin === ‘http://extras.denverpost.com’ || event.origin === ‘http://localhost’ )
{
if ( typeof event.data.distance !== ‘undefined’ )
{
map_group.add_guess(event.data.distance);
current_game += 1;
var slug = all_games[current_game];
var title = slug.replace(/-/g, ‘ ‘);
// Count down to the next game
var countdown = 8;
$(‘#countdown’).removeClass(‘hide’);
$(‘#countdown’).addClass(‘show’);
var interval = window.setInterval(function() { $(‘#countdown_timer’).text(countdown); countdown –; if ( countdown == 0 ) window.clearInterval(interval); }, 1000)
// Load the next game
window.setTimeout(function () { $(‘#game’).html(” + title + ‘'+'h2>Next game loads in: 9'+'p>‘); }, ‘9000’);
// Update the status texts
$(‘#guessed’).html(current_game);
if ( event.data.distance == 0 ) $(‘#correct’).html(map_group.correct);
}
}
}, false);
var map_group = {
config: {
games: 7,
log_url: ‘http://denverpostplus.com/app/mapgame/tally.php’,
slug: ‘rtr-2015’
},
guesses: 0,
distance: 0,
correct: 0,
add_guess: function (distance)
{
this.guesses += 1;
this.distance += distance;
if ( distance === 0 )
{
this.correct += 1;
}
if ( this.guesses === this.config.games )
{
// They finished the game. Log the results and scroll to them.
var distance = Math.floor(this.distance/this.guesses);
$(‘#result’).append(‘Your 7 guesses landed, on average, ‘ + distance + ‘ miles away from the targets. You got ‘ + this.correct + ‘ correct.’);
var params = ‘?slug=’ + this.config.slug + ‘&distance=’ + distance + ‘&correct=’ + this.correct + ‘&lat=0&lon=0&callback=’;
var jqxhr = $.getJSON( this.config.log_url + params, function(data)
{
// Success
// Display how the reader has done compared to everyone else.
$(‘#result’).append(‘On average, people got ‘ + data.average_correct + ‘ correct. ‘);
var average = Math.round(data.average);
$(‘#result’).append(‘ ‘ + data.guesses + ‘ other people have played. An average guess, across all guesses, landed ‘ + average + ‘ miles away.’);
})
.fail(function() {
// Error
$(‘#result’).append(‘ Sorry, we could not reach the upstream servers. Please refresh the page and try again.’);
})
.always(function() {
// Complete
});
$(‘html, body’).animate({
scrollTop: $(“#result”).offset().top
}, 2000);
}
}
};
Can you place the seven Ride The Rockies 2015 host cities on the map?
Drag the marker to where you think each city on (which kicks off in Grand Junction on Saturday) is.
When you drop it, the answer will appear, and you’ll see how your guess compares with everyone else who has played.
Progress: 0 / 7 finished, 0 correct.
Grand Junction
Next game loads in:
Grand Junction
Hotchkiss
Gunnison
Crested Butte
Salida
Cañon City
Westcliffe
Ride The Rockies history
.
body { margin:2%; }
@media only screen and (max-width:650px) {
}
.gameframe
{
border: 0;
width: 100%;
height: 700px;
overflow: hidden;
}
.hide { display: none; }
.show { display: block; }
#countdown { color: blue; }
#result { font-size: 150%; color: red; font-weight: bold; }
.titlecase { text-transform: capitalize; }
h3 { color: #666; }
Previous map games
Group Games
- Play the
- Play the
- Play the
- Play the
Colorado Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
North American Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
World Map Games
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the
- Play the Where is ? map game
<!–
–>



