Created
June 14, 2014 03:13
-
-
Save perkinslr/cbb7083e708efe4fcd37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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