Created
December 22, 2015 00:12
-
-
Save awhit012/e548cf81354b2492ac90 to your computer and use it in GitHub Desktop.
a quick refactor of a students code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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