IMPORTANT

We are in a process to move most of our legacy code as jQuery plugin; we'll add them as the conversion progress. Most of them will also be posted in the jQuery repository.

About mJSLib

What the library is

In a nutshell: mJSLib is a toolkit for adding useful dynamic behaviours to web sites with little or no extra coding involved for the site operator. It's structured as a library that allows you to mix and match different functionality like validating forms, building menus and the like according to your needs. The library is under continuing development and is released under an open license.

Before everything else, this library aims to be as pragmatic as possible by offering you a set of tools that will help you to build a web site. We are building these tools with the main objective that they be used with as little effort as possible. While you are welcome to modify them as you see fit, in most cases you should not have to. If you do, keep in mind that your may not be compatible with future versions.

One aspect that makes this toolkit a little special is the extensive use of HTML extensions (custom attributes) instead of JavaScript APIs. We are working this way because we believe that what makes HTML such an incredibly popular content structure language (not a programming language, as is sometimes claimed) is its simplicity. Dealing with JavaScript is rarely simple, while adding markup can be.

What the library is not

If you are looking for general web technology tutorials, this collection may be frustrating for you because there is not much documentation outside of verbose code comments and documentation on this site specifically on how to deploy mJSLib. There are many web sites that offer comprehensive assistance for improving your web coding skills. However, if you already are familiar with those technologies, you may find useful information by reading mjslib source code.

If you want to have information about coding and standards, good and bad practices, etc., please don't take our code and samples as authoritative! There are many different and probably better ways of doing this stuff. If the HTML/CSS/JavaScript does not entirely respect standards on every little point, this is because our main test for building quality code is whether or not it works in common web browsers. Standards are being considered, but not at the expense of functionality or extraneous coding.

Now, with that said...

Intended audience

mJSLib and its associated documentation are probably useful to anyone wanting to improve a web site's usability by adding some ready-to-deploy client-side scripting. To use it, you will not be required to be an expert in DOM, JavaScript or HTML. You'll only have to know some basic stuff so that you can include and configure the components you are going to use.

You should be roughly familiar with the DOM representation of an HTML document -- the tree of HTML elements. Understanding the tree aspects such as child-parent-ancestor relationships between elements and the inheritance of properties according to those relationships are enough to get started here. If you use CSS on your web site for more than just text styles, you're probably familiar enough already. If you simply know HTML from your preferred WYSIWYG editor, you may consider spending some time acquiring the before diving into mJSLib.

Design and characteristics

Modularity

This library is separated into a few modules (each having its own .js file) designed to cohabitate with each other and code from other sources. Depending on your needs, you can use a subset of this library by referencing only the modules you are interested in. This way, you will not overload the client-side program with unused code. The only module that is required is "main.js", which contains general purpose features and services that all the others rely on. Have a look in there, you'll probably find a few useful things such as a JavaScript version of Perl's sprintf() function, to name one.

You can choose to load only as many of the modules needed for the functionality you want, but you need to respect the inclusion order as defined in this table:

main.js General purpose functions; acts as a runtime for other modules. Mandatory and needs to be included first.
debug.js When included, this module enables debugging features and open a debug window that will be helpful when troubleshooting your code; very experimental at this stage, works well enough in Mozilla.
formval.js General purpose, extendable form validation framework.
date.js Deals with date fields (editing, format conversion, verification)
fieldgroup.js Toggles the editibility of one or more form fields, based on the state of a controlling field.
toc.js Generates a table of contents with in-document links from heading tags.
menu.js Deals with menus (flat, nested, menu bars, static, etc.)
image.js A few image related tools
tooltip.js Rich-text tooltips
dumper.js Dump a complex object as a string; still highly experimental.

You'll find more information in the Coding document and the documents on the individual modules themselves.

The modules are designed to interfere as little as possible with the javascript global context and the DOM objects: variable and function names are chosen with care, with extensive use of prefixes; you should not have trouble adding your own javascript or code from other libraries.

Compatibility

Well, combining standards compliance with cross-browser compatibility is a lot like the quest for the holy grail! If you are a web programmer, you already know that building a browser-compatible web site can be a frustrating and uselessy harassing challenge, that only gets worse when you start adding dynamic behaviour. This sucks hard, but there is nothing we can do to force browser maintainers to improve their stuff, and it's too late anyway with so many computers installed with broken software.

As we work on mJSLib, we are doing our best to support "major" browsers (which reads into: browsers that most people use):

Opera, Konqueror and Safari support still require some further work at this point. Internet Explorer 5.x / Macintosh would need additional contributor(s) to the project before it gets any serious level of support. We haven't tried to and don't plan on making this toolkit work with any truly legacy so-called "JavaScript-capable" browser such as Netscape 4, Internet Explorer 4, Opera 5 and so forth. Porting a few things might be possible but we can't justify the effort in dealing with them, since they're clearly obsolete now. You can see more per browser support information in the download page.

Mozilla support note

The problem with labeling support precisely for Mozilla-based browsers is that there's several of them, and naturally, each has their own versioning scheme. We can say definitively that we fully support Mozilla and its derivatives going back to the Mozilla 1.4 codebase. This was used in Netscape 7.1 and others. We've tested going back to Mozilla 0.9.4 (Netscape 6.2) and with that version and a few point releases after, mJSLib itself works, but some of our CSS suggestions break.

Boiling all of this down... mJSLib works very well in Mozilla, Netscape, Firefox (Firebird, Phoenix), Camino (Chimera), and others based on Mozilla in their respective releases dated 2003 and later. Versions from mid-2001 to 2002 have some degraded support, and we haven't tested further back.

At some later point, we may add more precise support information for the variants of Mozilla browsers, but don't bet on it: it's a time consuming task, and when you consider that users of these browsers tend to keep their installations reasonably fresh and the overall user-base of outdated versions is very small, there is probably little need.

Resources

Contributors, contacts

This project is the work of Hervé Masson (JavaScript coding, writing) and Steve Bronfman (writing, editing, CSS and HTML), and published within the scope of MindStep's [www.mindstep.com] open source program. Serge Colle did thorough testing and reviewing; provided fixes and is a mjslib contributor and maintainer. This toolkit has first be created for the ZunoBox thin server product [www.netzuno.com].

Should you have any comment, question or suggestion, please send your email to: mjslib@mjslib.org.

License

All the content published in this collection is free and open source, as stated by the BSD-like license below. The only thing we ask is that you send us an email with the url of your web site so that we can maintain a "web sites using mJSLib " page later.

 
################################################################################
#    ____________________________________________________________________
# / \
# | ____ __ ___ _____ / ___ ___ |
# | ____ / \/ \ ' / \ / / /__ / \ / \ |
# | / _ \ / / / / / / ___/ \__ / /____/ / / |
# | / |_ / / / / / / / / / \ / / /____/ |
# | \____/ / / \/_/ / \__/ _____/ \__/ \___/ / |
# | / |
# | |
# | Copyright (c) 2000-2007 All rights reserved |
# | MindStep SCOP SARL |
# | |
# | www.mindstep.com www.mjslib.com |
# | info-oss@mindstep.com mjslib@mjslib.com |
# \____________________________________________________________________/
#
# [This product is distributed under a BSD-like license] # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # # THIS SOFTWARE IS PROVIDED BY THE MINDSTEP CORP PROJECT ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MINDSTEP CORP OR CONTRIBUTORS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # The views and conclusions contained in the software and documentation # are those of the authors and should not be interpreted as representing # official policies, either expressed or implied, of MindStep Corp. # ################################################################################