termlib.js home | multiple terminals | parser | faq | documentation | samples

mass:werk termlib.js

The JavaScript library "termlib.js" provides a `Terminal' object, which facillitates a simple and object oriented approach to generate and control a terminal-like interface for web services.

"termlib.js" features direct keyboard input and powerful output methods for multiple and simultanious instances of the `Terminal' object.

The library was written with the aim of simple usage and a maximum of compatibility with minimal foot print in the global namespace.


A short example:
  var term = new Terminal( {handler: termHandler} );
  term.open();

  function termHandler() {
     this.newLine();
     var line = this.lineBuffer;
     if (line != "") {
        this.write("You typed: "+line);
     }
     this.prompt();
  }
Key Features:
  • Object oriented: Handle multiple instances independently at the same time!
  • Type styles: Ready-to-use type styles and support for custom styles and mark up.
  • Colors: Extended support for colors.
  • ANSI codes: Limited ANSI-support for SGR codes.
  • Text wrapping: Automatic text wrapping (v 1.3 and higher, see faq for details)
  • Remote communications: The socket extension for client-server remote communication (commonly known as AJAX) provides a tightly integrated API for a simple and object oriented approach to XMLHttpRequests.
    (Starting with version 1.5 the socket extension is included in the main library.)
  • Import methods: "termlib.js" provides methods for text import via dialogs or copy'n'paste.
  • Parser: Set up your own shell-like application using the included parser.
  • Documentation: Extensive documentation and loads of usage examples.
  • Free: Best of all: "termlib.js" is free, see the licence below.
Note on Backward Compatibility:

Version 1.5:   Changed the license.
Also dropped support for Netscape 4 (layers) and included the socket extension in the main library.
As the socket extension is now included in the library, please delete any script-tags refering to "termlib_socket.js" from older applications!
 
Version 1.52:   Re-organized the Parser. The parser is now a self-contained object with a constructor.
 
License

This JavaScript-library is free.
Include a visible backlink to <http://www.masswerk.at/termlib/> in the embedding web page or application. The library should always be accompanied by the "readme.txt" and the sample HTML-documents.
Distribution

This JavaScript-library may be distributed freely as long it is distributed together with the "readme.txt" and the sample HTML-documents and this document.

Any changes to the library should be commented and be documented in the readme-file.
Any changes must be reflected in the `Terminal.version' string as "Version.Subversion (compatibility)".
Disclaimer

This software is distributed AS IS and in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The entire risk as to the quality and performance of the product is borne by the user. No use of the product is authorized hereunder except under this disclaimer.
History

This library evolved from the terminal script "TermApp" ((c) N. Landsteiner 2003) and is in its current form a down scaled spinn-off of the "JS/UIX" project. (JS/UIX is not a free software by now.) c.f.: <http://www.masswerk.at/jsuix>

For version history: see the readme.txt.
 
Download

Be sure to have read the license information and the disclamer and that you are willing to respect copyrights.

Download: termlib.zip (~ 153 KB, incl. docs & sample pages)

Current version is "1.66 (original)".
Files are provided with line breaks in format <CRLF>.
The ZIP-archive includes now also a compacted version of "termlib.js".  
Donations

Donations are welcome: You may use the PayPal-button to support and/or honor the development of "termlib.js" at: http://www.masswerk.at/termlib/donate/
Author

© Norbert Landsteiner 2003-2015
mass:werk – media environments
http://www.masswerk.at
 
Author's note:
Please do not contact me on questions of simple usage. There is an extensive documentation (readme.txt) including plenty of sample code that should provide all information you need.
 
> top of page