From eb9a6e31340ca8e75e53e2d8d92ecd4047760a1b Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Fri, 26 Jul 2019 14:01:07 +0300 Subject: [PATCH] Fixed world pie size on accordions --- .../assets/plan/web/js/player-values.js | 30 ++++++++++++++---- .../assets/plan/web/js/sessionAccordion.js | 31 ++++++++++++++----- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/Plan/common/src/main/resources/assets/plan/web/js/player-values.js b/Plan/common/src/main/resources/assets/plan/web/js/player-values.js index 0a2546883..8e9441f3a 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/player-values.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/player-values.js @@ -158,23 +158,41 @@ function loadServerAccordion(json, error) { serverTable.append('No Sessions---') } + var serversHtml = ''; for (var i = 0; i < servers.length; i++) { var server = servers[i]; var title = createServerAccordionTitle(i, server); var body = createServerAccordionBody(i, server); - var worldSeries = {name: 'World Playtime', colorByPoint: true, data: server.world_pie_series}; - var gmSeries = server.gm_series; + serversHtml += title + body; + } - serverTable.append(title); - serverTable.append(body); + serverTable.append(serversHtml); - 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) { - return '' + return '' + server.server_name + (server.operator ? ' ' : '') + (server.banned ? ' ' : '') + diff --git a/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js b/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js index 29cc961e7..c78c64220 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/sessionAccordion.js @@ -12,18 +12,35 @@ function loadSessionAccordion(json, error) { sessionTable.append('No Sessions---') } + var sessionsHtml = ''; for (var i = 0; i < sessions.length; i++) { var session = sessions[i]; var title = createAccordionTitle(i, session); var body = createAccordionBody(i, session); + sessionsHtml += title + body; + } - var worldSeries = {name: 'World Playtime', colorByPoint: true, data: session.world_series}; - var gmSeries = session.gm_series; + sessionTable.append(sessionsHtml); - sessionTable.append(title); - sessionTable.append(body); + for (var i = 0; i < sessions.length; i++) { + $('#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) { - return '' + return '' + session.name + '' + '' + session.start + '' + '' + session.length + '' @@ -77,7 +94,7 @@ function createKillsTable(player_kills) { var table = ''; if (player_kills.length === 0) { - table += '' + table += '' } for (var i = 0; i < player_kills.length; i++) {
None--
No Kills--