mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-07-24 13:00:41 +08:00
Implement basic JSON file loading functionality.
This commit is contained in:
+17
-6
@@ -1,14 +1,25 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
var loadJsonFile = function(filename) {
|
||||
var res;
|
||||
$.ajax({
|
||||
async: false,
|
||||
url : filename,
|
||||
success : function(data) {
|
||||
res = data;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
var discoveries = loadJsonFile('json/discoveries.json');
|
||||
var workers = loadJsonFile('json/workers.json');
|
||||
|
||||
console.log(discoveries);
|
||||
console.log(workers);
|
||||
|
||||
var app = angular.module('particleClicker', []);
|
||||
})();
|
||||
|
||||
var discoveries = [
|
||||
{
|
||||
name: 'W-Boson',
|
||||
description: 'Some nice description.'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"name": "W-Boson",
|
||||
"description": "The W-Boson is the carrier boson of the weak force.",
|
||||
"research": {
|
||||
"reputation": 1,
|
||||
"cost": 100
|
||||
},
|
||||
"histogram": {}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"name": "PhD Student",
|
||||
"description": "Basically a slave just with fewer rights.",
|
||||
"loan": 100,
|
||||
"rate": 1
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user