-
Notifications
You must be signed in to change notification settings - Fork 7
/
matches.html
1 lines (1 loc) · 2.92 KB
/
matches.html
1
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Dozenvalues</title><link rel="shortcut icon" href="./assets/icon.png" type="image/x-icon"><link href="./assets/icon.png" type="image/x-icon"><meta property="og:title" content="Dozenvalues"><meta property="og:image" content="https://quark88.github.io/dozenvalues/assets/icon.png"><meta property="og:url" content="https://quark88.github.io/dozenvalues"><meta property="og:type" content="Political test"><meta property="og:locale" content="en_US"><meta property="og:description" content="DozenValues is a political test that aims to map differing political perspectives onto six axes."><link rel="stylesheet" href="./dist/style.css"></head><body> <h1 id="title"></h1><select id="match-dropdown"></select><canvas id="match"></canvas><div id="match-text"></div><div class="small-button-holder"><button class="small-button" id="lister_button"></button><button id="back_button" onclick="window.history.back()"></button><button class="small-button" id="questions_button"></button></div><script type="application/javascript">window.VERSION = "5.0.2"</script><script type="module">import{getJson as e,getLanguage as t,Canvas as n,matchAxisTier as o,b64dec as a}from"./dist/common.js";const s=new URLSearchParams(document.location.search);let c=s.get("lang")??"en";const l=t(c);c=l.lang??c;const r=l.resultstext.version_name+": "+window.VERSION,i=e("ideologies-"+c),d=document.getElementById("match"),m=window.matchMedia?.("(prefers-color-scheme: dark)").matches,[u,x]=m?["#202020","#fff"]:["#e0e0e0","#000"],f=new n(d,800,880,l.font.text_font,l.font.title_font,x,u),h=document.getElementById("match-dropdown"),g=document.getElementById("match-text");i.forEach(((e,t)=>{const n=document.createElement("option");n.value=t.toFixed(),n.textContent=e.name,h.appendChild(n)})),l.axes.forEach(((e,t)=>{const n=[e.leftvalue.icon,e.rightvalue.icon];f.drawImages(n,t)}));for(const[e,t]of Object.entries(l.matchestext))document.getElementById(e).textContent=t;document.getElementById("lister_button").addEventListener("click",(()=>{const e=parseInt(h.value);window.location.href="lister.html?lang="+c+"&score="+i[e].stats.map((e=>e.toFixed(1))).join(",")}));function w(e){f.drawHeader(l.resultstext.text.title,"quark88.github.io/dozenvalues/",r,e.name),e.stats.forEach(((e,t)=>{const n=[l.axes[t].leftvalue.color,l.axes[t].rightvalue.color],a=o(e,l.axes[t].tiers);let s;s=l.resultstext.axis_name_before?`${l.resultstext.axis_name} ${l.axes[t].axisname}: ${a}`:`${l.axes[t].axisname} ${l.resultstext.axis_name}: ${a}`,f.drawBar(t,n,e,s)})),g.textContent=e.desc}document.getElementById("questions_button").addEventListener("click",(()=>window.location.href=`questions.html?lang=${c}`)),window.onload=()=>{const e=s.get("ideo");if(e)try{const t=a(e),n=i.find((e=>e.name===t))??i[0];w(n),h.selectedIndex=i.indexOf(n)}catch(e){console.error(e),w(i[0])}else w(i[0])},h.addEventListener("change",(()=>{const e=parseInt(h.value);w(i[e])}));</script></body></html>