-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
210 lines (197 loc) · 25.5 KB
/
worker.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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var firstNames = ["John", "Sally", "Mark", "Felipe", "Joe", "Jose", "Juan", "Jared", "Matt", "Manuel", "Mohammed", "Mehdi", "Fatima", "Mariam", "Ali", "Noah", "Milan", "William", "Henry", "Marie", "Jazmin", "Malcolm", "Daniel", "Jacob", "Santiago", "Olivia", "Mia"];
var lastNames = ["Smith", "Brown", "Lee", "Wilson", "Mohammad", "Ali", "Dia", "Rodriguez", "Morales", "Gruber", "Maier", "Brunner", "Castro"];
var firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
var lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
var name = firstName + " " + lastName;
var SPRITES = {
shareIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJGSURBVDjLp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bNHLsE1EQQY7p06RMEY0LLtAoUaZFhzCIIBnjkR4fdHinzQvPPFCjh0bIQARJz6XMMj06vNLkkXuqfKKxYa7PIYIgSfuBqdOjxQNFbulO8g9A4vaYeUOXa7SZPAGIat81C7zR5WoqTwEkat8afdFnY/SbZwCyGS1zTiD455PjbVnDztBllVNWcyvOJesM2LZF8ntkSFAngUoMP7681zYBkfYNBgMaNKjzwgCDIzytCQgrKmdUqDFkyBMF9lnArUzdELStKf7scmWReXxVb9ajuG3j8g3ex2UlnmJ3nQAAAABJRU5ErkJggg==",
ephemeralIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAQAAAAEABcxq3DAAAC1klEQVQ4y41Tz29UVRg933fffdOZlkpnSlurjgsiP0IEjQmYuNCFC0OCLIwx1hAhceOCmJCYEOwWF/AXuCAmFhNLiBAim7pTokiaEnUj2tpOJ0AL/cF05r5373v33c9FWwTjgpOc1Zdzvh8nH+EJcOTzr7ZtqQ08X+RZunq38deF08ezzRoBwMmrM/t7KuWjijCkCLN57r/+7M361IlvJut9A09/opheZELOQE6AEZErv1+buDg2eqygw+d/2zlcrZ7ojshpokQzDETay9ZP9ZT0RzETK0L2X5q8+OPH78bHovpg7WCj4xeKVFoRoROTtBWk7cEfrkmxEq8LnCKyiuCiddq8CL722tu7o/oWPdAwfnWlCA9iSDuGtBnS91K1a9vkg6wZBClDUkWwCrARxCqChUgagvRzJyv+7I85jyBtvc7OU7Gq1Xs0QHAmBGNEEhMkMSEkSRCTFMFkoUgIYL7+y/VvIbIaQ4yGmBiSKgBbu1TRqwhMcAw4BbERYBXERRCnAceEoGa+H3d6+75bvYPPootga13RgcGyPtRfjl4Jubygga2ukAYBrQ2x1RDHgBBB6NG83780+8ZQJT5WUmR7NO+xPriF1C/7EFp3rb/KkGUNsQwEIpCEsBRtind88ClXSvqdmcQ3NSFhoNmnadeSK+4RpKUhgwy5sykGEC6/t2vuoUG5OjC8t1qqXmx25r1IJwLMcibzEWQogoQIAgZAhDKARfLZNAA8NGDA95aYuhW5NS+GIIYhiYLMaUhBQC/b9rRdaKxqeAztefXjt0598eVjNzj70+KZqSU3e9vm9zUk2UglYSAohn2mu/xcNeYdJi8u/Dp5bW1idCThRw0m5+6ci0mChqQaksSQdGPnSkWrZmB+vZn49orLhydGR5KNyf/F+MjLt+bn/74SI3Q0RDFQIkK+ePOHG2OHt6+1Mv/zvTSbXnH+9pN88f9i57vHH2v6DzHye4Ou+EnBAAAAPnRFWHRjb21tZW50AENsZWFuaW5nIGJ1YmJsZXMgZnJvbSBJY29uIEdhbGxlcnkgaHR0cDovL2ljb25nYWwuY29tL8POZD8AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDgtMjFUMTQ6NDQ6MjUtMDY6MDAZD+vfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTA4LTIxVDE0OjQ0OjI1LTA2OjAwaFJTYwAAAABJRU5ErkJggg==",
timelineIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADZSURBVBgZBcFBbo1hGAbQ83+5kRCJhA2IEQMrYAPMxRZMbcLG2ICRGTeUtE1jpr1p3/95nLMV8PnL3eOT07Pr79f+/f34GuAAcPfqgXseunlx6ysADsfC0+3k1n03ODP41oiX2+IReO7KH7sfLr1HPBEsCOKNc0cXPghGDFZUUPHWb+/UIKpYUUXU+LRFBbsYLCqICkbsiArWroKIQVQQFayIYFRQFYwKVtQgqhgxiNixooJdDKIgCtaIHVFB1KAqWFFBVDCiiAoOuzMwfgnqpyCOYCsAAADgP4mZnXDW2crZAAAAAElFTkSuQmCC",
}
var debug = false;
var baseUrl = debug ? 'http://localhost:5000' : 'https://warm-bayou-4025.herokuapp.com';
function setAmbientNotification(count){
apiPort.postMessage({
topic: 'social.ambient-notification',
data: {
name: 'mentions',
iconURL: SPRITES.timelineIcon,
counter: count || 0,
contentPanel: baseUrl + '/panel.html?name=' + encodeURIComponent(name),
label: 'Mentions',
menuURL: baseURL + '/mentions.html'
}
});
}
function dump2Sidebar(msg) {
if (sidebarPort)
sidebarPort.postMessage({topic: 'dump', message: msg});
else
dump("\n\n SIDEBAR NOT AVAILABLE: " + msg + "\n\n");
}
var count = 0;
var handlers = {
'social.cookie-changed': function(data, port) {
dump2Sidebar('got social.cookie-changed (worker)');
},
'social.user-recommend-prompt': function(data, port) {
dump2Sidebar('got social.user-recommend-prompt (worker)');
port.postMessage({topic: 'social.user-recommend-prompt-response',
data: {
url: data.url,
images: {
share: SPRITES.shareIcon,
unshare: SPRITES.sharedIcon
},
messages: {
shareTooltip: "Share me quick!",
unshareTooltip: "I was shared!",
sharedLabel: "I was shared with the quickness!",
unsharedLabel: "Nobody shared me..."
}
}
});
},
'social.user-recommend': function(data, port) {
dump2Sidebar('got social.user-recommend');
for (var i in data.data)
dump2Sidebar(i + " " + data.data[i]);
sidebarPort.postMessage({topic: 'share',
data: {
url: data.data.url,
}
});
},
'social.user-unrecommend': function(data, port) {
dump2Sidebar('got social.user-unrecommend');
sidebarPort.postMessage({topic: 'unshare',
data: {
url: data.data.url,
}
});
},
'ambient-update': function(data){
dump2Sidebar('handling ambient-update (worker)');
if (panelPort)
panelPort.postMessage({topic: 'new-user', data: data.data});
setAmbientNotification(++count);
},
'ambient-reset': function(data){
dump2Sidebar('handling ambient-reset (worker)');
count = 0;
setAmbientNotification(0);
},
'social.port-closing': function(data, port){
dump2Sidebar('port-closing (worker), ' + port);
if (apiPort == port){
apiPort.close();
apiPort = null;
}
},
'social.initialize': function(data, port){
dump2Sidebar('social.initialize on port ' + JSON.stringify(port));
apiPort = port;
apiPort.postMessage({
topic: 'social.user-profile',
data: {
userName: name,
displayName: name,
portrait: "data:image/png;base64,iV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++7eBed+D0d7RNTA4DPoLAEiiYGi9dHSzcvJjw9y32umPDW8+1k3tNM7sNs9+AUqoGN4u6l3N7Vgq6For7t3MagGEvCsf3o4pGfRg5Wievl/Vt5TfOM3L7gyJa2JnD7bPf62f+lIxvJXXucxP76jum/vw1/ehscm7t5+qKu9/ZGEx0DvI48QxotiREdHOTm5Oju4O1mRjPWM1oo7pJYsn1pSAMC5fmJ6cWpiSVsDlisvL6grzywrySior6hob2np7BodHJtKyi5KyC1e+/Bye35YoHNosGtrM6VmumPzY+O6v5rmvddOfaqZ2y4Y3y4a3qyc+N7z5WjKwWdS3EV89nVDzJqNlOad7hVs66C0oUDhyrXF4qbhxmp/Z48utYucO5fWs5oDyVzeV3zr3dvnTu42d9ILiQ4eMT126ceScaefIWN/b9Zza0RBuriizJamgQ5BeG8bKNr1mefqqxZmH1mduWe0/ckHd8Iqs1lkN/Sv7D15Q3n9aW++8xoFTcqpGchqndY0ueQdE0nlxI8vb7bOfG6Y//1/LBXpJArUWOwAAAABJRU5ErkJggg==",
profileURL: baseUrl + '/profile'
}
});
setAmbientNotification();
},
'panel.registration': function(data, port) {
dump2Sidebar('panel.registration completed');
panelPort = port;
},
'sidebar.registration': function(data, port) {
dump2Sidebar('sidebar.registration completed');
sidebarPort = port;
sidebarPort.postMessage({topic: 'new-connection', name: name});
},
'chat1-registration': function(data, port) {
dump2Sidebar('registered chat1 port (worker)');
chat1Port = port;
},
'chat1-message': function(data, port) {
dump2Sidebar('got chat1-message (worker)');
sidebarPort.postMessage({topic: 'chat1-message', name: name, message: data.message});
},
'chat1-message-response': function(data, port) {
dump2Sidebar('got chat1-message-response (worker)');
chat1Port.postMessage({topic: 'chat-response', data: data});
},
'chat2-registration': function(data, port) {
dump2Sidebar('registered chat2 port (worker)');
chat2Port = port;
},
'chat2-message': function(data, port) {
dump2Sidebar('got chat2-message (worker)');
sidebarPort.postMessage({topic: 'chat2-message', name: name, message: data.message});
},
'chat2-message-response': function(data, port) {
dump2Sidebar('got chat2-message-response (worker)');
chat2Port.postMessage({topic: 'chat-response', data: data});
},
'chat3-registration': function(data, port) {
dump2Sidebar('registered chat3 port (worker)');
chat3Port = port;
},
'chat3-message': function(data, port) {
dump2Sidebar('got chat3-message (worker)');
sidebarPort.postMessage({topic: 'chat3-message', name: name, message: data.message});
},
'chat3-message-response': function(data, port) {
dump2Sidebar('got chat3-message-response (worker)');
chat3Port.postMessage({topic: 'chat-response', data: data});
},
'chat4-registration': function(data, port) {
dump2Sidebar('registered chat4 port (worker)');
chat4Port = port;
},
'chat4-message': function(data, port) {
dump2Sidebar('got chat4-message (worker)');
sidebarPort.postMessage({topic: 'chat4-message', name: name, message: data.message});
},
'chat4-message-response': function(data, port) {
dump2Sidebar('got chat4-message-response (worker)');
chat4Port.postMessage({topic: 'chat-response', data: data});
}
};
var apiPort = null,
sidebarPort = null,
panelPort = null,
chat1Port = null,
chat2Port = null,
chat3Port = null,
chat4Port = null;
var ports = [];
onconnect = function(e) {
var port = e.ports[0];
port.onmessage = function (e) {
var msg = e.data;
var handler = handlers[msg.topic];
if (handler == null){
dump("No handler found for " + msg.topic + "\n\n\n");
}
else {
try {
handler(msg, port);
}
catch(e){
dump("Error thrown by handler: " + e.toString() + "\n\n\n");
}
}
}
inbound = e.ports[0];
if (e.ports.size > 1)
outbound = e.ports[1];
else
outbound = inbound;
}