Spaces:
Running
Running
Download index.html from dinoclub/Project_66: direct link, hf CLI and curl.
- Browser
- Download file 88.7 kB
-
https://huggingface.co/spaces/dinoclub/Project_66/resolve/main/index.html
- Command line
-
hf download hf://spaces/dinoclub/Project_66/index.html
-
curl -L -o index.html https://huggingface.co/spaces/dinoclub/Project_66/resolve/main/index.html
88.7 kB
| <meta charset=utf-8><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{margin:0}</style> | |
| <title>Representation Gap</title> | |
| <meta name="claude:viewport-fit-sides" content="cover"> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Anton&family=Spectral:wght@500;600&family=Public+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js"></script> | |
| <script src="bio.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/topojson-client@3.1.0/dist/topojson-client.min.js"></script> | |
| <style> | |
| /* Layout: one-screen atlas. Control rail on the left (stacks under the map on phones), county map fills the rest. */ | |
| :root{ | |
| --bg:#eef0f1; --panel:#f8f9f9; --ink:#1a222b; --muted:#5d6873; --line:#d3d8dc; | |
| --accent:#5e2f6e; --focus:#2f6b4f; --nodata:#dfe2e4; --stroke:#ffffff; --hatch:rgba(26,34,43,.28); | |
| --r0:#2f7a4f; --r1:#6fa77c; --r2:#b6d5b2; --r3:#ece8e0; --r4:#cfb6d6; --r5:#93619f; --r6:#5a2c69; --dem:#a8741a; --rep:#4a505c; | |
| --k1:#2f6b4f; --k2:#c07b3a; --k3:#2f7f86; --k4:#8a5a83; --k5:#7a6a4f; --k6:#6f7f8c; --k7:#b8962e; --band:rgba(47,122,79,.10); | |
| --f-display:"Spectral",Georgia,"Times New Roman",serif; | |
| --f-body:"Public Sans",system-ui,-apple-system,"Segoe UI",sans-serif; | |
| --f-data:"IBM Plex Mono",ui-monospace,"SFMono-Regular",Menlo,monospace; | |
| --f-name:"Anton","Impact","Arial Narrow",sans-serif; | |
| } | |
| @media (prefers-color-scheme:dark){:root:not([data-theme="light"]){ | |
| --bg:#12171c; --panel:#192027; --ink:#e6eaee; --muted:#97a3ae; --line:#2b353f; | |
| --accent:#c9a2dc; --focus:#86c29c; --nodata:#232b33; --stroke:#12171c; --hatch:rgba(230,234,238,.3); | |
| --r0:#7cc596; --r1:#4f9466; --r2:#3a7350; --r3:#5b5862; --r4:#6d4c7c; --r5:#9d71b2; --r6:#d6aee6; --dem:#e0b45a; --rep:#b3bac6; --k1:#86c29c; --k2:#e0a066; --k3:#7cc6cc; --k4:#c08fb9; --k5:#c4b08c; --k6:#a3b1bc; --k7:#e9cf77; --band:rgba(124,197,150,.10); color-scheme:dark}} | |
| :root[data-theme="dark"]{ | |
| --bg:#12171c; --panel:#192027; --ink:#e6eaee; --muted:#97a3ae; --line:#2b353f; | |
| --accent:#c9a2dc; --focus:#86c29c; --nodata:#232b33; --stroke:#12171c; --hatch:rgba(230,234,238,.3); | |
| --r0:#7cc596; --r1:#4f9466; --r2:#3a7350; --r3:#5b5862; --r4:#6d4c7c; --r5:#9d71b2; --r6:#d6aee6; --dem:#e0b45a; --rep:#b3bac6; --k1:#86c29c; --k2:#e0a066; --k3:#7cc6cc; --k4:#c08fb9; --k5:#c4b08c; --k6:#a3b1bc; --k7:#e9cf77; --band:rgba(124,197,150,.10); color-scheme:dark} | |
| [hidden]{display:none} | |
| html,body{height:100%} | |
| body{background:var(--bg);color:var(--ink);font:400 14px/1.45 var(--f-body)} | |
| *{box-sizing:border-box} | |
| button,input,select{font:inherit;color:inherit} | |
| :focus-visible{outline:2px solid var(--focus);outline-offset:2px} | |
| .app{height:100%;display:grid;grid-template-columns:minmax(300px,380px) 1fr;grid-template-rows:auto 1fr} | |
| header{grid-column:1/-1;display:flex;align-items:baseline;gap:16px;flex-wrap:wrap;padding:12px 20px 12px max(20px,env(safe-area-inset-left,0px));border-bottom:1px solid var(--line);background:var(--panel)} | |
| .brand{font:600 22px/1 var(--f-display);letter-spacing:.01em} | |
| .brand span{color:var(--accent)} | |
| .tag{color:var(--muted);font-size:13px;min-width:0} | |
| .search{margin-left:auto} | |
| .search input{width:min(260px,60vw);padding:7px 10px;border:1px solid var(--line);border-radius:6px;background:var(--bg)} | |
| aside{overflow:auto;border-right:1px solid var(--line);background:var(--panel);padding:16px 20px 28px max(20px,env(safe-area-inset-left,0px));display:flex;flex-direction:column;gap:18px;min-width:0} | |
| .lbl{font:500 11px/1 var(--f-body);text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:6px;display:block} | |
| select{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:var(--bg)} | |
| .desc{color:var(--muted);font-size:13px;margin-top:6px} | |
| .seg{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--bg)} | |
| .seg button{border:0;background:transparent;padding:7px 8px;cursor:pointer;font-size:13px;color:var(--muted)} | |
| #level button{line-height:1.2;padding:7px 4px} | |
| .seg button[aria-pressed=true]{background:var(--ink);color:var(--panel);font-weight:600} | |
| #cong{grid-template-columns:repeat(5,1fr)} | |
| .note{font-size:12.5px;color:var(--muted);background:var(--bg);border:1px dashed var(--line);border-radius:6px;padding:7px 9px;margin-top:8px} | |
| details.sec summary{cursor:pointer;font:500 11px var(--f-body);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)} | |
| .legend svg{display:block;width:100%;height:auto;overflow:visible} | |
| .legend text{font:400 10.5px var(--f-data);fill:var(--muted)} | |
| .legkeys{display:flex;gap:14px;margin-top:8px;font-size:12px;color:var(--muted);flex-wrap:wrap} | |
| .legkeys i{display:inline-block;width:12px;height:12px;vertical-align:-2px;margin-right:5px;border:1px solid var(--line);background:var(--nodata)} | |
| .legkeys .hz{background-image:repeating-linear-gradient(45deg,var(--hatch) 0 1.5px,transparent 1.5px 4px)} | |
| .county{border-top:1px solid var(--line);padding-top:16px;display:flex;flex-direction:column;gap:12px} | |
| .cname{font:600 20px/1.15 var(--f-display);text-wrap:balance} | |
| .csub{color:var(--muted);font-size:13px} | |
| .big{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap} | |
| .big b{font:500 30px/1 var(--f-data);letter-spacing:-.02em} | |
| .big small{color:var(--muted)} | |
| .chips{display:flex;gap:6px;flex-wrap:wrap} | |
| .chip{font-size:12px;padding:2px 8px;border-radius:999px;border:1px solid var(--line);color:var(--muted)} | |
| .chip.warn{border-color:var(--accent);color:var(--accent)} | |
| h4{margin:0 0 4px;font:500 11px var(--f-body);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)} | |
| .allm table{width:100%;border-collapse:collapse;font-size:12.5px} | |
| .allm td{padding:5px 0;border-bottom:1px solid var(--line);vertical-align:middle} | |
| .allm td.v{font-family:var(--f-data);text-align:right;white-space:nowrap;padding-left:8px;font-variant-numeric:tabular-nums} | |
| .allm td.p{width:72px;padding-left:10px} | |
| .pbar{height:6px;background:var(--nodata);border-radius:3px;position:relative} | |
| .pbar i{position:absolute;top:0;bottom:0;left:0;background:var(--r5);border-radius:3px} | |
| .allm tr{cursor:pointer} .allm tr:hover td{color:var(--accent)} | |
| .mem{border:1px solid var(--line);border-radius:8px;background:var(--bg)} | |
| .mem+.mem{margin-top:6px} | |
| .mem summary{cursor:pointer;display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:center;padding:8px 10px;list-style:none} | |
| .mem summary::-webkit-details-marker{display:none} | |
| .mem summary .n{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500} | |
| .mem .body{padding:0 10px 10px;font-size:12.5px} | |
| .mono{font-family:var(--f-data);font-variant-numeric:tabular-nums} | |
| .votes{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0} | |
| .vote{font:500 11px var(--f-data);padding:2px 6px;border-radius:3px;border:1px solid var(--line)} | |
| .vote.x{background:var(--r5);color:#fff;border-color:var(--r5)} | |
| .vote.r{border-style:dashed;color:var(--muted)} | |
| .donors{margin:4px 0 0;padding:0;list-style:none} | |
| .donors li{display:flex;justify-content:space-between;gap:10px;border-bottom:1px solid var(--line);padding:3px 0} | |
| .donors li span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} | |
| .exp{display:flex;flex-direction:column;gap:8px;margin-top:8px} | |
| .exp input[type=search]{width:100%;font:inherit;font-size:13px;padding:7px 9px;border:1px solid var(--line);border-radius:6px;background:var(--bg);color:var(--ink)} | |
| .fchips{display:flex;flex-wrap:wrap;gap:6px} | |
| .fchips button{font-size:12px;padding:3px 9px;border-radius:999px;border:1px solid var(--line);background:transparent;color:var(--muted);cursor:pointer} | |
| .fchips button[aria-pressed=true]{background:var(--ink);color:var(--panel);border-color:var(--ink)} | |
| .explist{max-height:360px;overflow:auto;border:1px solid var(--line);border-radius:8px;background:var(--bg)} | |
| .erow{display:grid;grid-template-columns:1fr auto;gap:2px 8px;width:100%;text-align:left;border:0;border-bottom:1px solid var(--line);background:transparent;padding:8px 10px;cursor:pointer;color:var(--ink);font:inherit;font-size:13px} | |
| .erow:hover,.erow[aria-expanded=true]{background:var(--panel)} | |
| .erow .nm{min-width:0} | |
| .erow .pc{font-family:var(--f-data);font-variant-numeric:tabular-nums;font-weight:600} | |
| .erow .bar{grid-column:1/-1;height:4px;border-radius:2px;background:var(--line);overflow:hidden} | |
| .erow .bar i{display:block;height:100%;background:var(--r0)} | |
| .erow .st{grid-column:1/-1;font-size:11.5px;color:var(--muted)} | |
| .edet{padding:8px 10px 12px;border-bottom:1px solid var(--line);background:var(--panel);font-size:12.5px;display:flex;flex-direction:column;gap:6px} | |
| .edet .acts{display:flex;flex-wrap:wrap;gap:6px} | |
| .edet .acts button{font-size:12px;padding:4px 9px;border-radius:6px;border:1px solid var(--accent);background:transparent;color:var(--accent);cursor:pointer} | |
| .edet .bl{border-left:3px solid var(--line);padding-left:8px} | |
| .ovbar{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12.5px;background:var(--bg);border:1px solid var(--accent);border-radius:6px;padding:6px 9px;margin-bottom:8px} | |
| .ovbar button{font-size:12px;border:0;background:transparent;color:var(--accent);cursor:pointer;text-decoration:underline} | |
| .src{font-size:12px;color:var(--muted);border-top:1px solid var(--line);padding-top:12px} | |
| .body-txt{font-size:12.5px;color:var(--muted);display:flex;flex-direction:column;gap:8px;margin-top:8px} | |
| .tr{border-bottom:1px solid var(--line);padding:4px 0} | |
| #histChart{display:block;width:100%;height:auto;overflow:visible} | |
| #histChart text{font:400 10px var(--f-data);fill:var(--muted)} | |
| .lgd{display:flex;gap:12px;font-size:12px}.lgd i{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:4px;vertical-align:-1px} | |
| main{position:relative;min-width:0;min-height:0} | |
| #map{width:100%;height:100%;display:block;touch-action:none} | |
| #map .c{stroke:var(--stroke);stroke-width:.25;vector-effect:non-scaling-stroke;cursor:pointer} | |
| #map .c:hover{stroke:var(--ink);stroke-width:1} | |
| #map .states{fill:none;stroke:var(--ink);stroke-opacity:.55;stroke-width:.8;vector-effect:non-scaling-stroke;pointer-events:none} | |
| #map .sel{fill:none;stroke:var(--focus);stroke-width:2.5;vector-effect:non-scaling-stroke;pointer-events:none} | |
| #map .hatch{pointer-events:none} | |
| .tip{position:absolute;pointer-events:none;background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:6px 9px;font-size:12.5px;box-shadow:0 4px 14px rgba(0,0,0,.12);max-width:260px} | |
| .tip b{font-family:var(--f-data)} | |
| .zoom{position:absolute;right:max(14px,env(safe-area-inset-right,0px));top:14px;display:flex;flex-direction:column;gap:4px} | |
| .zoom button{width:32px;height:32px;border:1px solid var(--line);background:var(--panel);border-radius:6px;cursor:pointer;font-size:16px} | |
| .status{position:absolute;left:16px;bottom:12px;font-size:12px;color:var(--muted);background:var(--panel);padding:3px 8px;border-radius:4px;border:1px solid var(--line)} | |
| .loading{position:absolute;inset:0;display:grid;place-items:center;color:var(--muted);background:var(--bg);padding:16px;text-align:center} | |
| .views{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px} | |
| .views button{border:1px solid var(--line);background:var(--bg);border-radius:999px;padding:4px 12px;cursor:pointer;font-size:13px} | |
| .views button[aria-pressed=true]{border-color:var(--ink);font-weight:600} | |
| /* Compact rail */ | |
| aside{gap:14px} | |
| .ctl{display:grid;gap:10px} | |
| .ctl .desc{font-size:12px;margin-top:4px} | |
| details.note{padding:6px 9px} | |
| details.note summary{cursor:pointer;font-size:12px} | |
| .mrow{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;gap:8px;align-items:center;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:inherit;text-decoration:none} | |
| .mrow+.mrow{margin-top:6px} | |
| .mrow:hover{border-color:var(--ink)} | |
| .mrow .pd{width:10px;height:10px;border-radius:50%;background:var(--muted)} | |
| .mrow .pd.D{background:var(--dem)} .mrow .pd.R{background:var(--rep)} | |
| .mrow .nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500} | |
| .mrow .nm small{color:var(--muted);font-weight:400} | |
| .mrow .go{font:500 11px var(--f-data);color:var(--accent);text-transform:uppercase;letter-spacing:.06em} | |
| .strip{display:flex;gap:2px;flex-wrap:wrap;grid-column:2/-1} | |
| .strip i{width:8px;height:8px;border:1px solid var(--muted);border-radius:1px} | |
| .strip i.x{background:var(--r5);border-color:var(--r5)} .strip i.r{border-style:dashed;opacity:.6} .strip i.n{border-style:dotted;opacity:.45} .strip i.u{outline:1.5px dashed var(--muted);outline-offset:1px} | |
| details.sub summary{cursor:pointer;font:500 11px var(--f-body);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)} | |
| /* Profile view */ | |
| .bio{grid-column:1/-1;grid-row:2;overflow:auto;background:var(--bg);min-width:0} | |
| .app.bio-on aside,.app.bio-on main{display:none} | |
| .bio-in{max-width:1180px;margin:0 auto;padding-block:20px 60px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:flex;flex-direction:column;gap:26px} | |
| .bio-load{color:var(--muted)} | |
| .bio-nav{display:flex;align-items:center;gap:14px;border-top:3px solid var(--ink);padding-top:10px} | |
| .back{font:500 13px var(--f-data);color:var(--ink);text-decoration:none;border:1px solid var(--line);padding:4px 10px;border-radius:4px;background:var(--panel)} | |
| .kick{font:600 11px var(--f-data);text-transform:uppercase;letter-spacing:.12em;background:var(--ink);color:var(--bg);padding:4px 10px} | |
| .bio-head{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:24px;align-items:start} | |
| .bname{font:400 clamp(44px,8vw,96px)/.92 var(--f-name);text-transform:uppercase;letter-spacing:.005em;margin:6px 0 12px;text-wrap:balance} | |
| .lede{font-size:18px;line-height:1.4;max-width:62ch;margin:0 0 14px} | |
| .bchips{display:flex;gap:6px;flex-wrap:wrap} | |
| .bchips button{font:500 12px var(--f-data);text-transform:uppercase;letter-spacing:.04em;border:1px solid var(--ink);background:var(--panel);padding:5px 10px;cursor:pointer;color:var(--ink)} | |
| .bchips button[aria-pressed=true]{background:var(--ink);color:var(--bg)} | |
| .bmap{margin:0;border:1px solid var(--line);background:var(--panel);padding:8px} | |
| .bmap svg{display:block;width:100%;height:auto} | |
| .bmap figcaption{font:400 11.5px var(--f-data);color:var(--muted);padding-top:6px} | |
| .mm{fill:var(--nodata);stroke:var(--panel);stroke-width:.8} | |
| .mm-on{fill:var(--r5);stroke:var(--ink);stroke-width:1.2} | |
| .mm-st{fill:none;stroke:var(--ink);stroke-width:1} | |
| .tiles{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));border-top:3px solid var(--ink);background:var(--panel);border-bottom:1px solid var(--line)} | |
| .tiles.small{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:12px} | |
| .tile{padding:12px 14px;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:4px;min-width:0} | |
| .tile:last-child{border-right:0} | |
| .tile .tk{font:600 10.5px var(--f-data);text-transform:uppercase;letter-spacing:.08em;color:var(--muted)} | |
| .tile b{font:500 30px/1.05 var(--f-data);letter-spacing:-.02em} | |
| .tile b small{font-size:13px;color:var(--muted)} | |
| .tile b.sm{font-size:16px;line-height:1.3} | |
| .tile .tc{font-size:12px;color:var(--muted)} | |
| .tile.hot b{color:var(--accent)} | |
| .bsec h2{font:600 15px var(--f-data);text-transform:uppercase;letter-spacing:.06em;margin:0;border-bottom:3px solid var(--ink);padding-bottom:6px} | |
| .bsec .bsub{color:var(--muted);max-width:75ch;margin:8px 0 12px;font-size:14px} | |
| .bsec h3{font:600 12px var(--f-data);text-transform:uppercase;letter-spacing:.06em;margin:16px 0 6px} | |
| .chart{background:var(--panel);border:1px solid var(--line);padding:10px 10px 8px} | |
| .bchart{display:block;width:100%;height:auto;overflow:visible} | |
| .bchart .grid{stroke:var(--line)} .bchart .grid.mid{stroke:var(--muted);stroke-dasharray:3 3} | |
| .bchart .ax{font:400 11px var(--f-data);fill:var(--muted)} .bchart .ax.dim{font-style:italic} | |
| .bchart .val{font:500 12px var(--f-data);fill:var(--ink)} | |
| .bchart .lab{font:400 12.5px var(--f-body);fill:var(--ink)} | |
| .bchart .bar{fill:var(--r5)} .bchart .bar.on{fill:var(--r6)} .bchart .bar.for{fill:var(--ink);opacity:.75} .bchart .bar.opp{fill:var(--r5)} | |
| .bchart .whisk{stroke:var(--ink);stroke-width:1.5} | |
| .bchart .tick{stroke-width:3} .bchart .tick.D{stroke:var(--dem)} .bchart .tick.R{stroke:var(--rep)} | |
| .bchart .vd{stroke-width:1.6} | |
| .bchart .vd.other{opacity:.22} .bchart .vd.ag{fill:var(--r5);stroke:var(--r6)} .bchart .vd.ok{fill:var(--panel);stroke:var(--ink)} .bchart .vd.rv{fill:none;stroke:var(--muted);stroke-dasharray:2 2} | |
| .bchart .dumb{stroke:var(--muted);stroke-width:2} .bchart .nat{fill:var(--panel);stroke:var(--muted);stroke-width:2} .bchart .loc{fill:var(--r5)} | |
| .bchart .term{fill:var(--band)} | |
| .lgd2{display:flex;gap:16px;flex-wrap:wrap;font-size:12px;color:var(--muted);padding:6px 4px 0} | |
| .sw{display:inline-block;width:12px;height:12px;margin-right:5px;vertical-align:-2px;border-radius:2px} | |
| .sw.bar{background:var(--r5)} .sw.tickD{height:3px;background:var(--dem);vertical-align:2px} .sw.tickR{height:3px;background:var(--rep);vertical-align:2px} | |
| .sw.ag{background:var(--r5);border-radius:50%} .sw.ok{border:1.6px solid var(--ink);border-radius:50%} .sw.rv{border:1.6px dashed var(--muted);border-radius:50%} | |
| .sw.loc{background:var(--r5);border-radius:50%} .sw.nat{border:2px solid var(--muted);border-radius:50%} | |
| .dim{color:var(--muted)} | |
| .scroll{overflow-x:auto;margin-top:12px;border:1px solid var(--line);background:var(--panel)} | |
| .btab a{color:var(--accent);text-underline-offset:2px} .btab{width:100%;border-collapse:collapse;font-size:13px} | |
| .btab th{font:600 10.5px var(--f-data);text-transform:uppercase;letter-spacing:.06em;color:var(--muted);text-align:left;padding:8px 10px;border-bottom:2px solid var(--ink)} | |
| .btab td{padding:8px 10px;border-bottom:1px solid var(--line);vertical-align:top} | |
| .btab .n{text-align:right;white-space:nowrap} | |
| .btab td.mono:first-child{white-space:nowrap} | |
| .btab .dim{font-size:12px} | |
| .two{display:grid;grid-template-columns:1fr 1fr;gap:24px} | |
| .pies{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:20px 28px;margin:18px 0 6px} | |
| .pie{min-width:0}.pie h3{margin-top:0}.pie svg{display:block;margin:0 auto 8px;max-width:100%} | |
| .pie .ctr{font:600 15px var(--f-data);fill:var(--ink)}.pie .ctr2{font:10.5px var(--f-data);fill:var(--muted);text-transform:uppercase;letter-spacing:.05em} | |
| .plg{display:flex;flex-direction:column;gap:4px;font-size:12.5px}.plg div{display:grid;grid-template-columns:12px 1fr auto auto;gap:8px;align-items:center} | |
| .plg i{width:12px;height:12px;border-radius:2px}.plg .pct{color:var(--muted);min-width:3.2em;text-align:right} | |
| .pie .slice{stroke:var(--panel);stroke-width:1.5} | |
| .hbars{display:flex;flex-direction:column;gap:6px} | |
| .hb{display:grid;grid-template-columns:minmax(0,1.3fr) 1fr auto;gap:10px;align-items:center;font-size:13px} | |
| .hb .hl{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} | |
| .hb .hv{height:10px;background:var(--nodata);position:relative}.hb .hv i{position:absolute;inset:0 auto 0 0;background:var(--ink);opacity:.7} | |
| .big2{font-size:15px}.big2 b{font:500 30px var(--f-data)} | |
| .siggrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:6px} | |
| .sig{display:flex;justify-content:space-between;gap:10px;border:1px solid var(--line);padding:7px 10px;background:var(--panel);font-size:13px} | |
| .sig.yes{border-color:var(--ink)} .sig .mono{font-size:12px;color:var(--muted);white-space:nowrap} | |
| .behind{border-top:1px solid var(--line);padding-top:12px} | |
| .behind summary{cursor:pointer;font:600 12px var(--f-data);text-transform:uppercase;letter-spacing:.06em} | |
| .behind p{max-width:80ch} | |
| @media (max-width:760px){ | |
| .bio-head{grid-template-columns:minmax(0,1fr)} | |
| .bmap{max-width:320px} | |
| .tiles{grid-template-columns:repeat(2,minmax(0,1fr))} | |
| .tile{border-bottom:1px solid var(--line)} | |
| .two{grid-template-columns:minmax(0,1fr)} | |
| .app.bio-on{grid-template-rows:auto auto} | |
| } | |
| @media (max-width:760px){ | |
| html,body{height:auto} | |
| .app{height:auto;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 58vh auto} | |
| #map{touch-action:pan-y} | |
| main{order:2} aside{order:3;border-right:0;border-top:1px solid var(--line);padding-right:max(20px,env(safe-area-inset-right,0px))} | |
| header{padding-right:max(20px,env(safe-area-inset-right,0px))} | |
| } | |
| </style> | |
| <div class="app"> | |
| <header> | |
| <div class="brand">Representation<span>Gap</span></div> | |
| <div class="tag" id="tagline">How often your elected representatives vote against what most of their own constituents want</div> | |
| <div class="search"><input id="q" list="countylist" placeholder="Find a county or a member" autocomplete="off" aria-label="Find a county or a member of Congress"><datalist id="countylist"></datalist></div> | |
| </header> | |
| <aside> | |
| <div class="ctl"><div> | |
| <span class="lbl" id="lvLbl">Show</span> | |
| <div class="seg" id="level" role="group" aria-labelledby="lvLbl"> | |
| <button type="button" data-l="all" aria-pressed="true">All my representatives</button> | |
| <button type="button" data-l="congress" aria-pressed="false">Congress</button> | |
| <button type="button" data-l="state" aria-pressed="false">State legislature</button> | |
| </div> | |
| <div class="desc" id="levelDesc"></div> | |
| </div> | |
| <div> | |
| <label class="lbl" for="measure">Position</label> | |
| <select id="measure"></select> | |
| <div class="desc" id="mdesc"></div> | |
| </div> | |
| <div id="whoBox"> | |
| <span class="lbl" id="whoLbl">Represented by</span> | |
| <div class="seg" id="who" role="group" aria-labelledby="whoLbl"> | |
| <button type="button" data-who="house" aria-pressed="true">House</button> | |
| <button type="button" data-who="senate" aria-pressed="false">Senate</button> | |
| <button type="button" data-who="both" aria-pressed="false">Both</button> | |
| </div> | |
| <div class="desc" id="whoDesc" hidden></div> | |
| </div> | |
| <div> | |
| <span class="lbl" id="cgLbl">Congress</span> | |
| <div class="seg" id="cong" role="group" aria-labelledby="cgLbl"> | |
| <button type="button" data-c="115" aria-pressed="false">115th</button> | |
| <button type="button" data-c="116" aria-pressed="false">116th</button> | |
| <button type="button" data-c="117" aria-pressed="false">117th</button> | |
| <button type="button" data-c="118" aria-pressed="false">118th</button> | |
| <button type="button" data-c="119" aria-pressed="true">119th</button> | |
| </div> | |
| <div class="desc mono" id="period"></div> | |
| <details class="note" id="agendaBox"><summary id="agendaSum">Test mix</summary><div id="agenda"></div></details> | |
| </div></div> | |
| <div class="legend"> | |
| <div class="ovbar" id="ovbar" hidden><span id="ovtxt"></span><button type="button" id="ovclear">Clear overlay</button></div> | |
| <span class="lbl" id="legTitle">Share of votes against the position</span> | |
| <svg id="legend" viewBox="0 0 320 34" role="img" aria-label="Map legend"></svg> | |
| <div class="legkeys"><span><i class="hz"></i><span id="hzTxt">No member with enough scored votes</span></span></div> | |
| </div> | |
| <details class="sec" id="explorer"><summary>Poll explorer: 66%+ ideas</summary> | |
| <div class="exp"> | |
| <input id="expq" type="search" placeholder="Search ideas, bills, committees" aria-label="Search the poll explorer"> | |
| <div class="fchips" id="expf" role="group" aria-label="Filter ideas"> | |
| <button type="button" data-f="all" aria-pressed="true">All</button> | |
| <button type="button" data-f="scored" aria-pressed="false">Got a scored vote</button> | |
| <button type="button" data-f="novote" aria-pressed="false">No floor vote</button> | |
| <button type="button" data-f="passed" aria-pressed="false">Passed the House before</button> | |
| <button type="button" data-f="petition" aria-pressed="false">Discharge petition</button> | |
| </div> | |
| <div class="desc" id="expn"></div> | |
| <div class="explist" id="explist" role="list">Loading</div> | |
| </div> | |
| </details> | |
| <div class="views" id="views"><button type="button" data-v="us" aria-pressed="true">United States</button><button type="button" data-v="state" aria-pressed="false">This state</button></div> | |
| <section class="county" id="county" aria-live="polite"></section> | |
| <details class="sec" id="hist"><summary>History since 1983</summary><div class="body-txt" id="histBody">Loading</div></details> | |
| <details class="sec" id="about"><summary>About this measure and sources</summary><div class="body-txt" id="aboutBody"></div></details> | |
| </aside> | |
| <main> | |
| <svg id="map" role="img" aria-label="Map of US counties shaded by representation gap"></svg> | |
| <div class="zoom"><button type="button" id="zin" aria-label="Zoom in">+</button><button type="button" id="zout" aria-label="Zoom out">−</button></div> | |
| <div class="tip" id="tip" hidden></div> | |
| <div class="status" id="status"></div> | |
| <div class="loading" id="loading">Loading counties and votes</div> | |
| </main> | |
| <section class="bio" id="bio" hidden aria-live="polite"></section> | |
| </div> | |
| <script> | |
| const $ = s => document.querySelector(s); | |
| const esc = s => String(s==null?"":s).replace(/[&<>"]/g,c=>({"&":"&","<":"<",">":">",'"':"""}[c])); | |
| const css = v => getComputedStyle(document.documentElement).getPropertyValue(v).trim(); | |
| const pct = x => x==null?"n/a":Math.round(x*100)+"%"; | |
| const usd = n => "$"+Math.round(n).toLocaleString("en-US"); | |
| const tit = s => s.toLowerCase().replace(/(^|[\s(\/&-])[a-z]/g,c=>c.toUpperCase()); | |
| const SHORT = {"pp-004":"Congress must approve Venezuela action","pp-001":"Sports teams by sex at birth","pp-002":"Release the Epstein files","rp-001":"Bipartisan infrastructure bill","rp-002":"2017 disaster aid + debt limit deal","rp-003":"Dreamers protection + border security","rp-004":"Rifle purchase age 21","rp-005":"Court-ordered gun removal (red flag)","rp-006":"Tougher Russia sanctions","rp-007":"Tougher North Korea sanctions","rp-008":"Renegotiate NAFTA","ns-001":"Background checks on all gun sales","ns-002":"Tax cut under $100K income","ns-003":"Higher tax over $600K income","ns-004":"Debt-free state college","ns-005":"Transgender military service","ns-006":"Legalize marijuana","ns-007":"Ban assault rifles","ns-008":"Public gun registry","ns-009":"Abortion beyond rape/incest/life","ns-010":"Guaranteed jobs","vc-001":"Fewer asylum claims at the border","vc-002":"More border law enforcement","vc-003":"COVID mask requirements","vop-001":"Drug prices tied to other countries","vop-004":"Renew ACA subsidies","vop-018":"Raise the minimum wage","vop-020":"No Medicaid cuts","vop-024":"Deport non-citizens convicted of crimes","vop-031":"Higher fuel-economy standards","vop-057":"Ban stock trading by officials","vop-012":"Limit corporate buying of single-family homes","vop-015":"Subsidize child care","vop-017":"Increase SNAP benefits","vop-029":"Tax credits for clean energy production","vop-030":"Tax credits for energy-efficient homes","vop-013":"Expand the Child Tax Credit","vop-022":"Path to citizenship for Dreamers","vop-023":"Mandatory E-Verify with more work visas","vop-027":"Work with other countries to cut greenhouse gases","vop-064":"More disclosure of campaign spending","vop-065":"Ban police chokeholds","vop-070":"Lower mandatory minimums for drug offenses","vop-006":"Public option like Medicare","vop-016":"Paid family and medical leave","vop-034":"Payroll tax on wages over $400,000","vop-042":"End the carried interest tax break","vop-049":"Ban campaign use of deepfakes","vop-052":"Protect access to birth control","vop-058":"Supreme Court ethics rules","vop-060":"Ranked choice voting","vop-008":"Funding for affordable multi-family housing","vop-026":"Make cutting air pollution and greenhouse gases a priority","vop-053":"Insurance must cover birth control"}; | |
| const PTEXT = {"pp-004":["Require congressional approval before U.S. military action in Venezuela", 76],"pp-001":["Require transgender athletes to compete on sports teams that match their sex at birth", 66],"pp-002":["Release the federal government's Epstein investigation files", 80],"rp-001":["Pass the $1 trillion bipartisan infrastructure bill (roads, bridges, broadband, water)", 66],"rp-002":["Fund hurricane disaster relief and raise the debt limit (the September 2017 agreement)", 74],"rp-003":["Pass a law that protects undocumented immigrants brought here as children and also increases border security", 71],"rp-004":["Raise the legal age to buy rifles and shotguns to 21 in all states", 74],"rp-005":["Allow police to take guns from people a court has found to be a danger to themselves or others", 88],"rp-006":["Impose tougher sanctions on Russia", 76],"rp-007":["Impose tougher economic sanctions on North Korea", 80],"rp-008":["Renegotiate the NAFTA trade agreement with Mexico and Canada", 69],"ns-001":["Require background checks for all gun purchases", 92],"ns-002":["Cut taxes for families making less than $100,000 per year", 84],"ns-003":["Raise taxes on families making over $600,000 per year", 75],"ns-004":["Ensure that all students can graduate from state colleges debt free", 70],"ns-005":["Allow transgender people to serve in the military", 72],"ns-006":["Legalize marijuana", 67],"ns-007":["Ban assault rifles", 66],"ns-008":["Create a public government registry of gun ownership", 68],"ns-009":["Permit abortion in cases other than rape, incest, or when the woman\u2019s life is in danger", 67],"ns-010":["Guarantee jobs for all Americans", 73],"vc-001":["Reduce the number of immigrants allowed to seek asylum at the U.S.-Mexico border",66],"vc-002":["Increase law enforcement at the U.S.-Mexico border",72],"vc-003":["Require people to wear masks when around other people outside their homes (COVID-19)",76],"vop-001":["Lower prescription drug prices by limiting prices to those charged in other developed countries",86],"vop-002":["Reform patent laws to increase competition by banning \u201cpay to delay\u201d deals",76],"vop-003":["Allow federal government to override drug patent if the drug is unaffordable, and it was developed with federal aid",79],"vop-004":["Renew enhanced ACA subsidies",81],"vop-005":["Allow people, aged 55 years or older, to purchase a Medicare plan, which is now only available to those 65 and over",80],"vop-006":["Offer a government-run public option similar to Medicare",80],"vop-007":["Increase funding for substance abuse treatment so that it is available to all who need and want it",75],"vop-008":["Provide $25 billion to local governments to increase multi-family housing affordable to low and middle-income households",74],"vop-009":["Provide $40 billion to increase the amount of high-density housing affordable to low-income households",74],"vop-010":["Provide $24 billion in additional housing vouchers for renters who are very low income, disabled or elderly",80],"vop-011":["Provide tax incentives to home builders to build or repair homes affordable to low- and middle-income households",83],"vop-012":["Prohibit large corporations from buying new single-family homes, and require they sell the ones they own",80],"vop-013":["Increase the Child Tax Credit and make it fully refundable",78],"vop-014":["Provide $25 billion to help states and local governments provide free universal preschool",79],"vop-015":["Subsidize childcare so that it costs no more than 7% of a family's income",83],"vop-016":["Create a national 12-week paid family and medical leave program for all workers, paid for with a new payroll tax",75],"vop-017":["Increase SNAP benefits",79],"vop-018":["Raise the federal minimum wage",94],"vop-019":["Increase the Earned Income Tax Credit for workers without children",77],"vop-020":["Do NOT reduce federal funding of Medicaid",70],"vop-021":["Create a path to legal status for long-term undocumented immigrants without a criminal record",77],"vop-022":["Create a path to citizenship for undocumented people brought to the US illegally as children",83],"vop-023":["Mandate employers verify new employees' legal status, while increasing the number of work visas",83],"vop-024":["Deport undocumented immigrants who have committed serious crimes",85],"vop-025":["Hire more immigration court judges and staff to speed up asylum cases",76],"vop-026":["Make the reduction of air pollution and greenhouse gases a high priority",86],"vop-027":["Commit, together with other countries, to work to reduce greenhouse gases",82],"vop-028":["Adopt the goal of reducing US greenhouse gas emissions by about 2% a year",80],"vop-029":["Provide tax credits for the production of energy that has no carbon emissions",77],"vop-030":["Provide tax credits for improving the energy-efficiency of homes and buildings",84],"vop-031":["Require new cars and trucks to get more miles per gallon",80],"vop-032":["Require electric companies to get a minimum portion of their electricity from energy sources that do not produce greenhouse gases (solar, wind, geothermal and nuclear)",76],"vop-033":["Provide transition assistance to workers who lose their jobs in the fossil fuel industry as a result of the transition to cleaner forms of energy",85],"vop-034":["Subject wages over $400,000 to the payroll tax",79],"vop-035":["Gradually increase the payroll tax from 6.2% to 6.5%",62],"vop-036":["Reduce benefits for the top 20% of lifetime earners",65],"vop-037":["Gradually increase the full retirement age to 68",56],"vop-038":["Raise the minimum benefit for someone who has worked 30 years to 125% of the federal poverty line",78],"vop-039":["Change cost-of-living adjustments to focus more on what older adults buy (thus increasing benefits)",70],"vop-040":["Tax capital gains at the (higher) ordinary income rate for income over $200,000",64],"vop-041":["Maintain or increase the estate tax",81],"vop-042":["End the special tax rate for carried interest",73],"vop-043":["Adopt a 0.01% tax on the purchase of stocks and bonds",72],"vop-044":["Increase the corporate tax rate",62],"vop-045":["Create a new federal agency to monitor new AI programs, anticipate potential problems, define best practices, and enforce regulations",80],"vop-046":["Regulate new AI programs that make critical decisions by requiring they first pass a government test",78],"vop-047":["Allow the government to audit, on an ongoing basis, AI programs that make critical decisions",74],"vop-048":["Require all AI\u2013generated deepfakes to be labelled as such",86],"vop-049":["Prohibit political campaigns, including PACs, from using deepfakes",82],"vop-050":["Work to create an international treaty banning fully autonomous weapons systems",79],"vop-051":["Work to create an international treaty to regulate large-scale AI programs",77],"vop-052":["Prohibit state governments from restricting or banning access to birth control",79],"vop-053":["Continue to require health insurance plans cover long-term birth control",82],"vop-054":["Increase funding for health care clinics to provide long-term birth control for free or at low cost",81],"vop-055":["Do NOT make it a serious crime for doctors to perform an abortion before fetal viability",50],"vop-056":["Impose term limits on Members of Congress",82],"vop-057":["Prohibit the trade of stocks in individual companies by Members of Congress, the President, Vice President, and Supreme Court Justices",76],"vop-058":["Require Supreme Court Justices to comply with the same ethical standards as all other federal judges",85],"vop-059":["Require that all Congressional districts be drawn by an independent citizen commission",81],"vop-060":["Require the use of ranked choice voting in all federal elections",66],"vop-061":["Pass a new Constitutional amendment allowing Congress and states to restrict corporations and PACs from spending money to influence elections",82],"vop-062":["Encourage small campaign donors by providing a tax credit for small donations",67],"vop-063":["Continue the restrictions on non-profit organizations\u2019 political activity",79],"vop-064":["Increase disclosure requirements for campaign-related spending by: corporations, unions, and other groups; individuals or groups paying for TV or radio ads; and federal contractors",83],"vop-065":["Prohibit the use of chokeholds",78],"vop-066":["Require police officers to intervene when another officer is using excessive force",88],"vop-067":["Require police to wear body cameras and use them during interactions with suspects",90],"vop-068":["Require law enforcement agencies to submit information about officer misconduct to a national public database",81],"vop-069":["Provide funds to states to hire independent prosecutors in cases of police using deadly force",78],"vop-070":["Lowering the mandatory minimum sentence for first-strike drug offenses from 10 to 5 years",67],"vop-071":["For prisoners who were convicted as juveniles and have served at least 20 years, giving federal judges the option to release them from prison on parole",73],"vop-072":["Restrict the use of solitary confinement, so it can only be used as punishment for serious violations and for no more than 30 days in a row",13],"vop-073":["Prohibit employers or licensing boards from disqualifying someone (not hiring, not licensing, or firing) because they were: arrested but never charged or convicted; convicted of a petty non-violent crime; or convicted of a crime unrelated to the job",65],"vop-074":["Limit the period of time during which employers and licensing boards can disqualify a person to one year after sentence completion for a misdemeanor, and five years for a felony",79],"vop-075":["Automatically seal the record of a non-violent drug conviction five years after sentence completion",77]}; | |
| const ABBR = {"01":"AL","02":"AK","04":"AZ","05":"AR","06":"CA","08":"CO","09":"CT","10":"DE","11":"DC","12":"FL","13":"GA","15":"HI","16":"ID","17":"IL","18":"IN","19":"IA","20":"KS","21":"KY","22":"LA","23":"ME","24":"MD","25":"MA","26":"MI","27":"MN","28":"MS","29":"MO","30":"MT","31":"NE","32":"NV","33":"NH","34":"NJ","35":"NM","36":"NY","37":"NC","38":"ND","39":"OH","40":"OK","41":"OR","42":"PA","44":"RI","45":"SC","46":"SD","47":"TN","48":"TX","49":"UT","50":"VT","51":"VA","53":"WA","54":"WV","55":"WI","56":"WY"}; | |
| const state = {m:"all", who:"house", level:"all", fips:null, view:"us", c:119, ov:null}; | |
| let EXP=null, expOpen=null, expF="all"; | |
| // State-legislature scores load here once states are published (none yet). Shape: {fips: value} | |
| // State legislatures (draft layers): one file per state, loaded after the map. | |
| const SL = {}; // state abbr -> layer | |
| let STATELEG = null; // truthy once any layer has loaded | |
| // stateleg-index.json lists the published state files (falls back to Michigan only) | |
| fetch("stateleg-index.json").then(r=>r.ok?r.json():["stateleg-MI.json"]).catch(()=>["stateleg-MI.json"]).then(files=> | |
| Promise.all(files.map(f=>fetch(f).then(r=>r.ok?r.json():null).catch(()=>null))).then(ls=>{ls.filter(Boolean).forEach(l=>{SL[l.state]=l}); if(Object.keys(SL).length){STATELEG=true; if(features) render()}})); | |
| // Rule 4.2 / R15: who sponsored the scored tests, and a low-confidence flag when the median scored legislator has under 3 tests. | |
| function slSidesHtml(L){ | |
| if(!L) return ""; | |
| let h=""; | |
| const sc=L.sides&&L.sides.scored; | |
| if(sc){ const lab={"R-sponsored":"Republican-sponsored","D-sponsored":"Democratic-sponsored","bipartisan":"sponsors from both parties"}; | |
| const parts=Object.entries(sc).sort((a,b)=>b[1]-a[1]).map(([k,n])=>n+" "+(lab[k]||k.replace(/^other: ?/,"other sponsor").replace("committee or unknown","committee or no listed sponsor"))); | |
| h+='<div class="desc">Scored tests by sponsor: '+esc(parts.join(", "))+'. Party comparisons reflect which measures reached a vote.</div>'; } | |
| const t=Object.values(L.members||{}).filter(m=>m.gap!=null).map(m=>m.tests).sort((a,b)=>a-b); | |
| if(t.length && t[Math.floor(t.length/2)]<3) h+='<div class="note">Low confidence: the typical scored legislator here has only '+t[Math.floor(t.length/2)]+' tested votes.</div>'; | |
| return h; | |
| } | |
| function slSession(L){ return Object.values(L.sessions).find(x=>x.congress===state.c) } | |
| // Returns {h,s,rows} for a county: population-weighted career scores of its state House and Senate members. | |
| function slCounty(fips){ | |
| const L=SL[ABBR[fips.slice(0,2)]]; if(!L) return null; const S=slSession(L); if(!S) return null; const c=S.counties[fips]; if(!c) return null; | |
| const out={rows:[]}; | |
| for(const ch of ["House","Senate"]){ let num=0,den=0; | |
| for(const [p,sh] of (c[ch]||[])){ const m=p&&L.members[p]; if(!m) continue; out.rows.push({m,ch,sh}); if(m.gap!=null){num+=sh*m.gap;den+=sh} } | |
| out[ch==="House"?"h":"s"]=den>0?num/den:null; } | |
| return out; | |
| } | |
| function slVal(fips){ const x=slCounty(fips); if(!x) return null; const v=[x.h,x.s].filter(y=>y!=null); return v.length?v.reduce((a,b)=>a+b,0)/v.length:null } | |
| function effWho(){return state.level==="congress"?state.who:"both"} | |
| const CACHE = {}, CSMEM = new Map(); | |
| const CONG = {115:"115th Congress, Jan 2017 to Jan 2019",116:"116th Congress, Jan 2019 to Jan 2021",117:"117th Congress, Jan 2021 to Jan 2023",118:"118th Congress, Jan 2023 to Jan 2025",119:"119th Congress, Jan 2025 to now"}; | |
| let distOf, stFips, D, topo, features, byId, nameOf = {}, stateName = {}, cPaths, svg, g, path, projection, W=0, H=0, vals = new Map(), zoom, hatchG, selPath; | |
| const loadC=c=>CACHE[c]?Promise.resolve(CACHE[c]):fetch(c===119?"gap-data.json":"gap-data-"+c+".json").then(r=>r.json()).then(d=>(CACHE[c]=d)); | |
| Promise.all([fetch("counties-10m.json").then(r=>r.json()), loadC(119)]).then(([t,d])=>{topo=t;D=d;init()}).catch(e=>{console.error(e);$("#loading").hidden=false;$("#loading").textContent="Could not load the map data. Reload the page to try again."}); | |
| function wOf(v){return v[5]?0.5:1} | |
| const isSenBill=id=>/^S\d/.test(id); | |
| function csInfo(i){ | |
| if(!D.cosp) return null; if(CSMEM.has(i)) return CSMEM.get(i); | |
| const m=D.members[i], sen=m.chamber==="S", mine=new Set(m.cs||[]); let tracked=0, signed=0; const rows=[]; | |
| for(const p of D.cosp.positions){ const bl=p.bills.filter(b=>isSenBill(b[0])===sen); if(!bl.length) continue; tracked++; const got=bl.filter(b=>mine.has(b[0])); if(got.length) signed++; rows.push({id:p.id,bills:bl,got}) } | |
| const r=tracked?{tracked,signed,rows}:null; CSMEM.set(i,r); return r; | |
| } | |
| function memberVal(i,pos){ | |
| const m=D.members[i]; | |
| if(pos==="S"){ const c=csInfo(i); return c?{v:1-c.signed/c.tracked,n:c.tracked}:null } | |
| if(pos==="all") return {v:m.gap,n:m.n}; | |
| let num=0,den=0,n=0; const side=(pos==="D"||pos==="R"); | |
| for(const v of m.votes){ if(v[6]||(side?v[7]!==pos:v[4]!==pos)) continue; const w=wOf(v); den+=w; num+=w*v[3]; n++; } | |
| return den?{v:num/den,n}:null; | |
| } | |
| function posIdx(){return (state.m==="all"||state.m==="D"||state.m==="R"||state.m==="S")?state.m:+state.m} | |
| function curPos(){return (state.m==="all"||state.m==="D"||state.m==="R"||state.m==="S")?null:D.positions[+state.m]} | |
| const MEAS={all:"All positions combined",D:"Positions Democrats voted for",R:"Positions Republicans voted for",S:"Bill sponsorship: majority positions with no signed bill"}; | |
| const MDESC={S:"Among majority-backed positions that have a matching bill in the member's chamber, the share where the member signed none. Not signing is not the same as opposing. Each party mostly signs its own bills, and members who joined mid-Congress could not sign earlier bills.",all:"Average over every vote test below. Tests flagged for review are left out.",D:"Only tests where most Democrats cast the aligned vote and most Republicans did not. High means the member voted against these.",R:"Only tests where most Republicans cast the aligned vote and most Democrats did not. High means the member voted against these."}; | |
| function houseParts(fips){return (D.counties[fips]||[]).map(([geo,s])=>({geo,s,i:D.districts[geo]}))} | |
| function countyVal(fips){ | |
| if(state.level==="state") return state.m==="all"?slVal(fips):null; | |
| if(state.level==="all"){ | |
| // every official counts equally: House member + each senator (+ state legislators once scored) | |
| const pos=posIdx(), st=ABBR[fips.slice(0,2)], parts=[]; | |
| let num=0,den=0; | |
| for(const p of houseParts(fips)){ if(p.i==null) continue; const r=memberVal(p.i,pos); if(r){num+=p.s*r.v;den+=p.s} } | |
| if(den>0) parts.push(num/den); | |
| (D.senators[st]||[]).forEach(i=>{const r=memberVal(i,pos); if(r) parts.push(r.v)}); | |
| if(state.m==="all"){ const x=slCounty(fips); if(x){ if(x.h!=null) parts.push(x.h); if(x.s!=null) parts.push(x.s); } } // state legislators only join "All positions combined" | |
| return parts.length?parts.reduce((a,b)=>a+b,0)/parts.length:null; | |
| } | |
| const pos=posIdx(), st=ABBR[fips.slice(0,2)]; | |
| let h=null, s=null; | |
| if(state.who!=="senate"){ | |
| let num=0,den=0; | |
| for(const p of houseParts(fips)){ if(p.i==null) continue; const r=memberVal(p.i,pos); if(r){num+=p.s*r.v;den+=p.s} } | |
| if(den>0) h=num/den; | |
| } | |
| if(state.who!=="house"){ | |
| const vs=(D.senators[st]||[]).map(i=>memberVal(i,pos)).filter(Boolean).map(r=>r.v); | |
| if(vs.length) s=vs.reduce((a,b)=>a+b,0)/vs.length; | |
| } | |
| if(state.who==="house") return h; if(state.who==="senate") return s; | |
| if(h==null) return s; if(s==null) return h; return (h+s)/2; | |
| } | |
| const BR=[.1,.25,.4,.55,.7,.85]; | |
| const cols = () => [0,1,2,3,4,5,6].map(i=>css("--r"+i)); | |
| function colorFor(v){ if(v==null) return css("--nodata"); const c=cols(); let k=0; while(k<BR.length&&v>=BR[k]) k++; return c[k]; } | |
| function init(){ | |
| features = topojson.feature(topo,topo.objects.counties).features; | |
| topo.objects.states.geometries.forEach(s=>{stateName[s.id]=s.properties.name}); | |
| features.forEach(f=>{nameOf[f.id]=f.properties.name}); | |
| byId = new Map(features.map(f=>[f.id,f])); | |
| stFips = Object.fromEntries(Object.entries(ABBR).map(([f,a])=>[a,f])); | |
| // controls | |
| setData(); | |
| $("#measure").onchange=e=>{state.ov=null;state.m=e.target.value;render()}; | |
| $("#ovclear").onclick=()=>{state.ov=null;render()}; | |
| $("#expq").addEventListener("input",renderExp); | |
| document.querySelectorAll("#expf button").forEach(b=>b.onclick=()=>{expF=b.dataset.f;document.querySelectorAll("#expf button").forEach(x=>x.setAttribute("aria-pressed",String(x===b)));renderExp()}); | |
| loadExp(); | |
| document.querySelectorAll("#who button").forEach(b=>b.onclick=()=>{state.who=b.dataset.who;render()}); | |
| document.querySelectorAll("#level button").forEach(b=>b.onclick=()=>{state.ov=null;state.level=b.dataset.l;render()}); | |
| document.querySelectorAll("#cong button").forEach(b=>b.onclick=()=>setCong(+b.dataset.c)); | |
| document.querySelectorAll("#views button").forEach(b=>b.onclick=()=>setView(b.dataset.v)); | |
| $("#hist").addEventListener("toggle",()=>{if($("#hist").open) loadHist()}); | |
| // county list | |
| const lst=features.map(f=>({id:f.id,label:nameOf[f.id]+", "+(ABBR[f.id.slice(0,2)]||"")})); | |
| const mem=D.members.filter(m=>m.b).map(m=>({b:m.b,label:mName(m)+" ("+m.party+", "+(m.chamber==="H"?(distOf[D.members.indexOf(m)]?dLabel(distOf[D.members.indexOf(m)]):m.state):m.state+" Senate")+")"})); | |
| $("#countylist").innerHTML=mem.map(x=>'<option value="'+esc(x.label)+'"></option>').join("")+lst.map(x=>'<option value="'+esc(x.label)+'"></option>').join(""); | |
| const byLabel=new Map(lst.map(x=>[x.label.toLowerCase(),x.id])), byMem=new Map(mem.map(x=>[x.label.toLowerCase(),x.b])); | |
| $("#q").addEventListener("change",e=>{const v=e.target.value.toLowerCase().trim(), b=byMem.get(v); if(b){location.hash="m-"+b;e.target.value="";return} const id=byLabel.get(v);if(id){select(id,true);e.target.value="";return} | |
| if(v.length>=3){const mm=mem.find(x=>x.label.toLowerCase().includes(v)); if(mm){location.hash="m-"+mm.b;e.target.value="";return} const cc=lst.find(x=>x.label.toLowerCase().startsWith(v))||lst.find(x=>x.label.toLowerCase().includes(v)); if(cc){select(cc.id,true);e.target.value="";return}} | |
| $("#status").textContent="No county or member matches \u201c"+e.target.value+"\u201d. Try a county name or a last name.";}); | |
| // map | |
| svg=d3.select("#map"); g=svg.append("g"); | |
| projection=d3.geoAlbersUsa(); path=d3.geoPath(projection); | |
| const defs=svg.append("defs"); defs.append("pattern").attr("id","hatch").attr("patternUnits","userSpaceOnUse").attr("width",4).attr("height",4).attr("patternTransform","rotate(45)").append("rect").attr("width",.7).attr("height",4).attr("fill","var(--hatch)"); | |
| cPaths=g.append("g").selectAll("path").data(features).join("path").attr("class","c").on("pointermove",hover).on("pointerleave",()=>{$("#tip").hidden=true}).on("click",(e,d)=>select(d.id,true)); | |
| hatchG=g.append("g").attr("class","hatch"); | |
| g.append("path").attr("class","states").datum(topojson.mesh(topo,topo.objects.states,(a,b)=>a!==b)); | |
| g.append("path").attr("class","states").datum(topojson.feature(topo,topo.objects.nation)); | |
| selPath=g.append("path").attr("class","sel"); | |
| zoom=d3.zoom().scaleExtent([1,60]).on("zoom",e=>g.attr("transform",e.transform)); | |
| svg.call(zoom); | |
| $("#zin").onclick=()=>svg.transition().duration(250).call(zoom.scaleBy,1.6); | |
| $("#zout").onclick=()=>svg.transition().duration(250).call(zoom.scaleBy,1/1.6); | |
| new ResizeObserver(layout).observe($("main")); | |
| matchMedia("(prefers-color-scheme: dark)").addEventListener("change",render); | |
| new MutationObserver(render).observe(document.documentElement,{attributes:true,attributeFilter:["data-theme"]}); | |
| $("#loading").hidden=true; | |
| layout(); render(); | |
| const h0=location.hash; | |
| const first=features.find(f=>f.id==="26049"); if(first) select("26049",false); | |
| if(h0.startsWith("#m-")&&location.hash!==h0) history.replaceState(null,"",h0); | |
| if(typeof routeBio==="function") routeBio(); | |
| } | |
| function setData(){ | |
| distOf = {}; Object.entries(D.districts).forEach(([g,i])=>{distOf[i]=g}); CSMEM.clear(); | |
| const keys=Object.keys(MEAS).filter(k=>k!=="S"||D.cosp); | |
| $("#measure").innerHTML=keys.map(k=>'<option value="'+k+'">'+MEAS[k]+'</option>').join("")+D.positions.map((p,i)=>'<option value="'+i+'">'+esc(SHORT[p.id]||p.text)+'</option>').join(""); | |
| $("#period").textContent=CONG[D.congress]+" \u00b7 "+D.tests.length+" vote tests"; | |
| document.querySelectorAll("#cong button").forEach(b=>b.setAttribute("aria-pressed",String(+b.dataset.c===D.congress))); | |
| const nd=D.tests.filter(t=>t.side==="D").length, nr=D.tests.filter(t=>t.side==="R").length, nx=D.tests.length-nd-nr, tot=D.tests.length; | |
| const lean=nd>=nr?["Democrats",nd]:["Republicans",nr]; | |
| $("#agendaSum").textContent=nd+" Democratic-backed, "+nr+" Republican-backed, "+nx+" both"+(lean[1]/tot>=.7?": lopsided, read before comparing parties":""); $("#agendaBox").open=lean[1]/tot>=.7; | |
| $("#agenda").textContent=lean[1]/tot>=.7?"Lopsided test mix: on "+lean[1]+" of "+tot+" tests, only "+lean[0]+" mostly took the majority-backed side. That can reflect how members voted or simply which measures came to a vote, so the other party's overall gap is partly built in. Compare the two party views before drawing conclusions.":(D.congress<119?"Mix of tests: "+nd+" Democratic-backed, "+nr+" Republican-backed, "+nx+" both parties.":""); | |
| } | |
| function setCong(c){ | |
| if(c===state.c) return; $("#status").textContent="Loading the "+c+"th Congress"; | |
| loadC(c).then(d=>{D=d;state.c=c;state.m="all";setData();render()}).catch(()=>{$("#status").textContent="Could not load that Congress. Try again."}); | |
| } | |
| function layout(){ | |
| const r=$("main").getBoundingClientRect(); W=r.width;H=r.height; if(!W||!H) return; | |
| projection.fitExtent([[10,10],[W-10,H-10]],topojson.feature(topo,topo.objects.nation)); | |
| svg.attr("viewBox","0 0 "+W+" "+H); cPaths.attr("d",path); g.selectAll(".states").attr("d",path); | |
| drawHatch(); drawSel(); | |
| } | |
| function drawHatch(){ | |
| hatchG.selectAll("path").remove(); | |
| hatchG.selectAll("path").data(features.filter(f=>vals.get(f.id)==null)).join("path").attr("d",path).attr("fill","url(#hatch)"); | |
| } | |
| // ---- Poll explorer + overlays (2026-10-31) ---- | |
| function loadExp(){ fetch("explorer.json").then(r=>r.json()).then(x=>{EXP=x;renderExp(); if(state.fips) renderCounty()}).catch(()=>{$("#explist").textContent="Could not load the poll explorer."}) } | |
| function expLabel(p){ return SHORT[p.id]||(p.text.length>70?p.text.slice(0,68)+"\u2026":p.text) } | |
| function expStatus(p){ const t=p.tests119.H+p.tests119.S; | |
| if(t) return t+" scored vote"+(t>1?"s":"")+" this Congress"+(p.novoteH&&!p.tests119.H?" (none in the House)":p.novoteS&&!p.tests119.S?" (none in the Senate)":""); | |
| if(p.novoteH&&p.novoteS) return "No floor vote in either chamber this Congress"; | |
| if(p.novoteH) return "No House floor vote this Congress"; if(p.novoteS) return "No Senate floor vote this Congress"; | |
| return "No counted vote this Congress" } | |
| function expMatch(p){ const q=($("#expq").value||"").toLowerCase().trim(); | |
| const t=p.tests119.H+p.tests119.S; | |
| if(expF==="scored"&&!t) return false; if(expF==="novote"&&!(p.novoteH||p.novoteS)) return false; | |
| if(expF==="passed"&&!p.history.length) return false; if(expF==="petition"&&!p.petitions.length) return false; | |
| if(!q) return true; | |
| return (p.text+" "+expLabel(p)+" "+p.topic+" "+p.blocked.map(b=>b.bill+" "+b.title+" "+b.committees+" "+b.chairs).join(" ")).toLowerCase().includes(q) } | |
| function expDetail(p){ | |
| const d=[]; d.push('<div>'+esc(p.text)+'</div>'); | |
| d.push('<div><b>'+p.support+'%</b> support \u00b7 '+esc(p.org)+', '+esc(p.date)+(p.url?' \u00b7 <a href="'+esc(p.url)+'" target="_blank" rel="noopener">source</a>':'')+(p.rep&&p.dem?'<br>Republicans '+esc(p.rep)+'%, Democrats '+esc(p.dem)+'%'+(p.unverified?' <span class="chip">auto-parsed, unverified</span>':''):'')+'</div>'); | |
| d.push('<div>'+esc(expStatus(p))+'.</div>'); | |
| if(p.blocked.length) d.push('<div><b>Bills this Congress</b>'+p.blocked.slice(0,3).map(b=>'<div class="bl">'+esc(b.bill)+' '+esc(b.title)+' <span class="chip">'+esc(b.sponsor_party)+' sponsor</span><br>Cosponsors '+esc(b.cos_d)+' D, '+esc(b.cos_r)+' R \u00b7 '+esc(b.committees)+(b.chairs?' ('+esc(b.chairs)+')':'')+'<br>Hearing or markup: '+esc(b.hearing||"none recorded")+(b.petition?'<br>'+esc(b.petition):'')+'</div>').join('')+(p.blocked.length>3?'<div style="color:var(--muted)">+'+(p.blocked.length-3)+' more</div>':'')+'</div>'); | |
| if(p.history.length) d.push('<div><b>Earlier floor passage</b> (same bill name): '+p.history.map(h=>esc(h.chamber)+' '+esc(h.date.slice(0,4))+', '+h.yea+'\u2013'+h.nay).join('; ')+'</div>'); | |
| if(p.lda_filings) d.push('<div><b>Lobbying</b>: '+p.lda_filings+' LDA filings in 2025\u201326 name these bills. Filings rarely state a side.</div>'); | |
| const acts=[]; const pi=D.congress===119?D.positions.findIndex(x=>x.id===p.id):-1; | |
| if(pi>=0) acts.push('<button type="button" data-act="votes" data-v="'+pi+'">Map the votes</button>'); | |
| (p.ces||[]).forEach(c=>{ if(D.opinion&&D.opinion.items.some(it=>it.id===c.id)) acts.push('<button type="button" data-act="ces" data-v="'+esc(c.id)+'">Map local support'+(c.quality==="proxy"?' (proxy question)':'')+'</button>') }); | |
| (p.petitions||[]).forEach(n=>acts.push('<button type="button" data-act="pet" data-v="'+esc(n)+'">Map petition '+esc(n)+' signers</button>')); | |
| if(acts.length) d.push('<div class="acts">'+acts.join('')+'</div>'); | |
| return '<div class="edet">'+d.join('')+'</div>' } | |
| function renderExp(){ | |
| if(!EXP) return; const L=$("#explist"); const ps=EXP.positions.filter(expMatch).sort((a,b)=>(b.support||0)-(a.support||0)); | |
| $("#expn").textContent=ps.length+" of "+EXP.positions.length+" polled positions"+(D.congress!==119?" \u00b7 statuses are for the 119th Congress":""); | |
| L.innerHTML=ps.map(p=>'<button type="button" class="erow" role="listitem" data-id="'+esc(p.id)+'" aria-expanded="'+(expOpen===p.id)+'"><span class="nm">'+esc(expLabel(p))+'</span><span class="pc">'+(p.support==null?'':p.support+'%')+'</span><span class="bar"><i style="width:'+(p.support||0)+'%"></i></span><span class="st">'+esc(expStatus(p))+(p.history.length?' \u00b7 passed the House before':'')+(p.petitions.length?' \u00b7 petition '+esc(p.petitions.join(", ")):'')+'</span></button>'+(expOpen===p.id?expDetail(p):'')).join('')||'<div style="padding:10px">No ideas match.</div>'; | |
| L.querySelectorAll(".erow").forEach(b=>b.onclick=()=>{expOpen=expOpen===b.dataset.id?null:b.dataset.id;renderExp()}); | |
| L.querySelectorAll(".acts button").forEach(b=>b.onclick=()=>expAct(b.dataset.act,b.dataset.v)); | |
| } | |
| function expAct(a,v){ | |
| if(a==="votes"){ state.ov=null; state.level="congress"; state.m=v; const P=D.positions[+v]; const ch=new Set(D.tests.filter(t=>D.positions[t.pos]===P).map(t=>t.ch)); if(ch.size===1) state.who=ch.has("S")?"senate":"house"; render(); return } | |
| if(a==="ces"){ const it=D.opinion.items.find(x=>x.id===v); state.ov={t:"ces",id:v,label:it?it.label:v}; render(); return } | |
| if(a==="pet"){ state.ov={t:"pet",no:v}; render(); return } } | |
| function ovVal(fips){ const o=state.ov; if(!o||D.congress!==119) return null; | |
| if(o.t==="ces"){ const O=D.opinion, k=O.items.findIndex(it=>it.id===o.id); let num=0,den=0; for(const p of houseParts(fips)){ const a=O.districts[p.geo]; if(a&&a[k]){num+=p.s*a[k][0];den+=p.s} } return den?num/den:null } | |
| if(o.t==="pet"){ const P=EXP&&EXP.petitions[o.no]; if(!P) return null; const set=new Set(P.geos); let best=null; for(const p of houseParts(fips)) if(!best||p.s>best.s) best=p; if(!best) return null; if(!set.has(best.geo)) return 0; const m=best.i!=null?D.members[best.i]:null; return m&&m.party==="R"?2:1 } return null } | |
| const SUPB=[.5,.6,.7,.8]; | |
| function ovColor(v){ if(v==null) return css("--nodata"); const o=state.ov; | |
| if(o.t==="pet") return v===2?css("--rep"):v===1?css("--dem"):css("--nodata"); | |
| const c=cols(), sc=[c[4],c[3],c[2],c[1],c[0]]; let k=0; while(k<SUPB.length&&v>=SUPB[k]) k++; return sc[k] } | |
| function ovText(){ const o=state.ov; if(!o) return ""; | |
| if(o.t==="ces") return "Overlay: estimated local support, "+o.label+" ("+(D.opinion.survey||"CES 2024")+", by House district). Rough: often 8 or more points off."; | |
| const P=EXP&&EXP.petitions[o.no]; return "Overlay: districts whose member signed discharge petition "+o.no+(P?" ("+P.geos.length+" of 218 needed; "+P.measure+"; clerk.house.gov, read "+P.read_on+")":"")+"." } | |
| function petBlock(i){ const m=D.members[i]; if(!EXP||D.congress!==119||m.chamber!=="H") return ""; const geo=distOf[i]; if(!geo) return ""; | |
| const P=Object.values(EXP.petitions); const signed=P.filter(p=>p.geos.includes(geo)); | |
| return '<div style="margin-top:6px">Discharge petitions on 66%+ ideas: signed '+signed.length+' of '+P.length+(signed.length?' ('+signed.map(p=>esc(p.no)).join(', ')+')':'')+'.</div>' } | |
| function render(){ | |
| if(state.ov&&D.congress!==119) state.ov=null; | |
| vals=new Map(); features.forEach(f=>vals.set(f.id,state.ov?ovVal(f.id):countyVal(f.id))); | |
| cPaths.attr("fill",f=>state.ov?ovColor(vals.get(f.id)):colorFor(vals.get(f.id))); | |
| $("#ovbar").hidden=!state.ov; $("#ovtxt").textContent=state.ov?(state.ov.t==="ces"?"Overlay: local support, "+state.ov.label:"Overlay: petition "+state.ov.no+" signers"):""; if(EXP) renderExp(); | |
| drawHatch(); drawLegend(); | |
| if($("#hzTxt")) $("#hzTxt").textContent=state.level==="state"?"State not covered yet, or no legislator with enough scored votes":"No member with enough scored votes"; | |
| document.querySelectorAll("#who button").forEach(b=>b.setAttribute("aria-pressed",String(b.dataset.who===state.who))); | |
| document.querySelectorAll("#level button").forEach(b=>b.setAttribute("aria-pressed",String(b.dataset.l===state.level))); | |
| $("#whoBox").hidden=state.level!=="congress"; $("#measure").parentElement.hidden=state.level==="state"; $("#period").hidden=$("#agendaBox").hidden=state.level==="state"; if(state.level==="state"&&state.m!=="all"){state.m="all"; return render()} | |
| $("#levelDesc").textContent={all:"Your U.S. House member and both senators"+(STATELEG?" and your state legislators":"")+", each counted equally."+(STATELEG?"":" No state legislatures are scored yet, so this is Congress only for now."),congress:"Members of Congress only. Pick House or Senate below.",state:STATELEG?"State House and Senate members, judged against statewide ballot results that passed or failed with 66% or more, or 66%+ in two or more independent state polls. "+(()=>{const v=Object.keys(SL).filter(k=>SL[k].draft===false).sort(), dr=Object.keys(SL).filter(k=>SL[k].draft!==false).sort(); return (v.length?"Independently verified: "+v.join(", ")+". ":"")+"Draft: "+dr.length+" state"+(dr.length===1?"":"s")+" ("+dr.join(", ")+")"})()+"; each member's score covers all their tested votes, not just this session. A dashed outline on a vote square means the vote was matched from the bill title or description only and is not yet independently checked."+(()=>{const e=Object.keys(SL).filter(k=>!Object.values(SL[k].members||{}).some(m=>m.gap!=null)).sort(); return e.length?" Not enough votes yet in "+e.join(", ")+" (no legislator with 2 tested votes); shown for reference.":""})():"No state legislatures are published yet. Michigan is in testing."}[state.level]+(STATELEG&&state.level!=="congress"&&state.m!=="all"?" State legislators are included only under \u201cAll positions combined\u201d.":""); | |
| const P=curPos(); | |
| $("#measure").value=state.m; | |
| $("#legTitle").textContent=state.ov?(state.ov.t==="ces"?"Estimated share of the district that supports this":"Member signed the petition"):state.m==="S"?"Share of tracked bills not signed":"Share of votes against the position"; | |
| $("#mdesc").textContent=P?P.national+"% of Americans support this"+(P.rep!=null&&P.dem!=null?" (R "+P.rep+"%, D "+P.dem+"%).":" (party split not published).") :MDESC[state.m]; | |
| $("#whoDesc").textContent={house:"Each county takes the score of its House member, weighted by land area when a county spans districts.",senate:"Each county takes the average of its state's senators.",both:"Average of the House and Senate scores for each county."}[state.who]; | |
| const n=[...vals.values()].filter(v=>v!=null).length; | |
| if(state.ov){ $("#status").textContent=ovText(); renderAbout(); renderHist(); if(state.fips) renderCounty(); return } | |
| $("#status").textContent=n?n.toLocaleString("en-US")+" of "+features.length.toLocaleString("en-US")+" counties scored":state.level==="state"?"No state legislatures published yet.":"No votes mapped yet for this position"+(state.level==="congress"?" in the "+(state.who==="house"?"House":"chosen chamber")+". Try Senate or Both.":"."); | |
| renderAbout(); renderHist(); | |
| if(state.fips) renderCounty(); | |
| } | |
| function drawLegend(){ | |
| const L=d3.select("#legend"); L.selectAll("*").remove(); const c=cols(), w=320/7; | |
| if(state.ov&&state.ov.t==="ces"){ const sc=[c[4],c[3],c[2],c[1],c[0]], w5=320/5; L.attr("aria-label","Map legend: estimated local support, breaks at 50, 60, 70 and 80 percent"); | |
| sc.forEach((x,i)=>L.append("rect").attr("x",i*w5).attr("y",0).attr("width",w5-1).attr("height",12).attr("fill",x)); | |
| ["<50%","50%","60%","70%","80%+"].forEach((t,i)=>L.append("text").attr("x",i*w5+2).attr("y",26).text(t)); return } | |
| if(state.ov&&state.ov.t==="pet"){ L.attr("aria-label","Map legend: signed by a Democrat, signed by a Republican, not signed"); | |
| [["--dem","Signed (D)"],["--rep","Signed (R)"],["--nodata","Not signed"]].forEach((x,i)=>{L.append("rect").attr("x",i*107).attr("y",0).attr("width",14).attr("height",12).attr("fill",css(x[0])); L.append("text").attr("x",i*107+20).attr("y",10).text(x[1])}); return } | |
| L.attr("aria-label","Map legend: seven shades from light (small gap) to dark (large gap), with breaks at "+BR.map(b=>Math.round(b*100)+"%").join(", ")); | |
| c.forEach((x,i)=>L.append("rect").attr("x",i*w).attr("y",0).attr("width",w-1).attr("height",12).attr("fill",x)); | |
| L.append("text").attr("x",0).attr("y",26).text("0%"); | |
| BR.forEach((b,i)=>L.append("text").attr("x",(i+1)*w-.5).attr("y",26).attr("text-anchor","middle").text(Math.round(b*100)+"%")); | |
| L.append("text").attr("x",320).attr("y",26).attr("text-anchor","end").text(""); | |
| } | |
| function repsFor(fips){ | |
| const st=ABBR[fips.slice(0,2)]; | |
| const h=houseParts(fips).filter(p=>p.i!=null&&p.s>=.01).sort((a,b)=>b.s-a.s).map(p=>({i:p.i,s:p.s,geo:p.geo})); | |
| const miss=houseParts(fips).filter(p=>p.i==null); | |
| return {h,miss,s:(D.senators[st]||[]).slice()}; | |
| } | |
| const dLabel=geo=>{const st=ABBR[geo.slice(0,2)],d=geo.slice(2);return st+(d==="00"?" at-large":"-"+(+d))}; | |
| const mName=m=>m.name.replace(/^([^,]+),\s*(.*)$/,"$2 $1").replace(/\s+[A-Z]\.?$/,"").replace(/\b(Mc|Mac(?=[a-z]{4})|O')([a-z])/g,(a,p,c)=>p+c.toUpperCase()); | |
| function hover(e,d){ | |
| const v=vals.get(d.id), st=ABBR[d.id.slice(0,2)]||"", t=$("#tip"), R=repsFor(d.id); | |
| const who=[...R.h.slice(0,2).map(x=>mName(D.members[x.i])+" ("+D.members[x.i].party+")")].join(", "); | |
| t.innerHTML="<strong>"+esc(nameOf[d.id])+", "+st+"</strong><br>"+(state.ov?(v==null?"No estimate":state.ov.t==="ces"?"<b>"+pct(v)+"</b> estimated support":v?"<b>Signed</b> petition "+esc(state.ov.no):"Did not sign petition "+esc(state.ov.no)):v==null?"No member with enough scored votes":"<b>"+pct(v)+"</b> "+(state.m==="S"?"unsigned":"gap"))+(who&&effWho()!=="senate"?"<br>"+esc(who):""); | |
| t.hidden=false; const r=$("main").getBoundingClientRect(); let x=e.clientX-r.left+14,y=e.clientY-r.top+14; if(x+260>r.width) x-=280; if(y+90>r.height) y-=90; t.style.left=x+"px"; t.style.top=y+"px"; | |
| } | |
| function select(fips,zoomIt){ | |
| state.fips=fips; renderCounty(); drawSel(); | |
| if(window.matchMedia("(max-width:760px)").matches){const el=$("#county"); if(el) setTimeout(()=>el.scrollIntoView({behavior:"smooth",block:"start"}),60)} | |
| if(zoomIt) setView(state.view==="us"?"state":state.view); | |
| } | |
| function drawSel(){ if(!selPath) return; const f=state.fips&&byId.get(state.fips); selPath.attr("d",f?path(f):null) } | |
| function setView(v){ | |
| state.view=v; document.querySelectorAll("#views button").forEach(b=>b.setAttribute("aria-pressed",String(b.dataset.v===v))); | |
| if(v==="us"){svg.transition().duration(450).call(zoom.transform,d3.zoomIdentity);return} | |
| const st=(state.fips||"26049").slice(0,2), fs=features.filter(f=>f.id.slice(0,2)===st); | |
| const [[x0,y0],[x1,y1]]=path.bounds({type:"FeatureCollection",features:fs}); if(!isFinite(x0)) return; | |
| const k=Math.min(60,.8/Math.max((x1-x0)/W,(y1-y0)/H)); | |
| svg.transition().duration(450).call(zoom.transform,d3.zoomIdentity.translate(W/2,H/2).scale(k).translate(-(x0+x1)/2,-(y0+y1)/2)); | |
| } | |
| function localOpinion(i){ | |
| const m=D.members[i], O=D.opinion; if(!O) return ""; | |
| const house=m.chamber==="H", key=house?distOf[i]:stFips[m.state]; const arr=key&&(house?O.districts[key]:O.states[key]); if(!arr) return ""; | |
| const rows=[]; | |
| O.items.forEach((it,k)=>{ const o=arr[k]; if(!o) return; | |
| it.vop.forEach(pid=>{ const pi=D.positions.findIndex(p=>p.id===pid); if(pi<0) return; const r=memberVal(i,pi); if(!r) return; | |
| rows.push('<tr><td>'+esc(it.label)+(it.quality==="proxy"?' <span class="chip">proxy</span>':'')+'<div style="color:var(--muted)">for '+esc(SHORT[pid])+'</div></td><td class="v">'+pct(o[0])+'</td><td class="v">'+(r.v>=.5?'<span class="chip warn">voted against</span>':'<span class="chip">voted for</span>')+'</td></tr>')})}); | |
| if(!rows.length) return ""; | |
| return '<div style="margin-top:8px"><h4>Local opinion, '+esc(O.survey||"CES 2024")+' estimate ('+(house?"district":"state")+')</h4><div class="allm"><table>'+rows.join("")+'</table></div><div style="color:var(--muted)">'+(house?"Estimates pool each district toward its state, so they are rough (often 8 points or more off).":"State-level estimate from the survey.")+' Proxy means the survey asked a related question, not this exact one.</div></div>'} | |
| const KIND={superpac:"super PAC",hybrid:"hybrid PAC",single:"single-candidate PAC",party:"party",pac:"PAC",nondisclosing:"undisclosed donors",other:"other"}; | |
| const usdS=n=>n>=1e6?"$"+(n/1e6).toFixed(n>=1e7?0:1)+"M":n>=1e3?"$"+Math.round(n/1e3)+"K":"$"+n; | |
| function moneyBlock(i){ | |
| const o=D.members[i].os; if(!o) return '<div style="margin-top:8px"><h4>Outside spending, 2018 to 2026</h4><div style="color:var(--muted)">None reported in their races.</div></div>'; | |
| const [sup,opp,ds,dop,top]=o; | |
| return '<div style="margin-top:8px"><h4>Outside spending, 2018 to 2026</h4><div class="mono">'+usdS(sup)+' for, '+usdS(opp)+' against</div>'+((ds+dop)>0?'<div>Groups that need not name donors: <span class="mono">'+usdS(ds)+' for, '+usdS(dop)+' against</span></div>':'')+ | |
| '<ul class="donors">'+top.map(t=>'<li><span>'+esc(/^[A-Z0-9&]{2,6}$/.test(t[0].trim())?t[0].trim():tit(t[0]))+' <span class="chip'+(t[1]==="nondisclosing"?' warn':'')+'">'+KIND[t[1]]+'</span></span><span class="mono">'+(t[2]?usdS(t[2])+' for':'')+(t[2]&&t[3]?', ':'')+(t[3]?usdS(t[3])+' against':'')+'</span></li>').join("")+'</ul><div style="color:var(--muted)">Independent expenditures reported to the FEC, all of the member\'s races in these cycles (including races for other offices). Approximate.</div></div>'; | |
| } | |
| function tradeBlock(i){ | |
| const t=D.members[i].tr; if(!t) return ""; | |
| const [f,n,late,un,top,yrs]=t; | |
| return '<div style="margin-top:8px"><h4>Stock trades disclosed'+(yrs?' ('+esc(yrs)+')':'')+'</h4><div class="mono">'+n.toLocaleString("en-US")+' trades in '+f+' reports</div>'+(late?'<div>'+late+' appear filed after the STOCK Act deadline (estimate from dates on the form).</div>':'')+(un?'<div style="color:var(--muted)">'+un+' scanned paper reports not counted.</div>':'')+(top.length?'<div style="color:var(--muted)">Most traded: '+top.map(a=>esc(a[0])).join(", ")+'</div>':'')+'</div>'; | |
| } | |
| function courtBlock(i){ | |
| const c=D.members[i].ct; | |
| if(!c) return '<div style="margin-top:8px"><h4>Federal court records</h4><div style="color:var(--muted)">Not searched yet ('+(D.courts_done||0)+' members searched so far).</div></div>'; | |
| const [ph,list,nshow,nposs]=c; | |
| const rows=list.map(k=>'<div class="tr"><a href="'+esc(k[5])+'" target="_blank" rel="noopener">'+esc(k[0])+'</a> <span class="mono">'+esc((k[2]||"").slice(0,4))+'</span> <span class="chip">'+esc(k[3])+' office</span>'+(k[4]?' <span class="chip">named with many officials</span>':'')+'<div style="color:var(--muted)">'+esc(k[1])+'</div></div>').join(""); | |
| return '<div style="margin-top:8px"><h4>Federal court records naming them</h4><div class="mono">'+(nshow?["before","during","after"].map(p=>(ph[p]||0)+" "+p).join(", ")+" office":"None found")+'</div>'+rows+'<div style="color:var(--muted)">From CourtListener\'s RECAP archive, which holds only some federal dockets. Name matches in their state, D.C. or appeals courts; not verified to be the same person. Includes suits filed against them as officials and amicus listings. Criminal and bankruptcy matches are held back for manual review'+(nposs?'; '+nposs+' same-name matches in other states not shown':'')+'.</div></div>'; | |
| } | |
| function cosBlock(i){ | |
| const c=csInfo(i); if(!c) return ""; | |
| const rows=c.rows.map(r=>'<div class="tr">'+esc(SHORT[r.id]||r.id)+' '+(r.got.length?r.got.map(b=>'<span class="chip" title="'+esc(b[1])+'">signed '+esc(b[0])+'</span>').join(" "):'<span class="chip warn">no signed bill</span>')+'</div>').join(""); | |
| return '<div style="margin-top:8px"><h4>Bills signed on majority positions</h4><div class="mono">'+c.signed+' of '+c.tracked+' tracked positions</div>'+rows+'<div style="color:var(--muted)">Sponsor or cosponsor of a matching 119th Congress bill. Not signing is not opposing; titles were matched by hand and unreviewed.</div></div>'; | |
| } | |
| function pubNote(t){ | |
| let s=String(t||""); | |
| s=s.replace(/\s*\((?:[^()]*?(?:docs\/|DECISIONS|\bR\d{1,2}\b|rule \d|owner ruling|\.md)[^()]*)\)/g,""); | |
| s=s.replace(/the rules v\d+(?:\.\d+)*/g,"the published rules").replace(/rules v\d+(?:\.\d+)*/g,"the published rules"); | |
| s=s.split(/(?<=\.)\s+/).filter(x=>!/docs\/|seat-window|DECISIONS|\bR\d{2}\b/.test(x)).join(" "); | |
| s=s.replace(/District returns were not applied; scores use the statewide public side\./,"Legislators are judged against the statewide result, not yet against their own district's result."); | |
| s=s.replace(/qualifies under the one-poll exception/g,"qualifies as a single large poll at 70% or more").replace(/one-poll exception/g,"single-poll rule"); | |
| return s.replace(/\s{2,}/g," ").trim(); | |
| } | |
| function slRow(x){ | |
| const m=x.m, L=SL[ABBR[state.fips.slice(0,2)]]; | |
| const strip=m.votes.map(v=>{const P=L.positions[v[0]]||{}, nd=v[4]==="nodissent"; return '<i class="'+(nd?'n':v[6]==="against"?'x':'')+(v[7]?' u':'')+'" title="'+esc((P.name||P.text||v[0])+' \u2014 '+v[1]+' ('+v[3]+'): voted '+v[5]+(v[4]==="partial"?', partial match':'')+(v[7]?', UNVERIFIED: this vote was matched to the position from the bill title or description only, or in a bundled bill (not yet independently checked)':'')+(nd?', near-unanimous vote: shown, not scored':v[6]==="against"?(P.kind==="poll"?', against the 66%+ majority in statewide polls':', against the statewide supermajority'):''))+'"></i>'}).join(""); | |
| return '<div class="mrow"><span class="pd '+(m.party||"").slice(0,1)+'"></span><span class="nm">'+(x.ch==="House"?"Rep. ":"Sen. ")+esc(m.name)+' <small>State '+x.ch+(x.sh<.995?', '+Math.round(x.sh*100)+'% of county':'')+'</small></span><span class="mono">'+(m.gap!=null?pct(m.gap):"n/a")+'</span><span class="go" title="Tested votes">'+m.tests+' test'+(m.tests===1?'':'s')+'</span><span class="strip">'+strip+'</span></div>'; | |
| } | |
| function memberRow(i,share,geo){ | |
| const m=D.members[i], r=memberVal(i,posIdx()), full=m.chamber==="H"; | |
| const strip=m.votes.map(v=>'<i class="'+(v[6]?'r':v[3]?'x':'')+'" title="'+esc(SHORT[D.positions[v[4]].id]||'')+': '+v[2]+(v[6]?' (held for review)':v[3]?' (against the local majority)':'')+'"></i>').join(""); | |
| const where=geo?dLabel(geo)+(share<.995?', '+Math.round(share*100)+'% of county':''):m.state+' Senate'; | |
| return '<a class="mrow" href="'+(m.b?'#m-'+m.b:'#')+'" title="Open the profile"><span class="pd '+m.party+'" aria-label="'+({D:"Democrat",R:"Republican"}[m.party]||"Independent")+'"></span><span class="nm">'+(full?"Rep. ":"Sen. ")+esc(mName(m))+' <small>'+esc(where)+'</small></span><span class="mono">'+(r?pct(r.v):"n/a")+'</span><span class="go">Profile ›</span><span class="strip">'+strip+'</span></a>'; | |
| } | |
| function memberCard(i,open,share,geo){ | |
| const m=D.members[i], r=memberVal(i,posIdx()), full=m.chamber==="H"; | |
| const chips=m.votes.map(v=>'<span class="vote'+(v[6]?' r':v[3]?' x':'')+'" title="'+esc(SHORT[D.positions[v[4]].id])+(v[5]?' (partial match)':'')+(v[6]?' (flagged, not scored)':'')+(v[8]!=null?' \u00b7 about '+pct(v[8])+' of the '+(full?'district':'state')+' supports':'')+'">'+v[0]+v[1]+' '+v[2]+'</span>').join(""); | |
| const loc=localOpinion(i)+cosBlock(i)+moneyBlock(i)+tradeBlock(i)+courtBlock(i); | |
| const pac=m.pac?'<div style="margin-top:6px">PAC gifts, 2018 to 2024 cycles: <b class="mono">'+usd(m.pac.total)+'</b></div><ul class="donors">'+m.pac.top.slice(0,5).map(x=>'<li><span>'+esc(tit(x[0]))+'</span><span class="mono">'+usd(x[1])+'</span></li>').join("")+'</ul>':'<div style="margin-top:6px">No PAC gift data matched.</div>'; | |
| const S=m.sens, sens=S?'<div style="color:var(--muted)">Sensitivity: '+[['with flagged votes',S.with_flagged],['with symbolic votes',S.with_symbolic],['direct matches only',S.direct_only]].map(x=>x[0]+' '+(x[1]==null?'n/a':pct(x[1]))).join(' \u00b7 ')+'</div>':''; | |
| return '<details class="mem"'+(open?' open':'')+'><summary><span class="n">'+(full?"Rep. ":"Sen. ")+esc(mName(m))+(geo?' <span style="color:var(--muted);font-weight:400">'+dLabel(geo)+(share<.995?', '+Math.round(share*100)+'% of county':'')+'</span>':'')+'</span><span class="chip">'+m.party+'</span><span class="mono">'+(r?pct(r.v):"n/a")+'</span></summary><div class="body"><div class="mono">'+m.against+' of '+m.n+' votes against ('+pct(m.lo)+' to '+pct(m.hi)+' range)</div><div class="votes">'+chips+'</div>'+sens+petBlock(i)+loc+pac+'</div></details>'; | |
| } | |
| function renderCounty(){ | |
| const f=state.fips, el=$("#county"); if(!f){el.innerHTML='<div class="csub">Select a county to see who represents it and how they voted.</div>';return} | |
| const st=ABBR[f.slice(0,2)], R=repsFor(f), v=vals.get(f), P=curPos()?SHORT[curPos().id]:MEAS[state.m]; | |
| const SLX=state.level!=="congress"&&state.m==="all"?slCounty(f):null; | |
| if(state.level==="state"&&!SLX){el.innerHTML='<div><div class="cname">'+esc(nameOf[f])+', '+esc(stateName[f.slice(0,2)]||st)+'</div><div class="csub">State legislators for this county will appear here once '+esc(stateName[f.slice(0,2)]||st)+' is scored and published'+(SL[st]?' (no session matches this Congress)':'')+'.</div></div>';return} | |
| const showH=effWho()!=="senate", showS=effWho()!=="house"; | |
| let html='<div><div class="cname">'+esc(nameOf[f])+', '+esc(stateName[f.slice(0,2)]||st)+'</div><div class="csub">'+esc(P)+'</div></div>'; | |
| html+='<div class="big"><b>'+(v==null?"n/a":pct(v))+'</b><small>'+(state.m==="S"?"of tracked bills not signed":"of votes against the position")+'</small></div>'; | |
| if(R.miss.length) html+='<div class="chips"><span class="chip warn">'+R.miss.map(p=>dLabel(p.geo)).join(", ")+': no member with enough scored votes</span></div>'; | |
| html+='<div><h4>Who represents this county</h4>'; | |
| if(state.level!=="state"){ | |
| if(showH) html+=R.h.map(x=>memberRow(x.i,x.s,x.geo)).join(""); | |
| if(showS) html+=R.s.map(i=>memberRow(i,1,null)).join(""); } | |
| if(SLX){ const LL=SL[st]; html+='<h4 style="margin-top:10px">State legislature '+(LL&&LL.draft===false?'<span class="chip">independently verified</span>':'<span class="chip">draft</span>')+'</h4>'+(LL&&LL.verified?'<div class="desc">'+esc(pubNote(LL.verified))+'</div>':'')+slSidesHtml(LL)+(SLX.rows.some(x=>x.m.gap!=null)?'':'<div class="note">Not enough votes yet: no legislator here has 2 or more tested votes, so none is scored. Shown so you can see who represents this county and which votes were tested.</div>')+SLX.rows.map(slRow).join(""); } | |
| html+='<div class="csub" style="margin-top:6px">Squares are counted votes; filled ones went against the local majority. Open a profile for charts, money, trades and court records.'+(state.level==='all'?' Each person here counts equally in the county score.':'')+'</div>'; | |
| if(!R.h.length&&showH) html+='<div class="csub">No scored House member for this county.</div>'; | |
| html+='</div>'; | |
| // by position table | |
| const rows=D.positions.map((p,i)=>{const sv=state.m; state.m=String(i); const x=countyVal(f); state.m=sv; return {i,p,x}}); | |
| html+='<details class="sub"><summary>This county, by position</summary><div class="allm"><table>'+rows.map(r=>'<tr data-i="'+r.i+'"><td>'+esc(SHORT[r.p.id])+'</td><td class="p"><div class="pbar"><i style="width:'+(r.x==null?0:r.x*100)+'%"></i></div></td><td class="v">'+(r.x==null?"n/a":pct(r.x))+'</td></tr>').join("")+'</table></div></details>'; | |
| html+='<div class="src">Votes: Voteview. Positions: VOP / Program for Public Consultation, ten items from the Democracy Fund + UCLA Nationscape survey (2019\u201321, about 465,000 interviews), and three from AP VoteCast (a survey of voters, not all adults; acknowledgment: AP-NORC Center for Public Affairs Research). District and state opinion: Nationscape for the 116th\u2013117th Congresses where it asked a matching question, then AP VoteCast (states only), otherwise the Cooperative Election Study. PAC gifts and outside spending: FEC. Districts: '+(D.congress>=118?'Census '+D.congress+'th Congress county relationship file.':'area overlay of 2020 Census district and county shapes (rough).')+(D.cosp?' Bill sponsorship: Congress.gov.':'')+(SLX?' State legislature ('+esc(st)+', draft): '+esc(SL[st].source):'')+'</div>'; | |
| el.innerHTML=html; | |
| el.querySelectorAll(".allm tr").forEach(tr=>tr.onclick=()=>{state.m=tr.dataset.i;render()}); | |
| } | |
| let HIST=null; | |
| function loadHist(){ if(HIST){renderHist();return} fetch("history.json").then(r=>r.json()).then(h=>{HIST=h;renderHist()}).catch(()=>{$("#histBody").textContent="Could not load the history data."}) } | |
| function renderHist(){ | |
| if(!HIST||!$("#hist").open) return; | |
| const ch=state.who==="senate"?"Senate":"House", rows=HIST.timeline.filter(r=>r.chamber===ch&&r.party!=="I"); | |
| const W2=320,H2=150,L=28,B=22, xs=d3.scaleLinear().domain([97.5,119.5]).range([L,W2-4]), ys=d3.scaleLinear().domain([0,1]).range([H2-B,6]); | |
| let svgs='<svg id="histChart" viewBox="0 0 '+W2+' '+H2+'" role="img" aria-label="Mean share of votes against bipartisan-majority positions by party and Congress, '+ch+'">'; | |
| [0,.5,1].forEach(v=>{svgs+='<line x1="'+L+'" x2="'+(W2-4)+'" y1="'+ys(v)+'" y2="'+ys(v)+'" stroke="var(--line)"/><text x="'+(L-4)+'" y="'+(ys(v)+3)+'" text-anchor="end">'+(v*100)+'%</text>'}); | |
| [98,104,110,116,119].forEach(c=>{svgs+='<text x="'+xs(c)+'" y="'+(H2-6)+'" text-anchor="middle">'+c+'</text>'}); | |
| svgs+='<line x1="'+xs(115.5)+'" x2="'+xs(115.5)+'" y1="6" y2="'+(H2-B)+'" stroke="var(--muted)" stroke-dasharray="2 3"/>'; | |
| rows.forEach(r=>{const c=r.party==="D"?"var(--dem)":"var(--rep)", hollow=r.source.startsWith("VOP"); | |
| svgs+='<circle cx="'+xs(r.congress+(r.party==="D"?-.18:.18))+'" cy="'+ys(r.mean_gap)+'" r="4" fill="'+(hollow?"var(--panel)":c)+'" stroke="'+c+'" stroke-width="1.6"><title>'+r.congress+'th '+ch+', '+(r.party==="D"?"Democrats":"Republicans")+': '+Math.round(r.mean_gap*100)+'% against ('+r.members+' members; '+esc(r.source)+')</title></circle>'}); | |
| svgs+='</svg>'; | |
| const tl=HIST.tests.filter(t=>t.chamber===ch); | |
| const side={D:"Democratic-backed",R:"Republican-backed",X:"both parties split"}; | |
| $("#histBody").innerHTML='<div>Average share of votes each party cast against positions that a national survey showed at 66% or more, with a majority of both parties, at the time of the vote. Showing the '+ch+' (switch with Represented by).</div><div class="lgd"><span><i style="background:var(--dem)"></i>Democrats</span><span><i style="background:var(--rep)"></i>Republicans</span><span><i style="border:1.6px solid var(--muted)"></i>Hollow: 2024-25 survey positions</span></div>'+svgs+ | |
| '<div>Before the dashed line, positions come from the General Social Survey and American National Election Studies: gun purchase checks, congressional term limits, the death penalty, school prayer and gays serving in the military. Each Congress has only one to four tests, so single dots swing widely. In the 1990s, House and Senate Democrats voted against the popular term-limits and death-penalty measures more than Republicans did.</div>'+ | |
| '<div><b>Historical vote tests, '+ch+'</b>'+tl.map(t=>'<div class="tr"><span class="mono">'+t.congress+'th '+t.chamber[0]+t.roll_number+'</span> '+esc(t.position)+': '+esc(t.question)+(t.eligible?' <span class="chip">'+side[t.side]+'</span> <span class="mono">'+t.survey_year+' support '+Math.round(t.survey[0]*100)+'% (D '+Math.round(t.survey[1]*100)+', R '+Math.round(t.survey[2]*100)+')</span>':' <span class="chip warn">not scored: support had fallen below the bar ('+t.survey_year+': '+Math.round(t.survey[0]*100)+'%, R '+Math.round(t.survey[2]*100)+'%)</span>')+'</div>').join("")+'</div>'; | |
| } | |
| function renderAbout(){ | |
| const el=$("#aboutBody"), P=curPos(); | |
| const tests=D.tests.filter(t=>P?D.positions[t.pos]===P:(state.m==="all"||t.side===state.m)); | |
| const cosAbout=state.m==="S"&&D.cosp?'<div><b>Tracked bills</b>'+D.cosp.positions.map(p=>'<div class="tr"><b>'+esc(SHORT[p.id]||p.id)+'</b> ('+p.national+'% support): '+p.bills.map(b=>esc(b[0])+' <span class="chip">'+b[2]+'</span> <span class="mono">'+b[3]+' signers, '+b[4]+'</span>').join('; ')+'</div>').join('')+'</div>':''; | |
| let h='<div>Gap: each vote is compared with what a majority of the member\'s own district (senators: state) is estimated to want. For each position, the weighted share of votes against that local majority (a vote on a bill that does exactly what was polled counts fully; a vote on a narrower or bundled bill counts half), then averaged across positions so no single issue dominates. A position qualifies when at least 66% of all adults nationally support it; so far no scored district has an estimated majority on the other side, so local and national scores match. Votes in districts within 3 points of 50% are skipped. Hover a vote chip to see the district estimate. Members need at least '+D.min_n+' counted votes. Tests follow written selection rules'+(D.rules?' ('+esc(D.rules)+')':'')+': every roll call in the Congress is screened, each candidate gets a logged decision, procedural and symbolic votes are left out, near-unanimous votes (under 5% opposed) are shown but not scored, and a survey close in time to the vote must show 66% support among all adults. All matches are curator drafts awaiting a second reviewer who will not see the vote counts.</div>'; | |
| h+=cosAbout; | |
| h+='<div><b>Money and courts</b> Outside spending: FEC independent expenditures 2018 to 2026; "undisclosed donors" are non-committee Form 5 filers such as 501(c) groups. Money a 501(c) gives to a super PAC is not traced. Stock trades: House Clerk and Senate eFD periodic transaction reports since 2019, parsed from electronic filings. Court records: CourtListener RECAP search by party name.</div>'; | |
| h+='<div><b>New, October 31, 2026</b> The House vote on H.R. 1834 (ACA subsidies, passed 230\u2013196 on Jan 8, 2026) now counts. Poll explorer: every polled 66%+ idea with its status this Congress, the bills behind it (Congress.gov / govinfo bill status), earlier House passages (Voteview) and discharge petition signers (clerk.house.gov). Overlays show estimated local support or petition signers on the map. Within each party, members in safe and competitive seats vote against their district about equally often.</div>'; | |
| if(D.opinion) h+='<div><b>Local opinion</b> '+esc(D.opinion.method)+'. Source: '+esc(D.opinion.survey||"CES 2024")+' Cooperative Election Study common content.</div>'; | |
| h+='<div><b>Vote tests'+(P?' for this position':'')+'</b>'+tests.map(t=>'<div class="tr"><span class="mono">'+t.ch+t.roll+'</span> '+esc(SHORT[D.positions[t.pos].id])+': '+esc(t.q)+' <span class="chip">'+t.match+'</span> <span class="chip">'+({D:"Democratic-backed",R:"Republican-backed",X:"both parties"}[t.side])+'</span>'+(t.review?' <span class="chip warn">review, not scored</span>':'')+(t.anchor?'<div style="color:var(--muted)">Opinion check: '+esc(t.anchor)+'</div>':'')+'</div>').join("")+'</div>'; | |
| if(D.summary&&!P&&state.m!=="S"){const rows=Object.entries(D.summary); | |
| h+='<div><b>How much the rules matter</b><div class="allm"><table><tr><td></td><td class="v">Headline</td><td class="v">+flagged</td><td class="v">+symbolic</td><td class="v">direct only</td></tr>'+rows.map(([k,v])=>'<tr><td>'+k.replace("-"," ")+' ('+v.members+')</td>'+[v.gap,v.with_flagged,v.with_symbolic,v.direct_only].map(x=>'<td class="v">'+(x==null?'n/a':pct(x))+'</td>').join('')+'</tr>').join('')+'</table></div><div style="color:var(--muted)">Party averages. "+flagged" adds votes held for review; "+symbolic" adds budget-resolution and reserve-fund votes; "direct only" drops partial matches (n/a when no direct matches were counted).</div></div>';} | |
| if(D.not_voted&&!P&&state.m!=="S"){const chs=effWho()==="senate"?["Senate"]:effWho()==="house"?["House"]:["House","Senate"]; | |
| h+=chs.map(ch=>{const d=D.not_voted[ch]||{};const n=Object.values(d).reduce((a,b)=>a+b.length,0); | |
| return '<div><b>'+ch+': '+n+' majority-backed positions without a counted vote</b>'+Object.entries(d).sort((a,b)=>b[1].length-a[1].length).map(([cat,ids])=>'<details><summary>'+esc(cat)+' ('+ids.length+')</summary>'+ids.map(id=>'<div class="tr">'+esc(SHORT[id]||(PTEXT[id]||[id])[0])+' <span class="mono">'+((PTEXT[id]||[])[1]||'')+'%</span></div>').join('')+'</details>').join('')+'</div>'}).join('')+'<div style="color:var(--muted)">"No floor vote found" is based on the keyword screen and may miss votes; send a roll call and it goes through the same log.'+((D.not_anchored||[]).length?' '+D.not_anchored.length+' positions have no survey close enough in time to judge for this Congress.':'')+'</div>';} | |
| const ex=(D.excluded||[]).filter(e=>!P||e.position_id===P.id); | |
| if(ex.length&&state.m!=="S") h+='<div><b>Votes considered but not counted'+(P?' for this position':'')+'</b>'+ex.map(e=>'<div class="tr"><span class="mono">'+e.chamber[0]+e.roll+'</span> '+esc(SHORT[e.position_id]||e.position_id)+': '+esc(e.question)+'<div style="color:var(--muted)">'+esc(e.reason)+'</div></div>').join('')+'</div>'; | |
| if(P&&P.lobby&&D.lobbying[P.lobby]){const L=D.lobbying[P.lobby];h+='<div><b>Lobbying on this issue</b><div>'+L.fetched+' Senate disclosure filings read'+(L.sampled?' (a sample of '+L.total.toLocaleString("en-US")+')':'')+', '+L.clients+' distinct clients. Filings show who lobbied, not which side they took. Most filings:</div>'+L.top.map(c=>'<div class="tr">'+esc(tit(c[0]))+' <span class="mono">'+c[1]+'</span></div>').join("")+'</div>'} | |
| el.innerHTML=h; | |
| } | |
| </script> | |