javascript:(function(){var old=document.getElementById('tracs-fill');if(old)old.remove();function onScreen(el){var r=el.getBoundingClientRect();if(r.width<2||r.height<2)return false;if(r.bottom<0||r.right<0||r.top>innerHeight||r.left>innerWidth)return false;var hit=document.elementFromPoint(r.left+r.width/2,r.top+r.height/2);return !!(hit&&(hit===el||el.contains(hit)||hit.contains(el)));}function rect(el){return el.getBoundingClientRect()}function pick(g){return g.length==4||g.length==5?g[3]:0}function groups(root){var m={},o=[],q=[].slice.call(root.querySelectorAll('input[type=radio]'));q.forEach(function(el){if(rect(el).width<2)return;var k=el.name||'_';(m[k]=m[k]||[]).push(el)});for(var k in m){var g=m[k].sort(function(a,b){return rect(a).left-rect(b).left}),c=[g[0]],i;for(i=1;i28&&c.length>3){if(pick(c))o.push(c);c=[g[i]]}else c.push(g[i])}if(pick(c))o.push(c)}return o}function findRows(){var a=[].slice.call(document.querySelectorAll('input[type=radio]')).filter(onScreen)[0];if(!a)return [];var b=a,n=a,c=0;while(n){var w=groups(n);if(w.length>200)break;if(w.length>=c){b=n;c=w.length}n=n.parentElement}var g=groups(b).sort(function(a,b){return rect(a[0]).top-rect(b[0]).top||rect(a[0]).left-rect(b[0]).left}),rows=[],i;for(i=0;irows.length)n=rows.length;var cols=0;for(var i=0;icols)cols=rows[i].length;rows[i].forEach(function(group){var target=pick(group);if(target&&!target.checked)target.click();});}status.textContent='Filled '+n+' rows'+(cols>1?', '+cols+' columns.':'.');}function clearAll(){var cleared=0;findRows().forEach(function(sets){sets.forEach(function(group){group.forEach(function(el){if(el.checked){el.checked=false;el.dispatchEvent(new Event('change',{bubbles:true}));cleared++;}});});});status.textContent='Cleared '+cleared+' selections.';}function btn(text){var b=document.createElement('button');b.type='button';b.textContent=text;b.style.marginRight='6px';return b;}var box=document.createElement('div');box.id='tracs-fill';box.style.cssText='position:fixed;top:70px;right:16px;z-index:2147483647;background:#111;color:#fff;padding:12px;border:2px solid #fff;font:14px sans-serif;width:230px;';['mousedown','click','keydown','keyup','keypress','wheel','input'].forEach(function(ev){box.addEventListener(ev,function(e){e.stopPropagation();});});var title=document.createElement('div');title.textContent='Grade fill';title.style.fontWeight='700';title.style.marginBottom='8px';title.style.cursor='move';var drag=0,ox=0,oy=0;function start(e){var p=e.touches?e.touches[0]:e;drag=1;var r=box.getBoundingClientRect();ox=p.clientX-r.left;oy=p.clientY-r.top;e.preventDefault();}function move(e){if(!drag)return;var p=e.touches?e.touches[0]:e;box.style.left=(p.clientX-ox)+'px';box.style.top=(p.clientY-oy)+'px';box.style.right='auto';e.preventDefault();}title.addEventListener('mousedown',start);title.addEventListener('touchstart',start);document.addEventListener('mousemove',move);document.addEventListener('touchmove',move);document.addEventListener('mouseup',function(){drag=0});document.addEventListener('touchend',function(){drag=0});var count=document.createElement('div');count.style.marginBottom='8px';count.textContent='Counting...';var num=document.createElement('input');num.type='number';num.min='1';num.style.cssText='width:70px;margin-right:6px;color:#111;background:#fff;';var go=btn('Fill'),all=btn('All'),clr=btn('Clear'),x=btn('Close');var status=document.createElement('div');status.style.marginTop='8px';box.appendChild(title);box.appendChild(count);box.appendChild(num);box.appendChild(go);box.appendChild(all);box.appendChild(clr);box.appendChild(status);box.appendChild(x);document.documentElement.appendChild(box);function refresh(){var rows=openRows();count.textContent=rows.length?rows.length+' open rows in this window':'No open rows in view';if(rows.length&&!num.value)num.value=rows.length;}go.onclick=function(){run(parseInt(num.value,10)||0);refresh();};all.onclick=function(){var rows=openRows();num.value=rows.length;run(rows.length);refresh();};clr.onclick=function(){clearAll();refresh();};x.onclick=function(){box.remove();};refresh();})();