{"id":148,"date":"2026-03-07T17:02:58","date_gmt":"2026-03-07T17:02:58","guid":{"rendered":"https:\/\/dabudi.si\/?page_id=148"},"modified":"2026-03-07T17:07:20","modified_gmt":"2026-03-07T17:07:20","slug":"odlocitve","status":"publish","type":"page","link":"https:\/\/dabudi.si\/index.php\/odlocitve\/","title":{"rendered":"Odlo\u010ditve"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"sl\">\n<head>\n<meta charset=\"UTF-8\">\n<title>Anketa<\/title>\n\n<style>\n\nbody{\nfont-family:Arial,sans-serif;\nbackground:linear-gradient(135deg,#4facfe,#00f2fe);\ndisplay:flex;\njustify-content:center;\nalign-items:center;\nheight:100vh;\nmargin:0;\n}\n\n#app{\nbackground:white;\npadding:30px;\nwidth:500px;\nborder-radius:15px;\nbox-shadow:0 10px 25px rgba(0,0,0,0.2);\ntext-align:center;\n}\n\nh1{\ncolor:#2196f3;\n}\n\ninput{\npadding:10px;\nwidth:80%;\nborder-radius:8px;\nborder:1px solid #ccc;\nmargin:5px;\n}\n\nbutton{\npadding:10px 15px;\nborder:none;\nborder-radius:8px;\nbackground:#2196f3;\ncolor:white;\nfont-weight:bold;\ncursor:pointer;\nmargin:5px;\n}\n\nbutton:hover{\nbackground:#1976d2;\n}\n\n#startBtn{ background:#4caf50; }\n#finishBtn{ background:#e53935; }\n#deleteBtn{ background:#000; }\n\n.option{\ndisplay:flex;\ngap:10px;\nmargin:5px;\n}\n\n.bar{\nheight:20px;\nborder-radius:6px;\nmargin-top:5px;\ncolor:white;\nfont-size:12px;\ndisplay:flex;\nalign-items:center;\njustify-content:center;\n}\n\n.red{background:#e53935;}\n.orange{background:#fb8c00;}\n.yellow{background:#fdd835;color:black;}\n.green{background:#43a047;}\n\n<\/style>\n<\/head>\n\n<body>\n\n<div id=\"app\">\n\n<h1>\ud83d\udcca Anketa<\/h1>\n\n<button onclick=\"createPoll()\">Dodaj anketo<\/button>\n\n<div id=\"pollCreator\" style=\"display:none\">\n\n<input id=\"question\" placeholder=\"Vpi\u0161i vpra\u0161anje\">\n\n<br>\n\n<label>\n<input type=\"checkbox\" id=\"multi\">Ve\u010d odgovorov\n<\/label>\n\n<div id=\"options\"><\/div>\n\n<button onclick=\"addOption()\">Dodaj opcijo<\/button>\n\n<br>\n\n<button id=\"startBtn\" onclick=\"startPoll()\">Za\u010dni<\/button>\n\n<\/div>\n\n<div id=\"pollArea\"><\/div>\n\n<\/div>\n\n<script>\n\nlet poll={\nquestion:\"\",\noptions:[],\nvotes:[],\nmulti:false,\nactive:false,\nfinished:false\n}\n\nfunction save(){\nlocalStorage.setItem(\"poll\",JSON.stringify(poll))\n}\n\nfunction load(){\nlet data=localStorage.getItem(\"poll\")\nif(data){\npoll=JSON.parse(data)\nrenderPoll()\n}\n}\n\nfunction createPoll(){\ndocument.getElementById(\"pollCreator\").style.display=\"block\"\n}\n\nfunction addOption(){\n\nlet div=document.createElement(\"div\")\ndiv.className=\"option\"\n\nlet input=document.createElement(\"input\")\ninput.placeholder=\"Opcija\"\n\ndiv.appendChild(input)\n\ndocument.getElementById(\"options\").appendChild(div)\n\n}\n\nfunction startPoll(){\n\npoll.question=document.getElementById(\"question\").value\npoll.multi=document.getElementById(\"multi\").checked\n\nlet optionInputs=document.querySelectorAll(\"#options input\")\n\npoll.options=[]\npoll.votes=[]\n\noptionInputs.forEach(o=>{\npoll.options.push(o.value)\npoll.votes.push(0)\n})\n\npoll.active=true\npoll.finished=false\n\nsave()\nrenderPoll()\n\n}\n\nfunction vote(i){\n\nif(!poll.active) return\n\nif(!poll.multi){\n\npoll.votes[i]++\n\n}else{\n\npoll.votes[i]++\n\n}\n\nsave()\nrenderPoll()\n\n}\n\nfunction finishPoll(){\n\npoll.active=false\npoll.finished=true\n\nsave()\nrenderPoll()\n\n}\n\nfunction deletePoll(){\n\nlocalStorage.removeItem(\"poll\")\nlocation.reload()\n\n}\n\nfunction renderPoll(){\n\nlet area=document.getElementById(\"pollArea\")\narea.innerHTML=\"\"\n\nif(!poll.question) return\n\nlet q=document.createElement(\"h2\")\nq.textContent=poll.question\n\narea.appendChild(q)\n\nlet total=poll.votes.reduce((a,b)=>a+b,0)\n\npoll.options.forEach((opt,i)=>{\n\nlet div=document.createElement(\"div\")\n\nif(!poll.finished){\n\nlet btn=document.createElement(\"button\")\nbtn.textContent=opt\nbtn.onclick=()=>vote(i)\n\ndiv.appendChild(btn)\n\n}else{\n\nlet percent= total==0 ? 0 : Math.round((poll.votes[i]\/total)*100)\n\nlet bar=document.createElement(\"div\")\nbar.className=\"bar\"\n\nif(percent==0) bar.classList.add(\"red\")\nelse if(percent<30) bar.classList.add(\"orange\")\nelse if(percent<60) bar.classList.add(\"yellow\")\nelse bar.classList.add(\"green\")\n\nbar.style.width=percent+\"%\"\nbar.textContent=opt+\" \"+percent+\"%\"\n\ndiv.appendChild(bar)\n\n}\n\narea.appendChild(div)\n\n})\n\nif(poll.active){\n\nlet finish=document.createElement(\"button\")\nfinish.id=\"finishBtn\"\nfinish.textContent=\"Zaklju\u010di\"\nfinish.onclick=finishPoll\n\narea.appendChild(finish)\n\n}\n\nif(poll.finished){\n\nlet del=document.createElement(\"button\")\ndel.id=\"deleteBtn\"\ndel.textContent=\"Izbri\u0161i\"\ndel.onclick=deletePoll\n\narea.appendChild(del)\n\n}\n\n}\n\nload()\n\n<\/script>\n\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Anketa \ud83d\udcca Anketa Dodaj anketo Ve\u010d odgovorov Dodaj opcijo Za\u010dni<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-148","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":4,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/148\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/pages\/148\/revisions\/152"}],"wp:attachment":[{"href":"https:\/\/dabudi.si\/index.php\/wp-json\/wp\/v2\/media?parent=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}