Pushing the boundaries of egotism since 2006!

Occasional insights into the mind of an awesomeness.

Archives Posts

Some bookmarklets

September 6th, 2007 by grimboy

I made a couple of bookmarklets to scratch itches in the way of hard to read web pages (Yeah, I know white ninja is meant to be like that. Doesn’t make the text any easier to read on a laptop with masses of glare.)

Readable width

According to some publisher type’s research, 30ems is near most people’s optimal line width for reading. This bookmarklet is used by clicking on some text that’s too wide, then clicking again and again until it works. (UI design award, Powerpoint applause)

javascript:t=true;d=document;a=addEventListener;r=removeEventListener;n='click';v='keypress';s='30em';b='white';p=d.createElement('p');q=p.style;q.position='fixed';q.top='42%';q.left='32%';q.width='36%';q.height='16%';q.border='1px black solid';q.backgroundColor=b;q.color='black';q.padding='0.5em';q.textAlign='center';p.innerHTML='Click a block of text until as much of the page as you want is a readable width. Then ctrl-click if you want it centred. Press esc to finish.';d.body.appendChild(p);h=function(e){if(e.ctrlKey){c(e.target)}else{m(e.target)}};a(n,h,t);f=function(e){if(e.keyCode==27){r(n,h,t);r(v,f,t);p.parentNode.removeChild(p);clearInterval(o)}};a(v,f,t);m=function(e){u=e.style;if(e.parentNode.style!=undefined){if(u.width==s){m(e.parentNode)}else{u.width=s}}};c=function(e){z=e.parentNode;if(z.style!=undefined){if(z.style.width==s){c(z)}else{e.style.margin='0 auto'}}};void(o=setInterval(function(){if(q.backgroundColor==b){q.backgroundColor='yellow'}else{q.backgroundColor=b}},1500))

Black text

Click some of that grey text that designers like to use to try and get a more ‘anti-aliased look’ according to some article or other (yes, this design is guilty of that too) to get it to #000, the way some figure I can use to pretend I have a fundamental views on the subject intended.

javascript:t=true;d=document;c='click';g=getComputedStyle;b='white';p=d.createElement('p');q=p.style;q.position='fixed';q.top='42%';q.left='32%';q.width='36%';q.height='16%';q.border='1px black solid';q.backgroundColor=b;q.color='black';q.padding='0.5em';q.textAlign='center';p.innerHTML='Click a block of wimpy grey text to turn all text that colour a nice, readable black.';d.body.appendChild(p);h=function(e){c=g(e.target,'').getPropertyCSSValue('color').cssText;n=d.getElementsByTagName('*');for(i=0;i

Oh and there is no pre-compression versions. I started tweaking whitespace impaired versions like an idiot. Some excuse for being crappy.

Woo? (Powerpoint applause)

Filed under Firefox, Javascript having No Comments »

Archives Posts

Where’s my vi <textarea>?

August 15th, 2007 by grimboy

Is it this it? Well, if you think opening another tab in gvim, making me switch back and forth and keeping stuff in sync behind my back counts then well, you have low expectations.

How about this?

no particular redistribution rights are granted;

that means you do not have the right to use this on your own web site.

exceptions: Internet Connection, Inc. customers may use this application on any site they like. They may not grant redistribution or other rights to others. they may do this even if they (sadly) become no longer customers.

other rights may become available in the future.

http://src.internetconnection.net/vi/

I can use it if I buy hosting off a provider named “Internet Connection, Inc”? Really, other rights in the future? On some code served from the domain gpl.internetconnection.net? Ambassador, you’re ruining us.

Fine, fine. I’ll get over it. So, yeah, this?

While JS/UIX is open-source (JS-files and HTML embedding must be) it is not
public domain. All rights reserved (c) mass:werk, N. Landsteiner 2003.
You may download the files for private use, but you must not publish, serve or
provide this system in any form without the positive confirmation of the
author. All changes to the source code must be authorized. No warranty of any
kind is granted.

Disclaimer: JS/UIX is provided free of charge and on an “as is” basis, without
warranties of any kind, expressed or implied. Licensors have no liability with
respect to use of the product. The entire risk as to the quality and perfor-
mance of the product is borne by licensee, who assumes the entire cost of any
service and repair. This disclaimer of warranty constitutes an essential part
of this agreement. No use of the product is authorized hereunder except under
this disclaimer.

JS/UIX is NOT a free software (for reasons see the FAQ). If you are looking for
a powerfull but easy to use terminal interface have a look at
“mass:werk termlib.js”

Better put than the last one at least. But what’s the reasoning behind it?

The strict licence is mainly due to the very nature of JS/UIX by now:
Since any malformed code could corrupt the whole system, a greater variety of
distributed copies would render it merly impossible to secure any bugfree
version. Plans are for a totally rebuild version with true multitasking and a
secure userland domain. As this new architecture would allow for third party
extensions, this future version of JS/UIX could well be the start of an open
project under a more permissive licence.

Oh, I see. If you licensed your “Operating System” openly then there would instantly be chaos. Just about everyone and their dogs would fork it. They’d all write masses of really buggy code ‘corrupting the whole system’. Every time anyone wanted a toy operating system they’d always opt for these broken forks rather than the original. Oh, and once again, we can look forward to freedom sometime in the future.

Right, fine. Aha! This one is even encouraging me to download it. Hey, it has command mode, search and replace.

h, j, k, l, h, j, k, l — “Key not supported”! But you have vi *in* your name, handface.gif.

Onwards. Hmm? Wait, even ‘o’ doesn’t work.

Never mind. Ho hum. No commands, no search, the cursor sometimes looks like it’s places where it isn’t, there’s nothing telling you what mode you’re in, no numbers preceding keys. Apart from that pretty good. The best of the freely licensed ones in my opinion.

None of the freely licensed ones are quite good enough for everyday use. That said, I’m amazed nobody’s packaged one them up as a greasemonkey script or the like.

Any I’ve missed?

(Oh, and from a non-textarea point of view vimperator is pretty good.)