Replaced some '' with `` in js files

To reduce issues with ' characters in locale

Affects issues:
- Fixed #1334
This commit is contained in:
Rsl1122 2020-02-20 14:50:10 +02:00
parent 98a1a15837
commit 542ce5dc03
4 changed files with 77 additions and 77 deletions

View File

@ -138,7 +138,7 @@ function loadOnlineActivityOverviewValues(json, error) {
$(element).find('#data_new_players_retention_30d').text('(' + data.new_players_retention_30d + '/' + data.new_players_30d + ') ' + data.new_players_retention_30d_perc);
$(element).find('#data_new_players_retention_7d').text('(' + data.new_players_retention_7d + '/' + data.new_players_7d + ') ' + data.new_players_retention_7d_perc);
$(element).find('#data_new_players_retention_24h').replaceWith('<td title="This value is a prediction based on previous players.">(' + data.new_players_retention_24h + '/' + data.new_players_24h + ') ' + data.new_players_retention_24h_perc + ' <i class="far fa-fw fa-eye"></i></td>');
$(element).find('#data_new_players_retention_24h').replaceWith(`<td title="This value is a prediction based on previous players.">(` + data.new_players_retention_24h + '/' + data.new_players_24h + ') ' + data.new_players_retention_24h_perc + ' <i class="far fa-fw fa-eye"></i></td>');
$(element).find('#data_playtime_30d').replaceWith('<td>' + data.playtime_30d + smallTrend(data.playtime_30d_trend) + '</td>');
$(element).find('#data_playtime_7d').text(data.playtime_7d);
@ -237,9 +237,9 @@ function loadservers(servers, error) {
if (!servers || !servers.length) {
$('#data_server_list').replaceWith(
'<div class="card shadow mb-4"><div class="card-body"><p>No servers found in the database.</p></div></div>'
`<div class="card shadow mb-4"><div class="card-body"><p>No servers found in the database.</p></div></div>`
);
$('#quick_view_players_online').text('No server to display online activity for.');
$('#quick_view_players_online').text(`No server to display online activity for.`);
return;
}
@ -256,21 +256,21 @@ function loadservers(servers, error) {
}
function createnetworkserverBox(i, server) {
return '<div class="card shadow mb-4">' +
'<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">' +
'<h6 class="m-0 font-weight-bold col-black"><i class="fas fa-fw fa-server col-light-green"></i> ' + server.name + '</h6>' +
'<div class="mb-0 col-lg-6">' +
'<p class="mb-1"><i class="fa fa-fw fa-users col-black"></i> Registered Players' +
'<span class="float-right"><b>' + server.players + '</b></span></p>' +
'<p class="mb-0"><i class="fa fa-fw fa-user col-blue"></i> Players Online' +
'<span class="float-right"><b>' + server.online + '</b></span></p>' +
'</div>' + // /column
'</div>' + // /header
'<div class="d-flex align-items-center justify-content-between">' +
'<a class="btn col-light-green ml-2" href="server/' + server.name + '"><i class="fa fa-fw fa-chart-line"></i> Server Analysis</a>' +
'<button class="btn bg-blue my-2 mr-2" id="server_quick_view_' + i + '">Quick view <i class="fa fa-fw fa-caret-square-right"></i></button>' +
'</div>' + // /buttons
'</div>' // /card
return `<div class="card shadow mb-4">` +
`<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">` +
`<h6 class="m-0 font-weight-bold col-black"><i class="fas fa-fw fa-server col-light-green"></i> ` + server.name + `</h6>` +
`<div class="mb-0 col-lg-6">` +
`<p class="mb-1"><i class="fa fa-fw fa-users col-black"></i> Registered Players` +
`<span class="float-right"><b>` + server.players + `</b></span></p>` +
`<p class="mb-0"><i class="fa fa-fw fa-user col-blue"></i> Players Online` +
`<span class="float-right"><b>` + server.online + `</b></span></p>` +
`</div>` + // /column
`</div>` + // /header
`<div class="d-flex align-items-center justify-content-between">` +
`<a class="btn col-light-green ml-2" href="server/` + server.name + `"><i class="fa fa-fw fa-chart-line"></i> Server Analysis</a>` +
`<button class="btn bg-blue my-2 mr-2" id="server_quick_view_` + i + `">Quick view <i class="fa fa-fw fa-caret-square-right"></i></button>` +
`</div>` + // /buttons
`</div>` // /card
}
function onViewserver(i, servers) {

View File

@ -1,5 +1,5 @@
function displayError(element, error) {
element.find('.d-sm-flex').after('<div class="alert alert-danger" role="alert">Failed to load values: ' + error + '</div>')
element.find('.d-sm-flex').after(`<div class="alert alert-danger" role="alert">Failed to load values: ` + error + '</div>')
}
function loadPlayerOverviewValues(json, error) {
@ -13,8 +13,8 @@ function loadPlayerOverviewValues(json, error) {
data = json.info;
element = $(tab).find("#data_player_info");
$(element).find("#data_online").replaceWith(data.online ? '<i class="col-green fa fa-fw fa-circle"></i> Online' : '<i class="col-red fa fa-fw fa-circle"></i> Offline');
$(element).find("#data_titles").replaceWith((data.operator ? '<i class="col-blue fab fa-fw fa-superpowers"></i> Operator' : '') + (data.banned ? '<i class="col-red fa fa-fw fa-gavel"></i> Banned' : ''));
$(element).find("#data_online").replaceWith(data.online ? `<i class="col-green fa fa-fw fa-circle"></i> Online` : '<i class="col-red fa fa-fw fa-circle"></i> Offline');
$(element).find("#data_titles").replaceWith((data.operator ? `<i class="col-blue fab fa-fw fa-superpowers"></i> Operator` : '') + (data.banned ? `<i class="col-red fa fa-fw fa-gavel"></i> Banned` : ''));
$(element).find("#data_kick_count").text(data.kick_count);
$(element).find("#data_player_kills").text(data.player_kill_count);
$(element).find("#data_mob_kills").text(data.mob_kill_count);
@ -115,7 +115,7 @@ function createNicknameTableBody(nicknames) {
var table = '<tbody>';
if (nicknames.length === 0) {
table += '<tr><td>No Nicknames</td><td>-</td><td>-</td></tr>'
table += `<tr><td>No Nicknames</td><td>-</td><td>-</td></tr>`
}
for (var i = 0; i < nicknames.length; i++) {
@ -133,7 +133,7 @@ function createConnectionsTableBody(connections) {
var table = '<tbody>';
if (connections.length === 0) {
table += '<tr><td>No Data</td><td>-</td></tr>'
table += `<tr><td>No Data</td><td>-</td></tr>`
}
for (var i = 0; i < connections.length; i++) {
@ -158,7 +158,7 @@ function loadserverAccordion(json, error) {
var servers = json.servers;
if (!servers.length) {
serverTable.append('<tr><td>No Data</td><td>-</td><td>-</td><td>-</td></tr>')
serverTable.append(`<tr><td>No Data</td><td>-</td><td>-</td><td>-</td></tr>`)
}
var serversHtml = '';
@ -185,7 +185,7 @@ function onOpenserver(i, servers) {
}
setTimeout(function () {
var server = servers[i];
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: server.world_pie_series};
var worldSeries = {name: `World Playtime`, colorByPoint: true, data: server.world_pie_series};
var gmSeries = server.gm_series;
worldPie("worldpie_server_" + i, worldSeries, gmSeries, '#3A3B45');
@ -207,24 +207,24 @@ function createserverAccordionTitle(i, server) {
function createserverAccordionBody(i, server) {
return '<tr class="collapse" data-parent="#tableSAccordion" id="server_t_' + i + '">' +
'<td colspan="4">' +
'<div class="collapse row" data-parent="#tableSAccordion" id="server_t_' + i + '">' +
'<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">' +
(server.operator ? '<p><i class="col-blue fab fa-fw fa-superpowers"></i> Operator</p>' : '') +
(server.banned ? '<p><i class="col-red fas fa-fw fa-gavel"></i> Banned</p>' : '') +
(server.operator || server.banned ? '<br>' : '') +
'<p><i class="col-teal far fa-fw fa-calendar-check"></i> Sessions<span class="float-right"><b>' + server.session_count + '</b></span></p>' +
'<p><i class="col-green far fa-fw fa-clock"></i> Playtime<span class="float-right"><b>' + server.playtime + '</b></span></p>' +
'<p><i class="col-grey far fa-fw fa-clock"></i> AFK Time<span class="float-right"><b>' + server.afk_time + '</b></span></p>' +
'<p><i class="col-teal far fa-fw fa-clock"></i> Longest Session<span class="float-right"><b>' + server.longest_session_length + '</b></span></p>' +
'<p><i class="col-teal far fa-fw fa-clock"></i> Session Median<span class="float-right"><b>' + server.session_median + '</b></span></p>' +
'<br>' +
'<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-right"><b>' + server.player_kills + '</b></span></p>' +
'<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-right"><b>' + server.mob_kills + '</b></span></p>' +
'<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-right"><b>' + server.deaths + '</b></span></p>' +
'</div><div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">' +
'<div id="worldpie_server_' + i + '" class="chart-pie"></div>' +
'</div>' +
'</div></td></tr>'
return `<tr class="collapse" data-parent="#tableSAccordion" id="server_t_` + i + `">` +
`<td colspan="4">` +
`<div class="collapse row" data-parent="#tableSAccordion" id="server_t_` + i + `">` +
`<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">` +
(server.operator ? `<p><i class="col-blue fab fa-fw fa-superpowers"></i> Operator</p>` : ``) +
(server.banned ? `<p><i class="col-red fas fa-fw fa-gavel"></i> Banned</p>` : ``) +
(server.operator || server.banned ? `<br>` : ``) +
`<p><i class="col-teal far fa-fw fa-calendar-check"></i> Sessions<span class="float-right"><b>` + server.session_count + `</b></span></p>` +
`<p><i class="col-green far fa-fw fa-clock"></i> Playtime<span class="float-right"><b>` + server.playtime + `</b></span></p>` +
`<p><i class="col-grey far fa-fw fa-clock"></i> AFK Time<span class="float-right"><b>` + server.afk_time + `</b></span></p>` +
`<p><i class="col-teal far fa-fw fa-clock"></i> Longest Session<span class="float-right"><b>` + server.longest_session_length + `</b></span></p>` +
`<p><i class="col-teal far fa-fw fa-clock"></i> Session Median<span class="float-right"><b>` + server.session_median + `</b></span></p>` +
`<br>` +
`<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-right"><b>` + server.player_kills + `</b></span></p>` +
`<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-right"><b>` + server.mob_kills + `</b></span></p>` +
`<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-right"><b>` + server.deaths + `</b></span></p>` +
`</div><div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">` +
`<div id="worldpie_server_` + i + `" class="chart-pie"></div>` +
`</div>` +
`</div></td></tr>`
}

View File

@ -37,7 +37,7 @@ function smallTrend(trend) {
}
function displayError(element, error) {
element.find('.d-sm-flex').after('<div class="alert alert-danger" role="alert">Failed to load values: ' + error + '</div>')
element.find('.d-sm-flex').after(`<div class="alert alert-danger" role="alert">Failed to load values: ` + error + '</div>')
}
/* This function loads Server Overview tab */
@ -152,7 +152,7 @@ function loadOnlineActivityOverviewValues(json, error) {
$(element).find('#data_new_players_retention_30d').text('(' + data.new_players_retention_30d + '/' + data.new_players_30d + ') ' + data.new_players_retention_30d_perc);
$(element).find('#data_new_players_retention_7d').text('(' + data.new_players_retention_7d + '/' + data.new_players_7d + ') ' + data.new_players_retention_7d_perc);
$(element).find('#data_new_players_retention_24h').replaceWith('<td title="This value is a prediction based on previous players.">(' + data.new_players_retention_24h + '/' + data.new_players_24h + ') ' + data.new_players_retention_24h_perc + ' <i class="far fa-fw fa-eye"></i></td>');
$(element).find('#data_new_players_retention_24h').replaceWith(`<td title="This value is a prediction based on previous players.">(` + data.new_players_retention_24h + '/' + data.new_players_24h + ') ' + data.new_players_retention_24h_perc + ' <i class="far fa-fw fa-eye"></i></td>');
$(element).find('#data_playtime_30d').replaceWith('<td>' + data.playtime_30d + smallTrend(data.playtime_30d_trend) + '</td>');
$(element).find('#data_playtime_7d').text(data.playtime_7d);

View File

@ -2,14 +2,14 @@ function loadSessionAccordion(json, error) {
sessionTable = $("#sessions-overview").find("#tableAccordion").find("tbody");
if (error) {
sessionTable.append('<tr><td>Error: ' + error + '</td><td>-</td><td>-</td><td>-</td></tr>');
sessionTable.append(`<tr><td>Error: ` + error + '</td><td>-</td><td>-</td><td>-</td></tr>');
return;
}
var sessions = json.sessions;
if (!sessions.length) {
sessionTable.append('<tr><td>No Data</td><td>-</td><td>-</td><td>-</td></tr>');
sessionTable.append(`<tr><td>No Data</td><td>-</td><td>-</td><td>-</td></tr>`);
return;
}
@ -40,7 +40,7 @@ function onOpenSession(i, sessions) {
}
setTimeout(function () {
var session = sessions[i];
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: session.world_series};
var worldSeries = {name: `World Playtime`, colorByPoint: true, data: session.world_series};
var gmSeries = session.gm_series;
worldPie("worldpie_" + i, worldSeries, gmSeries, '#3A3B45');
@ -51,7 +51,7 @@ function onOpenSession(i, sessions) {
function loadPlayerKills(json, error) {
if (error) {
$('#playerKillTable').replaceWith('<p>Failed to load player kills: ' + error + '</p>');
$('#playerKillTable').replaceWith(`<p>Failed to load player kills: ` + error + '</p>');
return;
}
$('#playerKillTable').replaceWith(createKillsTable(json.player_kills));
@ -59,48 +59,48 @@ function loadPlayerKills(json, error) {
function loadPlayerdeaths(json, error) {
if (error) {
$('#playerDeathTable').replaceWith('<p>Failed to load player deaths: ' + error + '</p>');
$('#playerDeathTable').replaceWith(`<p>Failed to load player deaths: ` + error + '</p>');
return;
}
$('#playerDeathTable').replaceWith(createKillsTable(json.player_deaths));
}
function createAccordionTitle(i, session) {
return '<tr id="session_h_' + i + '" aria-controls="session_t_' + i + '" aria-expanded="false" class="clickable collapsed bg-teal" data-target="#session_t_' + i + '" data-toggle="collapse"><td>'
+ session.name + (session.first_session ? ' <i title="Registered (First session)" class="far fa-calendar-plus"></i>' : '') + '</td>'
+ '<td>' + session.start + '</td>'
+ '<td>' + session.length + '</td>'
+ '<td>' + (session.network_server ? session.network_server : session.most_used_world) + '</td></tr>'
return `<tr id="session_h_` + i + `" aria-controls="session_t_` + i + `" aria-expanded="false" class="clickable collapsed bg-teal" data-target="#session_t_` + i + `" data-toggle="collapse"><td>`
+ session.name + (session.first_session ? ` <i title="Registered (First session)" class="far fa-calendar-plus"></i>` : ``) + `</td>`
+ `<td>` + session.start + `</td>`
+ `<td>` + session.length + `</td>`
+ `<td>` + (session.network_server ? session.network_server : session.most_used_world) + `</td></tr>`
}
function createAccordionBody(i, session) {
return '<tr class="collapse" data-parent="#tableAccordion" id="session_t_' + i + '">' +
'<td colspan="4">' +
'<div class="collapse row" data-parent="#tableAccordion" id="session_t_' + i + '">' +
'<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">' +
'<p><i class="col-teal far fa-fw fa-clock"></i> Ended<span class="float-right"><b>' + session.end + '</b></span></p>' +
'<p><i class="col-green far fa-fw fa-clock"></i> Length<span class="float-right"><b>' + session.length + '</b></span></p>' +
'<p><i class="col-grey far fa-fw fa-clock"></i> AFK Time<span class="float-right"><b>' + session.afk_time + '</b></span></p>' +
'<p><i class="col-green fa fa-fw fa-server"></i> Server<span class="float-right"><b>' + session.server_name + '</b></span></p>' +
(session.avg_ping ? '<p><i class="col-amber fa fa-fw fa-signal"></i> Average Ping<span class="float-right"><b>' + session.avg_ping + '</b></span></p>' : '') +
'<br>' +
'<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-right"><b>' + session.player_kills.length + '</b></span></p>' +
'<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-right"><b>' + session.mob_kills + '</b></span></p>' +
'<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-right"><b>' + session.deaths + '</b></span></p><hr>' +
return `<tr class="collapse" data-parent="#tableAccordion" id="session_t_` + i + `">` +
`<td colspan="4">` +
`<div class="collapse row" data-parent="#tableAccordion" id="session_t_` + i + `">` +
`<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">` +
`<p><i class="col-teal far fa-fw fa-clock"></i> Ended<span class="float-right"><b>` + session.end + `</b></span></p>` +
`<p><i class="col-green far fa-fw fa-clock"></i> Length<span class="float-right"><b>` + session.length + `</b></span></p>` +
`<p><i class="col-grey far fa-fw fa-clock"></i> AFK Time<span class="float-right"><b>` + session.afk_time + `</b></span></p>` +
`<p><i class="col-green fa fa-fw fa-server"></i> Server<span class="float-right"><b>` + session.server_name + `</b></span></p>` +
(session.avg_ping ? `<p><i class="col-amber fa fa-fw fa-signal"></i> Average Ping<span class="float-right"><b>` + session.avg_ping + `</b></span></p>` : ``) +
`<br>` +
`<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-right"><b>` + session.player_kills.length + `</b></span></p>` +
`<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-right"><b>` + session.mob_kills + `</b></span></p>` +
`<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-right"><b>` + session.deaths + `</b></span></p><hr>` +
createKillsTable(session.player_kills) +
'</div><div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">' +
'<div id="worldpie_' + i + '" class="chart-pie"></div>' +
'<a href="' + (session.network_server ? './player/' : '../player/') + session.player_url_name + '" class="float-right btn bg-blue"><i class="fa fa-user"></i><span> Player Page</span></a>' +
(session.network_server ? '<a href="./server/' + session.server_url_name + '" class="float-right btn bg-light-green mr-2"><i class="fa fa-server"></i><span> Server Analysis</span></a>' : '') +
'</div>' +
'</div></td></tr>'
`</div><div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">` +
`<div id="worldpie_` + i + `" class="chart-pie"></div>` +
`<a href="` + (session.network_server ? `./player/` : `../player/`) + session.player_url_name + `" class="float-right btn bg-blue"><i class="fa fa-user"></i><span> Player Page</span></a>` +
(session.network_server ? `<a href="./server/` + session.server_url_name + `" class="float-right btn bg-light-green mr-2"><i class="fa fa-server"></i><span> Server Analysis</span></a>` : ``) +
`</div>` +
`</div></td></tr>`
}
function createKillsTable(player_kills) {
var table = '<table class="table mb-0"><tbody>';
if (player_kills.length === 0) {
table += '<tr><td>None</td><td>-</td><td>-</td></tr>'
table += `<tr><td>None</td><td>-</td><td>-</td></tr>`
}
for (var i = 0; i < player_kills.length; i++) {