-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.txt
42 lines (38 loc) · 1.79 KB
/
tests.txt
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
'submit .new-story': function(event) {
var story = event.target.story - text.value;
var age = event.target.age.value;
var faceType = event.target.faceType.value;
var language = event.target.lang_type.value;
Stories.insert({
storyText: story,
votes: [{faceType: faceType}],
count_votes: votes.length,
count_faces: function () {
var face1 = 0, face2 = 0, face3 = 0, face4 = 0;
for (var i; i < votes.length; i++) {
if (votes.faceType == "face1") {
face1++;
} else if (votes.faceType == "face2") {
face2++;
} else if (votes.faceType == "face3") {
face3++;
} else if (votes.faceType == "face4") {
face4++;
}
}
},
create_date: new Date(),
ipAddress: function () {
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", "http://api.hostip.info/get_html.php", false);
xmlhttp.send();
hostipInfo = xmlhttp.responseText.split("\n");
for (i = 0; hostipInfo.length >= i; i++) {
ipAddress = hostipInfo[i].split(":");
if (ipAddress[0] == "IP") return ipAddress[1];
}
},
age: age,
language: language
}),