javascript:(function(){ function selectColor(i) { return [%22#fdc%22, %22#cdf%22, %22#bfd%22, %22#dbf%22, %22#fbd%22] [i%5]; } var u=location.href, ul=u.length; var tparts=[%22%22], zparts=[], nz=0; function isDigit(c) { return (%220%22 <= c && c <= %229%22); } for (i=0; i<ul; ) { for (; i<ul && !isDigit(u.charAt(i)); ++i) tparts[nz] += u.charAt(i); if(i<ul) { zparts[nz]=%22%22; for (; i<ul && isDigit(u.charAt(i)); ++i) zparts[nz] += u.charAt(i); tparts[nz+1]=%22%22; ++nz; } } if(!nz) { alert(%22No numbers in URL.%22); return; } D=window.open().document; D.write(); D.close(); function a(n) { A(D.body,n); } function A(p,n) { p.append****(n); } function E(q) { return D.createElement(q); } function cT(t) { return D.createTextNode(t) } function cBR() { return E(%22br%22); } function cS(t,ci) { var s=E(%22span%22); s.style.background=selectColor(ci); s.style.fontWeight=%22bold%22; A(s, cT(t)); return s; } function cTB(v,oc) { var b=E(%22input%22); b.size=6; b.value=v; b.addEventListener(%22input%22, oc, false); return b; } function cCB(t,oc) { var L=E(%22label%22), b=E(%22input%22); b.type=%22checkbox%22; b.checked=true; b.onchange=oc; A(L,b); A(L,cT(t)); return L; } function cL(nz,tparts,zparts) { var L=E(%22a%22); var u=%22%22; for (var i=0; i<nz; ++i) { A(L,cT(tparts[i])); A(L,cS(zparts[i], i)); u += tparts[i]+zparts[i]; } A(L,cT(tparts[nz])); u += tparts[nz]; L.href=u; L.target=%22_blank%22; return L; } a(cT(%22Original URL: %22)); a(cBR()); a(cL(nz, tparts, zparts)); a(cBR()); a(cBR()); var fromBoxes=[], toBoxes=[], padChecks=[]; for (i=0; i<nz; ++i) { a(cT(%22Run %22)); a(cS(zparts[i], i)); a(cT(%22 from %22)); a(fromBoxes[i]=cTB(zparts[i], listURLs)); a(cT(%22 to %22)); a(toBoxes[i]=cTB(zparts[i], listURLs)); a(cT(%22 (%22)); a(j=cCB(%22 Pad with zeroes to maintain length%22, listURLs)); padChecks[i]=j.****Nodes[0]; a(cT(%22)%22)); a(cBR()); } a(cBR()); resultDiv=E(%22div%22); a(resultDiv); listURLs(); function listURLs() { while (resultDiv.****Nodes.length) resultDiv.remove****(resultDiv.****Nodes[0]); var lows=[], highs=[]; for (i=0; i<nz; ++i) { lows[i]=parseInt(fromBoxes[i].value, 10); highs[i]=parseInt(toBoxes[i].value, 10); if(highs[i]-lows[i] > 999) { A(resultDiv, cT(%22Too many%22)); return; } } urls=[]; function cb(sta) { var newzparts=[]; for (var i=0; i<nz; ++i) { var z=%22%22+sta[i]; if(padChecks[i].checked) while (z.length < zparts[i].length) z=%220%22+z; newzparts[i]=z; } A(resultDiv, cL(nz, tparts, newzparts)); A(resultDiv, cBR()); } fors(nz, cb, lows, highs); } function fors (n, callback, lows, highs) { function fors_inner (states, v) { if(v >= n) callback(states); else for (states[v]=lows[v]; states[v] <= highs[v]; ++(states[v])) fors_inner(states, v+1); } fors_inner ([], 0); } })() |