jqueryToolkit
Back in time (2 more)
Home | Pages | Files

JqueryToolkit

jqueryToolkit is a jquery plugin creation tool assistant. Largely inspired by the work down on jquery-ui jqueryToolkit is the results of my personnal view about progressive enhancement and is primary done to better sweet my way of doing things instead of following thoose already defined in other projects such as jquery-ui or jqtools.

Perhaps some of you around there will find that doing things with jqueryToolkit correspond to their willing too and will use it. This would be my greatest pleasure.

philosophy

The main idea behind jqueryToolkit is to achieve progressive enhancement essentialy by using class attributes and other common html attributes. When i’ve for example tons of widgets in a page i don’t want to instanciate each widgets one by one with javascript code like that:

<div id="id1" class="tk-widget">id1</div>
<div id="id2" class="tk-widget">id2</div>
<div id="id3" class="tk-widget">id3</div>
<div id="id4" class="tk-widget">id4</div>
<div id="id5" class="tk-widget">id5</div>
<script type="text/javascript">
  $('#id1,#id2,#id3....').widget({option:val1});
  $('#id4,#id5,....').widget({option:val2});
</script>

Instead i prefer to make something like this:

<div id="id1" class="tk-widget tk-widget-val1">id1</div>
<div id="id2" class="tk-widget tk-widget-val1">id2</div>
<div id="id3" class="tk-widget tk-widget-val1">id3</div>
<div id="id4" class="tk-widget tk-widget-val2">id4</div>
<div id="id5" class="tk-widget tk-widget-val2">id5</div>
<script type="text/javascript">
  $.toolkit.initPlugins('widget');
</script>

Seeing this on a simple example may not seems so interesting at first glance, but in fact it has some benefits imho.

  • First each element that will be enhanced has some meaning class attribute so even without javascript activated we can try to make some work in the stylesheet to handle this gracefully.
  • We can change add new elements that will be enhanced without any more javascript
  • finaly another indirect benefits is that it will be more easy for non javascript coder to use the later as they already know how to add classnames to their markup.

In fine some of you will like, others won’t but we’re all free to use or not this library as it comme in dual GPL / MIT licence.

key features

  • assist in creating jquery widget plugins
  • allow for reading widgets options in class names (depending on the widget code)
  • allow for client side stored options using jquery.toolkit.storage
  • automaticly create setter/getter for options

documentation