Skip to content

Instantly share code, notes, and snippets.

@perkinslr
Created June 14, 2014 03:13
Show Gist options
  • Save perkinslr/cbb7083e708efe4fcd37 to your computer and use it in GitHub Desktop.
Save perkinslr/cbb7083e708efe4fcd37 to your computer and use it in GitHub Desktop.
roll20api.startReading=(function(){
var w = XPCNativeWrapper.unwrap(content.window);
var campaignRoot = w.campaign_storage_path;
if (!campaignRoot){
alert("Let the page finish loading!");
}
roll20api.fb = new w.Firebase(w.FIREBASE_ROOT);
var fb=roll20api.fb;
roll20api.chat=fb.child(campaignRoot).child('chat');
fb.auth(w.GNTKN,function(authinfo){
roll20api.chat.once('child_added', function(c){
roll20api.chatchild=c.val();
});
});
});
roll20api.sendMessageToRoll20=function(msgptr){
try{
var msg=JSON.parse(msgptr.readString());
}
catch(err){
console.log(err);
return -1;
}
for (var i in msg){
roll20api.chatchild[i]=msg[i];
}
roll20api.chat.push(roll20api.chatchild);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment