Skip to content

Instantly share code, notes, and snippets.

@corppneq
Created October 6, 2023 12:13
Show Gist options
  • Save corppneq/d61e3045c774f03d463fd5b7ea7cbf2d to your computer and use it in GitHub Desktop.
Save corppneq/d61e3045c774f03d463fd5b7ea7cbf2d to your computer and use it in GitHub Desktop.
Bookmarklets
<ul>
<li><a href="javascript:function%20toArray%20(c){var%20a,%20k;a=new%20Array;for%20(k=0;%20k<c.length;%20++k)a[k]=c[k];return%20a;}function%20insAtTop(par,child){if(par.childNodes.length)%20par.insertBefore(child,%20par.childNodes[0]);else%20par.appendChild(child);}function%20countCols(tab){var%20nCols,%20i;nCols=0;for(i=0;i<tab.rows.length;++i)if(tab.rows[i].cells.length>nCols)nCols=tab.rows[i].cells.length;return%20nCols;}function%20makeHeaderLink(tableNo,%20colNo,%20ord){var%20link;link=document.createElement('a');link.href='javascript:sortTable('+tableNo+','+colNo+','+ord+');';link.appendChild(document.createTextNode((ord>0)?'a':'d'));return%20link;}function%20makeHeader(tableNo,nCols){var%20header,%20headerCell,%20i;header=document.createElement('tr');for(i=0;i<nCols;++i){headerCell=document.createElement('td');headerCell.appendChild(makeHeaderLink(tableNo,i,1));headerCell.appendChild(document.createTextNode('/'));headerCell.appendChild(makeHeaderLink(tableNo,i,-1));header.appendChild(headerCell);}return%20header;}g_tables=toArray(document.getElementsByTagName('table'));if(!g_tables.length)%20alert(%22This%20page%20doesn't%20contain%20any%20tables.%22);(function(){var%20j,%20thead;for(j=0;j<g_tables.length;++j){thead=g_tables[j].createTHead();insAtTop(thead,%20makeHeader(j,countCols(g_tables[j])))}})%20();function%20compareRows(a,b){if(a.sortKey==b.sortKey)return%200;return%20(a.sortKey%20<%20b.sortKey)%20?%20g_order%20:%20-g_order;}function%20sortTable(tableNo,%20colNo,%20ord){var%20table,%20rows,%20nR,%20bs,%20i,%20j,%20temp;g_order=ord;g_colNo=colNo;table=g_tables[tableNo];rows=new%20Array();nR=0;bs=table.tBodies;for(i=0;%20i<bs.length;%20++i)for(j=0;%20j<bs[i].rows.length;%20++j){rows[nR]=bs[i].rows[j];temp=rows[nR].cells[g_colNo];if(temp)%20rows[nR].sortKey=temp.innerHTML;else%20rows[nR].sortKey=%22%22;++nR;}rows.sort(compareRows);for%20(i=0;%20i%20<%20rows.length;%20++i)insAtTop(table.tBodies[0],%20rows[i]);}">sort table</A>
<li><a href="javascript:(function(){var d=document,q=%22table%22,i,j,k,y,r,c,t;for(i=0;t=d.getElementsByTagName(q)[i];++i){var w=0,N=t.cloneNode(0);N.width=%22%22;N.height=%22%22;N.border=1;for(j=0;r=t.rows[j];++j)for(y=k=0;c=r.cells[k];++k){var z,a=c.rowSpan,b=c.colSpan,v=c.cloneNode(1);v.rowSpan=b;v.colSpan=a;v.width=%22%22;v.height=%22%22;if(!v.bgColor)v.bgColor=r.bgColor;while(w<y+b)N.insertRow(w++).p=0;while(N.rows[y].p>j)++y;N.rows[y].appendChild(v);for(z=0;z<b;++z)N.rows[y+z].p+=a;y+=b;}t.parentNode.replaceChild(N,t);}})()">transpose tables</A>
<li><a href="javascript:location.href='https://web.archive.org/web/*/'+document.location.href;">WayBack Machine look up</A>
<li><a href="javascript:location.href='https://web.archive.org/web/30000000000000/'+document.location.href;">WayBack Machine look up latest</A>
<li><a href="javascript:(function(){location.href='http://web.archive.org/save/'+(location.href);})();">Wayback Machine Submit</A>
<li><a href="javascript:void(open('https://archive.is/?run=1&url='+encodeURIComponent(document.location)))"">archive.is Submit</A>
<li><a href="javascript:(function()%7Bjavascript%3A%20document.body.contentEditable%20%3D%20'true'%3B%0Adocument.designMode%20%3D%20'on'%3B%0Avoid%200%7D)()">Edit Page</A>
<li><a href="javascript:(function(){var b=document.getElementsByTagName('*');for(var i=0;i<b.length;i++){b[i].style.textAlign='justify'}})()">justify</A>
<li><a href="javascript:(function(){var b=document.getElementsByTagName('*');for(var i=0;i<b.length;i++){b[i].style.fontSize='1.0rem';}})()">Font-Size</A>
<li><a href="javascript:(function(){var b=document.getElementsByTagName('*');for(var i=0;i<b.length;i++){b[i].style.fontSize='1.0rem';b[i].style.lineHeight='1.5rem'}})()">Font-Size &amp; lineHeight</A>
<li><a href="javascript: (function() { var b = document.getElementsByTagName('*'); for (var i = 0; i < b.length; i++) { b[i].style.fontFamily = '%22Tex Gyre Heros%22, %22DejaVu Sans%22, Verdana'; if (navigator.appVersion.indexOf(%22Win%22) != -1) { b[i].style.fontFamily = 'Verdana'; } } })()">Tex Gyre Heros</A>
<li><a href="javascript: (function() { var b = document.getElementsByTagName('*'); for (var i = 0; i < b.length; i++) { b[i].style.fontFamily = '%22Tex Gyre Termes%22, %22DejaVu Serif%22, %22Times New Roman%22'; if (navigator.appVersion.indexOf(%22Win%22) != -1) { b[i].style.fontFamily = '%22Times New Roman%22'; } } })()">Tex Gyre Termes</A>
<li><a href="javascript:(function(){var b=document.getElementsByTagName('*');for(var i=0;i<b.length;i++){b[i].style.fontFamily='%22Source Code Pro%22, %22DejaVu Sans Mono%22, Monospace'}})()">Source Code Pro</A>
<li><a href="javascript: (function() { var b = document.getElementsByTagName('*'); for (var i = 0; i < b.length; i++) { b[i].style.backgroundImage = 'none'; b[i].style.backgroundColor = '#2d2828';%20b[i].style.color%20=%20'#eae8e9'%20}%20})()">Light, dark</A>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment