Bug fixes and updates for desktop notifications.
This commit is contained in:
parent
5c484ff9d6
commit
2ebe218514
|
@ -118,7 +118,7 @@ function timedRequest()
|
||||||
for(var i = 0; i < jsonText.length; i++)
|
for(var i = 0; i < jsonText.length; i++)
|
||||||
{
|
{
|
||||||
// Check if version filter is active
|
// Check if version filter is active
|
||||||
if(version === '' || jsonText[i].glestVersion == version)
|
if(version == '' || jsonText[i].glestVersion == version)
|
||||||
{
|
{
|
||||||
////// DYNAMIC TABLE SECTION
|
////// DYNAMIC TABLE SECTION
|
||||||
|
|
||||||
|
@ -128,10 +128,10 @@ function timedRequest()
|
||||||
table += "<td><a href=\"?version=" + escapeHtml(jsonText[i].glestVersion) + "\" rel=\"nofollow\">" + escapeHtml(jsonText[i].glestVersion) + "</a></td>";
|
table += "<td><a href=\"?version=" + escapeHtml(jsonText[i].glestVersion) + "\" rel=\"nofollow\">" + escapeHtml(jsonText[i].glestVersion) + "</a></td>";
|
||||||
|
|
||||||
/// Status
|
/// Status
|
||||||
var statusCode = parseInt(jsonText[i].status);
|
var statusCode = jsonText[i].status;
|
||||||
|
|
||||||
// Change text if the server is full
|
// Change text if the server is full
|
||||||
if((statusCode === 0) && (jsonText[i].networkSlots <= jsonText[i].connectedClients))
|
if((statusCode == 0) && (jsonText[i].networkSlots <= jsonText[i].connectedClients))
|
||||||
{
|
{
|
||||||
statusCode = 1;
|
statusCode = 1;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ function timedRequest()
|
||||||
|
|
||||||
table += "</tr>";
|
table += "</tr>";
|
||||||
|
|
||||||
if ((statusCode === "2" || statusCode === "3") && jsonText[i].gameUUID !== "")
|
if ((statusCode == "2" || statusCode == "3") && jsonText[i].gameUUID !== "")
|
||||||
{
|
{
|
||||||
table += "<tr width='100%%' class='fullyhide' id='content_row_" + jsonText[i].gameUUID + "'>";
|
table += "<tr width='100%%' class='fullyhide' id='content_row_" + jsonText[i].gameUUID + "'>";
|
||||||
table += "<td width='100%%' colspan='100'></td>";
|
table += "<td width='100%%' colspan='100'></td>";
|
||||||
|
@ -232,14 +232,14 @@ function timedRequest()
|
||||||
////// 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
|
||||||
var identifier = jsonText[i].ip + jsonText[i].externalServerPort;
|
var identifier = jsonText[i].ip + ":" + jsonText[i].externalServerPort;
|
||||||
newServerList[identifier] = { 'ip': jsonText[i].ip, 'port': jsonText[i].externalServerPort, 'title': jsonText[i].serverTitle, 'free': (jsonText[i].networkSlots - jsonText[i].connectedClients), 'version': jsonText[i].glestVersion };
|
newServerList[identifier] = { 'ip': jsonText[i].ip, 'port': jsonText[i].externalServerPort, 'title': jsonText[i].serverTitle, 'free': (jsonText[i].networkSlots - jsonText[i].connectedClients), 'version': jsonText[i].glestVersion, 'connectedClients': jsonText[i].connectedClients };
|
||||||
|
|
||||||
// Only check for changes if NOT the first time
|
// Only check for changes if NOT the first time
|
||||||
if(!firstLoop)
|
if(!firstLoop)
|
||||||
{
|
{
|
||||||
if((newServerList[identifier].free > 0 && !serverList[identifier] && statusCode === 0) || // doesn't exist in old list
|
if((newServerList[identifier].free > 0 && !serverList[identifier] && statusCode == 0 && (serverList[identifier] === undefined || !serverList[identifier].title.startsWith("Headless"))) || // doesn't exist in old list
|
||||||
(newServerList[identifier].free > 0 && serverList[identifier].free == 0 && statusCode === 0 && serverList[identifier].serverTitle.startsWith("Headless"))) // Headless server that previously had zero players
|
(newServerList[identifier].free > 0 && serverList[identifier].connectedClients == 0 && newServerList[identifier].connectedClients > 0 && statusCode == 0 && (serverList[identifier] !== undefined && serverList[identifier].title.startsWith("Headless")))) // Headless server that previously had zero players
|
||||||
{
|
{
|
||||||
// Create notification
|
// Create notification
|
||||||
var notification = new Notification("Open server", {
|
var notification = new Notification("Open server", {
|
||||||
|
|
Loading…
Reference in New Issue