Archive for the ‘CNET JS Standards’ Category

Mootools 1.2 is close – but what about the CNET codebase?

February 25th, 2008 by Aaron N.

Hi Gang,

I’ve been picking up more and more chatter regarding the imminent release of Mootools 1.2b and I keep getting emails and whatnot asking about CNET’s codebase, which works in 1.11, but not so well in 1.2 (even with the Mootools compatibility layer).

We’re working on it and we’ve made a lot of progress. We’ve now migrated ALL of our code and have only the 3rd party scripts we support (Slimbox and Autocompleter) left to port. But even then we’re not ready to release it – or even post a release candidate – until we’ve done some QA.

So this post is just to tell you all that, yes, we’re porting it all to 1.2 and that it’s not that far off. You can, if you like, browse the documentation for the new scripts here:

http://clientside.cnet.com/docs/Core

We’ve rearranged things a bit (more on that in a later post), renaming some classes and methods and whatnot. We’ll also have a compatibility layer that should make our code work with Mootools 1.11, as well.

Other plans include a download page much like the Mootools download page (finally!), specs (unit tests), and demos.

Stay tuned; we’ll have a release candidate for you to start playing with in another week or so.

-aaron

CNET Update (svn 181), lots of goodies

January 11th, 2008 by Aaron N.

New date picker, Date extentions, Auto-ajax indicator, and Input text hovers

So I just finished pushing out and testing my latest batch of additions to the CNET Libraries and you can download them in our svn. Here’s a brief roundup with links to demos and stuff:

  • DatePicker got a lot of love including the ability to output a custom format for the date and the ability to choose ranges and enter times
  • Extended the Native Date object to add lots and lots of neat-o methods including date comparison, fancy parsing, and about 2 dozen other useful features and methods
  • OverText – a new Class that hovers text over inputs until the user clicks into them and changes them
  • Waiter – an ajax indicator class that automatically greys out a dom element with a spinner image (you can customize these things) while your Ajax is requesting new HTML for it. Can be used stand alone (i.e. if you need to show a waiting indicator even if it’s not Ajax you’re using), but it’s integrated nicely into Ajax if you are using it.
  • Our default DHTML popup html (stickyWinHTML) got an option to add a drag handle to the window

The Waiter class is probably my favorite, but all the Date love is really nice, too. Check it out and play around with it.

Localizing the CNET JS code

October 24th, 2007 by Aaron N.

The CNET JS code includes references to various assets – images and a few css files and at least one flash (swf) file. I include references in the javascript so that these things “just work” when you use them.

First and foremost, our libraries are designed for us to develop with, and making that process easy is our main concern. The problem is when you want to use these scripts somewhere other than CNET (or for local development).

Well, now you can. Just download the assets here:

http://code.google.com/p/cnetjavascript/downloads/list

Then use http://cnetjavascript.googlecode.com/svn/trunk/setAssetHref.js to set the location of the assets. Voila.

CNET javascript update (r137)

September 24th, 2007 by Aaron N.

Just a quick update on some action in the svn.

  • new file: StickyWin.Ajax – adds ajax support to all stickywin classes (creates new classes, just append .Ajax to any of the existing ones)
  • date.picker, product.picker – updated syntax to use Element.empty
  • form.validator – now passes along the event object to the onFormValidate event so that the form submit event can be stopped if you like
  • popupdetails – added html response support; you can now return the html you wish to display rather than a json object; only applies to ajax. Also added a cache so that multiple requests are not made for the same url.
  • stickyWinHTML – ractored so that options are now, you know, *optional*
  • MooScroller – added support for width option for horizontal scrolling
  • TagMaker.js – new file  > demo in the wikitorial.

CNET update (r126): Fx.Marquee, IconMenu, MooScroller, bug fixes

August 30th, 2007 by Aaron N.

Hi gang,

Got some new goodies for you in the ol’ svn today. First, the bugs fixed:

  • fixPNG: slight tweaks and debugging lines added
  • modalizer: cleaned up style syntax a little
  • stickyWinFx: updated convention for options management to current methods
  • jsonp: added a timeout/retry system, added some dbug lines
  • Fx.Sort: fixed a bug in IE6
  • element.setPosition: now correctly restores display, visibility, and position values to their previous state,
  • element.forms: reverted (and tested) cursor/selection management; IE6 was acting up. fixed a doc typo
  • element.pin: fixed a positioning bug
  • element.position: now supports elements inside positioned parents (it calculates the relevant offsets); added support for fixed positioned elements;

