Download lecture-06/assets/slidev/TimerBar-W1bISSuY.js from DeepLearning-VT/DeepLearning_2026: direct link, hf CLI and curl.
- Browser
- Download file 2.77 kB
-
https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-06/assets/slidev/TimerBar-W1bISSuY.js
- Command line
-
hf download hf://spaces/DeepLearning-VT/DeepLearning_2026/lecture-06/assets/slidev/TimerBar-W1bISSuY.js
-
curl -L -o TimerBar-W1bISSuY.js https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-06/assets/slidev/TimerBar-W1bISSuY.js
2.77 kB
| import{Q as e,S as t,V as n,_t as r,a as i,b as a,bt as o,g as s,m as c,mt as l,st as u,vt as d,w as f,y as p,z as m}from"../modules/shiki-BFOesOFp.js";import{U as h,t as g,tt as _}from"../useNav-CQhUpX69.js";import{F as v}from"../modules/vue-Ymwlffw_.js";import{o as y}from"../index-B3wHE1T9.js";var b={class:`relative flex gap-px`},x=f({__name:`CurrentProgressBar`,props:{clicksContext:{},current:{}},setup(l){let u=l,f=g(),h=s(()=>u.clicksContext??f.clicksContext.value),_=s(()=>u.current??f.currentSlideNo.value),{total:v}=f;return(s,l)=>(m(),a(`div`,b,[(m(!0),a(c,null,n(r(v)-1,n=>(m(),a(`div`,{key:n,class:d([`border-x border-b border-main h-4px transition-all`,n<_.value?`bg-primary border-primary`:``]),style:o({width:`${1/(r(v)-1)*100}%`})},[t(i,{name:`fade`},{default:e(()=>[n===_.value?(m(),a(`div`,{key:0,class:`h-full bg-primary op75 transition-all`,style:o({width:`${h.value.total===0?0:h.value.current/(h.value.total+1)*100}%`})},null,4)):p(`v-if`,!0)]),_:2},1024)],6))),128))]))}});function S(){let e=s(()=>_.timer||`stopwatch`),t=s(()=>h(_.duration).seconds),n=v(100,{controls:!0}),r=l(y,`timer`),i=s(()=>r.value?.status),a=s(()=>(n.counter.value,r.value.status===`stopped`||!r.value.startedAt?0:r.value.status===`paused`?r.value.pausedAt-r.value.startedAt:Date.now()-r.value.startedAt)),o=s(()=>a.value/1e3),c=s(()=>o.value/t.value*100),u=s(()=>{if(e.value===`stopwatch`&&(r.value.status===`stopped`||!r.value.startedAt))return{h:``,m:`-`,s:`--`,ms:`-`};let n=e.value===`countdown`?t.value*1e3-a.value:a.value,i=Math.floor(n/1e3/60/60).toString();i===`0`&&(i=``);let o=Math.floor(n/1e3/60%60).toString();i&&(o=o.padStart(2,`0`));let s=Math.floor(n/1e3%60).toString().padStart(2,`0`),c=Math.floor(n%1e3/100).toString();return{h:i,m:o,s,ms:c}});function d(){n.pause(),r.value={status:`stopped`,slides:{},startedAt:0,pausedAt:0}}function f(){r.value&&(r.value?.status===`stopped`?(r.value.status=`running`,r.value.startedAt=Date.now()):r.value.status===`paused`&&(r.value.status=`running`,r.value.startedAt=Date.now()-(r.value.pausedAt-r.value.startedAt)),n.resume())}function p(){r.value.status=`paused`,r.value.pausedAt=Date.now(),n.pause()}function m(){r.value.status===`running`?p():f()}return{state:r,status:i,timer:u,reset:d,toggle:m,resume:f,pause:p,passed:o,percentage:c,duration:t,mode:e}}var C={class:`border-b mt-px border-main relative flex h-4px`},w=f({__name:`TimerBar`,setup(e){let t=u(S()),n=s(()=>t.status===`stopped`?`op50`:t.status===`paused`?`bg-blue`:t.percentage>100?`bg-red`:t.percentage>80?`bg-yellow`:`bg-green`);return(e,r)=>(m(),a(`div`,C,[t.status===`stopped`?p(`v-if`,!0):(m(),a(`div`,{key:0,class:d([`h-4px`,n.value]),style:o({width:`${t.percentage}%`})},null,6)),p(` {{ timesplits }} `)]))}});export{S as n,x as r,w as t}; |