views:

351

answers:

4

What types of JavaScript scripts do find most useful in your work? What tasks do you use JavaScript for the most? Are there scripts that you wished were out there but just haven't been able to find? I'm trying to create a library of MooTools plugins and so I'm always looking for inspiration and advice. I'm trying to concentrate on utility more than anything else, but any suggestions are okay. I'm really not looking for code examples but rather descriptions of the tasks that you most often perform or would like to perform with JavaScript.

+1  A: 

I use JavaScript the most for:

  • Form validation
  • DOM manipulation
  • AJAX
Diodeus
A: 

DOM manipulation will be a popular answer, but it also covers a very broad range of actual purposes. To better illustrate I'll list that last few things I've done in JS, maybe it will help.

Unobtrusively added alternate views of products in an ecom site. Auto update a specific area of a website using AJAX. Filter certain elements out of a short list, without requiring round trips to the server. Add fade effects for item addition and removal from a list.

But here's the bad news for you. Passed using JQuery and a couple of plugins, each of these tasks was unique, and required at least a few lines of custom code. The parts that could be generalized already were by JQuery. I'd argue against the real utility in another widget pack on top of an existing framework like JQuery or MooTools or Prototype.

tanner
I would agree. If it replicates something that already exists, who bother.
Diodeus
A: 

I use Javascript for tasks that are not needed for the website to function properly but provide convenience or "prettification" (graceful degradation). These include:

  • AJAX for real-time form validation (or a Javascript approximation of validation)
  • Animation (and thus timing, DOM manipulation)
  • Inline editing (transform a block of text into a form without page reloading)
  • Filtering search results with AJAX

All of these things can be done without Javascript (barring animation), but provide an enhanced experience to those that have it enabled.

thekidder
+1  A: 

I'v got to agree with what's already been said - I use it to unobtrusively control a page, manipulate dom elements, do AJAX, animate, edit, and probably a few other things as well.

I write classes that take options to do effects, vs. something that would require a lot of editing and variable manipulation, so the Class is written once, and ran everywhere.

In terms of things that I've done: AJAX Wholesale Order Form. Slideshow with an option to slide vertically/horizontally (essentially, I rewrote noobSlide and added more options to it). Form Validation (this was modified code from Clientside). Wishlist manipulation (home grown). Menu effects (garage doors, CSS sprite effects). jQuery plugin rewrites - taking cool jquery code and making it into mootools code. AlphaPNG for IE6 (based off of Toby Miller's original script, added in elements from a lot of the other IE6 scripts out there, including jQuery). I rewote Konqueror's jQuery "poof" into mootools - but that was mainly an experiment in PNG sprite animation.

Now you say you're gathering for a library of plugins but I know they (the MooTools Devs) are workin gon a plugin repository built in PHP.

Of course, that shouldn't stop you, doing what's been done in new techs or in a different way is a great way to get better.

keif