more stuff working
This commit is contained in:
parent
f366519de7
commit
5e85d1516b
6 changed files with 46 additions and 3 deletions
12
client.js
Normal file
12
client.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
var eejs = require("ep_etherpad-lite/node/eejs");
|
||||
|
||||
exports.eejsBlock_scripts = function (hook_name, args, cb) {
|
||||
args.content = args.content + eejs.require("ep_email_notifications/templates/scripts.html", {}, module);
|
||||
return cb();
|
||||
};
|
||||
|
||||
exports.eejsBlock_toolbarRight = function (hook_name, args, cb) {
|
||||
args.content = args.content + eejs.require("ep_email_notifications/templates/button.html", {}, module);
|
||||
return cb();
|
||||
};
|
||||
|
5
ep.json
5
ep.json
|
@ -3,7 +3,10 @@
|
|||
{
|
||||
"name": "ep_email_notifications",
|
||||
"hooks": {
|
||||
"padUpdate": "ep_email_notifications/update"
|
||||
"padUpdate": "ep_email_notifications/update",
|
||||
"handleMessage": "ep_email_notifications/update",
|
||||
"eejsBlock_scripts": "ep_email_notifications/client",
|
||||
"eejsBlock_editbarMenuRight": "ep_email_notifications/client:eejsBlock_toolbarRight"
|
||||
},
|
||||
"client_hooks": {
|
||||
}
|
||||
|
|
13
static/js/ep_email.js
Normal file
13
static/js/ep_email.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
function sendEmailToServer(){
|
||||
var email = "john@mclear.co.uk";
|
||||
var message = {};
|
||||
message.type = 'USERINFO_UPDATE';
|
||||
message.userInfo = {};
|
||||
message.userInfo.colorId = "#0000";
|
||||
message.userInfo.email = "test";
|
||||
message.userInfo.userId = "FUCKING TEST";
|
||||
|
||||
if(email){
|
||||
pad.collabClient.sendMessage(message);
|
||||
}
|
||||
}
|
1
templates/button.html
Normal file
1
templates/button.html
Normal file
|
@ -0,0 +1 @@
|
|||
<button onClick=sendEmailToServer();>FUCKING AY</button>
|
1
templates/scripts.html
Normal file
1
templates/scripts.html
Normal file
|
@ -0,0 +1 @@
|
|||
<script type='text/javascript' src='/static/plugins/ep_email_notifications/static/js/ep_email.js'></script>
|
17
update.js
17
update.js
|
@ -11,9 +11,22 @@ var timers = {};
|
|||
// When a new message comes in from the client
|
||||
exports.handleMessage = function(hook_name, context, callback){
|
||||
console.warn(context);
|
||||
if ( context.message.type == 'USERINFO_UPDATE' ) {
|
||||
console.warn ("LORDAMERCI!");
|
||||
if (context.message && context.message.data){
|
||||
if (context.message.data.type == 'USERINFO_UPDATE' ) { // if it smells okay..
|
||||
if (context.message.data.userInfo){
|
||||
if(context.message.data.userInfo.email){ // it contains email
|
||||
|
||||
exports.setAuthorEmail(
|
||||
context.message.data.userInfo.userId,
|
||||
context.message.data.userInfo.email, callback);
|
||||
|
||||
console.warn ("WRITE MY GOODNESS TO THE DATABASE!",context.message.data.userInfo.email);
|
||||
}
|
||||
}
|
||||
console.warn ("LORDAMERCI!");
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
exports.padUpdate = function (hook_name, _pad) {
|
||||
|
|
Loading…
Reference in a new issue