Archive for August, 2007

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

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.

Xray for IE

Today on Ajaxian:

We had a great response for XRAY, the “free cross browser tool that lets you see the box model in action for any element, letting you see beneath the skin of any web page.”

The number one question was “but what about IE???” and now we have the answer. The latest release supports IE6 and above, and “displays information about an element’s borders, and allows you to move around the document with arrow keys. Use the up, down, left and right key to XRAY the currently selected element’s parent, first child, and previous and next siblings.”

XRAY on IE 6

Selector Sugar for Mootools

Mootools contributor Digitarald (i.e. Harald Krischner) posted a while back about Mootools selector goodness that's been added. CSS3 selectors arrive and it's all nice stuff.

The $$() function in MooTools uses CSS selectors to select Elements from the DOM. Since last week, basic CSS2 was supported, but now the developers added more selector features. Check out the slick speed test and the blog entry about the tale of pseudoselectors describing the details and the development. I’ll describe some basic about the selectors here …

That was already possible

JavaScript:
// Select all anchors
$$('a');

// Select all anchors inside list items
$$('li a');

// Select all anchors with class "ajaxified" inside an element with "menu" id
$$('#menu a.ajaxified');

// Select all anchors and images with the "title" attribute
$$('a[title], img[title]');

// Select all anchors with the "href" attribute, beginning with "http://" and with "ajaxified" class
$$('a.ajaxified[href^="http://"]');

drag to resize


$$ returns an Array of Elements, extended with Elements methods, so you can do this:

JavaScript:
// Adding an ajax request to all ajaxified menu anchors
var menuAjax = new Ajax('', { // url is empty, we set it dynamically
    autoCancel: true, // when a new request starts and the previous one is running, its cancelled
    update: $('content'), // the target
    evalScripts: true // maybe we have script tags in the content
})

$$('#menu a.ajaxified').addEvent('click', function(e) {
    menuAjax.url = this.getProperty('href');
    menuAjax.request();
    return false; // see NOTE
})

drag to resize



This simple example adds ajax loading to menu items using the href url. Now you can add e.g. effects when the content is injected, a spinner when the request starts, selected items and more fancy stuff.

NOTE: This event handling is new in the svn trunk. You no longer need to use new Event(e), bindWithEvent or bindAsEventListener when you use Element::addEvent. The given event is automatically the extended cross-browser Event class and of course this (the scope in your event callback) is the Element. Furthermore you can return false to stop the event propagation.
When you want to use this example with MooTools 1.11, simply stop the event with new Event(e).stop().

And what is new?

The new CSS3 selectors are not ALL available like shown in w3c-specs, we added the useful ones. Of course the whole thing is super fast, uses XPath internally for cool browsers and is, like most things in MooTools, extendable.

JavaScript:
// All list items which are childnodes of ul#top
$$('ul#top> li');

// all list items following li.head with the same parent node
$$('li.head ~ li');

// all anchors containing the word "Hello"
$$('a:contains("Hello")');

// The selector implementation and parsing allows also short-hand notations ...

// first list item in an ul element
$$('ul li:first');
// same as
$$('ul li:nth-child(1)');
// same as
$$('ul li:first-child');

// every second li inside an ul, starting from the second
$$('ul li:nth-child(2n)');
// same as
$$('ul li:nth-child(even)');
// same as
$$('ul li:even');

// simple and fast zebra table in one line
$$('table> tr:odd').addClass('odd');

drag to resize


Read more on The MooTools Blog – Selectors on Fire

Xray Bookmarklet

Here's a nice little bookmarklet that Mark Bult (of Webshots here at CNET) sent my way: Xray. Here's what Ajaxian had to say about it when they posted on it last week:

John Allsopp has developed XRAY, a bookmarklet that launches a tool to visualize the web page that you are on (a little like features in Firebug and Firefox). The look and feel is great, and the margin popups look like the new Safari/Webkit search functionality (mmm orange).

What is XRAY

XRAY is the first in hopefully a suite of free cross browser tools for helping web designers and developers better visualize what their code is doing in a browser. XRAY is designed to help you get beneath the skin of your web page.

XRAY let’s you see the box model for any element on a page in action - where is the top and left of an element, how big is each margin, how big is the padding, how wide and high is the content box?

What platforms and browsers is XRAY available on?

XRAY currently has been tested on Safari 2 and 3 on Mac OS X, Webkit nightly builds, and Mozilla based browsers (Firefox, Camino and so on) on Mac OS X and Windows. At present it won’t work on Internet Explorer (XRAY uses the canvas element, but plans are afoot to adapt it for Internet Explorer), and has not been adapted for Opera. We hope to have versions for Opera shortly, and Internet Explorer on Windows in the not too distant future. XRAY works in Safari 3 on Windows, but clicking a bookmark does not fire any Javascript it contains. To use XRAY on Safari 3 for windows at present, you’ll need to paste the XRAY link into the address field and hit return.

Xray

Categories

Archives

Links and whatnot