mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-08 03:39:42 +01:00
Fixed world pie size on accordions
This commit is contained in:
parent
f905f3c879
commit
eb9a6e3134
@ -158,23 +158,41 @@ function loadServerAccordion(json, error) {
|
|||||||
serverTable.append('<tr><td>No Sessions</td><td>-</td><td>-</td><td>-</td></tr>')
|
serverTable.append('<tr><td>No Sessions</td><td>-</td><td>-</td><td>-</td></tr>')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var serversHtml = '';
|
||||||
for (var i = 0; i < servers.length; i++) {
|
for (var i = 0; i < servers.length; i++) {
|
||||||
var server = servers[i];
|
var server = servers[i];
|
||||||
var title = createServerAccordionTitle(i, server);
|
var title = createServerAccordionTitle(i, server);
|
||||||
var body = createServerAccordionBody(i, server);
|
var body = createServerAccordionBody(i, server);
|
||||||
|
|
||||||
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: server.world_pie_series};
|
serversHtml += title + body;
|
||||||
var gmSeries = server.gm_series;
|
}
|
||||||
|
|
||||||
serverTable.append(title);
|
serverTable.append(serversHtml);
|
||||||
serverTable.append(body);
|
|
||||||
|
|
||||||
worldPie("worldpie_server_" + i, worldSeries, gmSeries);
|
for (var i = 0; i < servers.length; i++) {
|
||||||
|
$('#server_h_' + i).click(onOpenServer(i, servers));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onOpenServer(i, servers) {
|
||||||
|
var opened = false;
|
||||||
|
return function () {
|
||||||
|
if (opened) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
var server = servers[i];
|
||||||
|
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: server.world_pie_series};
|
||||||
|
var gmSeries = server.gm_series;
|
||||||
|
|
||||||
|
worldPie("worldpie_server_" + i, worldSeries, gmSeries);
|
||||||
|
}, 250);
|
||||||
|
opened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createServerAccordionTitle(i, server) {
|
function createServerAccordionTitle(i, server) {
|
||||||
return '<tr aria-controls="server_t_' + i + '" aria-expanded="false" class="clickable collapsed bg-light-green" data-target="#server_t_' + i + '" data-toggle="collapse"><td>'
|
return '<tr id="server_h_' + i + '" aria-controls="server_t_' + i + '" aria-expanded="false" class="clickable collapsed bg-light-green" data-target="#server_t_' + i + '" data-toggle="collapse"><td>'
|
||||||
+ server.server_name +
|
+ server.server_name +
|
||||||
(server.operator ? ' <i class="col-blue fab fa-fw fa-superpowers"></i>' : '') +
|
(server.operator ? ' <i class="col-blue fab fa-fw fa-superpowers"></i>' : '') +
|
||||||
(server.banned ? ' <i class="col-red fas fa-fw fa-gavel"></i>' : '') +
|
(server.banned ? ' <i class="col-red fas fa-fw fa-gavel"></i>' : '') +
|
||||||
|
@ -12,18 +12,35 @@ function loadSessionAccordion(json, error) {
|
|||||||
sessionTable.append('<tr><td>No Sessions</td><td>-</td><td>-</td><td>-</td></tr>')
|
sessionTable.append('<tr><td>No Sessions</td><td>-</td><td>-</td><td>-</td></tr>')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sessionsHtml = '';
|
||||||
for (var i = 0; i < sessions.length; i++) {
|
for (var i = 0; i < sessions.length; i++) {
|
||||||
var session = sessions[i];
|
var session = sessions[i];
|
||||||
var title = createAccordionTitle(i, session);
|
var title = createAccordionTitle(i, session);
|
||||||
var body = createAccordionBody(i, session);
|
var body = createAccordionBody(i, session);
|
||||||
|
sessionsHtml += title + body;
|
||||||
|
}
|
||||||
|
|
||||||
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: session.world_series};
|
sessionTable.append(sessionsHtml);
|
||||||
var gmSeries = session.gm_series;
|
|
||||||
|
|
||||||
sessionTable.append(title);
|
for (var i = 0; i < sessions.length; i++) {
|
||||||
sessionTable.append(body);
|
$('#session_h_' + i).click(onOpenSession(i, sessions));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
worldPie("worldpie_" + i, worldSeries, gmSeries);
|
function onOpenSession(i, sessions) {
|
||||||
|
var opened = false;
|
||||||
|
return function () {
|
||||||
|
if (opened) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
var session = sessions[i];
|
||||||
|
var worldSeries = {name: 'World Playtime', colorByPoint: true, data: session.world_series};
|
||||||
|
var gmSeries = session.gm_series;
|
||||||
|
|
||||||
|
worldPie("worldpie_" + i, worldSeries, gmSeries);
|
||||||
|
}, 250);
|
||||||
|
opened = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +61,7 @@ function loadPlayerDeaths(json, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createAccordionTitle(i, session) {
|
function createAccordionTitle(i, session) {
|
||||||
return '<tr aria-controls="session_t_' + i + '" aria-expanded="false" class="clickable collapsed bg-teal" data-target="#session_t_' + i + '" data-toggle="collapse"><td>'
|
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 + '</td>'
|
+ session.name + '</td>'
|
||||||
+ '<td>' + session.start + '</td>'
|
+ '<td>' + session.start + '</td>'
|
||||||
+ '<td>' + session.length + '</td>'
|
+ '<td>' + session.length + '</td>'
|
||||||
@ -77,7 +94,7 @@ function createKillsTable(player_kills) {
|
|||||||
var table = '<table class="table scrollbar"><tbody>';
|
var table = '<table class="table scrollbar"><tbody>';
|
||||||
|
|
||||||
if (player_kills.length === 0) {
|
if (player_kills.length === 0) {
|
||||||
table += '<tr><td>None</td><td>-</td><td>-</td></tr>'
|
table += '<tr><td>No Kills</td><td>-</td><td>-</td></tr>'
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < player_kills.length; i++) {
|
for (var i = 0; i < player_kills.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user