Update vendored topbar

This commit is contained in:
Claudio Ortolina
2025-07-17 17:42:00 +01:00
parent 6c90a3467d
commit feab0939b4
+4 -31
View File
@@ -1,39 +1,12 @@
/** /**
* @license MIT * @license MIT
* topbar 2.0.0, 2023-02-04 * topbar 3.0.0
* https://buunguyen.github.io/topbar * http://buunguyen.github.io/topbar
* Copyright (c) 2021 Buu Nguyen * Copyright (c) 2024 Buu Nguyen
*/ */
(function (window, document) { (function (window, document) {
"use strict"; "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, var canvas,
currentProgress, currentProgress,
showing, showing,
@@ -88,7 +61,6 @@
style.zIndex = 100001; style.zIndex = 100001;
style.display = "none"; style.display = "none";
if (options.className) canvas.classList.add(options.className); if (options.className) canvas.classList.add(options.className);
document.body.appendChild(canvas);
addEvent(window, "resize", repaint); addEvent(window, "resize", repaint);
}, },
topbar = { topbar = {
@@ -105,6 +77,7 @@
showing = true; showing = true;
if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId);
if (!canvas) createCanvas(); if (!canvas) createCanvas();
if (!canvas.parentElement) document.body.appendChild(canvas);
canvas.style.opacity = 1; canvas.style.opacity = 1;
canvas.style.display = "block"; canvas.style.display = "block";
topbar.progress(0); topbar.progress(0);