From 41ba0894acb6dd97427589acbd43910d0555adac Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Fri, 1 Sep 2023 18:09:30 -0500 Subject: [PATCH] Add loading bar --- resources/base.scss | 14 ++++++++++++-- resources/common.js | 7 +++++++ resources/vars.scss | 2 ++ templates/base.html | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/resources/base.scss b/resources/base.scss index 48ac6af..687249f 100644 --- a/resources/base.scss +++ b/resources/base.scss @@ -233,7 +233,7 @@ header { top: 0; left: 0; right: 0; - height: 48px; + height: $navbar_height; } nav { @@ -377,7 +377,7 @@ hr { } #content { - margin: 48px auto 1em auto; + margin: $navbar_height auto 1em auto; padding-top: 1em; // Header @@ -860,6 +860,16 @@ select { margin-bottom: 1em; } +#loading-bar { + position: fixed; + top: 0; + left: 0; + height: 2px; + background-color: #993932; + width: 0; + z-index: 9999; +} + @media (max-width: 799px) { #user-links, .anon { padding-right: 0.5em; diff --git a/resources/common.js b/resources/common.js index 488fb33..380dc63 100644 --- a/resources/common.js +++ b/resources/common.js @@ -385,6 +385,12 @@ function onWindowReady() { showTooltip(e.trigger, fallbackMessage(e.action)); }); }); + $('a').click(function() { + $("#loading-bar").show(); + $("#loading-bar").animate({ width: "100%" }, 1500, function() { + $(this).hide(); + }); + }); } $(function() { @@ -429,4 +435,5 @@ $(function() { $('html').click(function () { $nav_list.hide(); }); + }); \ No newline at end of file diff --git a/resources/vars.scss b/resources/vars.scss index 4bcda31..7556626 100644 --- a/resources/vars.scss +++ b/resources/vars.scss @@ -10,3 +10,5 @@ $widget_border_radius: 4px; $table_header_rounding: 6px; $monospace-fonts: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace; + +$navbar_height: 48px; diff --git a/templates/base.html b/templates/base.html index 2e5013e..c5be0ff 100644 --- a/templates/base.html +++ b/templates/base.html @@ -316,6 +316,7 @@ +
{% if request.in_contest %}