-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest2.html
78 lines (74 loc) · 2.55 KB
/
test2.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#drop_zone {
background-color: lightgray;
box-shadow: 0px 0px 0px 10px lightgray;
border: 5px dashed white;
margin: 0 auto;
width: 800px;
height: 300px;
text-align: center;
color: gray;
}
</style>
<script>
var userpath = firebase.database().ref("/users/" + uid + "/events/").push();
userpath.set({
time: firebase.database.ServerValue.TIMESTAMP,
type: "work",
description: "You received 5 credits for completing a GENERATE task.",
credits: 5
});
var db = firebase.database().ref().child("users").child(uid);
db.once("value").then(function(snapshot) {
var value = snapshot.val();
var credits = value.credits;
var generate = value.generate;
var score = value.score;
firebase.database().ref("/users/" + uid).update({"credits": credits + 5, "generate": generate + 1, "score": score + 5});
});
//______________________________________________________________________________________
var userpath = firebase.database().ref("/users/" + uid + "/events/").push();
userpath.set({
time: firebase.database.ServerValue.TIMESTAMP,
type: "work",
description: "You received 3 credits for completing a FIX task.",
credits: 3
});
var db = firebase.database().ref().child("users").child(uid);
db.once("value").then(function(snapshot) {
var value = snapshot.val();
var credits = value.credits;
var fix = value.fix;
var score = value.score;
firebase.database().ref("/users/" + uid).update({"credits": credits + 3, "fix": fix + 1, "score": score + 3});
});
//______________________________________________________________________________________
var userpath = firebase.database().ref("/users/" + uid + "/events/").push();
userpath.set({
time: firebase.database.ServerValue.TIMESTAMP,
type: "work",
description: "You received 2 credits for completing a VERIFY task.",
credits: 2
});
var db = firebase.database().ref().child("users").child(uid);
db.once("value").then(function(snapshot) {
var value = snapshot.val();
var credits = value.credits;
var verify = value.verify;
var score = value.score;
firebase.database().ref("/users/" + uid).update({"credits": credits + 2, "verify": verify + 1, "score": score + 2});
});
</script>
</head>
<body>
<div id="drop_zone" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event);">
<input type='file' style='display: none;'/>
<img src="images/upload.png" style="margin-top: 70px">
<p>Drag and drop or click</p>
</div>
</body>
</html>