From f62736e6ee390cae6af6c44d8a7719a1fce03707 Mon Sep 17 00:00:00 2001
From: Austin Anderson <angerson@google.com>
Date: Mon, 22 May 2023 19:01:26 -0700
Subject: [PATCH] Fix cookie warning delay

---
 tf_oss_dashboard/script.js | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/tf_oss_dashboard/script.js b/tf_oss_dashboard/script.js
index 3e1ed3f..5ddb706 100644
--- a/tf_oss_dashboard/script.js
+++ b/tf_oss_dashboard/script.js
@@ -1,3 +1,12 @@
+// Display warning banner if use of analytics cookies hasn't been acknowledged
+if (location.hostname !== "" && !Cookies.get("tf-cookies-accepted")) {
+  $(".tf-cookie-warning").removeClass("d-none")
+}
+$("#tf-accept-cookies").click(function() {
+  $(this).addClass("d-none")
+  Cookies.set("tf-cookies-accepted", true)
+})
+
 // Navbar toggle switches
 // When the page loads or when the navbar toggles are switched, toggle the
 // class on the HTML <body> tag that controls those features (colorblind or
@@ -20,6 +29,7 @@ $('#tf-show-buildcop').change(function () {
   $('body').toggleClass('tf-show-buildcop')
 })
 
+
 // Update the human-readable timestamp once per minute and when the page loads
 // Uses moment.js, which is included in the top of the HTML page
 function humanizeTimestamp () {
@@ -166,13 +176,4 @@ $(function () {
     revealed = $(this).attr("data-tf-reveal")
     $(".badge[data-bs-target='" + revealed + "']").removeClass("tf-last-clicked").addClass("tf-revealed")
   })
-
-  // Display warning banner if use of analytics cookies hasn't been acknowledged
-  if (location.hostname !== "" && !Cookies.get("tf-cookies-accepted")) {
-    $(".tf-cookie-warning").removeClass("d-none")
-  }
-  $("#tf-accept-cookies").click(function() {
-    $(this).addClass("d-none")
-    Cookies.set("tf-cookies-accepted", true)
-  })
 })
-- 
GitLab