From 34b1ee18b3b843886ca151f0b3341f03872e7fc5 Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 9 Aug 2020 10:08:38 +0200 Subject: [PATCH] Updated statistics page (#74) --- pages/statistics/statistics.css | 15 ++++++--------- pages/statistics/statistics.html | 8 ++++---- pages/statistics/statistics.js | 18 +----------------- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/pages/statistics/statistics.css b/pages/statistics/statistics.css index df4b326e..c3403f1a 100644 --- a/pages/statistics/statistics.css +++ b/pages/statistics/statistics.css @@ -9,23 +9,20 @@ table { width: 100%; } +td { + border-top: 1px solid #888; + min-width: 50px; + text-align: right; +} + td:first-child { text-align: left; } -td { - border-top: 1px solid #888; - min-width: 50px; -} - th:first-child { text-align: left; } -#statistics-overview, #tbl-statistics-cdns, #tbl-statistics-frameworks { - display: none; -} - #statistics-overview { text-align: left; } diff --git a/pages/statistics/statistics.html b/pages/statistics/statistics.html index cde8ce7a..936ab0a1 100644 --- a/pages/statistics/statistics.html +++ b/pages/statistics/statistics.html @@ -24,13 +24,13 @@
Delete
-
Average (injections/day)-
-
Injected frameworks-
+
Average (injections/day)-
+
Injected frameworks-
- + @@ -40,7 +40,7 @@
CDNsQuantity
CDNs
--
- + diff --git a/pages/statistics/statistics.js b/pages/statistics/statistics.js index 4ae01a61..162c8655 100644 --- a/pages/statistics/statistics.js +++ b/pages/statistics/statistics.js @@ -28,22 +28,16 @@ statistics._onDocumentLoaded = function () { // Default view is 'today' statistics._dateRange = [new Date().toISOString().slice(0, 10)]; - document.getElementById('date-range').value = 'day'; + document.getElementById('date-range').value = statistics._dateUnit; statistics._registerListener(); statistics._getStatistics().then(statistics._renderContents); }; statistics._renderContents = function () { - if (statistics._data === undefined || statistics._dateRange.length === 0) { - statistics._showData(false); - return false; - } - statistics._filterAndSortData(); statistics._determineInjections(); - statistics._showData(true); statistics._clearTables(); statistics._determineInjections(); statistics._generateTable(statistics._dataSortedCDNs, 'cdns'); @@ -185,7 +179,6 @@ statistics._handlerDateRange = function ({ target }) { statistics._getStatistics().then(statistics._setDateRange); } else if (type === 'delete') { statistics._deleteStatistic(); - statistics._showData(false); } }; @@ -197,15 +190,6 @@ statistics._deleteStatistic = function () { } }; -statistics._showData = function (type) { - let attr = type === true ? 'block' : 'none'; - - document.getElementById('statistics-overview').style.display = attr; - document.getElementById('tbl-statistics-cdns').style.display = attr; - document.getElementById('tbl-statistics-frameworks').style.display = attr; - document.getElementById('btn-delete').disabled = !type; -}; - statistics._registerListener = function () { document.getElementById('date-range').addEventListener('change', statistics._handlerDateRange); document.getElementById('btn-delete').addEventListener('click', function () {
FrameworksQuantity
Frameworks
--