diff --git a/CTFd/themes/admin/static/css/style.css b/CTFd/themes/admin/static/css/style.css index 520ea8e2..e12dcdde 100644 --- a/CTFd/themes/admin/static/css/style.css +++ b/CTFd/themes/admin/static/css/style.css @@ -106,12 +106,17 @@ table{ line-height: 66px; } -.spinner { +.fa.spinner { margin-top: 225px; text-align: center; opacity: 0.5; } +.spinner-error { + text-align: center; + opacity: 0.5; +} + #score-graph{ height: 450px; display: block; @@ -495,7 +500,7 @@ table{ .footer { position: absolute; left: 0; - padding: 0; + bottom: 0; padding: 0; margin: 0; width: 100%; diff --git a/CTFd/themes/admin/templates/base.html b/CTFd/themes/admin/templates/base.html index 595ea32a..a158380c 100644 --- a/CTFd/themes/admin/templates/base.html +++ b/CTFd/themes/admin/templates/base.html @@ -66,9 +66,12 @@
{% block content %} {% endblock %} - +
+ + diff --git a/CTFd/themes/admin/templates/team.html b/CTFd/themes/admin/templates/team.html index 5c7c822d..51a22b73 100644 --- a/CTFd/themes/admin/templates/team.html +++ b/CTFd/themes/admin/templates/team.html @@ -89,6 +89,7 @@ + {% if solves %}
@@ -104,6 +105,11 @@
+ {% else %} +
+

No solves yet

+
+ {% endif %}

IP Addresses

diff --git a/CTFd/themes/original/static/css/style.css b/CTFd/themes/original/static/css/style.css index 9b3a02ff..70c12147 100644 --- a/CTFd/themes/original/static/css/style.css +++ b/CTFd/themes/original/static/css/style.css @@ -116,12 +116,18 @@ table{ clear: both; } -.spinner { +.fa.spinner { margin-top: 225px; text-align: center; opacity: 0.5; } +.spinner-error { + padding-top: 210px; + text-align: center; + opacity: 0.5; +} + #keys-pie-graph{ width: 50%; float: left; diff --git a/CTFd/themes/original/static/js/scoreboard.js b/CTFd/themes/original/static/js/scoreboard.js index 51a006b7..30b4c21d 100644 --- a/CTFd/themes/original/static/js/scoreboard.js +++ b/CTFd/themes/original/static/js/scoreboard.js @@ -1,11 +1,16 @@ function updatescores () { $.get(script_root + '/scores', function( data ) { - teams = $.parseJSON(JSON.stringify(data)); + var teams = $.parseJSON(JSON.stringify(data)); $('#scoreboard > tbody').empty() for (var i = 0; i < teams['standings'].length; i++) { - row = "".format(i+1, teams['standings'][i].id, htmlentities(teams['standings'][i].team), teams['standings'][i].score) + var row = "".format( + i+1, + teams['standings'][i].id, + htmlentities(teams['standings'][i].team), + teams['standings'][i].score + ); $('#scoreboard > tbody').append(row) - }; + } }); } @@ -18,15 +23,17 @@ function cumulativesum (arr) { } function UTCtoDate(utc){ - var d = new Date(0) - d.setUTCSeconds(utc) + var d = new Date(0); + d.setUTCSeconds(utc); return d; } + function scoregraph () { $.get(script_root + '/top/10', function( data ) { var places = $.parseJSON(JSON.stringify(data)); places = places['places']; - if (Object.keys(places).length == 0 ){ + if (Object.keys(places).length === 0 ){ + $('#score-graph').html('

No solves yet

'); // Replace spinner return; } @@ -46,7 +53,7 @@ function scoregraph () { y: team_score, mode: 'lines+markers', name: places[teams[i]]['name'] - } + }; traces.push(trace); } @@ -65,7 +72,7 @@ function scoregraph () { }; console.log(traces); - $('#score-graph').empty() // Remove spinners + $('#score-graph').empty(); // Remove spinners Plotly.newPlot('score-graph', traces, layout); }); } diff --git a/CTFd/themes/original/static/js/team.js b/CTFd/themes/original/static/js/team.js index d729b26e..0087bd70 100644 --- a/CTFd/themes/original/static/js/team.js +++ b/CTFd/themes/original/static/js/team.js @@ -22,15 +22,16 @@ function cumulativesum (arr) { } function scoregraph() { - var times = [] - var scores = [] - var teamname = $('#team-id').text() + var times = []; + var scores = []; + var teamname = $('#team-id').text(); $.get(script_root + '/solves/' + teamid(), function (data) { var solves = $.parseJSON(JSON.stringify(data)); solves = solves['solves']; - if (solves.length == 0) + if (solves.length == 0) { return; + } for (var i = 0; i < solves.length; i++) { var date = moment(solves[i].time * 1000); diff --git a/CTFd/themes/original/templates/scoreboard.html b/CTFd/themes/original/templates/scoreboard.html index aa1f91dd..703edffa 100644 --- a/CTFd/themes/original/templates/scoreboard.html +++ b/CTFd/themes/original/templates/scoreboard.html @@ -32,6 +32,7 @@
+ {% if teams %}
{0}{2}{3}
{0}{2}{3}
@@ -50,6 +51,7 @@
{% endif %} + {% endif %} {% endblock %} diff --git a/CTFd/themes/original/templates/team.html b/CTFd/themes/original/templates/team.html index 07c06a3f..92f3da4a 100644 --- a/CTFd/themes/original/templates/team.html +++ b/CTFd/themes/original/templates/team.html @@ -41,6 +41,7 @@
+ {% if solves %}
@@ -104,6 +105,9 @@
+ {% else %} +

No solves yet

+ {% endif %} {% endif %}
{% endblock %} @@ -111,5 +115,7 @@ {% block scripts %} + {% if solves %} + {% endif %} {% endblock %}