Update chat stuff to point to new+improved server code
This commit is contained in:
parent
676b5f0ee2
commit
29a805ab87
@ -53,9 +53,8 @@ function serverProblemsDialog(errmsg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mkApiUrl(action, server) {
|
function mkApiUrl(action, server) {
|
||||||
server = typeof server !== 'undefined' ? server : "gs";
|
server = "gs";
|
||||||
return "http://" + server + ".terranquest.net/" + action + ".php";
|
return "http://" + server + ".terranquest.net/" + action + ".php";
|
||||||
//return "config/" + action + ".json";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ function refreshStats() {
|
|||||||
|
|
||||||
function getChat() {
|
function getChat() {
|
||||||
if (lockGot) {
|
if (lockGot) {
|
||||||
$.getJSON(mkApiUrl('chat', 'cs'), {
|
$.getJSON(mkApiUrl('chat'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
@ -59,10 +59,10 @@ function getChat() {
|
|||||||
var content = "";
|
var content = "";
|
||||||
data.forEach(function (msg) {
|
data.forEach(function (msg) {
|
||||||
var usernameclass = "chat-username";
|
var usernameclass = "chat-username";
|
||||||
if (msg.username === 'skylarmt') {
|
if (msg.nickname === 'skylarmt') {
|
||||||
usernameclass = "chat-username-admin";
|
usernameclass = "chat-username-admin";
|
||||||
}
|
}
|
||||||
content += "<span class='" + usernameclass + "' onclick='openProfile(\"" + msg.username + "\");'>" + msg.username + "</span> " + msg.message + "<br />";
|
content += "<span class='" + usernameclass + "' onclick='openProfile(\"" + msg.nickname + "\");'>" + msg.nickname + "</span> " + msg.message + "<br />";
|
||||||
});
|
});
|
||||||
$('#chatmsgs').html(content);
|
$('#chatmsgs').html(content);
|
||||||
});
|
});
|
||||||
@ -81,8 +81,7 @@ setInterval(function () {
|
|||||||
$("#chatsendform").submit(function (event) {
|
$("#chatsendform").submit(function (event) {
|
||||||
var message = $('#chatbox-input').val();
|
var message = $('#chatbox-input').val();
|
||||||
if (message !== '') {
|
if (message !== '') {
|
||||||
$.post(mkApiUrl('chat', 'cs'), {
|
$.post(mkApiUrl('chat'), {
|
||||||
user: username,
|
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude,
|
long: longitude,
|
||||||
msg: message
|
msg: message
|
||||||
|
Reference in New Issue
Block a user