Skip to content

Instantly share code, notes, and snippets.

@awhit012
Created December 22, 2015 00:12

Revisions

  1. awhit012 created this gist Dec 22, 2015.
    39 changes: 39 additions & 0 deletions quick_refactor.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    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();