forked from Deyvid777/dozenvalues
-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions.html
1 lines (1 loc) · 2.18 KB
/
questions.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><div id="questionholder"></div><div class="small-button-holder"><button class="small-button" id="matches_button"></button><button id="back_button" onclick="window.history.back()"></button><button class="small-button" id="lister_button"></button></div><script type="module">import{getJson as e,getLanguage as t}from"./dist/common.js";let n=new URLSearchParams(document.location.search).get("lang")??"en";const o=t(n);n=o.lang??n;for(const[e,t]of Object.entries(o.questionstext))document.getElementById(e).textContent=t;document.getElementById("lister_button").addEventListener("click",(()=>window.location.href=`lister.html?lang=${n}`));document.getElementById("matches_button").addEventListener("click",(()=>{window.location.href=`matches.html?lang=${n}`}));const c=e("questions-"+n),a=document.getElementById("questionholder"),l=(e,t)=>{const n=document.createElement("div");n.className="value-holder";const o=new Image;o.src=t.icon;const c=document.createElement("div");c.className="value-score";const a=document.createElement("p");return a.textContent=e.toFixed(),c.appendChild(a),c.style.backgroundColor=t.color,n.appendChild(o),n.appendChild(c),n};for(const e of c){const t=document.createElement("div");t.className="question-holder";const n=document.createElement("div");n.className="question-text",n.textContent=e.text,t.appendChild(n),e.effect.forEach(((e,n)=>{e>0?t.appendChild(l(e,o.axes[n].leftvalue)):e<0&&t.appendChild(l(Math.abs(e),o.axes[n].rightvalue))})),a.appendChild(t)}</script></body></html>