aboutsummaryrefslogtreecommitdiffhomepage
path: root/archive/assets/loading.js
diff options
context:
space:
mode:
Diffstat (limited to 'archive/assets/loading.js')
-rw-r--r--archive/assets/loading.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/archive/assets/loading.js b/archive/assets/loading.js
new file mode 100644
index 0000000..109743d
--- /dev/null
+++ b/archive/assets/loading.js
@@ -0,0 +1,2 @@
+(()=>{document.addEventListener("DOMContentLoaded",()=>{let m=document.getElementsByClassName("js-phper-token")[0],a=document.getElementsByClassName("js-aggregated-execution-status")[0],c=document.getElementsByClassName("js-aggregated-execution-status-loading-indicator")[0],u=a.dataset.answerId,s=t=>new Map(Array.from(document.getElementsByClassName(t)??[]).map(n=>[parseInt(n.dataset.testcaseExecutionId),n])),g=s("js-testcase-execution-status"),E=s("js-testcase-execution-status-loading-indicator"),x=s("js-testcase-execution-stdout"),p=s("js-testcase-execution-stderr");if(!c)return;let C=`/phperkaigi/2024/golf/api/answers/${u}/statuses`,d;d=setInterval(()=>{fetch(C).then(t=>t.json()).then(({aggregated_status:t,testcase_executions:n,phper_token:i})=>{i&&(m.innerHTML=`<div class="alert alert-success">\u30D0\u30FC\u30C7\u30A3\u30FC\uFF01 ${i}</div>`);for(let e of n){let r=g.get(e.id),l=E.get(e.id),f=x.get(e.id),I=p.get(e.id),{status:o,stdout:j,stderr:v}=e;o.label!==r.textContent&&(r.textContent=o.label,f.textContent=j,I.textContent=v,l&&!o.show_loading_indicator&&l.remove())}t.label!==a.textContent&&(a.textContent=t.label,t.show_loading_indicator||(c.remove(),clearInterval(d)))})},5*1e3)});})();
+//# sourceMappingURL=loading.js.map