Skip to content

Instantly share code, notes, and snippets.

@awhit012
Created December 22, 2015 00:12
Show Gist options
  • Save awhit012/e548cf81354b2492ac90 to your computer and use it in GitHub Desktop.
Save awhit012/e548cf81354b2492ac90 to your computer and use it in GitHub Desktop.
a quick refactor of a students code
function Game(){
this.prophesy = document.getElementById("prophesy");
this.current_user;
}
Game.prototype.smash() {
var cookie = document.getElementById("cookie");
if (cookie.style.display === '') {
cookie.style.display = 'none';
debris.style.display = '';
prophesy.style.display = "block";
console.log("it was clicked");
}
adjustScore();
setTimeout(refresh, 3500);
}
Game.prototype.logMeOut() {
this.current_user = 0;
console.log("logout function has been triggered");
}
Game.prototype.refresh() {
document.location.reload(true);
}
Game.prototype.adjustScore() {
$.ajax({
type: 'PUT',
url: '/increment_score',
data: { _method: 'PUT'},
}).success (200, function() {
console.log("success");
});
}
var game = new Game();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment