-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
50 lines (44 loc) · 1.52 KB
/
index.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
/*jslint browser: true*/
/*global exports*/
var settings;
exports.loadSettings = function (hook, context) {
"use strict";
settings = {};
settings.updateInterval = 1500;
settings.triggerSequence = '###';
settings.replacePause = true;
if(context.settings.ep_insertTimestamp) {
if(context.settings.ep_insertTimestamp.updateInterval) {
settings.updateInterval = context.settings.ep_insertTimestamp.updateInterval;
}
if(context.settings.ep_insertTimestamp.triggerSequence) {
settings.triggerSequence = context.settings.ep_insertTimestamp.triggerSequence;
}
if(context.settings.ep_insertTimestamp.replacePause) {
settings.replacePause = context.settings.ep_insertTimestamp.replacePause;
}
}
};
exports.eejsBlock_scripts = function (hook, context) {
"use strict";
var syncJS = '<script type="text/javascript">';
syncJS += 'ep_insertTimestamp={};';
syncJS += 'ep_insertTimestamp.settings=' + JSON.stringify(settings) + ";";
syncJS += '</script>';
context.content = context.content + syncJS;
};
exports.handleMessage = function(hook, context, callback) {
"use strict";
var msg = context.message;
var client = context.client;
if (msg.type === 'COLLABROOM' && msg.data.type === "timeSync") {
client.json.send({ type: "COLLABROOM",
data: {
type: "timeSync",
payload: { servTime: Date.now() }
}
});
return [null];
}
callback();
};