From 8dc9b98ed06f05312d395ad65f52b4909e2da763 Mon Sep 17 00:00:00 2001 From: Korbs Date: Mon, 26 Feb 2024 05:25:43 -0500 Subject: [PATCH] update --- dist/zorn.js | 377 +++++++++++++++++++++++++++++++++++++++++---- esbuild.config.mjs | 5 +- 2 files changed, 348 insertions(+), 34 deletions(-) diff --git a/dist/zorn.js b/dist/zorn.js index 0f50e54..351e1d2 100644 --- a/dist/zorn.js +++ b/dist/zorn.js @@ -1,46 +1,359 @@ -(() => { - // src/assets/icons/play-solid.svg - var play_solid_default = ''; - - // src/get.js - var ZornVideoPlayer = document.querySelector(".zorn-player"); - var VideoContainer = document.querySelector(".video-container"); - var PlayIcon = play_solid_default; - - // src/themes/default.js - var Controls = ` +(()=>{var x='';var b='';var y='';var w='';var C='';var z='';var M='';var V='';var L='';var T='';var e=document.querySelector(".zorn-player"),p=document.querySelector(".video-container"),g=x,E=b,B=y,I=w,S=C,H=z,h=M,F=V,P=L,$=T;var j=`

+
+
+ + +
00:00
+
+
- - -
- - + + +
+
+ + / +
-
- - -
00:00
-
+ + +
-
- - / - -
- - + +
-`; + +`;function A(){e.addEventListener("error",function(t){document.querySelector("#invalid-src").style.display="inherit",document.querySelector(".zorn-player-controls").style.display="none",videoContainer.style.backgroundColor="#101010",setTimeout(()=>{e.style.opacity="0.10",document.querySelector("#buffering").style.display="none"},168)},!0),e.onwaiting=t=>{document.querySelector("#buffering").style.display="inherit",e.style.transition="5s opacity",e.style.opacity="0.25"},e.oncanplaythrough=t=>{document.querySelector("#buffering").style.display="none",e.style.transition="0.3s opacity",e.style.opacity="1"}}function U(){let t=document.querySelector(".zorn-player-controls #play-pause");t.addEventListener("click",r),e.addEventListener("click",r),e.addEventListener("play",i),e.addEventListener("pause",i);function r(){e.paused||e.ended?e.play():e.pause()}function i(){e.paused?(t.setAttribute("data-title","Play (K)"),t.innerHTML=`${g}`):(t.setAttribute("data-title","Pause (K)"),t.innerHTML=`${E}`)}}function Z(){let t=document.querySelector(".zorn-player-controls #skip-back"),r=document.querySelector(".zorn-player-controls #skip-forth");t.addEventListener("click",i),r.addEventListener("click",a);function i(){d(-10)}function a(){d(10)}function d(s){e.currentTime+=s}}function _(){let t=document.getElementById("fullscreen");function r(){document.fullscreenElement?document.exitFullscreen():document.webkitFullscreenElement?document.webkitExitFullscreen():p.webkitRequestFullscreen?p.webkitRequestFullscreen():p.requestFullscreen()}t.onclick=r;function i(){document.fullscreenElement?(t.setAttribute("data-title","Exit full screen (f)"),t.innerHTML=''):(t.setAttribute("data-title","Full screen (f)"),t.innerHTML='')}p.addEventListener("fullscreenchange",i)}function q(){var t=document.querySelector(".zorn-player-controls #subtitles"),r=[],i=function(c,k,u){var m=document.createElement("li"),l=m.appendChild(document.createElement("button"));return l.setAttribute("id",c),l.className="subtitles-button",k.length>0&&l.setAttribute("lang",k),l.value=u,l.setAttribute("data-state","inactive"),l.appendChild(document.createTextNode(u)),l.addEventListener("click",function(o){r.map(function(v,O,oe){r[O].setAttribute("data-state","inactive")});for(var n=this.getAttribute("lang"),f=0;f0&&e.volume<=.5?t.innerHTML=`${F}`:t.innerHTML=`${h}`}e.addEventListener("volumechange",a);function d(){e.muted=!e.muted,e.muted?(r.setAttribute("data-volume",r.value),r.value=0):r.value=r.dataset.volume}t.addEventListener("click",d)}function D(){let t=document.getElementById("time-elapsed"),r=document.getElementById("duration");function i(o){let n=new Date(o*1e3).toISOString().substr(11,8);return{minutes:n.substr(3,2),seconds:n.substr(6,2)}}e.addEventListener("loadedmetadata",c);function a(){let o=i(Math.round(e.currentTime));t.innerText=`${o.minutes}:${o.seconds}`,t.setAttribute("datetime",`${o.minutes}m ${o.seconds}s`)}e.addEventListener("timeupdate",a);let d=document.getElementById("progress-bar"),s=document.getElementById("seek");function c(){let o=Math.round(e.duration);s.setAttribute("max",o),d.setAttribute("max",o);let n=i(o);r.innerText=`${n.minutes}:${n.seconds}`,r.setAttribute("datetime",`${n.minutes}m ${n.seconds}s`)}function k(){s.value=Math.floor(e.currentTime),d.value=Math.floor(e.currentTime)}e.addEventListener("timeupdate",k);let u=document.getElementById("seek-tooltip");function m(o){let n=Math.round(o.offsetX/o.target.clientWidth*parseInt(o.target.getAttribute("max"),10));s.setAttribute("data-seek",n);let f=i(n);u.textContent=`${f.minutes}:${f.seconds}`;let v=e.getBoundingClientRect();u.style.left=`${o.pageX-v.left}px`}s.addEventListener("mousemove",m);function l(o){let n=o.target.dataset.seek?o.target.dataset.seek:o.target.value;e.currentTime=n,d.value=n,s.value=n}s.addEventListener("input",l),c()}var R=` +
+ ${$} +
+`;e.insertAdjacentHTML("afterend",j);e.insertAdjacentHTML("afterend",R);A();U();Z();_();q();G();D();Buffering();})(); diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 094b527..412653f 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,9 +1,10 @@ import esbuild from 'esbuild' import svg from 'esbuild-plugin-svg' -const context = await esbuild.context({ +const context = esbuild.context({ entryPoints: ['src/index.js'], bundle: true, - outfile: 'dist/zorn.js', + minify: true, + outfile: './dist/zorn.js', plugins: [svg()] }) \ No newline at end of file