forked from cdanis/urzas-overlay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decklist.js
35 lines (33 loc) · 1.13 KB
/
decklist.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
29
30
31
32
33
34
35
var config = {
apiKey: "AIzaSyDqDSKWpdJJIDBIX5Xq7w24hYss0zliBp8",
authDomain: "urzaslunchbreak.firebaseapp.com",
databaseURL: "https://urzaslunchbreak.firebaseio.com",
storageBucket: "",
};
firebase.initializeApp(config);
firebase.database().ref('player1').on('value', function (v) {
$("#p1").find(".player-name").text(v.val().name);
});
firebase.database().ref('player2').on('value', function (v) {
$("#p2").find(".player-name").text(v.val().name);
});
firebase.database().ref('player1').on('value', function (v) {
$("#p1").find(".deck-name").text(v.val().deck);
});
firebase.database().ref('player2').on('value', function (v) {
$("#p2").find(".deck-name").text(v.val().deck);
});
firebase.database().ref('p1deck').on('value', function (v) {
if (v.val()) {
var p1 = $("#p1");
fillDeck(p1.find(".deck"), v.val(), false);
fillDeck(p1.find(".side"), v.val(), true);
}
});
firebase.database().ref('p2deck').on('value', function (v) {
if (v.val()) {
var p2 = $("#p2");
fillDeck(p2.find(".deck"), v.val(), false);
fillDeck(p2.find(".side"), v.val(), true);
}
});