February 23rd, 2007 by Aaron N.
There are several new goodies in the most recent release of the CNET libraries. I’ve got examples and details in the wikitorial, but here’s a quick list:
- JsonP – handles grabbing Json from a foreign domain; works a lot like Ajax
- Element.smoothShow/smoothHide – a height/opacity transition for an element to add it to the page smoothly.
- Element.setPosition – position an element relative to another (the window or another dom element)
- ProductPicker – a generic “picker” to allow users (typically in a CMS) to choose an item from a data source.
- stickyWinHTML – a default html block for in-page popups
- SimpleSlideShow – a very, very simple slideshow for dom elements or images
Have fun.
Posted in CNET JS Standards, Examples, Widgets | Comments Off
February 9th, 2007 by Aaron N.
If you are new to javascript or Mootools, you should:
2) Read
the Mootools Tutorial
Now, the problem with the Tutorial is that it shows you snippets of how Mootools work, but doesn’t put them all together to show you how to actually do things on a page.
So in an effort to help people see the right way to write code (well, at least how I write code; “right” is definitely subjective with javascript), as well as how to use the accordion and things like Fx.Slide, I’ve authored a simple little page that demonstrates these things and comments them line by line.
So:
3) View the source of the Mootools Beginner’s Example
Posted in Best Practices, Event Scripting, Examples, Manipulating the Dom, MooTools, Reference, Visual Effects | Comments Off
February 1st, 2007 by Aaron N.
Continuing in my current project of rewriting all the javascript on Download.com (pity me), I encountered the functions on the screenshots page. A quick rewrite and here’s my SimpleGallery class. It’s not super-duper fancy but it’s not meant to be. Read the rest of this entry »
Posted in Examples, Visual Effects, Widgets | 2 Comments »
January 30th, 2007 by Aaron N.
Mootools 1.0 is out. Fancy new site design and docs.
We’ve already refactored all our code for 1.0, though it is not yet released to the CNET site. We’re entering into QA now…
I’ve also released the second part of my wiki tutorial series, this time giving working examples of all the CNET common code. The CNET Libraries are comprised of common code (widgets, shortcuts, etc.) and implementation code – code that is specific to a given page or application. The implementation code is usually just implementing and executing functions and libraries in the common portion of the library. The wikitorial for the CNET common code focuses on this generic content. Form validation, date pickers, carousels, etc. Dig in! Oh, and if you have a chance, Digg the tutorials, too. You’ll find shortcuts to do that in the right navigation column in the tutorials.
Posted in Ajax, CNET JS Standards, Event Scripting, Examples, Manipulating the Dom, MooTools, Reference, Visual Effects | Comments Off
January 30th, 2007 by Aaron N.
Today on Ajaxian there’s a post about Joe Hewitt’s recent presentation where he demonstrates the nice new features in Firebug 1.0 (note that the ajaxian post actually includes a video of Joe presenting Firebug from last may, which I think is an error as the post refers to this most recent presentation). If you haven’t had time to fool around with Firebug, or feel like you’re not getting everything out of it that you can, you really should watch this presentation.
Posted in 'Industry' News, Browser Plugins, Examples | Comments Off
January 18th, 2007 by Aaron N.
I’ve updated my Mootools Tutorial for the upcoming version 1.0 of the library. It (the library) is still in development, so my tutorial is likely to always be a little behind the svn, but if you’re digging into Mootools for the first time, or you want to see what’s different in version 1.0, here’s the place to start.
I’ve also installed a copy of docuwiki for all my example and tutorial work. The old stuff is still there but I’ll be moving it all over to the wiki. Expect to see more examples of code I’ve written in the coming weeks.
Posted in Examples, Reference, Uncategorized | 3 Comments »
January 12th, 2007 by Aaron N.
So I spent an entire day discovering a quirk about javascript that I must now share. In a previous post on creating default settings for classes/objects I discussed the following technique:
var Widget = new Class({
initialize: function(element, options){
this.element = element;
this.options = Object.extend({
offsetX: 0,
offsetY: 0
}, options || {});
this.setPosition();
},
setPosition: function(){
this.element.setStyles({
left: this.options.offsetX + 'px',
top: this.options.offsetY + 'px'
});
}
});
Now, this isn’t a very useful class, but it illustrates the technique. The functions in our class don’t have to worry if the options are defined; they are either what the default value is or they are what the user passed in. If the user elects to just pass in a subset of the values, that’s fine:
var myWidget = new Widget(myElement, {offsetX: 100});
//myElement will be offset by 100 on the left,
//zero (the default) on the top
But what if you want to extend the functionality of your class later? What if you want to be able to insert more default options?
Here’s what I was doing that caused me trouble: Read the rest of this entry »
Posted in Best Practices, Browser Bugs, Code Snippets, Examples, Reference | Comments Off
January 4th, 2007 by Aaron N.
I thought about the form validator that I refactored and posted about the other day for a bit and decided I wasn’t happy with all it did. Specifically, I wanted to be able to do more with the validation and more with the messaging. I also thought I could improve on the core functionality a little.
So I rewrote it entirely and borrowed heavily from it to come up with my own version. This version works almost the same way as the previous one with a few differences:
- the transition is smoother
- error messages have access to more information about the element they evaluate
- tests can have conditions specific to individual elements
It still uses css class names, now you can give each field some specific conditions.
You can now see this in action, download the script, and see the docs in our wikitorial.
Posted in Code Snippets, Examples, Visual Effects, Widgets | 1 Comment »
November 29th, 2006 by Aaron N.
If you don’t know javascript, or you like learning by watching people do things, you might like the “Mootools for the Rest of Us” series over at beautyindesign.com.
It’s not as complete at my Mootools Primer/Tutorial but it is pretty friendly. You get to watch a screencast of someone setting up a document with Mootools and then implementing a few effects like Drag, Resize, Opacity, as well as an Ajax example.
Posted in Examples, MooTools | 1 Comment »
November 25th, 2006 by Aaron N.
Hi gang,
To go along with the posting of our collection of scripts, I’m still writing tutorials on how to make use of all our code. Today’s update is for all our extensions to the Mootools libraries that we’ve written.
You’ll find new helper functions, new extensions to ajax, string, element, window and more. For the most part, you can just drop these scripts into your environment and they should work. If there are dependencies, you can find them listed at the top of each script.
Posted in CNET JS Standards, Code Snippets, Examples, MooTools, Reference, Uncategorized | 1 Comment »