fixed json desktop notifications
This commit is contained in:
parent
b71ec8447e
commit
5d5c2855b6
|
@ -83,6 +83,7 @@ function timedRequest()
|
||||||
var jsonText = JSON.parse(request.responseText);
|
var jsonText = JSON.parse(request.responseText);
|
||||||
var newServerList = {};
|
var newServerList = {};
|
||||||
|
|
||||||
|
games_with_stats = 100;
|
||||||
// Repopulate table content
|
// Repopulate table content
|
||||||
var table = "<tr>\n"
|
var table = "<tr>\n"
|
||||||
+ " <th title=\"glestVersion\">Version</th>\n"
|
+ " <th title=\"glestVersion\">Version</th>\n"
|
||||||
|
@ -147,7 +148,16 @@ function timedRequest()
|
||||||
statusClass = 'unknown';
|
statusClass = 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//debugger;
|
||||||
|
if ((statusCode == "2" || statusCode == "3") && jsonText[i].gameUUID != "")
|
||||||
|
{
|
||||||
|
var specialColHTML = "<td title=\"" + jsonText[i].status + "\" class=\"" + statusClass + "\"><a id=\"gameStats_" + games_with_stats + "\" href=\"#\" gameuuid=\"" + jsonText[i].gameUUID + "\">" + escapeHtml(statusTitle) + "</a></td>";
|
||||||
|
table += specialColHTML;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
table += "<td title=\"" + jsonText[i].status + "\" class=\"" + statusClass + "\">" + escapeHtml(statusTitle) + "</td>";
|
table += "<td title=\"" + jsonText[i].status + "\" class=\"" + statusClass + "\">" + escapeHtml(statusTitle) + "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
/// Country
|
/// Country
|
||||||
if(jsonText[i].country !== "")
|
if(jsonText[i].country !== "")
|
||||||
|
@ -195,6 +205,15 @@ function timedRequest()
|
||||||
|
|
||||||
table += "</tr>";
|
table += "</tr>";
|
||||||
|
|
||||||
|
if ((statusCode == "2" || statusCode == "3") && jsonText[i].gameUUID != "")
|
||||||
|
{
|
||||||
|
table += "<tr width='100%%' class='fullyhide' id='content_row_" + jsonText[i].gameUUID + "'>";
|
||||||
|
table += "<td width='100%%' colspan='100'></td>";
|
||||||
|
table += "</tr>";
|
||||||
|
|
||||||
|
games_with_stats++;
|
||||||
|
}
|
||||||
|
|
||||||
////// DESKTOP NOTIFICATIONS SECTION
|
////// DESKTOP NOTIFICATIONS SECTION
|
||||||
|
|
||||||
// Store data in an array keyed by the concatenation of the IP and port
|
// Store data in an array keyed by the concatenation of the IP and port
|
||||||
|
@ -229,6 +248,11 @@ function timedRequest()
|
||||||
var tableDOM = document.getElementsByTagName("tbody");
|
var tableDOM = document.getElementsByTagName("tbody");
|
||||||
tableDOM[0].innerHTML = table;
|
tableDOM[0].innerHTML = table;
|
||||||
|
|
||||||
|
//debugger;
|
||||||
|
for(var gameIndex = 100; gameIndex < 200; ++gameIndex) {
|
||||||
|
setupGameStatsLink(gameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
// Catch empty case
|
// Catch empty case
|
||||||
if(jsonText.length == 0)
|
if(jsonText.length == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,8 +26,7 @@ function asynchDone(url, target) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//debugger;
|
function setupGameStatsLink(gameIndex) {
|
||||||
for(var gameIndex = 1; gameIndex < 200; ++gameIndex) {
|
|
||||||
if(document.getElementById('gameStats_' + gameIndex) ) {
|
if(document.getElementById('gameStats_' + gameIndex) ) {
|
||||||
var link = document.getElementById('gameStats_' + gameIndex);
|
var link = document.getElementById('gameStats_' + gameIndex);
|
||||||
link.onclick = function() {
|
link.onclick = function() {
|
||||||
|
@ -48,3 +47,9 @@ for(var gameIndex = 1; gameIndex < 200; ++gameIndex) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//debugger;
|
||||||
|
|
||||||
|
for(var gameIndex = 1; gameIndex < 200; ++gameIndex) {
|
||||||
|
setupGameStatsLink(gameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// consider replacing this by a cron job
|
// consider replacing this by a cron job
|
||||||
cleanupServerList();
|
cleanupServerList();
|
||||||
|
|
||||||
$servers_in_db = mysql_query( 'SELECT * FROM glestserver status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
|
$servers_in_db = mysql_query( 'SELECT * FROM glestserver WHERE status <> 3 OR (status = 3 AND lasttime > DATE_add(NOW(), INTERVAL -8 hour)) ORDER BY status, lasttime DESC, connectedClients > 0 DESC, (networkSlots - connectedClients), ip DESC;' );
|
||||||
$all_servers = array();
|
$all_servers = array();
|
||||||
while ( $server = mysql_fetch_array( $servers_in_db ) )
|
while ( $server = mysql_fetch_array( $servers_in_db ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user