dynmap/web/js/chat.js
Jason Booth 2cef9731ed WebChat enhancement and fixes
Added Spam Message config
Internal server now replies a spam message
Fixed getting webchat-interval to get int rather than double then cast
Fixed holding down "enter" on the empty chat line would spam chat attempts
Fixed so jsonip.appspot query is only done once
2011-03-15 19:17:58 -05:00

21 lines
437 B
JavaScript

var ip;
$.ajax({
type: "GET",
url: "http://jsonip.appspot.com/?callback=?",
dataType: "jsonp",
success: function(getip) { ip = getip.ip; }
});
function sendChat(me, message) {
var data = '{"name":"'+ip+'","message":"'+message+'"}';
$.ajax({
type: 'POST',
url: 'up/sendmessage',
data: data,
dataType: 'json',
success: function(response) {
//handle response
if(response)
me.onPlayerChat('', response);
}
});
}