{"id":3128,"date":"2026-04-07T19:12:00","date_gmt":"2026-04-07T19:12:00","guid":{"rendered":"https:\/\/kosningaspa.is\/?p=3128"},"modified":"2026-04-07T19:12:13","modified_gmt":"2026-04-07T19:12:13","slug":"saetaspa-7-april","status":"publish","type":"post","link":"https:\/\/kosningaspa.is\/?p=3128","title":{"rendered":"S\u00e6tasp\u00e1 &#8211; 7. apr\u00edl"},"content":{"rendered":"\n<p>Myndin h\u00e9r fyrir ne\u00f0an s\u00fdnir l\u00edkur \u00e1 a\u00f0 frambj\u00f3\u00f0andi n\u00e1i kj\u00f6ri mi\u00f0a\u00f0 vi\u00f0 fylgist\u00f6lur \u00ed n\u00fdjustu kosningasp\u00e1, 28 ma\u00ed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/kosningaspa.is\/wp-content\/uploads\/2026\/04\/Screenshot-2026-04-07-at-13.44.53.png\" alt=\"\"\/><\/figure>\n\n\n\n\n\n<p>Fyrir \u00fe\u00e1 sem vilja \u00fathluta borgarstj\u00f3rnars\u00e6tum \u00fat fr\u00e1 fylgist\u00f6lum \u00ed er h\u00e6gt a\u00f0 gera \u00fea\u00f0 h\u00e9r a\u00f0 ne\u00f0an \u00ed reikniv\u00e9l sem notar D&#8217;Hondt a\u00f0fer\u00f0ina<\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"is\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>D&#8217;Hondt reikniv\u00e9l \u2014 Borgarstj\u00f3rn Reykjav\u00edkur<\/title>\n<style>\n  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n  :root {\n    --bg: #ffffff;\n    --bg-secondary: #f5f5f3;\n    --text: #1a1a18;\n    --text-secondary: #6b6b68;\n    --text-tertiary: #9e9e9b;\n    --border: rgba(0,0,0,0.12);\n    --border-hover: rgba(0,0,0,0.25);\n    --radius-md: 8px;\n    --radius-lg: 12px;\n  }\n  @media (prefers-color-scheme: dark) {\n    :root {\n      --bg: #1c1c1a;\n      --bg-secondary: #272725;\n      --text: #f0efe8;\n      --text-secondary: #a0a09c;\n      --text-tertiary: #6b6b68;\n      --border: rgba(255,255,255,0.12);\n      --border-hover: rgba(255,255,255,0.25);\n    }\n  }\n  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); padding: 2rem 1.5rem; max-width: 780px; margin: 0 auto; }\n  h1 { font-size: 18px; font-weight: 500; margin-bottom: 0.25rem; }\n  .subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 1.5rem; }\n  .controls { display: flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; flex-wrap: wrap; }\n  .controls label { font-size: 13px; color: var(--text-secondary); }\n  input[type=number] { border: 0.5px solid var(--border-hover); border-radius: var(--radius-md); padding: 4px 8px; font-size: 14px; background: var(--bg); color: var(--text); text-align: right; }\n  input[type=number]:focus { outline: none; box-shadow: 0 0 0 2px var(--border-hover); }\n  .si { width: 52px; }\n  .summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 1.5rem; }\n  .metric { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 12px 14px; }\n  .metric-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }\n  .metric-val { font-size: 22px; font-weight: 500; }\n  .pgrid { display: grid; grid-template-columns: 40px 1fr 54px 100px; gap: 0; border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; }\n  .gh > div { background: var(--bg-secondary); padding: 8px 12px; font-size: 12px; color: var(--text-secondary); font-weight: 500; border-bottom: 0.5px solid var(--border); }\n  .gh { display: contents; }\n  .gr { display: contents; }\n  .gr > div { padding: 8px 12px; font-size: 14px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; background: var(--bg); }\n  .gr:last-child > div { border-bottom: none; }\n  input[type=number].ip { width: 72px; border: 0.5px solid var(--border-hover); border-radius: var(--radius-md); padding: 4px 8px; font-size: 14px; background: var(--bg); color: var(--text); text-align: right; }\n  .bw { flex: 1; background: var(--bg-secondary); border-radius: 2px; height: 6px; margin: 0 8px; overflow: hidden; }\n  .bar { height: 100%; border-radius: 2px; transition: width 0.3s; }\n  .sn { font-size: 20px; font-weight: 500; min-width: 28px; text-align: center; justify-content: center; }\n  .sdots { display: flex; flex-wrap: wrap; gap: 3px; }\n  .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-secondary); border: 0.5px solid var(--border); }\n  .dot.f { border: none; }\n  .seq-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }\n  .seq-chips { display: flex; flex-wrap: wrap; gap: 6px; }\n  .chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: 20px; font-size: 13px; font-weight: 500; border: 0.5px solid transparent; }\n  .chip.next { opacity: 0.6; }\n  .chip-q { font-size: 10px; opacity: 0.6; font-weight: 400; margin-left: 2px; }\n  .divider { display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0; }\n  .divider-line { flex: 1; height: 0.5px; background: var(--border); }\n  .divider-text { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }\n<\/style>\n<\/head>\n<body>\n<h1>D&#8217;Hondt reikniv\u00e9l<\/h1>\n<p class=\"subtitle\">\u00dathlutun s\u00e6ta \u00ed borgarstj\u00f3rn<\/p>\n\n<div class=\"controls\">\n  <label>Borgarstj\u00f3rnars\u00e6ti<\/label>\n  <input type=\"number\" class=\"si\" id=\"total-seats\" value=\"23\" min=\"1\" max=\"63\" oninput=\"calculate()\">\n<\/div>\n\n<div class=\"summary\">\n  <div class=\"metric\"><div class=\"metric-label\">Heildarfylgi flokka<\/div><div class=\"metric-val\" id=\"total-support\">\u2014<\/div><\/div>\n  <div class=\"metric\"><div class=\"metric-label\">S\u00e6tum \u00fathluta\u00f0<\/div><div class=\"metric-val\" id=\"seats-assigned\">\u2014<\/div><\/div>\n<\/div>\n\n<div class=\"pgrid\" id=\"party-grid\">\n  <div class=\"gh\">\n    <div><\/div>\n    <div>Fylgi (%)<\/div>\n    <div style=\"text-align:center\">S\u00e6ti<\/div>\n    <div><\/div>\n  <\/div>\n<\/div>\n\n<div class=\"seq-label\">\u00dathlutun s\u00e6ta<\/div>\n<div class=\"seq-chips\" id=\"seq-chips\"><\/div>\n\n<script>\nconst PARTIES = [\n  {id:'B', color:'#185FA5', bg:'#E6F1FB', tc:'#0C447C'},\n  {id:'C', color:'#0F6E56', bg:'#E1F5EE', tc:'#085041'},\n  {id:'D', color:'#533AB7', bg:'#EEEDFE', tc:'#3C3489'},\n  {id:'F', color:'#D85A30', bg:'#FAECE7', tc:'#712B13'},\n  {id:'J', color:'#D4537E', bg:'#FBEAF0', tc:'#72243E'},\n  {id:'M', color:'#BA7517', bg:'#FAEEDA', tc:'#633806'},\n  {id:'O', color:'#639922', bg:'#EAF3DE', tc:'#27500A'},\n  {id:'P', color:'#888780', bg:'#F1EFE8', tc:'#444441'},\n  {id:'S', color:'#E24B4A', bg:'#FCEBEB', tc:'#791F1F'},\n  {id:'W', color:'#3C3489', bg:'#EEEDFE', tc:'#26215C'},\n];\nconst DEFS = {B:5, C:12.3, D:22.9, F:3.7, J:3, M:10.9, O:1.8, P:5, S:23.4, W:10.8};\n\nfunction buildGrid() {\n  const grid = document.getElementById('party-grid');\n  const hdr = grid.querySelector('.gh');\n  grid.innerHTML = '';\n  grid.appendChild(hdr);\n  PARTIES.forEach(p => {\n    const row = document.createElement('div');\n    row.className = 'gr';\n    row.innerHTML = `\n      <div><span style=\"font-weight:500;color:var(--text-secondary);font-size:12px\">${p.id}<\/span><\/div>\n      <div style=\"display:flex;align-items:center;gap:8px\">\n        <input type=\"number\" class=\"ip\" id=\"inp-${p.id}\" value=\"${DEFS[p.id]}\" min=\"0\" max=\"100\" step=\"0.1\" oninput=\"calculate()\">\n        <div class=\"bw\"><div class=\"bar\" id=\"bar-${p.id}\" style=\"background:${p.color}\"><\/div><\/div>\n      <\/div>\n      <div class=\"sn\" id=\"seats-${p.id}\" style=\"color:${p.color}\">\u2014<\/div>\n      <div id=\"dots-${p.id}\" class=\"sdots\"><\/div>\n    `;\n    grid.appendChild(row);\n  });\n}\n\nfunction dhondtFull(votes, totalRounds) {\n  const seats = {};\n  const order = [];\n  Object.keys(votes).forEach(id => seats[id] = 0);\n  const ids = Object.keys(votes);\n  for (let i = 0; i < totalRounds; i++) {\n    let best = null, bestQ = -1;\n    ids.forEach(id => {\n      const q = votes[id] \/ (seats[id] + 1);\n      if (q > bestQ) { bestQ = q; best = id; }\n    });\n    if (best) { seats[best]++; order.push({party: best, seatNum: seats[best], quotient: bestQ}); }\n  }\n  return {seats, order};\n}\n\nfunction fmtQ(q) {\n  if (q >= 100) return Math.round(q).toString();\n  if (q >= 10) return q.toFixed(1);\n  return q.toFixed(2);\n}\n\nfunction calculate() {\n  const totalSeats = parseInt(document.getElementById('total-seats').value) || 23;\n  const extraRounds = 10;\n  const totalRounds = totalSeats + extraRounds;\n  let votes = {}, total = 0;\n  PARTIES.forEach(p => {\n    const v = parseFloat(document.getElementById('inp-' + p.id).value) || 0;\n    votes[p.id] = v;\n    total += v;\n  });\n  document.getElementById('total-support').textContent = total.toFixed(1);\n  const eligible = Object.fromEntries(Object.entries(votes).filter(([, v]) => v > 0));\n  const {order} = Object.keys(eligible).length > 0 ? dhondtFull(eligible, totalRounds) : {order: []};\n  const maxPct = Math.max(...Object.values(votes), 1);\n\n  PARTIES.forEach(p => {\n    const finalSeats = order.slice(0, totalSeats).filter(x => x.party === p.id).length;\n    document.getElementById('bar-' + p.id).style.width = ((votes[p.id] \/ maxPct) * 100).toFixed(1) + '%';\n    const numEl = document.getElementById('seats-' + p.id);\n    numEl.textContent = finalSeats;\n    numEl.style.color = finalSeats > 0 ? p.color : 'var(--text-tertiary)';\n    const dotsEl = document.getElementById('dots-' + p.id);\n    dotsEl.innerHTML = Array.from({length: Math.min(totalSeats, 30)}, (_, i) =>\n      `<div class=\"dot${i < finalSeats ? ' f' : ''}\" style=\"${i < finalSeats ? 'background:' + p.color : ''}\"><\/div>`\n    ).join('');\n  });\n\n  document.getElementById('seats-assigned').textContent = Math.min(order.length, totalSeats) + ' \/ ' + totalSeats;\n\n  const inOrder = order.slice(0, totalSeats);\n  const nextOrder = order.slice(totalSeats, totalSeats + extraRounds);\n\n  let html = inOrder.map((item, i) => {\n    const p = PARTIES.find(x => x.id === item.party);\n    return `<div class=\"chip\" style=\"background:${p.bg};border-color:${p.color}20;color:${p.tc}\">\n      <span style=\"font-size:10px;opacity:0.55;font-weight:400;margin-right:1px\">${i + 1}.<\/span>${p.id}<span style=\"font-size:11px;opacity:0.65;font-weight:400;margin-left:2px\">${item.seatNum}<\/span><span class=\"chip-q\">${fmtQ(item.quotient)}<\/span>\n    <\/div>`;\n  }).join('');\n\n  html += `<div class=\"divider\"><div class=\"divider-line\"><\/div><div class=\"divider-text\">N\u00e6stir inn \u00ed borgarstj\u00f3rn eftir a\u00f0 ${totalSeats} s\u00e6tum er \u00fathluta\u00f0<\/div><div class=\"divider-line\"><\/div><\/div>`;\n\n  html += nextOrder.map((item, i) => {\n    const p = PARTIES.find(x => x.id === item.party);\n    return `<div class=\"chip next\" style=\"background:${p.bg};border-color:${p.color}20;color:${p.tc}\">\n      <span style=\"font-size:10px;opacity:0.55;font-weight:400;margin-right:1px\">${totalSeats + i + 1}.<\/span>${p.id}<span style=\"font-size:11px;opacity:0.65;font-weight:400;margin-left:2px\">${item.seatNum}<\/span><span class=\"chip-q\">${fmtQ(item.quotient)}<\/span>\n    <\/div>`;\n  }).join('');\n\n  document.getElementById('seq-chips').innerHTML = html;\n}\n\nbuildGrid();\ncalculate();\n<\/script>\n<\/body>\n<\/html>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Myndin h\u00e9r fyrir ne\u00f0an s\u00fdnir l\u00edkur \u00e1 a\u00f0 frambj\u00f3\u00f0andi n\u00e1i kj\u00f6ri mi\u00f0a\u00f0 vi\u00f0 fylgist\u00f6lur \u00ed n\u00fdjustu kosningasp\u00e1, 28 ma\u00ed. Fyrir \u00fe\u00e1 sem vilja \u00fathluta borgarstj\u00f3rnars\u00e6tum \u00fat fr\u00e1 fylgist\u00f6lum \u00ed er h\u00e6gt a\u00f0 gera \u00fea\u00f0 h\u00e9r a\u00f0 ne\u00f0an \u00ed reikniv\u00e9l sem notar D&#8217;Hondt a\u00f0fer\u00f0ina D&#8217;Hondt reikniv\u00e9l \u2014 Borgarstj\u00f3rn Reykjav\u00edkur D&#8217;Hondt reikniv\u00e9l \u00dathlutun s\u00e6ta \u00ed borgarstj\u00f3rn Borgarstj\u00f3rnars\u00e6ti [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,4],"tags":[],"class_list":["post-3128","post","type-post","status-publish","format-standard","hentry","category-borgarstjornarkosningar","category-kosningaspa"],"_links":{"self":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3128"}],"version-history":[{"count":10,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3128\/revisions"}],"predecessor-version":[{"id":3139,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3128\/revisions\/3139"}],"wp:attachment":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}