CodePen

HTML

            
              
            
          
!
via HTML Inspector

CSS

            
              
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              application.LeaderboardManager.leaderboard = function() {
    return application.LeaderboardManager.getData("leaderboard");
};
 
application.LeaderboardManager.addScore_name = function(score, name) {
    var leaderboard = application.LeaderboardManager.leaderboard();
    
    var scoreDic = new APT.Dictionary();
    scoreDic[new String("name")] = name;
    scoreDic[new String("score")] = score;
    leaderboard.push(scoreDic);
    
    leaderboard = leaderboard.sort(function (a, b) {
        if (a.score > b.score) return -1;
        if (a.score < b.score) return 1;
        return 0;
    });
    
    var leaderboardDictionary = { "leaderboard": leaderboard };
    var leaderboardString = JSON.stringify(leaderboardDictionary);
    application.LeaderboardManager.saveData("leaderboard", leaderboardString);
};
 
application.LeaderboardManager.saveData = function (name, data) {
    localStorage[name] = data;
    return true;
};
 
application.LeaderboardManager.getData = function (name) {
    var data = localStorage[name];
 
    if (data == null) {
        return new Array();
    }
    else {
        var jsonVar = JSON.parse(data);
        for (var i = 0; i < jsonVar.leaderboard.length; i++)
        {
            jsonVar.leaderboard[i] = new APT.Dictionary().initWithDictionary(jsonVar.leaderboard[i]);
        }
        return jsonVar.leaderboard;
    }
};

            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................