budgit/assets/js/progress.min.js
2025-12-10 16:05:30 -05:00

1 line
903 B
JavaScript

(()=>{(function(){"use strict";function a(r){let e=r.querySelector("[data-tui-progress-indicator]");if(!e)return;let t=parseFloat(r.getAttribute("aria-valuenow")||"0"),u=parseFloat(r.getAttribute("aria-valuemax")||"100")||100,i=Math.max(0,Math.min(100,t/u*100));e.style.width=i+"%"}function o(){document.querySelectorAll('[role="progressbar"]').forEach(a)}document.addEventListener("DOMContentLoaded",()=>{o();let r=new MutationObserver(e=>{e.forEach(t=>{t.type==="attributes"&&(t.attributeName==="aria-valuenow"||t.attributeName==="aria-valuemax")&&a(t.target)})});new MutationObserver(()=>{document.querySelectorAll('[role="progressbar"]').forEach(e=>{e.hasAttribute("data-tui-progress-observed")||(e.setAttribute("data-tui-progress-observed","true"),a(e),r.observe(e,{attributes:!0,attributeFilter:["aria-valuenow","aria-valuemax"]}))})}).observe(document.body,{childList:!0,subtree:!0})})})();})();