Skip to content

Commit

Permalink
Add ability to reset the RSVP list for a fresh with all yeses
Browse files Browse the repository at this point in the history
  • Loading branch information
piontkowski committed Apr 10, 2018
1 parent 6b45b1f commit 8bf806f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion public_html/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function select_winner(rsvps) {

// If the code inside here runs, then display a picture of the chosen winner!
clearInterval(interval);
$('#winner-photo').html('<p><img src="' + rsvps[0].photo + '" width="150px" /></p><button id="again" class="btn btn-danger btn-lg">Run again?</button>&nbsp;<a href="javascript:location.reload();"><button class="btn btn-default btn-lg">Reload?</button></a>');
$('#winner-photo').html('<p><img src="' + rsvps[0].photo + '" width="150px" /></p><button id="again" class="btn btn-primary btn-lg">Run Again</button>&nbsp;<button id="reset" class="btn btn-default btn-lg">Reset</button>&nbsp;<a href="javascript:location.reload();"><button class="btn btn-danger btn-lg">Reload</button></a>');
$('#countdown-timer').empty();
$('#winner-banner').text('WINNER!!!').css({'font-size': '3em', 'color': 'blue', 'font-weight': 'bold'});

Expand All @@ -122,6 +122,16 @@ function select_winner(rsvps) {
select_winner(rsvps);
});

$('#reset').click(function () {

$('#winner-banner').empty().css({'font-size': '', 'color': '', 'font-weight': ''});
$('#countdown-timer').empty();
$('#winner-name').empty();
$('#winner-photo').empty();

run();
});

// Shoot off some fireworks.
var r = 4 + parseInt(Math.random() * 16);
for (var i = r; i--;) {
Expand Down

0 comments on commit 8bf806f

Please sign in to comment.