And thew new widgets:

  • Fx.Marquee – a little Fx plugin for announcing status messages
  • IconMenu – a menu for managing a bunch of icons in a scrollable workspace
  • MooScroller – like regular overflow scrollbars that come with your browser when you use overflow: auto, except done in javascript so the scrollbar is 100% css styleable

Have fun.

Clientside js updated: SVN 108

July 17th, 2007 by Aaron N.

Hi gang,

Been out of town for a week and now that I’m back it’s time to smash a few bugs:

  • Fx.SmoothShow – refactored the exploration of the element dimensions when hidden so that it isn’t visible to the user (you won’t see items “flicker” before the show transition anymore)
  • element.position – refactored to allow for more than just the previous 5 positions, now supports nine: all corners, all mid-points between those corners, and the center (examples)
  • string.cnet.js – fixed up the query string logic to url-decode values
  • element.legacy.js – added Element.setText for users who aren’t up to Mootools 1.0
  • date.picker.js, product.picker.js, stickyWin.default.layout.js, stickyWin.js – now all use Element.setText for css injection (fixes IE6 probs)
  • dramatic refactor of tabswapper; now tabs can be added, removed, moved. Additionally, you can now pass in for tabs, sections, and clickers a dom collection or a selector.

Fx.SmoothMove

June 27th, 2007 by Aaron N.

I just did a little clean up and released Fx.SmoothMove. This functionality used to be a part of Element.setPosition but now it’s an extension to Fx.Styles.

Mootools has a convention that I was breaking here (the same reason prompted me moving Fx.SmoothShow into Fx and out of Element). Basically, it is a general rule in the Mootools dev team never to create one-off instance of classes, especially in Native object extensions (Element in particular). Element.setPosition had an option (smoothMove: true) that would transition the position of the element to the new location smoothly (i.e. using Fx.Styles). But it didn’t return this to you, so every time you used it you created a new instance of Fx.Styles. Aside from this being wasteful, it also means that if you attempt to do this behavior while another is still in process, instead of canceling the previous one and starting a new one, both would run, causing your element to jump around until they both finished.

This is bad form and I should be given three lashes or something. I figured all this out after I’d written a lot of it and have just now gotten around to cleaning it up. But hey, as long as we all learned something… right?

See Fx.SmoothMove in action.

Update: I keep switching out Fx.SmoothShow and Fx.SmoothMove; this note as about the latter… Fixed the typos…

Mootorial updated for Mootools 1.1

May 30th, 2007 by Aaron N.

Mootools 1.1 was released a few weeks ago and I’ve finally finished re-writing the Mootorial. You’ll find executable examples of nearly every function and class found in the library. Just as before, it’s a wiki (a wikitorial?) so you can jump in and fix typos or add clarity where you think it needs it.

In addition to this update we’ve tidied up some of our libraries (in particular the Element extensions) and tested them for compatibility with Mootools 1.1. You can download these files from our SVN server, view the examples of them in action, and look through the docs. Read the rest of this entry »

CNET code now uses Mootools 1.1

May 17th, 2007 by Aaron N.

The CNET libraries have, until recently, required that you download a version of Mootools from our svn repository or use the dev version of Mootools. This was before Mootools 1.1 released, and it had some dependencies on code that wasn’t in 1.0.

As Mootools 1.1 is now out, you should download it from Mootools.net. I’ve removed Mootools from our SVN so now the only thing there is our code. You’ll find clientside.moo.v1.1.packed.js in the /cat directory; this is a copy of ALL of Mootools 1.1 + ALL of our code. It’s a big file, but it’s complete if you just want to fool around with it.

CNET javascript update (r90)

May 16th, 2007 by Aaron N.

I released a lot of code today including a bug fix that was probably pestering any of you with r87.

  • product.picker.js now has no picklets; these are in the implementations/picklets directory
  • ProductPicker now detects if there is no doctyp and, if not, sets the position of the picker to be fixed (no IE6 support)
  • small docs update in element.cnet.js
  • added new picklet: CNETProductPicker_PricePath
  • added new picklet: NewsStoryPicker_Path
  • new file: clipboard.js (allows you to insert text into the OS clipboard)
  • new file: html.table.js (automates building html tables)
  • new file: element.forms.js (for managing text inputs – get selected text information, insert content around selection, etc.)
  • fixed an error in stickyWinHTML (ie reserves “class” for member names)
  • converted window.onDomReady references to window.addEvent(‘domready’..
  • updated css for stickyWin.js to avoid namespace conflicts with the css class “clearfix”

Read the rest of this entry »