This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathquiz.html
1 lines (1 loc) · 3.22 KB
/
quiz.html
1
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>PolcompballValues</title><link rel="icon" type="x-icon" href="./assets/icon.png"><link rel="shortcut icon" type="x-icon" href="./assets/icon.png"><meta name="theme-color" content="#000000" data-react-helmet="true"><meta property="og:ttl" content="600"><meta property="og:type" content="website"><meta property="og:site_name" content="polcompballvalues.github.io"><meta property="og:url" content="https://polcompballvalues.github.io/"><meta property="og:title" content="PolcompballValues (Archive)"><meta property="og:description" content="PolcompballValues a quiz aimed at members of the Polcompball community."><meta property="og:image" content="https://polcompballvalues.github.io/assets/previcon.png"><meta property="og:image:width" content="1024"><meta property="og:image:height" content="1024"><link href="./dist/style.css" rel="stylesheet" type="text/css"></head><body><h1>PolcompballValues</h1><h2 style="text-align:center;" id="question-number">Loading...</h2><p class="question" id="question-text"> </p><button class="button" id="button-stag"> </button><button class="button" id="button-ag">Agree</button><button class="button" id="button-neut">Neutral/Ambivalent/Skip</button><button class="button" id="button-disag">Disagree</button><button class="button" id="button-stdisag"> </button><div><button class="small_button" id="back_button">Back</button></div><script type="module">var e,t,n,o,r,s,i,a,c,u,d,l,f,g,h,m;import{getJson as y}from"./dist/common.min.js";for(r in f=()=>{var e,n,o,r,s;if(document.getElementById("question-number").textContent=`Question ${c+1} of ${u.length}`,document.getElementById("question-text").textContent=u[c].question,u[c].yesno){for(n in o=[],t)switch(s=t[n],e=document.getElementById("button-"+n),s){case 1:o.push(e.textContent="Yes");break;case-1:o.push(e.textContent="No");break;default:o.push(e.style.display="none")}return o}for(n in r=[],t)switch(s=t[n],e=document.getElementById("button-"+n),s){case 1:r.push(e.textContent="Strongly Agree");break;case-1:r.push(e.textContent="Strongly Disagree");break;default:r.push(e.style.display="block")}return r},n=async()=>{var e,t,n,o,r,s,a,c,u,d,l;for(t=new TextEncoder,new TextDecoder,n=[],o=r=0,s=(a=Object.keys(g)).length;r<s;o=++r)l=a[o],n.push((100*(i[l]+g[l])/(2*i[l])).toFixed(1));return d=n.join(","),c=t.encode(d),u=await crypto.subtle.digest("SHA-512",c),e=String.fromCharCode(...new Uint8Array(u)),window.location.href="results.html?score="+d+"&digest="+btoa(e)+"&edition="+(h?"s":"f")},a=t=>{var o,r,s;for(o in e[c]=t,r=u[c].effect)s=r[o],g[o]+=s*t;return++c>=u.length?n():f()},h="?s"===document.location.search,u=await y("questions"),h&&(u=u.filter((e=>e.short))),e=Array(u.length),i={},g={},c=0,d=u[0].effect)m=d[r],g[r]=0,i[r]=0;for(o=0,s=u.length;o<s;o++)for(r in l=u[o].effect)m=l[r],i[r]+=Math.abs(m);for(r in t={stag:1,ag:.5,neut:0,disag:-.5,stdisag:-1})m=t[r],((e,t)=>{document.getElementById("button-"+e).addEventListener("click",(()=>a(t)))})(r,m);document.getElementById("back_button").addEventListener("click",(()=>{var t;if(0===c)return window.history.back();for(r in c--,t=u[c].effect)m=t[r],g[r]-=e[c]*m;return f()})),f();</script></body></html>