Added support for all text-based documents

I've added support for all text-based documents to this extension.  The original Javascript-specific algorithm is still used for Javascript files, but there is now a robust generic algorithm for it to fall back on for other documents.

In the future, further language-specific algorithms could be added for various file types as well.  But this way there will always be a working algorithm for the general case, making this extension generally useful for all documents.

Please let me know if I've inadvertently diverged from your plan or coding style, and if so how I can rectify that in my patch.

Thanks!