diff --git a/assets/js/editor-artifact.js b/assets/js/editor-artifact.js index d76c9c1f..7c4dd835 100644 --- a/assets/js/editor-artifact.js +++ b/assets/js/editor-artifact.js @@ -117,11 +117,13 @@ import { clipValue, getElmById, titleize } from "./helper.mjs"; ); const tmploc = getElmById(`artifact-editor-templocation`); - if (tmploc !== null) { + if (tmploc !== null && tmploc !== undefined) { const tmplocl = getElmById(`artifact-editor-templocation-label`); - tmplocl.addEventListener(`click`, () => - clipValue(`artifact-editor-templocation`) - ); + if (tmplocl !== null) { + tmplocl.addEventListener(`click`, () => + clipValue(`artifact-editor-templocation`) + ); + } } const osl = document.getElementById("artifact-editor-os-label"); diff --git a/assets/js/editor-assets.js b/assets/js/editor-assets.js index 0ba73005..a88e7601 100644 --- a/assets/js/editor-assets.js +++ b/assets/js/editor-assets.js @@ -20,6 +20,7 @@ import { getElmById } from "./helper.mjs"; const previewReset = getElmById(`artifact-editor-preview-reset`); const previewInput = getElmById(`artifact-editor-replace-preview`); + const previewSubmit = getElmById(`artifact-editor-preview-submit`); const alert = getElmById(`artifact-editor-dl-alert`); const reset = getElmById(`artifact-editor-dl-reset`); const lastMod = getElmById(`artifact-editor-last-modified`); @@ -289,4 +290,13 @@ import { getElmById } from "./helper.mjs"; previewInput.value = ``; previewInput.classList.remove(`is-invalid`, `is-valid`); }); + + // Automatically submit the preview form when a file is selected. + previewInput.addEventListener("change", function (evt) { + if (evt.target.value.trim() === ``) { + return; + } + console.log(`Submitting the image or photo preview form`); + previewSubmit.click(); + }); })(); diff --git a/assets/js/helper.mjs b/assets/js/helper.mjs index 1db70633..8ae98269 100644 --- a/assets/js/helper.mjs +++ b/assets/js/helper.mjs @@ -132,7 +132,9 @@ export async function clipValue(elementId) { export function getElmById(elementId) { const element = document.getElementById(elementId); if (element == null) { - throw new Error(`The ${elementId} for getElmById() element is null.`); + console.error(`The ${elementId} for getElmById() element is null.`); + return; + // throw new Error(`The ${elementId} for getElmById() element is null.`); } return element; } diff --git a/public/js/editor-artifact.min.js b/public/js/editor-artifact.min.js index 25485111..54a9215c 100644 --- a/public/js/editor-artifact.min.js +++ b/public/js/editor-artifact.min.js @@ -1,2 +1,2 @@ /* editor-artifact.min.js © Defacto2 2024 */ -(()=>{function M(t,r,i){if(t==null)throw new Error("The year input element is null.");if(r==null)throw new Error("The month input element is null.");if(i==null)throw new Error("The day input element is null.");t.classList.remove("is-invalid","is-valid"),r.classList.remove("is-invalid","is-valid"),i.classList.remove("is-invalid","is-valid");let o=parseInt(t.value,10);isNaN(o)?t.value="0":t.value=o;let s=parseInt(r.value,10);isNaN(s)?r.value="0":r.value=s;let a=parseInt(i.value,10);isNaN(a)?i.value="0":i.value=a;let d=0,L=new Date().getFullYear(),E=o>=1980&&o<=L;o>d&&!E&&t.classList.add("is-invalid");let U=s>=1&&s<=12;s>d&&!U&&r.classList.add("is-invalid");let y=a>=1&&a<=31;a>d&&!y&&i.classList.add("is-invalid"),isNaN(o)&&(U||y)&&t.classList.add("is-invalid"),(s==d||isNaN(s))&&y&&r.classList.add("is-invalid")}function Ee(t){return pe(t,!0)}function we(t){return pe(t,!1)}function pe(t,r){if(t==null)throw new Error("The repository URL element is null.");t.classList.remove("is-valid","is-invalid");let i=t.value.trim();if(i.length===0)return;if(r==!0&&i.startsWith("refs/")){t.classList.add("is-invalid");return}if(i.includes("://")){t.classList.add("is-invalid");return}let s=/[^A-Za-z0-9-._/]/g;i=i.replace(s,""),i=i.replaceAll("//","/");let a=/^\//;i=i.replace(a,""),t.value=i;let d=t.getAttribute("maxlength");if(d===null)throw new Error(`The maxlength attribute is required for ${t.id}.`);if(i.length>d){t.classList.add("is-invalid");return}}function I(t){if(t==null)throw new Error("The element of the releaser validator is null.");t.classList.remove("is-valid","is-invalid");let r=t.value.trimStart().toUpperCase();r=r.replace("+",", "),r=r.replace(/[^ A-ZÀ-ÖØ-Þ0-9\-,&]/g,""),r=r.replace(/[ ]{2,}/g," "),t.value=r;let i=t.getAttribute("minlength"),o=t.getAttribute("maxlength"),s=t.getAttribute("required");if(i===null)throw new Error(`The minlength attribute is required for ${t.id}.`);if(o===null)throw new Error(`The maxlength attribute is required for ${t.id}.`);let a=document.getElementById("artifact-editor-releasers-error");if(a===null)throw new Error("The releasers error element is null.");let d=r.lengtho;if(s!=null&&d){t.classList.add("is-invalid"),t.id==="-1"&&a.classList.add("d-block");return}let L=r.length>0&&(r.lengtho);if(s==null&&L){t.classList.add("is-invalid");return}t.classList.remove("is-invalid"),a.classList.remove("d-block")}function Le(t){if(t==null)throw new Error("The element of the releaser validator is null.");t.classList.remove("is-valid","is-invalid");let r=t.value.trim();r.length>0&&r.length!=11&&t.classList.add("is-invalid")}function Z(t,r){if(t==null)throw new Error("The element of the number validator is null.");t.classList.remove("is-valid","is-invalid");let i=parseInt(t.value,10);isNaN(i)&&t.classList.add("is-invalid"),(i>r||i<0)&&t.classList.add("is-invalid")}function ye(t){let r=["a","an","and","as","but","for","if","of","or","so","the","to"];return t.split(" ").map((i,o)=>{let s=Ne(i);return o>0&&Number.isInteger(s)?s:o===0||!r.includes(i.toLowerCase())?i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():i.toLowerCase()}).join(" ")}function Ne(t){let r={I:1,V:5,X:10},i=0,o=0;for(let s=t.length-1;s>=0;s--){let a=r[t[s].toUpperCase()];aa?`${(Math.round(t*100/a)/100).toFixed(2)} GB`:t>s?`${(Math.round(t*100/s)/100).toFixed(1)} MB`:t>1e3?`${(Math.round(t*100/1e3)/100).toFixed()} kB`:`${Math.round(t).toFixed()} bytes`}(()=>{"use strict";function t(e){return function(){e.forEach(n=>{n.disabled=!0,n.classList.remove("btn-outline-primary"),n.classList.add("btn-light")})}}function r(e){return function(){e.forEach(n=>{n.disabled=!1,n.classList.remove("btn-light"),n.classList.add("btn-outline-primary")})}}let i=document.getElementById("artifact-editor-modal"),o=document.getElementsByName("artifact-editor-dataeditor");i.addEventListener("shown.bs.modal",()=>{t(o)()}),i.addEventListener("hidden.bs.modal",()=>{r(o)()});let s=document.getElementById("asset-editor-modal"),a=document.getElementsByName("artifact-editor-fileeditor");s.addEventListener("shown.bs.modal",()=>{t(a)()}),s.addEventListener("hidden.bs.modal",()=>{r(a)()});let d=document.getElementById("emulate-editor-modal"),L=document.getElementsByName("artifact-editor-emueditor");d.addEventListener("shown.bs.modal",()=>{t(L)()}),d.addEventListener("hidden.bs.modal",()=>{r(L)()});let E=document.getElementById("emulate-run-program");if(E!==null){let e=document.getElementById("emulate-guess-program");if(e===null)throw new Error("The guess program input is missing.");E.addEventListener("input",()=>{if(E.value=E.value.toUpperCase(),E.value!==""){e.disabled=!0;return}e.disabled=!1})}if(v("artifact-editor-key-value")===null)throw new Error("The key value is missing.");let y=v("artifact-editor-key-label");if(y===null)throw new Error("The key label is missing.");if(y.addEventListener("click",()=>x("artifact-editor-key-value")),v("artifact-editor-unique-id-value")===null)throw new Error("The unique id value is missing.");let X=v("artifact-editor-unique-id-label");if(X===null)throw new Error("The unique id label is missing.");if(X.addEventListener("click",()=>x("artifact-editor-unique-id-value")),v("artifact-editor-location-value")===null)throw new Error("The location value is missing.");let _=v("artifact-editor-location-label");if(_===null)throw new Error("The location label is missing.");if(_.addEventListener("click",()=>x("artifact-editor-location-value")),v("artifact-editor-templocation")!==null&&v("artifact-editor-templocation-label").addEventListener("click",()=>x("artifact-editor-templocation")),document.getElementById("artifact-editor-os-label")===null)throw new Error("The operating system label is missing.");let w=document.getElementById("artifact-editor-operating-system");if(w===null)throw new Error("The operating system input is missing.");w.addEventListener("input",D);let p=document.getElementById("artifact-editor-category");if(p===null)throw new Error("The category input is missing.");p.addEventListener("input",Y),D(),Y();function D(){w.selectedIndex==0&&(w.classList.remove("is-valid"),w.classList.add("is-invalid"))}function Y(){p.selectedIndex==0&&(p.classList.remove("is-valid"),p.classList.add("is-invalid"))}let F=document.getElementsByName("prereset-classifications");if(F.length===0)throw new Error("The preset classifications are missing.");for(let e=0;e{T.preventDefault(),w.value=m,w.classList.remove("is-invalid"),p.value=f,p.classList.remove("is-invalid"),D(),Y()})}let g=document.getElementById("artifact-editor-filename");if(g===null)throw new Error("The filename input is missing.");g.addEventListener("input",e=>{e.target.classList.remove("is-valid"),e.target.classList.remove("is-invalid"),e.target.value.trim().length===0&&e.target.classList.add("is-invalid")});let J=document.getElementById("artifact-editor-filename-reset");if(J===null)throw new Error("The filename reset is missing.");let z=document.getElementsByName("artifact-editor-filename-undo");if(z.length===0)throw new Error("The filename resetter is missing.");J.addEventListener("click",()=>{if(g.classList.remove("is-valid"),z.length===0)throw new Error("The filename resetter is missing.");g.value=z[0].value,g.classList.add("is-valid"),g.classList.remove("is-invalid"),g.value.trim().length===0&&g.classList.add("is-invalid")});let b=document.getElementById("artifact-editor-releaser-1");if(b===null)throw new Error("The releaser 1 input is missing.");b.addEventListener("input",e=>I(e.target));let B=document.getElementById("artifact-editor-releaser-2");if(B===null)throw new Error("The releaser 2 input is missing.");B.addEventListener("input",e=>I(e.target));let K=document.getElementById("artifact-editor-releaser-undo");if(K===null)throw new Error("The releasers reset is missing.");K.addEventListener("click",Be);function Be(){let e=b.getAttribute("data-reset-rel1");if(e===null)throw new Error("data-reset-rel1 attribute is required for artifact-editor-releaser-1.");b.value=e,I(b);let n=B.getAttribute("data-reset-rel2");if(n===null)throw new Error("data-reset-rel2 attribute is required for artifact-editor-releaser-2.");B.value=n,I(B)}let h=document.getElementById("artifact-editor-title");if(h===null)throw new Error("The title input is missing.");h.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let Q=document.getElementById("artifact-editor-title-undo");if(Q===null)throw new Error("The title reset is missing.");let S=document.getElementsByName("artifact-editor-titleundo");if(S.length===0)throw new Error("The title resetter is missing.");Q.addEventListener("click",()=>{if(h.classList.remove("is-valid"),S.length===0)throw new Error("The title resetter is missing.");h.value=S[0].value,h.classList.add("is-valid")});let ee=document.getElementById("artifact-editor-titleize");if(ee.length===0)throw new Error("The titleize button is missing.");ee.addEventListener("click",()=>{h.value=ye(h.value);let e=new Event("keyup");h.dispatchEvent(e)});let V=document.getElementById("artifact-editor-credit-text");if(V===null)throw new Error("The creator text input is missing.");V.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let G=document.getElementById("artifact-editor-credit-ill");if(G===null)throw new Error("The creator illustrator input is missing.");G.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let P=document.getElementById("artifact-editor-credit-prog");if(P===null)throw new Error("The creator programmer input is missing.");P.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let j=document.getElementById("artifact-editor-credit-audio");if(j===null)throw new Error("The creator audio input is missing.");j.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let O=document.getElementById("artifact-editor-credits-undo");if(O===null)throw new Error("The creator resetter is missing.");let te=document.getElementById("artifact-editor-credit-undo");if(te===null)throw new Error("The creator reset is missing.");te.addEventListener("click",()=>{if(O.length===0)throw new Error("The creator resetter is missing.");let e=O.value.split(";");if(e.length!=4)throw new Error("The creator resetter values are invalid.");let n=e[0],m=e[1],f=e[2],T=e[3];V.value=n,G.value=m,P.value=f,j.value=T});let ie=document.getElementById("artifact-editor-virustotal");if(ie===null)throw new Error("The virustotal input is missing.");ie.addEventListener("input",e=>{e.target.classList.remove("is-valid","is-invalid");let n=e.target.value.trim();n.length!=0&&(n.startsWith("https://www.virustotal.com/")||e.target.classList.add("is-invalid"))});let l=document.getElementById("artifact-editor-year");if(l===null)throw new Error("The year input is missing.");l.addEventListener("input",()=>{let e=parseInt(l.value,10);e>=79&&e<=99&&(l.value=1900+e),M(l,c,u)});let c=document.getElementById("artifact-editor-month");if(c===null)throw new Error("The month input is missing.");c.addEventListener("input",()=>{M(l,c,u)});let u=document.getElementById("artifact-editor-day");if(u===null)throw new Error("The day input is missing.");u.addEventListener("input",()=>{M(l,c,u)});let re=document.getElementById("artifact-editor-date-reset");if(re===null)throw new Error("The date reset is missing.");let ne=document.getElementById("artifact-editor-date-resetter");if(ne===null)throw new Error("The date resetter is missing.");re.addEventListener("click",()=>{l.classList.remove("is-invalid","is-valid"),c.classList.remove("is-invalid","is-valid"),u.classList.remove("is-invalid","is-valid");let n=ne.value.split("-");if(n.length!=3)throw new Error("The date resetter values are invalid.");l.value=n[0],c.value=n[1],u.value=n[2]});let k=document.getElementById("artifact-editor-comment");if(k===null)throw new Error("The comment input is missing.");k.addEventListener("input",e=>{if(e.target.classList.remove("is-valid"),(l.value==0&&c.value==0&&u.value==0)==!1)return;let f=/(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(\d{2})/.exec(e.target.value);if(f){let T=f[1],xe=f[2],ke=f[3],C=parseInt(ke,10);l.value=2e3+C,C>=79&&C<=99&&(l.value=1900+C),c.value=T,u.value=xe;let he=document.getElementById("artifact-editor-date-update");he!==null&&he.click()}});let se=document.getElementById("artifact-editor-comment-undo");if(se===null)throw new Error("The comment reset is missing.");let ae=document.getElementById("artifact-editor-comment-resetter");if(ae===null)throw new Error("The comment resetter is missing.");se.addEventListener("click",()=>{k.classList.remove("is-valid"),k.value=ae.value});let oe=document.getElementById("artifact-editor-date-lastmod");if(oe!==null){let e=document.getElementById("artifact-editor-date-lastmodder");if(e===null)throw new Error("The date last modder input is missing.");oe.addEventListener("click",()=>{l.classList.remove("is-invalid","is-valid"),c.classList.remove("is-invalid","is-valid"),u.classList.remove("is-invalid","is-valid");let m=e.value.split("-");if(m.length!=3)throw new Error("The date last modder values are invalid.");l.value=m[0],c.value=m[1],u.value=m[2]})}let le=document.getElementById("artifact-editor-links-reset");if(le===null)throw new Error("The links reset is missing.");let N=document.getElementById("artifact-editor-youtube"),de=document.getElementById("artifact-editor-youtube-reset");if(N===null||de===null)throw new Error("A YouTube input is missing.");let $=document.getElementById("artifact-editor-demozoo"),ce=document.getElementById("artifact-editor-demozoo-reset");if($===null||ce===null)throw new Error("A Demozoo input is missing.");let A=document.getElementById("artifact-editor-pouet"),ue=document.getElementById("artifact-editor-pouet-reset");if(A===null||ue===null)throw new Error("A Pouet input is missing.");let R=document.getElementById("artifact-editor-16colors"),me=document.getElementById("artifact-editor-16colors-reset");if(R===null||me===null)throw new Error("A 16colors input is missing.");let q=document.getElementById("artifact-editor-github"),ve=document.getElementById("artifact-editor-github-reset");if(q===null||ve===null)throw new Error("A GitHub input is missing.");let H=document.getElementById("artifact-editor-relations"),fe=document.getElementById("artifact-editor-relations-reset");if(H===null||fe===null)throw new Error("A relations input is missing.");let W=document.getElementById("artifact-editor-websites"),ge=document.getElementById("artifact-editor-websites-reset");if(W===null||ge===null)throw new Error("A websites input is missing.");le.addEventListener("click",()=>{N.classList.remove("is-invalid","is-valid"),$.classList.remove("is-invalid","is-valid"),A.classList.remove("is-invalid","is-valid"),R.classList.remove("is-invalid","is-valid"),q.classList.remove("is-invalid","is-valid"),H.classList.remove("is-invalid","is-valid"),W.classList.remove("is-invalid","is-valid"),N.value=de.value,$.value=ce.value,A.value=ue.value,R.value=me.value,q.value=ve.value,H.value=fe.value,W.value=ge.value});let Te=45e4,Ie=2e5;N.addEventListener("input",e=>Le(e.target)),$.addEventListener("input",e=>Z(e.target,Te)),A.addEventListener("input",e=>Z(e.target,Ie)),R.addEventListener("input",e=>we(e.target)),q.addEventListener("input",e=>Ee(e.target))})();})(); +(()=>{function M(t,r,i){if(t==null)throw new Error("The year input element is null.");if(r==null)throw new Error("The month input element is null.");if(i==null)throw new Error("The day input element is null.");t.classList.remove("is-invalid","is-valid"),r.classList.remove("is-invalid","is-valid"),i.classList.remove("is-invalid","is-valid");let o=parseInt(t.value,10);isNaN(o)?t.value="0":t.value=o;let s=parseInt(r.value,10);isNaN(s)?r.value="0":r.value=s;let a=parseInt(i.value,10);isNaN(a)?i.value="0":i.value=a;let d=0,L=new Date().getFullYear(),E=o>=1980&&o<=L;o>d&&!E&&t.classList.add("is-invalid");let U=s>=1&&s<=12;s>d&&!U&&r.classList.add("is-invalid");let y=a>=1&&a<=31;a>d&&!y&&i.classList.add("is-invalid"),isNaN(o)&&(U||y)&&t.classList.add("is-invalid"),(s==d||isNaN(s))&&y&&r.classList.add("is-invalid")}function we(t){return Le(t,!0)}function pe(t){return Le(t,!1)}function Le(t,r){if(t==null)throw new Error("The repository URL element is null.");t.classList.remove("is-valid","is-invalid");let i=t.value.trim();if(i.length===0)return;if(r==!0&&i.startsWith("refs/")){t.classList.add("is-invalid");return}if(i.includes("://")){t.classList.add("is-invalid");return}let s=/[^A-Za-z0-9-._/]/g;i=i.replace(s,""),i=i.replaceAll("//","/");let a=/^\//;i=i.replace(a,""),t.value=i;let d=t.getAttribute("maxlength");if(d===null)throw new Error(`The maxlength attribute is required for ${t.id}.`);if(i.length>d){t.classList.add("is-invalid");return}}function I(t){if(t==null)throw new Error("The element of the releaser validator is null.");t.classList.remove("is-valid","is-invalid");let r=t.value.trimStart().toUpperCase();r=r.replace("+",", "),r=r.replace(/[^ A-ZÀ-ÖØ-Þ0-9\-,&]/g,""),r=r.replace(/[ ]{2,}/g," "),t.value=r;let i=t.getAttribute("minlength"),o=t.getAttribute("maxlength"),s=t.getAttribute("required");if(i===null)throw new Error(`The minlength attribute is required for ${t.id}.`);if(o===null)throw new Error(`The maxlength attribute is required for ${t.id}.`);let a=document.getElementById("artifact-editor-releasers-error");if(a===null)throw new Error("The releasers error element is null.");let d=r.lengtho;if(s!=null&&d){t.classList.add("is-invalid"),t.id==="-1"&&a.classList.add("d-block");return}let L=r.length>0&&(r.lengtho);if(s==null&&L){t.classList.add("is-invalid");return}t.classList.remove("is-invalid"),a.classList.remove("d-block")}function ye(t){if(t==null)throw new Error("The element of the releaser validator is null.");t.classList.remove("is-valid","is-invalid");let r=t.value.trim();r.length>0&&r.length!=11&&t.classList.add("is-invalid")}function Z(t,r){if(t==null)throw new Error("The element of the number validator is null.");t.classList.remove("is-valid","is-invalid");let i=parseInt(t.value,10);isNaN(i)&&t.classList.add("is-invalid"),(i>r||i<0)&&t.classList.add("is-invalid")}function be(t){let r=["a","an","and","as","but","for","if","of","or","so","the","to"];return t.split(" ").map((i,o)=>{let s=$e(i);return o>0&&Number.isInteger(s)?s:o===0||!r.includes(i.toLowerCase())?i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():i.toLowerCase()}).join(" ")}function $e(t){let r={I:1,V:5,X:10},i=0,o=0;for(let s=t.length-1;s>=0;s--){let a=r[t[s].toUpperCase()];aa?`${(Math.round(t*100/a)/100).toFixed(2)} GB`:t>s?`${(Math.round(t*100/s)/100).toFixed(1)} MB`:t>1e3?`${(Math.round(t*100/1e3)/100).toFixed()} kB`:`${Math.round(t).toFixed()} bytes`}(()=>{"use strict";function t(e){return function(){e.forEach(n=>{n.disabled=!0,n.classList.remove("btn-outline-primary"),n.classList.add("btn-light")})}}function r(e){return function(){e.forEach(n=>{n.disabled=!1,n.classList.remove("btn-light"),n.classList.add("btn-outline-primary")})}}let i=document.getElementById("artifact-editor-modal"),o=document.getElementsByName("artifact-editor-dataeditor");i.addEventListener("shown.bs.modal",()=>{t(o)()}),i.addEventListener("hidden.bs.modal",()=>{r(o)()});let s=document.getElementById("asset-editor-modal"),a=document.getElementsByName("artifact-editor-fileeditor");s.addEventListener("shown.bs.modal",()=>{t(a)()}),s.addEventListener("hidden.bs.modal",()=>{r(a)()});let d=document.getElementById("emulate-editor-modal"),L=document.getElementsByName("artifact-editor-emueditor");d.addEventListener("shown.bs.modal",()=>{t(L)()}),d.addEventListener("hidden.bs.modal",()=>{r(L)()});let E=document.getElementById("emulate-run-program");if(E!==null){let e=document.getElementById("emulate-guess-program");if(e===null)throw new Error("The guess program input is missing.");E.addEventListener("input",()=>{if(E.value=E.value.toUpperCase(),E.value!==""){e.disabled=!0;return}e.disabled=!1})}if(v("artifact-editor-key-value")===null)throw new Error("The key value is missing.");let y=v("artifact-editor-key-label");if(y===null)throw new Error("The key label is missing.");if(y.addEventListener("click",()=>x("artifact-editor-key-value")),v("artifact-editor-unique-id-value")===null)throw new Error("The unique id value is missing.");let X=v("artifact-editor-unique-id-label");if(X===null)throw new Error("The unique id label is missing.");if(X.addEventListener("click",()=>x("artifact-editor-unique-id-value")),v("artifact-editor-location-value")===null)throw new Error("The location value is missing.");let _=v("artifact-editor-location-label");if(_===null)throw new Error("The location label is missing.");_.addEventListener("click",()=>x("artifact-editor-location-value"));let J=v("artifact-editor-templocation");if(J!=null){let e=v("artifact-editor-templocation-label");e!==null&&e.addEventListener("click",()=>x("artifact-editor-templocation"))}if(document.getElementById("artifact-editor-os-label")===null)throw new Error("The operating system label is missing.");let w=document.getElementById("artifact-editor-operating-system");if(w===null)throw new Error("The operating system input is missing.");w.addEventListener("input",D);let p=document.getElementById("artifact-editor-category");if(p===null)throw new Error("The category input is missing.");p.addEventListener("input",Y),D(),Y();function D(){w.selectedIndex==0&&(w.classList.remove("is-valid"),w.classList.add("is-invalid"))}function Y(){p.selectedIndex==0&&(p.classList.remove("is-valid"),p.classList.add("is-invalid"))}let F=document.getElementsByName("prereset-classifications");if(F.length===0)throw new Error("The preset classifications are missing.");for(let e=0;e{T.preventDefault(),w.value=m,w.classList.remove("is-invalid"),p.value=f,p.classList.remove("is-invalid"),D(),Y()})}let g=document.getElementById("artifact-editor-filename");if(g===null)throw new Error("The filename input is missing.");g.addEventListener("input",e=>{e.target.classList.remove("is-valid"),e.target.classList.remove("is-invalid"),e.target.value.trim().length===0&&e.target.classList.add("is-invalid")});let K=document.getElementById("artifact-editor-filename-reset");if(K===null)throw new Error("The filename reset is missing.");let z=document.getElementsByName("artifact-editor-filename-undo");if(z.length===0)throw new Error("The filename resetter is missing.");K.addEventListener("click",()=>{if(g.classList.remove("is-valid"),z.length===0)throw new Error("The filename resetter is missing.");g.value=z[0].value,g.classList.add("is-valid"),g.classList.remove("is-invalid"),g.value.trim().length===0&&g.classList.add("is-invalid")});let b=document.getElementById("artifact-editor-releaser-1");if(b===null)throw new Error("The releaser 1 input is missing.");b.addEventListener("input",e=>I(e.target));let B=document.getElementById("artifact-editor-releaser-2");if(B===null)throw new Error("The releaser 2 input is missing.");B.addEventListener("input",e=>I(e.target));let Q=document.getElementById("artifact-editor-releaser-undo");if(Q===null)throw new Error("The releasers reset is missing.");Q.addEventListener("click",Te);function Te(){let e=b.getAttribute("data-reset-rel1");if(e===null)throw new Error("data-reset-rel1 attribute is required for artifact-editor-releaser-1.");b.value=e,I(b);let n=B.getAttribute("data-reset-rel2");if(n===null)throw new Error("data-reset-rel2 attribute is required for artifact-editor-releaser-2.");B.value=n,I(B)}let h=document.getElementById("artifact-editor-title");if(h===null)throw new Error("The title input is missing.");h.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let ee=document.getElementById("artifact-editor-title-undo");if(ee===null)throw new Error("The title reset is missing.");let S=document.getElementsByName("artifact-editor-titleundo");if(S.length===0)throw new Error("The title resetter is missing.");ee.addEventListener("click",()=>{if(h.classList.remove("is-valid"),S.length===0)throw new Error("The title resetter is missing.");h.value=S[0].value,h.classList.add("is-valid")});let te=document.getElementById("artifact-editor-titleize");if(te.length===0)throw new Error("The titleize button is missing.");te.addEventListener("click",()=>{h.value=be(h.value);let e=new Event("keyup");h.dispatchEvent(e)});let V=document.getElementById("artifact-editor-credit-text");if(V===null)throw new Error("The creator text input is missing.");V.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let G=document.getElementById("artifact-editor-credit-ill");if(G===null)throw new Error("The creator illustrator input is missing.");G.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let P=document.getElementById("artifact-editor-credit-prog");if(P===null)throw new Error("The creator programmer input is missing.");P.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let j=document.getElementById("artifact-editor-credit-audio");if(j===null)throw new Error("The creator audio input is missing.");j.addEventListener("input",e=>{e.target.classList.remove("is-valid")});let O=document.getElementById("artifact-editor-credits-undo");if(O===null)throw new Error("The creator resetter is missing.");let ie=document.getElementById("artifact-editor-credit-undo");if(ie===null)throw new Error("The creator reset is missing.");ie.addEventListener("click",()=>{if(O.length===0)throw new Error("The creator resetter is missing.");let e=O.value.split(";");if(e.length!=4)throw new Error("The creator resetter values are invalid.");let n=e[0],m=e[1],f=e[2],T=e[3];V.value=n,G.value=m,P.value=f,j.value=T});let re=document.getElementById("artifact-editor-virustotal");if(re===null)throw new Error("The virustotal input is missing.");re.addEventListener("input",e=>{e.target.classList.remove("is-valid","is-invalid");let n=e.target.value.trim();n.length!=0&&(n.startsWith("https://www.virustotal.com/")||e.target.classList.add("is-invalid"))});let l=document.getElementById("artifact-editor-year");if(l===null)throw new Error("The year input is missing.");l.addEventListener("input",()=>{let e=parseInt(l.value,10);e>=79&&e<=99&&(l.value=1900+e),M(l,u,c)});let u=document.getElementById("artifact-editor-month");if(u===null)throw new Error("The month input is missing.");u.addEventListener("input",()=>{M(l,u,c)});let c=document.getElementById("artifact-editor-day");if(c===null)throw new Error("The day input is missing.");c.addEventListener("input",()=>{M(l,u,c)});let ne=document.getElementById("artifact-editor-date-reset");if(ne===null)throw new Error("The date reset is missing.");let se=document.getElementById("artifact-editor-date-resetter");if(se===null)throw new Error("The date resetter is missing.");ne.addEventListener("click",()=>{l.classList.remove("is-invalid","is-valid"),u.classList.remove("is-invalid","is-valid"),c.classList.remove("is-invalid","is-valid");let n=se.value.split("-");if(n.length!=3)throw new Error("The date resetter values are invalid.");l.value=n[0],u.value=n[1],c.value=n[2]});let k=document.getElementById("artifact-editor-comment");if(k===null)throw new Error("The comment input is missing.");k.addEventListener("input",e=>{if(e.target.classList.remove("is-valid"),(l.value==0&&u.value==0&&c.value==0)==!1)return;let f=/(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(\d{2})/.exec(e.target.value);if(f){let T=f[1],ke=f[2],Ne=f[3],C=parseInt(Ne,10);l.value=2e3+C,C>=79&&C<=99&&(l.value=1900+C),u.value=T,c.value=ke;let Ee=document.getElementById("artifact-editor-date-update");Ee!==null&&Ee.click()}});let ae=document.getElementById("artifact-editor-comment-undo");if(ae===null)throw new Error("The comment reset is missing.");let oe=document.getElementById("artifact-editor-comment-resetter");if(oe===null)throw new Error("The comment resetter is missing.");ae.addEventListener("click",()=>{k.classList.remove("is-valid"),k.value=oe.value});let le=document.getElementById("artifact-editor-date-lastmod");if(le!==null){let e=document.getElementById("artifact-editor-date-lastmodder");if(e===null)throw new Error("The date last modder input is missing.");le.addEventListener("click",()=>{l.classList.remove("is-invalid","is-valid"),u.classList.remove("is-invalid","is-valid"),c.classList.remove("is-invalid","is-valid");let m=e.value.split("-");if(m.length!=3)throw new Error("The date last modder values are invalid.");l.value=m[0],u.value=m[1],c.value=m[2]})}let de=document.getElementById("artifact-editor-links-reset");if(de===null)throw new Error("The links reset is missing.");let N=document.getElementById("artifact-editor-youtube"),ue=document.getElementById("artifact-editor-youtube-reset");if(N===null||ue===null)throw new Error("A YouTube input is missing.");let $=document.getElementById("artifact-editor-demozoo"),ce=document.getElementById("artifact-editor-demozoo-reset");if($===null||ce===null)throw new Error("A Demozoo input is missing.");let A=document.getElementById("artifact-editor-pouet"),me=document.getElementById("artifact-editor-pouet-reset");if(A===null||me===null)throw new Error("A Pouet input is missing.");let R=document.getElementById("artifact-editor-16colors"),ve=document.getElementById("artifact-editor-16colors-reset");if(R===null||ve===null)throw new Error("A 16colors input is missing.");let q=document.getElementById("artifact-editor-github"),fe=document.getElementById("artifact-editor-github-reset");if(q===null||fe===null)throw new Error("A GitHub input is missing.");let H=document.getElementById("artifact-editor-relations"),ge=document.getElementById("artifact-editor-relations-reset");if(H===null||ge===null)throw new Error("A relations input is missing.");let W=document.getElementById("artifact-editor-websites"),he=document.getElementById("artifact-editor-websites-reset");if(W===null||he===null)throw new Error("A websites input is missing.");de.addEventListener("click",()=>{N.classList.remove("is-invalid","is-valid"),$.classList.remove("is-invalid","is-valid"),A.classList.remove("is-invalid","is-valid"),R.classList.remove("is-invalid","is-valid"),q.classList.remove("is-invalid","is-valid"),H.classList.remove("is-invalid","is-valid"),W.classList.remove("is-invalid","is-valid"),N.value=ue.value,$.value=ce.value,A.value=me.value,R.value=ve.value,q.value=fe.value,H.value=ge.value,W.value=he.value});let Ie=45e4,xe=2e5;N.addEventListener("input",e=>ye(e.target)),$.addEventListener("input",e=>Z(e.target,Ie)),A.addEventListener("input",e=>Z(e.target,xe)),R.addEventListener("input",e=>pe(e.target)),q.addEventListener("input",e=>we(e.target))})();})(); diff --git a/public/js/editor-assets.min.js b/public/js/editor-assets.min.js index a7ea9842..1ae7d64f 100644 --- a/public/js/editor-assets.min.js +++ b/public/js/editor-assets.min.js @@ -1,2 +1,2 @@ /* editor-assets.min.js © Defacto2 2024 */ -(()=>{function u(t){let r=document.getElementById(t);if(r==null)throw new Error(`The ${t} for getElmById() element is null.`);return r}var g="is-invalid",f="d-none",R=100,v=1024*1024,L=100*v;async function Y(t){if(t==null)throw new Error("The file value of checkSHA is null.");try{let r=await z(t),o=await fetch(`/uploader/sha384/${r}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:r});if(!o.ok)throw new Error(`Hashing is not possible, server response: ${o.status}`);return await o.text()=="true"}catch(r){console.log(`Hashing is not possible: ${r}`)}}async function z(t){if(t==null)throw new Error("The file value of sha384 is null.");try{let r=await t.arrayBuffer(),o=await crypto.subtle.digest("SHA-384",r);return Array.from(new Uint8Array(o)).map(c=>c.toString(16).padStart(2,"0")).join("")}catch(r){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${r}`)}}function T(t,r){if(t==null)throw new Error("The formId value of progress is null.");if(r==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${t}`,"htmx:xhr:progress",function(o){o.target.id==`${t}`&&htmx.find(`#${r}`).setAttribute("value",o.detail.loaded/o.detail.total*R)})}function $(t){if(t==null)throw new Error("The file value of checkSize is null.");return t.size>L?`The chosen file is too big at ${Math.round(t.size/v)}MB, maximum size is ${L/v}MB.`:""}function B(t,r,o,c){if(t==null)throw new Error("The errors value of checkErrors is null.");if(r==null)throw new Error("The alert value of checkErrors is null.");if(o==null)throw new Error("The fileInput value of checkErrors is null.");if(c==null)throw new Error("The results value of checkErrors is null.");t=t.filter(h=>h!=""),!(t.length<=0)&&(r.innerText=t.join(" "),r.classList.remove(f),o.innerText="",o.classList.add(g),c.classList.add(f))}async function M(t,r,o,c){if(t==null)throw new Error("The file value of checkDuplicate is null.");if(r==null)throw new Error("The alert value of checkDuplicate is null.");if(o==null)throw new Error("The fileInput value of checkDuplicate is null.");if(c==null)throw new Error("The results value of checkDuplicate is null.");await Y(t)!=!1&&(r.innerText=`The chosen file already exists in the database: ${t.name}`,r.classList.remove(f),o.innerText="",o.classList.add(g),c.classList.add(f))}function I(t,r,o){if(t==null)throw new Error("The fileInput value of resetInput is null.");if(r==null)throw new Error("The alert value of resetInput is null.");if(o==null)throw new Error("The results value of resetInput is null.");t.innerText="",t.classList.remove(g),r.innerText="",r.classList.add(f),o.innerText="",o.classList.add(f)}(()=>{"use strict";T("artifact-editor-dl-form","artifact-editor-dl-progress"),T("artifact-editor-preview-form","artifact-editor-preview-progress");let t=u("artifact-editor-preview-reset"),r=u("artifact-editor-replace-preview"),o=u("artifact-editor-dl-alert"),c=u("artifact-editor-dl-reset"),h=u("artifact-editor-last-modified"),x=u("artifact-editor-dl-results"),d=u("artifact-editor-dl-up");d.addEventListener("change",S);async function S(){I(d,o,x);let e=this.files[0],s=[$(e)];B(s,o,d,x),M(e,o,d,x);let n=e.lastModified,i=new Date().getTime(),a=60*60*1e3;i-n{location.reload()},500);return}if(e.detail.failed&&e.detail.xhr){i.classList.add(a),i.innerText=`Something on the server is not working, ${w.status} status: ${w.responseText}.`;return}i.classList.add(a),i.innerText="Something with the browser is not working, please try again or refresh the page."}function y(e,s,n,i){if(e.detail.elt===null||e.detail.elt.id!==`${s}`)return;let a=document.getElementById(n);if(a===null)throw new Error(`The htmx successful input element ${n} is null`);let l=document.getElementById(i);if(l===null)throw new Error(`The htmx successful feedback element ${i} is null`);if(e.detail.successful)return A(e,a,l);if(e.detail.failed&&e.detail.xhr)return F(e,a,l);j(a,l)}function A(e,s,n){let i=e.detail.xhr;n.innerText=`${i.responseText}`,n.classList.remove("invalid-feedback"),n.classList.add("valid-feedback"),s.classList.remove("is-invalid"),s.classList.add("is-valid"),setTimeout(()=>{location.reload()},500)}function F(e,s,n){let i=e.detail.xhr;n.innerText=`Something on the server is not working, ${i.status} status: ${i.responseText}.`,n.classList.remove("valid-feedback"),n.classList.add("invalid-feedback"),s.classList.remove("is-valid"),s.classList.add("is-invalid")}function j(e,s){e.classList.remove("is-valid"),e.classList.add("is-invalid"),s.innerText="Something with the browser is not working, please try again or refresh the page.",s.classList.remove("d-none")}c.addEventListener("click",function(){o.innerText="",o.classList.add("d-none"),d.value="",d.classList.remove("is-invalid","is-valid")}),t.addEventListener("click",function(){r.value="",r.classList.remove("is-invalid","is-valid")})})();})(); +(()=>{function u(t){let r=document.getElementById(t);if(r==null){console.error(`The ${t} for getElmById() element is null.`);return}return r}var g="is-invalid",f="d-none",Y=100,v=1024*1024,L=100*v;async function z(t){if(t==null)throw new Error("The file value of checkSHA is null.");try{let r=await U(t),i=await fetch(`/uploader/sha384/${r}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:r});if(!i.ok)throw new Error(`Hashing is not possible, server response: ${i.status}`);return await i.text()=="true"}catch(r){console.log(`Hashing is not possible: ${r}`)}}async function U(t){if(t==null)throw new Error("The file value of sha384 is null.");try{let r=await t.arrayBuffer(),i=await crypto.subtle.digest("SHA-384",r);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("")}catch(r){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${r}`)}}function T(t,r){if(t==null)throw new Error("The formId value of progress is null.");if(r==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${t}`,"htmx:xhr:progress",function(i){i.target.id==`${t}`&&htmx.find(`#${r}`).setAttribute("value",i.detail.loaded/i.detail.total*Y)})}function $(t){if(t==null)throw new Error("The file value of checkSize is null.");return t.size>L?`The chosen file is too big at ${Math.round(t.size/v)}MB, maximum size is ${L/v}MB.`:""}function B(t,r,i,a){if(t==null)throw new Error("The errors value of checkErrors is null.");if(r==null)throw new Error("The alert value of checkErrors is null.");if(i==null)throw new Error("The fileInput value of checkErrors is null.");if(a==null)throw new Error("The results value of checkErrors is null.");t=t.filter(h=>h!=""),!(t.length<=0)&&(r.innerText=t.join(" "),r.classList.remove(f),i.innerText="",i.classList.add(g),a.classList.add(f))}async function M(t,r,i,a){if(t==null)throw new Error("The file value of checkDuplicate is null.");if(r==null)throw new Error("The alert value of checkDuplicate is null.");if(i==null)throw new Error("The fileInput value of checkDuplicate is null.");if(a==null)throw new Error("The results value of checkDuplicate is null.");await z(t)!=!1&&(r.innerText=`The chosen file already exists in the database: ${t.name}`,r.classList.remove(f),i.innerText="",i.classList.add(g),a.classList.add(f))}function I(t,r,i){if(t==null)throw new Error("The fileInput value of resetInput is null.");if(r==null)throw new Error("The alert value of resetInput is null.");if(i==null)throw new Error("The results value of resetInput is null.");t.innerText="",t.classList.remove(g),r.innerText="",r.classList.add(f),i.innerText="",i.classList.add(f)}(()=>{"use strict";T("artifact-editor-dl-form","artifact-editor-dl-progress"),T("artifact-editor-preview-form","artifact-editor-preview-progress");let t=u("artifact-editor-preview-reset"),r=u("artifact-editor-replace-preview"),i=u("artifact-editor-preview-submit"),a=u("artifact-editor-dl-alert"),h=u("artifact-editor-dl-reset"),S=u("artifact-editor-last-modified"),x=u("artifact-editor-dl-results"),d=u("artifact-editor-dl-up");d.addEventListener("change",C);async function C(){I(d,a,x);let e=this.files[0],s=[$(e)];B(s,a,d,x),M(e,a,d,x);let n=e.lastModified,o=new Date().getTime(),l=60*60*1e3;o-n{location.reload()},500);return}if(e.detail.failed&&e.detail.xhr){o.classList.add(l),o.innerText=`Something on the server is not working, ${w.status} status: ${w.responseText}.`;return}o.classList.add(l),o.innerText="Something with the browser is not working, please try again or refresh the page."}function y(e,s,n,o){if(e.detail.elt===null||e.detail.elt.id!==`${s}`)return;let l=document.getElementById(n);if(l===null)throw new Error(`The htmx successful input element ${n} is null`);let c=document.getElementById(o);if(c===null)throw new Error(`The htmx successful feedback element ${o} is null`);if(e.detail.successful)return F(e,l,c);if(e.detail.failed&&e.detail.xhr)return j(e,l,c);R(l,c)}function F(e,s,n){let o=e.detail.xhr;n.innerText=`${o.responseText}`,n.classList.remove("invalid-feedback"),n.classList.add("valid-feedback"),s.classList.remove("is-invalid"),s.classList.add("is-valid"),setTimeout(()=>{location.reload()},500)}function j(e,s,n){let o=e.detail.xhr;n.innerText=`Something on the server is not working, ${o.status} status: ${o.responseText}.`,n.classList.remove("valid-feedback"),n.classList.add("invalid-feedback"),s.classList.remove("is-valid"),s.classList.add("is-invalid")}function R(e,s){e.classList.remove("is-valid"),e.classList.add("is-invalid"),s.innerText="Something with the browser is not working, please try again or refresh the page.",s.classList.remove("d-none")}h.addEventListener("click",function(){a.innerText="",a.classList.add("d-none"),d.value="",d.classList.remove("is-invalid","is-valid")}),t.addEventListener("click",function(){r.value="",r.classList.remove("is-invalid","is-valid")}),r.addEventListener("change",function(e){e.target.value.trim()!==""&&(console.log("Submitting the image or photo preview form"),i.click())})})();})(); diff --git a/public/js/readme.min.js b/public/js/readme.min.js index 1d43e540..3b80502e 100644 --- a/public/js/readme.min.js +++ b/public/js/readme.min.js @@ -1,2 +1,2 @@ /* readme.min.js © Defacto2 2024 */ -(()=>{async function u(t){let a=c(t);a.focus(),await navigator.clipboard.writeText(`${a.textContent}`).then(function(){console.log(`Copied ${x(a.textContent.length)} to the clipboard`);let e=document.getElementById("artifact-copy-readme-body");if(e===null)return;let r=e.textContent;e.textContent="\u2713 Copied",window.setTimeout(()=>{e.textContent=`${r}`},1e3)},function(e){console.error(`could not save any text to the clipboard: ${e}`)})}function c(t){let n=document.getElementById(t);if(n==null)throw new Error(`The ${t} for getElmById() element is null.`);return n}function x(t=0){let r=Math.pow(1e3,2),o=Math.pow(1e3,3);return t>o?`${(Math.round(t*100/o)/100).toFixed(2)} GB`:t>r?`${(Math.round(t*100/r)/100).toFixed(1)} MB`:t>1e3?`${(Math.round(t*100/1e3)/100).toFixed()} kB`:`${Math.round(t).toFixed()} bytes`}(()=>{"use strict";let t="d-none",n=["reader-invert","border","border-black","rounded-1"],a="readmeLatin1",e=c(a),r="readmeCP437",o=c(r),f=document.querySelector('input[name="readme-base"]:checked'),l=document.getElementById("monoFont");l!==null&&l.addEventListener("click",m);function m(){switch(f.id){case"vgaFont":e.classList.add(t),o.classList.remove(t,"font-dos",...n),o.classList.add("font-cascadia-mono");break;case"topazFont":o.classList.add(t),e.classList.remove(t,"font-amiga",...n),e.classList.add("font-cascadia-mono");break;default:throw new Error("no default font found for the readme")}}let i=document.getElementById("topazFont");i!==null&&i.addEventListener("click",p);function p(){o.classList.add(t),e.classList.remove(t,"font-cascadia-mono"),e.classList.add("font-amiga",...n)}let s=document.getElementById("vgaFont");s!==null&&s.addEventListener("click",h);function h(){e.classList.add(t),o.classList.remove(t,"font-cascadia-mono"),o.classList.add("font-dos",...n)}let d=c("artifact-copy-readme-body");typeof navigator.clipboard>"u"?d.classList.add(t):d.addEventListener("click",v);function v(){i!==null&&i.checked?u(a):s!==null&&s.checked?u(r):u(r)}})();})(); +(()=>{async function u(t){let a=c(t);a.focus(),await navigator.clipboard.writeText(`${a.textContent}`).then(function(){console.log(`Copied ${x(a.textContent.length)} to the clipboard`);let e=document.getElementById("artifact-copy-readme-body");if(e===null)return;let r=e.textContent;e.textContent="\u2713 Copied",window.setTimeout(()=>{e.textContent=`${r}`},1e3)},function(e){console.error(`could not save any text to the clipboard: ${e}`)})}function c(t){let n=document.getElementById(t);if(n==null){console.error(`The ${t} for getElmById() element is null.`);return}return n}function x(t=0){let r=Math.pow(1e3,2),o=Math.pow(1e3,3);return t>o?`${(Math.round(t*100/o)/100).toFixed(2)} GB`:t>r?`${(Math.round(t*100/r)/100).toFixed(1)} MB`:t>1e3?`${(Math.round(t*100/1e3)/100).toFixed()} kB`:`${Math.round(t).toFixed()} bytes`}(()=>{"use strict";let t="d-none",n=["reader-invert","border","border-black","rounded-1"],a="readmeLatin1",e=c(a),r="readmeCP437",o=c(r),f=document.querySelector('input[name="readme-base"]:checked'),l=document.getElementById("monoFont");l!==null&&l.addEventListener("click",m);function m(){switch(f.id){case"vgaFont":e.classList.add(t),o.classList.remove(t,"font-dos",...n),o.classList.add("font-cascadia-mono");break;case"topazFont":o.classList.add(t),e.classList.remove(t,"font-amiga",...n),e.classList.add("font-cascadia-mono");break;default:throw new Error("no default font found for the readme")}}let i=document.getElementById("topazFont");i!==null&&i.addEventListener("click",p);function p(){o.classList.add(t),e.classList.remove(t,"font-cascadia-mono"),e.classList.add("font-amiga",...n)}let s=document.getElementById("vgaFont");s!==null&&s.addEventListener("click",h);function h(){e.classList.add(t),o.classList.remove(t,"font-cascadia-mono"),o.classList.add("font-dos",...n)}let d=c("artifact-copy-readme-body");typeof navigator.clipboard>"u"?d.classList.add(t):d.addEventListener("click",v);function v(){i!==null&&i.checked?u(a):s!==null&&s.checked?u(r):u(r)}})();})(); diff --git a/public/js/uploader.min.js b/public/js/uploader.min.js index bd584927..472929db 100644 --- a/public/js/uploader.min.js +++ b/public/js/uploader.min.js @@ -1,2 +1,2 @@ /* uploader.min.js © Defacto2 2024 */ -(()=>{function t(e){let a=document.getElementById(e);if(a==null)throw new Error(`The ${e} for getElmById() element is null.`);return a}function n(e){if(`${e}`=="")return!0;let a=1980,r=new Date().getFullYear();return!(er)}function o(e){return`${e}`==""?!0:!(e<1||e>12)}function ne(e){return`${e}`==""?!0:!(e<1||e>31)}function Se(e,a){if(e=="")return!0;let r=Number(e),s=Number(a);if(!Number.isInteger(s)||s<1)throw new Error(`The ID sanity value is invalid: ${s}`);return Number.isInteger(r)&&r>0&&r<=s}var l="is-invalid",k="d-none",gt=100,xe=1024*1024,He=100*xe;function T(e,a){if(e==null)throw new Error("The elementId value of focusModalById is null.");if(a==null)throw new Error("The submissionId value of focusModalById is null.");let r=document.getElementById(a);if(r==null)throw new Error(`The ${a} element is null.`);let s=t(e);if(s.addEventListener("shown.bs.modal",function(){r.focus()}),bootstrap===void 0)throw new Error("The bootstrap object is undefined.");return new bootstrap.Modal(s,{keyboard:!0})}async function yt(e){if(e==null)throw new Error("The file value of checkSHA is null.");try{let a=await bt(e),r=await fetch(`/uploader/sha384/${a}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:a});if(!r.ok)throw new Error(`Hashing is not possible, server response: ${r.status}`);return await r.text()=="true"}catch(a){console.log(`Hashing is not possible: ${a}`)}}async function bt(e){if(e==null)throw new Error("The file value of sha384 is null.");try{let a=await e.arrayBuffer(),r=await crypto.subtle.digest("SHA-384",a);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(a){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${a}`)}}function H(e,a){if(e==null)throw new Error("The formId value of progress is null.");if(a==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${e}`,"htmx:xhr:progress",function(r){r.target.id==`${e}`&&htmx.find(`#${a}`).setAttribute("value",r.detail.loaded/r.detail.total*gt)})}function u(e){if(e==null)throw new Error("The file value of checkSize is null.");return e.size>He?`The chosen file is too big at ${Math.round(e.size/xe)}MB, maximum size is ${He/xe}MB.`:""}function Ye(){return ne(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function d(){return console.log(`The month value is ${this.value}.`),o(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function f(){return n(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function p(e,a,r,s){if(e==null)throw new Error("The errors value of checkErrors is null.");if(a==null)throw new Error("The alert value of checkErrors is null.");if(r==null)throw new Error("The fileInput value of checkErrors is null.");if(s==null)throw new Error("The results value of checkErrors is null.");e=e.filter(w=>w!=""),!(e.length<=0)&&(a.innerText=e.join(" "),a.classList.remove(k),r.innerText="",r.classList.add(l),s.classList.add(k))}async function m(e,a,r,s){if(e==null)throw new Error("The file value of checkDuplicate is null.");if(a==null)throw new Error("The alert value of checkDuplicate is null.");if(r==null)throw new Error("The fileInput value of checkDuplicate is null.");if(s==null)throw new Error("The results value of checkDuplicate is null.");await yt(e)!=!1&&(a.innerText=`The chosen file already exists in the database: ${e.name}`,a.classList.remove(k),r.innerText="",r.classList.add(l),s.classList.add(k))}function h(e,a,r){if(e==null)throw new Error("The file1 value of hiddenDetails is null.");if(a==null)throw new Error("The lastMod value of hiddenDetails is null.");if(r==null)throw new Error("The magic value of hiddenDetails is null.");let s=e.lastModified,w=new Date().getTime(),Be=60*60*1e3;w-s=400&&s.classList.remove(Q)}),document.body.addEventListener("htmx:afterRequest",function(S){if(S.detail.elt===null||S.detail.elt.id!==`${e}`)return;if(S.detail.successful)return Vt(r);let ie=S.detail.xhr;if(S.detail.failed&&ie)return ie.status===404?Nt(s,w,a):qt(s,ie);Rt(s)})}function je(e,a){e.addEventListener("input",function(){if(!Se(e.value,a)){e.classList.add(ge);return}e.classList.remove(ge)})}function At(e,a){a.innerHTML="",e.innerText="",e.classList.add(Q)}function Vt(e){e.focus()}function Nt(e,a,r){a.innerText=`Production not found on ${r}.`}function Rt(e){e.innerText="Something with the browser is not working, please refresh the page.",e.classList.remove(Q)}function qt(e,a){e.innerText=`Something went wrong, ${a.status} status: ${a.responseText}.`,e.classList.remove(Q)}var Pt="application/x-freearc",Kt="application/x-arj",Ut="application/x-bzip",Gt="application/x-bzip2",Ot="application/gzip",Xt="application/vnd.rar",Zt="application/x-tar",_t="application/zip",Jt="application/x-7z-compressed",Qt="application/x-msdos-program",Wt="image/bmp",er="image/gif",tr="image/jpeg",rr="image/vnd.zbrush.pcx",ar="image/png",sr="image/tiff",ir="image/webp",nr="application/x-csh",or="application/x-chrome-extension",lr="text/x-script.perl",cr="application/x-httpd-php",ur="text/x-script.phyton",dr="text/x-script.rexx",fr="application/x-sh",pr="application/x-shellscript",mr="text/x-script.tcl",hr="text/x-shellscript",vr="text/x-script.zsh";function Lr(){return[nr,or,lr,cr,ur,dr,fr,pr,mr,hr,vr]}function Ae(){return[Qt]}function oe(){return[Pt,Kt,Ut,Gt,Ot,Xt,Zt,_t,Jt]}function Ve(){return["application/octet-stream","application/x-binary","application/x-ms-dos-executable"]}function xr(){return[Wt,er,tr,rr,ar,sr,ir]}function Ne(){return["text/plain","text/x-nfo"]}function Re(e){return Lr().includes(e)}function qe(e){return xr().concat(oe()).includes(e)}function le(e){return Ae().concat(oe(),Ve()).includes(e)}function Pe(e){return Ne().concat(oe(),Ae(),Ve()).includes(e)}function Ke(e){return Ne().concat(oe()).includes(e)}var gr="uploader-image-form",E="is-invalid",be="d-none",yr=t(gr),R=t("uploader-image-alert"),Y=t("uploader-image-file"),Ue=t("uploader-image-last-modified"),br=t("uploader-image-list-1"),wr=t("uploader-image-list-2"),Ge=t("uploader-image-magic"),W=t("uploader-image-month"),ce=t("uploader-image-releaser-1"),M=t("uploader-image-results"),N=t("uploader-image-year");yr.addEventListener("reset",function(){Ue.value="",Ge.value="",Xe()});Y.addEventListener("change",Tr);ce.addEventListener("input",c);N.addEventListener("input",f);W.addEventListener("input",d);function Oe(e){t(e).addEventListener("click",function(){let r=!0;if(ce.value==""&&(ce.classList.add(E),r=!1),n(N.value)==!1&&(N.classList.add(E),r=!1),o(W.value)==!1&&(W.classList.add(E),r=!1),W.value!=""&&N.value==""&&(N.classList.add(E),r=!1),Y.value==""&&(Y.classList.add(E),r=!1),r==!1)return L(R,M);Xe(),M.innerText="...",M.classList.remove(be)})}async function Tr(){v(Y,R,M);let e=this.files[0],a=[u(e),Er(e)];p(a,R,Y,M),m(e,R,Y,M),h(e,Ue,Ge)}function Er(e){return qe(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function Xe(){br.innerHTML="",wr.innerHTML="",M.innerHTML="",M.classList.add(be),R.innerText="",R.classList.add(be),N.classList.remove(E),W.classList.remove(E),ce.classList.remove(E),Y.classList.remove(E)}var kr="uploader-intro-form",b="is-invalid",we="d-none",Mr=t(kr),P=t("uploader-intro-alert"),F=t("uploader-intro-file"),Ze=t("uploader-intro-last-modified"),zr=t("uploader-intro-list-1"),$r=t("uploader-intro-list-2"),_e=t("uploader-intro-magic"),ee=t("uploader-intro-month"),ue=t("uploader-intro-releaser-1"),z=t("uploader-intro-results"),q=t("uploader-intro-year"),Je=t("uploader-intro-youtube");Mr.addEventListener("reset",function(){Ze.value="",_e.value="",We()});F.addEventListener("change",Ir);ue.addEventListener("input",c);q.addEventListener("input",f);ee.addEventListener("input",d);Je.addEventListener("input",Fe);function Qe(e){t(e).addEventListener("click",function(){let r=!0;if(ue.value==""&&(ue.classList.add(b),r=!1),n(q.value)==!1&&(q.classList.add(b),r=!1),o(ee.value)==!1&&(ee.classList.add(b),r=!1),ee.value!=""&&q.value==""&&(q.classList.add(b),r=!1),F.value==""&&(F.classList.add(b),r=!1),r==!1)return L(P,z);We(),z.innerText="...",z.classList.remove(we)})}async function Ir(){v(F,P,z);let e=this.files[0],a=[u(e),Br(e)];p(a,P,F,z),m(e,P,F,z),h(e,Ze,_e)}function Br(e){return le(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function We(){zr.innerHTML="",$r.innerHTML="",z.innerHTML="",z.classList.add(we),P.innerText="",P.classList.add(we),q.classList.remove(b),ee.classList.remove(b),ue.classList.remove(b),Je.classList.remove(b),F.classList.remove(b)}var Dr="uploader-magazine-form",x="is-invalid",Te="d-none",Sr=t(Dr),U=t("uploader-magazine-alert"),C=t("uploader-magazine-file"),et=t("uploader-magazine-last-modified"),Hr=t("uploader-magazine-list-1"),tt=t("uploader-magazine-magic"),te=t("uploader-magazine-month"),de=t("uploader-magazine-releaser-1"),$=t("uploader-magazine-results"),Ee=t("uploader-magazine-title"),K=t("uploader-magazine-year");Sr.addEventListener("reset",function(){et.value="",tt.value="",at()});C.addEventListener("change",Yr);de.addEventListener("input",c);K.addEventListener("input",f);te.addEventListener("input",d);function rt(e){t(e).addEventListener("click",function(){let r=!0;if(Ee.value==""&&(Ee.classList.add(x),r=!1),de.value==""&&(de.classList.add(x),r=!1),n(K.value)==!1&&(K.classList.add(x),r=!1),o(te.value)==!1&&(te.classList.add(x),r=!1),te.value!=""&&K.value==""&&(K.classList.add(x),r=!1),C.value==""&&(C.classList.add(x),r=!1),r==!1)return L(U,$);at(),$.innerText="...",$.classList.remove(Te)})}async function Yr(){v(C,U,$);let e=this.files[0],a=[u(e),Fr(e)];p(a,U,C,$),m(e,U,C,$),h(e,et,tt)}function Fr(e){return Pe(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function at(){Hr.innerHTML="",$.innerHTML="",$.classList.add(Te),U.innerText="",U.classList.add(Te),K.classList.remove(x),te.classList.remove(x),de.classList.remove(x),C.classList.remove(x),Ee.classList.remove(x)}var Cr="uploader-text-form",g="is-invalid",ke="d-none",jr=t(Cr),O=t("uploader-text-alert"),j=t("uploader-text-file"),st=t("uploader-text-last-modified"),Ar=t("uploader-text-list-1"),Vr=t("uploader-text-list-2"),it=t("uploader-text-magic"),re=t("uploader-text-month"),fe=t("uploader-text-releaser-1"),I=t("uploader-text-results"),Me=t("uploader-text-title"),G=t("uploader-text-year");jr.addEventListener("reset",function(){st.value="",it.value="",ot()});j.addEventListener("change",Nr);fe.addEventListener("input",c);G.addEventListener("input",f);re.addEventListener("input",d);function nt(e){t(e).addEventListener("click",function(){let r=!0;if(Me.value==""&&(Me.classList.add(g),r=!1),fe.value==""&&(fe.classList.add(g),r=!1),n(G.value)==!1&&(G.classList.add(g),r=!1),o(re.value)==!1&&(re.classList.add(g),r=!1),re.value!=""&&G.value==""&&(G.classList.add(g),r=!1),j.value==""&&(j.classList.add(g),r=!1),r==!1)return L(O,I);ot(),I.innerText="...",I.classList.remove(ke)})}async function Nr(){v(j,O,I);let e=this.files[0],a=[u(e),Rr(e)];p(a,O,j,I),m(e,O,j,I),h(e,st,it)}function Rr(e){return Ke(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for a text.`}function ot(){Ar.innerHTML="",Vr.innerHTML="",I.innerHTML="",I.classList.add(ke),O.innerText="",O.classList.add(ke),G.classList.remove(g),re.classList.remove(g),fe.classList.remove(g),j.classList.remove(g),Me.classList.remove(g)}var qr="uploader-trainer-form",y="is-invalid",ze="d-none",Pr=t(qr),Z=t("uploader-trainer-alert"),A=t("uploader-trainer-file"),lt=t("uploader-trainer-last-modified"),Kr=t("uploader-trainer-list-1"),Ur=t("uploader-trainer-list-2"),ct=t("uploader-trainer-magic"),ae=t("uploader-trainer-month"),pe=t("uploader-trainer-releaser-1"),B=t("uploader-trainer-results"),$e=t("uploader-trainer-title"),X=t("uploader-trainer-year");Pr.addEventListener("reset",function(){lt.value="",ct.value="",dt()});A.addEventListener("change",Gr);pe.addEventListener("input",c);X.addEventListener("input",f);ae.addEventListener("input",d);function ut(e){t(e).addEventListener("click",function(){let r=!0;if($e.value==""&&($e.classList.add(y),r=!1),pe.value==""&&(pe.classList.add(y),r=!1),n(X.value)==!1&&(X.classList.add(y),r=!1),o(ae.value)==!1&&(ae.classList.add(y),r=!1),ae.value!=""&&X.value==""&&(X.classList.add(y),r=!1),A.value==""&&(A.classList.add(y),r=!1),r==!1)return L(Z,B);dt(),B.innerText="...",B.classList.remove(ze)})}async function Gr(){v(A,Z,B);let e=this.files[0],a=[u(e),Or(e)];p(a,Z,A,B),m(e,Z,A,B),h(e,lt,ct)}function Or(e){return le(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function dt(){Kr.innerHTML="",Ur.innerHTML="",B.innerHTML="",B.classList.add(ze),Z.innerText="",Z.classList.add(ze),X.classList.remove(y),ae.classList.remove(y),pe.classList.remove(y),A.classList.remove(y),$e.classList.remove(y)}var Xr="uploader-advanced-form",i="is-invalid",Ie="d-none",Zr=t(Xr),J=t("uploader-advanced-alert"),me=t("uploader-advanced-category"),_r=t("uploader-advanced-classification-help"),he=t("uploader-advanced-day"),V=t("uploader-advanced-file"),ft=t("uploader-advanced-last-modified"),Jr=t("uploader-advanced-list-1"),Qr=t("uploader-advanced-list-2"),pt=t("uploader-advanced-magic"),se=t("uploader-advanced-month"),ve=t("uploader-advanced-operating-system"),Le=t("uploader-advanced-releaser-1"),D=t("uploader-advanced-results"),_=t("uploader-advanced-year");Zr.addEventListener("reset",function(){ft.value="",pt.value="",ht()});V.addEventListener("change",Wr);Le.addEventListener("input",c);_.addEventListener("input",f);se.addEventListener("input",d);he.addEventListener("input",Ye);me.addEventListener("change",c);ve.addEventListener("change",c);function mt(e){t(e).addEventListener("click",function(){let r=!0;if(Le.value==""&&(Le.classList.add(i),r=!1),n(_.value)==!1&&(_.classList.add(i),r=!1),o(se.value)==!1&&(se.classList.add(i),r=!1),ne(he.value)==!1&&(he.classList.add(i),r=!1),se.value!=""&&_.value==""&&(_.classList.add(i),r=!1),V.value==""&&(V.classList.add(i),r=!1),ve.value==""&&(ve.classList.add(i),r=!1),me.value==""&&(me.classList.add(i),r=!1),r==!1)return L(J,D);ht(),D.innerText="...",D.classList.remove(Ie)})}async function Wr(){v(V,J,D);let e=this.files[0],a=[u(e),ea(e)];p(a,J,V,D),m(e,J,V,D),h(e,ft,pt)}function ea(e){return Re(e.type)?`The chosen file mime type ${e.type} might not be suitable for an upload.`:""}function ht(){Jr.innerHTML="",Qr.innerHTML="",D.innerHTML="",_r.innerHTML="",D.classList.add(Ie),J.innerText="",J.classList.add(Ie),_.classList.remove(i),se.classList.remove(i),he.classList.remove(i),Le.classList.remove(i),V.classList.remove(i),ve.classList.remove(i),me.classList.remove(i)}(()=>{"use strict";Ce(),ye("demozoo-submission","Demozoo"),ye("pouet-submission","Pou\xEBt"),Oe("uploader-image-submit"),H("uploader-image-form","uploader-image-progress"),Qe("uploader-intro-submit"),H("uploader-intro-form","uploader-intro-progress"),ut("uploader-trainer-submit"),H("uploader-trainer-form","uploader-trainer-progress"),rt("uploader-magazine-submit"),H("uploader-magazine-form","uploader-magazine-progress"),nt("uploader-text-submit"),H("uploader-text-form","uploader-text-progress"),mt("uploader-advanced-submit"),H("uploader-advanced-form","uploader-advanced-progress")})();})(); +(()=>{function t(e){let a=document.getElementById(e);if(a==null){console.error(`The ${e} for getElmById() element is null.`);return}return a}function n(e){if(`${e}`=="")return!0;let a=1980,r=new Date().getFullYear();return!(er)}function o(e){return`${e}`==""?!0:!(e<1||e>12)}function ne(e){return`${e}`==""?!0:!(e<1||e>31)}function Se(e,a){if(e=="")return!0;let r=Number(e),s=Number(a);if(!Number.isInteger(s)||s<1)throw new Error(`The ID sanity value is invalid: ${s}`);return Number.isInteger(r)&&r>0&&r<=s}var l="is-invalid",k="d-none",gt=100,xe=1024*1024,He=100*xe;function w(e,a){if(e==null)throw new Error("The elementId value of focusModalById is null.");if(a==null)throw new Error("The submissionId value of focusModalById is null.");let r=document.getElementById(a);if(r==null)throw new Error(`The ${a} element is null.`);let s=t(e);if(s.addEventListener("shown.bs.modal",function(){r.focus()}),bootstrap===void 0)throw new Error("The bootstrap object is undefined.");return new bootstrap.Modal(s,{keyboard:!0})}async function yt(e){if(e==null)throw new Error("The file value of checkSHA is null.");try{let a=await bt(e),r=await fetch(`/uploader/sha384/${a}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:a});if(!r.ok)throw new Error(`Hashing is not possible, server response: ${r.status}`);return await r.text()=="true"}catch(a){console.log(`Hashing is not possible: ${a}`)}}async function bt(e){if(e==null)throw new Error("The file value of sha384 is null.");try{let a=await e.arrayBuffer(),r=await crypto.subtle.digest("SHA-384",a);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(a){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${a}`)}}function H(e,a){if(e==null)throw new Error("The formId value of progress is null.");if(a==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${e}`,"htmx:xhr:progress",function(r){r.target.id==`${e}`&&htmx.find(`#${a}`).setAttribute("value",r.detail.loaded/r.detail.total*gt)})}function u(e){if(e==null)throw new Error("The file value of checkSize is null.");return e.size>He?`The chosen file is too big at ${Math.round(e.size/xe)}MB, maximum size is ${He/xe}MB.`:""}function Ye(){return ne(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function d(){return console.log(`The month value is ${this.value}.`),o(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function f(){return n(this.value)==!1?(this.classList.add(l),!1):(this.classList.remove(l),!0)}function p(e,a,r,s){if(e==null)throw new Error("The errors value of checkErrors is null.");if(a==null)throw new Error("The alert value of checkErrors is null.");if(r==null)throw new Error("The fileInput value of checkErrors is null.");if(s==null)throw new Error("The results value of checkErrors is null.");e=e.filter(T=>T!=""),!(e.length<=0)&&(a.innerText=e.join(" "),a.classList.remove(k),r.innerText="",r.classList.add(l),s.classList.add(k))}async function m(e,a,r,s){if(e==null)throw new Error("The file value of checkDuplicate is null.");if(a==null)throw new Error("The alert value of checkDuplicate is null.");if(r==null)throw new Error("The fileInput value of checkDuplicate is null.");if(s==null)throw new Error("The results value of checkDuplicate is null.");await yt(e)!=!1&&(a.innerText=`The chosen file already exists in the database: ${e.name}`,a.classList.remove(k),r.innerText="",r.classList.add(l),s.classList.add(k))}function h(e,a,r){if(e==null)throw new Error("The file1 value of hiddenDetails is null.");if(a==null)throw new Error("The lastMod value of hiddenDetails is null.");if(r==null)throw new Error("The magic value of hiddenDetails is null.");let s=e.lastModified,T=new Date().getTime(),Be=60*60*1e3;T-s=400&&s.classList.remove(Q)}),document.body.addEventListener("htmx:afterRequest",function(S){if(S.detail.elt===null||S.detail.elt.id!==`${e}`)return;if(S.detail.successful)return Vt(r);let ie=S.detail.xhr;if(S.detail.failed&&ie)return ie.status===404?Nt(s,T,a):qt(s,ie);Rt(s)})}function je(e,a){e.addEventListener("input",function(){if(!Se(e.value,a)){e.classList.add(ge);return}e.classList.remove(ge)})}function At(e,a){a.innerHTML="",e.innerText="",e.classList.add(Q)}function Vt(e){e.focus()}function Nt(e,a,r){a.innerText=`Production not found on ${r}.`}function Rt(e){e.innerText="Something with the browser is not working, please refresh the page.",e.classList.remove(Q)}function qt(e,a){e.innerText=`Something went wrong, ${a.status} status: ${a.responseText}.`,e.classList.remove(Q)}var Pt="application/x-freearc",Kt="application/x-arj",Ut="application/x-bzip",Gt="application/x-bzip2",Ot="application/gzip",Xt="application/vnd.rar",Zt="application/x-tar",_t="application/zip",Jt="application/x-7z-compressed",Qt="application/x-msdos-program",Wt="image/bmp",er="image/gif",tr="image/jpeg",rr="image/vnd.zbrush.pcx",ar="image/png",sr="image/tiff",ir="image/webp",nr="application/x-csh",or="application/x-chrome-extension",lr="text/x-script.perl",cr="application/x-httpd-php",ur="text/x-script.phyton",dr="text/x-script.rexx",fr="application/x-sh",pr="application/x-shellscript",mr="text/x-script.tcl",hr="text/x-shellscript",vr="text/x-script.zsh";function Lr(){return[nr,or,lr,cr,ur,dr,fr,pr,mr,hr,vr]}function Ae(){return[Qt]}function oe(){return[Pt,Kt,Ut,Gt,Ot,Xt,Zt,_t,Jt]}function Ve(){return["application/octet-stream","application/x-binary","application/x-ms-dos-executable"]}function xr(){return[Wt,er,tr,rr,ar,sr,ir]}function Ne(){return["text/plain","text/x-nfo"]}function Re(e){return Lr().includes(e)}function qe(e){return xr().concat(oe()).includes(e)}function le(e){return Ae().concat(oe(),Ve()).includes(e)}function Pe(e){return Ne().concat(oe(),Ae(),Ve()).includes(e)}function Ke(e){return Ne().concat(oe()).includes(e)}var gr="uploader-image-form",E="is-invalid",be="d-none",yr=t(gr),R=t("uploader-image-alert"),Y=t("uploader-image-file"),Ue=t("uploader-image-last-modified"),br=t("uploader-image-list-1"),Tr=t("uploader-image-list-2"),Ge=t("uploader-image-magic"),W=t("uploader-image-month"),ce=t("uploader-image-releaser-1"),M=t("uploader-image-results"),N=t("uploader-image-year");yr.addEventListener("reset",function(){Ue.value="",Ge.value="",Xe()});Y.addEventListener("change",wr);ce.addEventListener("input",c);N.addEventListener("input",f);W.addEventListener("input",d);function Oe(e){t(e).addEventListener("click",function(){let r=!0;if(ce.value==""&&(ce.classList.add(E),r=!1),n(N.value)==!1&&(N.classList.add(E),r=!1),o(W.value)==!1&&(W.classList.add(E),r=!1),W.value!=""&&N.value==""&&(N.classList.add(E),r=!1),Y.value==""&&(Y.classList.add(E),r=!1),r==!1)return L(R,M);Xe(),M.innerText="...",M.classList.remove(be)})}async function wr(){v(Y,R,M);let e=this.files[0],a=[u(e),Er(e)];p(a,R,Y,M),m(e,R,Y,M),h(e,Ue,Ge)}function Er(e){return qe(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function Xe(){br.innerHTML="",Tr.innerHTML="",M.innerHTML="",M.classList.add(be),R.innerText="",R.classList.add(be),N.classList.remove(E),W.classList.remove(E),ce.classList.remove(E),Y.classList.remove(E)}var kr="uploader-intro-form",b="is-invalid",Te="d-none",Mr=t(kr),P=t("uploader-intro-alert"),F=t("uploader-intro-file"),Ze=t("uploader-intro-last-modified"),zr=t("uploader-intro-list-1"),$r=t("uploader-intro-list-2"),_e=t("uploader-intro-magic"),ee=t("uploader-intro-month"),ue=t("uploader-intro-releaser-1"),z=t("uploader-intro-results"),q=t("uploader-intro-year"),Je=t("uploader-intro-youtube");Mr.addEventListener("reset",function(){Ze.value="",_e.value="",We()});F.addEventListener("change",Ir);ue.addEventListener("input",c);q.addEventListener("input",f);ee.addEventListener("input",d);Je.addEventListener("input",Fe);function Qe(e){t(e).addEventListener("click",function(){let r=!0;if(ue.value==""&&(ue.classList.add(b),r=!1),n(q.value)==!1&&(q.classList.add(b),r=!1),o(ee.value)==!1&&(ee.classList.add(b),r=!1),ee.value!=""&&q.value==""&&(q.classList.add(b),r=!1),F.value==""&&(F.classList.add(b),r=!1),r==!1)return L(P,z);We(),z.innerText="...",z.classList.remove(Te)})}async function Ir(){v(F,P,z);let e=this.files[0],a=[u(e),Br(e)];p(a,P,F,z),m(e,P,F,z),h(e,Ze,_e)}function Br(e){return le(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function We(){zr.innerHTML="",$r.innerHTML="",z.innerHTML="",z.classList.add(Te),P.innerText="",P.classList.add(Te),q.classList.remove(b),ee.classList.remove(b),ue.classList.remove(b),Je.classList.remove(b),F.classList.remove(b)}var Dr="uploader-magazine-form",x="is-invalid",we="d-none",Sr=t(Dr),U=t("uploader-magazine-alert"),C=t("uploader-magazine-file"),et=t("uploader-magazine-last-modified"),Hr=t("uploader-magazine-list-1"),tt=t("uploader-magazine-magic"),te=t("uploader-magazine-month"),de=t("uploader-magazine-releaser-1"),$=t("uploader-magazine-results"),Ee=t("uploader-magazine-title"),K=t("uploader-magazine-year");Sr.addEventListener("reset",function(){et.value="",tt.value="",at()});C.addEventListener("change",Yr);de.addEventListener("input",c);K.addEventListener("input",f);te.addEventListener("input",d);function rt(e){t(e).addEventListener("click",function(){let r=!0;if(Ee.value==""&&(Ee.classList.add(x),r=!1),de.value==""&&(de.classList.add(x),r=!1),n(K.value)==!1&&(K.classList.add(x),r=!1),o(te.value)==!1&&(te.classList.add(x),r=!1),te.value!=""&&K.value==""&&(K.classList.add(x),r=!1),C.value==""&&(C.classList.add(x),r=!1),r==!1)return L(U,$);at(),$.innerText="...",$.classList.remove(we)})}async function Yr(){v(C,U,$);let e=this.files[0],a=[u(e),Fr(e)];p(a,U,C,$),m(e,U,C,$),h(e,et,tt)}function Fr(e){return Pe(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function at(){Hr.innerHTML="",$.innerHTML="",$.classList.add(we),U.innerText="",U.classList.add(we),K.classList.remove(x),te.classList.remove(x),de.classList.remove(x),C.classList.remove(x),Ee.classList.remove(x)}var Cr="uploader-text-form",g="is-invalid",ke="d-none",jr=t(Cr),O=t("uploader-text-alert"),j=t("uploader-text-file"),st=t("uploader-text-last-modified"),Ar=t("uploader-text-list-1"),Vr=t("uploader-text-list-2"),it=t("uploader-text-magic"),re=t("uploader-text-month"),fe=t("uploader-text-releaser-1"),I=t("uploader-text-results"),Me=t("uploader-text-title"),G=t("uploader-text-year");jr.addEventListener("reset",function(){st.value="",it.value="",ot()});j.addEventListener("change",Nr);fe.addEventListener("input",c);G.addEventListener("input",f);re.addEventListener("input",d);function nt(e){t(e).addEventListener("click",function(){let r=!0;if(Me.value==""&&(Me.classList.add(g),r=!1),fe.value==""&&(fe.classList.add(g),r=!1),n(G.value)==!1&&(G.classList.add(g),r=!1),o(re.value)==!1&&(re.classList.add(g),r=!1),re.value!=""&&G.value==""&&(G.classList.add(g),r=!1),j.value==""&&(j.classList.add(g),r=!1),r==!1)return L(O,I);ot(),I.innerText="...",I.classList.remove(ke)})}async function Nr(){v(j,O,I);let e=this.files[0],a=[u(e),Rr(e)];p(a,O,j,I),m(e,O,j,I),h(e,st,it)}function Rr(e){return Ke(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for a text.`}function ot(){Ar.innerHTML="",Vr.innerHTML="",I.innerHTML="",I.classList.add(ke),O.innerText="",O.classList.add(ke),G.classList.remove(g),re.classList.remove(g),fe.classList.remove(g),j.classList.remove(g),Me.classList.remove(g)}var qr="uploader-trainer-form",y="is-invalid",ze="d-none",Pr=t(qr),Z=t("uploader-trainer-alert"),A=t("uploader-trainer-file"),lt=t("uploader-trainer-last-modified"),Kr=t("uploader-trainer-list-1"),Ur=t("uploader-trainer-list-2"),ct=t("uploader-trainer-magic"),ae=t("uploader-trainer-month"),pe=t("uploader-trainer-releaser-1"),B=t("uploader-trainer-results"),$e=t("uploader-trainer-title"),X=t("uploader-trainer-year");Pr.addEventListener("reset",function(){lt.value="",ct.value="",dt()});A.addEventListener("change",Gr);pe.addEventListener("input",c);X.addEventListener("input",f);ae.addEventListener("input",d);function ut(e){t(e).addEventListener("click",function(){let r=!0;if($e.value==""&&($e.classList.add(y),r=!1),pe.value==""&&(pe.classList.add(y),r=!1),n(X.value)==!1&&(X.classList.add(y),r=!1),o(ae.value)==!1&&(ae.classList.add(y),r=!1),ae.value!=""&&X.value==""&&(X.classList.add(y),r=!1),A.value==""&&(A.classList.add(y),r=!1),r==!1)return L(Z,B);dt(),B.innerText="...",B.classList.remove(ze)})}async function Gr(){v(A,Z,B);let e=this.files[0],a=[u(e),Or(e)];p(a,Z,A,B),m(e,Z,A,B),h(e,lt,ct)}function Or(e){return le(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function dt(){Kr.innerHTML="",Ur.innerHTML="",B.innerHTML="",B.classList.add(ze),Z.innerText="",Z.classList.add(ze),X.classList.remove(y),ae.classList.remove(y),pe.classList.remove(y),A.classList.remove(y),$e.classList.remove(y)}var Xr="uploader-advanced-form",i="is-invalid",Ie="d-none",Zr=t(Xr),J=t("uploader-advanced-alert"),me=t("uploader-advanced-category"),_r=t("uploader-advanced-classification-help"),he=t("uploader-advanced-day"),V=t("uploader-advanced-file"),ft=t("uploader-advanced-last-modified"),Jr=t("uploader-advanced-list-1"),Qr=t("uploader-advanced-list-2"),pt=t("uploader-advanced-magic"),se=t("uploader-advanced-month"),ve=t("uploader-advanced-operating-system"),Le=t("uploader-advanced-releaser-1"),D=t("uploader-advanced-results"),_=t("uploader-advanced-year");Zr.addEventListener("reset",function(){ft.value="",pt.value="",ht()});V.addEventListener("change",Wr);Le.addEventListener("input",c);_.addEventListener("input",f);se.addEventListener("input",d);he.addEventListener("input",Ye);me.addEventListener("change",c);ve.addEventListener("change",c);function mt(e){t(e).addEventListener("click",function(){let r=!0;if(Le.value==""&&(Le.classList.add(i),r=!1),n(_.value)==!1&&(_.classList.add(i),r=!1),o(se.value)==!1&&(se.classList.add(i),r=!1),ne(he.value)==!1&&(he.classList.add(i),r=!1),se.value!=""&&_.value==""&&(_.classList.add(i),r=!1),V.value==""&&(V.classList.add(i),r=!1),ve.value==""&&(ve.classList.add(i),r=!1),me.value==""&&(me.classList.add(i),r=!1),r==!1)return L(J,D);ht(),D.innerText="...",D.classList.remove(Ie)})}async function Wr(){v(V,J,D);let e=this.files[0],a=[u(e),ea(e)];p(a,J,V,D),m(e,J,V,D),h(e,ft,pt)}function ea(e){return Re(e.type)?`The chosen file mime type ${e.type} might not be suitable for an upload.`:""}function ht(){Jr.innerHTML="",Qr.innerHTML="",D.innerHTML="",_r.innerHTML="",D.classList.add(Ie),J.innerText="",J.classList.add(Ie),_.classList.remove(i),se.classList.remove(i),he.classList.remove(i),Le.classList.remove(i),V.classList.remove(i),ve.classList.remove(i),me.classList.remove(i)}(()=>{"use strict";Ce(),ye("demozoo-submission","Demozoo"),ye("pouet-submission","Pou\xEBt"),Oe("uploader-image-submit"),H("uploader-image-form","uploader-image-progress"),Qe("uploader-intro-submit"),H("uploader-intro-form","uploader-intro-progress"),ut("uploader-trainer-submit"),H("uploader-trainer-form","uploader-trainer-progress"),rt("uploader-magazine-submit"),H("uploader-magazine-form","uploader-magazine-progress"),nt("uploader-text-submit"),H("uploader-text-form","uploader-text-progress"),mt("uploader-advanced-submit"),H("uploader-advanced-form","uploader-advanced-progress")})();})();