-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
88 lines (85 loc) · 2.77 KB
/
server.js
File metadata and controls
88 lines (85 loc) · 2.77 KB
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
79
80
81
82
83
84
85
86
87
88
Windows = new Mongo.Collection("Windows");
if (Meteor.isServer) {
Meteor.publish('Windows', function () {
return Windows.find({id: this.userId});
});
Meteor.methods({
insertWindowData: function (userId) {
Windows.insert({
id: userId,
window1: {
width: "44%",
height: "50%",
left: "5%",
top: "12%",
visible: true
},
window2: {
width: "44%",
height: "50%",
left: "51%",
top: "12%",
visible: true
},
window3: {
width: "90%",
height: "28%",
left: "5%",
top: "66%",
visible: true
}
});
},
updateWindowSizeAndPosition: function (userId, window, x, y, height, width) {
if (window == "window1") {
Windows.update({id: userId}, {
"$set": {
"window1.height": height,
"window1.width": width,
"window1.top": y,
"window1.left": x
}
});
} else if (window == "window2") {
Windows.update({id: userId}, {
"$set": {
"window2.height": height,
"window2.width": width,
"window2.top": y,
"window2.left": x
}
});
} else if (window == "window3") {
Windows.update({id: userId}, {
"$set": {
"window3.height": height,
"window3.width": width,
"window3.top": y,
"window3.left": x
}
});
}
},
setWindowVisible: function (userId, window, visible) {
if (window == "window1") {
Windows.update({id: userId}, {
"$set": {
"window1.visible": visible
}
});
} else if (window == "window2") {
Windows.update({id: userId}, {
"$set": {
"window2.visible": visible
}
});
} else if (window == "window3") {
Windows.update({id: userId}, {
"$set": {
"window3.visible": visible
}
});
}
}
});
}