-
Notifications
You must be signed in to change notification settings - Fork 77
/
index.js
29 lines (27 loc) · 967 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function processJson(data) {
var machineList = data.machines;
var base = $("#base-cell");
var machineListContainer = $("#machine-list");
for (i = 0; i < machineList.length; i++) {
var machine = machineList[i];
var clone = base.clone();
var title = machine.name + " - " + machine.year;
var playerlink = "player.html?machine=" + machine.id;
if (machine.emularity) {
playerlink = "emularity.html?machine=" + machine.id;
}
if (machine.directurl) {
playerlink = machine.directurl;
}
clone.show();
clone.attr("id", machine.id);
clone.find("a").attr("href", playerlink);
clone.find("figcaption").text(title)
clone.find(".figure-img").attr("src", machine.image)
machineListContainer.append(clone);
}
}
$(document).ready(function () {
$.ajaxSetup({ cache: false});
$.getJSON("machines.json", processJson);
});