From feab0939b47d81410bb85ded75463df160aa4c4d Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Thu, 17 Jul 2025 17:42:00 +0100 Subject: [PATCH] Update vendored topbar --- assets/vendor/topbar.js | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/assets/vendor/topbar.js b/assets/vendor/topbar.js index 41957274..0552337c 100644 --- a/assets/vendor/topbar.js +++ b/assets/vendor/topbar.js @@ -1,39 +1,12 @@ /** * @license MIT - * topbar 2.0.0, 2023-02-04 - * https://buunguyen.github.io/topbar - * Copyright (c) 2021 Buu Nguyen + * topbar 3.0.0 + * http://buunguyen.github.io/topbar + * Copyright (c) 2024 Buu Nguyen */ (function (window, document) { "use strict"; - // https://gist.github.com/paulirish/1579671 - (function () { - var lastTime = 0; - var vendors = ["ms", "moz", "webkit", "o"]; - for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { - window.requestAnimationFrame = - window[vendors[x] + "RequestAnimationFrame"]; - window.cancelAnimationFrame = - window[vendors[x] + "CancelAnimationFrame"] || - window[vendors[x] + "CancelRequestAnimationFrame"]; - } - if (!window.requestAnimationFrame) - window.requestAnimationFrame = function (callback, element) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - lastTime)); - var id = window.setTimeout(function () { - callback(currTime + timeToCall); - }, timeToCall); - lastTime = currTime + timeToCall; - return id; - }; - if (!window.cancelAnimationFrame) - window.cancelAnimationFrame = function (id) { - clearTimeout(id); - }; - })(); - var canvas, currentProgress, showing, @@ -88,7 +61,6 @@ style.zIndex = 100001; style.display = "none"; if (options.className) canvas.classList.add(options.className); - document.body.appendChild(canvas); addEvent(window, "resize", repaint); }, topbar = { @@ -101,10 +73,11 @@ if (delay) { if (delayTimerId) return; delayTimerId = setTimeout(() => topbar.show(), delay); - } else { + } else { showing = true; if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); if (!canvas) createCanvas(); + if (!canvas.parentElement) document.body.appendChild(canvas); canvas.style.opacity = 1; canvas.style.display = "block"; topbar.progress(0);