What's new? | Help | Directory | Sign in
Google
easy-designs
Easy! Designs, LLC's Code Repository
  
  
  
  
    
Search
for
Updated Aug 28, 2007 by aaron.easydesigns
FigureHandler  
This script facilitates the creation of layout rules for figures.

Current Version

0.1 (28 August 2007)

Requirements

License

FigureHandler is distributed under the liberal MIT License.

Use

To use, simply include FigureHandler.js and prototype.js in the HEAD of your document. Then, initialize the FigureHandler:

if( typeof( Prototype ) != 'undefined' &&
    typeof( FigureHandler ) != 'undefined' ){
  Event.observe( window, 'load', function(){ new FigureHandler; } );
}

By default the following classes are applied:

FigureHandler's Default classes

Percent of the Column class Applied
0-25 quarter-col
25-34 third-col
34-50 half-col
50-67 two-thirds-col
67-75 three-quarters-col
75-100 full-col

Customization

You can also customize FigureHandler by targeting a specific container

if( typeof( Prototype ) != 'undefined' &&
    typeof( FigureHandler ) != 'undefined' ){
  Event.observe( window, 'load', function(){ new FigureHandler( 'main' ); } );
}

or by providing a list of custom classes to be applied (using JSON syntax):

if( typeof( Prototype ) != 'undefined' &&
    typeof( FigureHandler ) != 'undefined' ){
  Event.observe( window, 'load', function(){
    new FigureHandler( 'main', { '0-27':   'small',
                                 '27-100': 'large' } );
    new FigureHandler( 'extras', { '0-50':   'potato',
                                   '50-100': 'tomato' } );
  });
}

Required Markup

FigureHandler assumes all figures are DIV elements classified as "figure." It is recommended that the following syntax be used (at a minimum):

<div class="figure">
  <img src="faces-of-the-fallen.jpg" alt="The &#8220;Faces of the
    Fallen&#8221; exhibit at Arlington National Cemetery." />
</div>

But you can embed much more information, following some of the current practices in figure markup:

<div class="figure">
  <img src="fa.jpg" alt="" />
  <p class="credit"><abbr class="type" title="Photograph">Photo</abbr>
    by <cite>Aaron Gustafson</cite></p>
  <p class="caption"><em class="title">Figure 1</em> The &#8220;Faces of the
    Fallen&#8221; exhibit at Arlington National Cemetery.</p>
</div>

Demo

View the default demo or the custom demo.

Optimized Releases

Development Version

If you are interested in helping to further develop this script, you can download the uncompressed JavaScript source file.

Change Log


Comment by marinof, Sep 26, 2007

dfg

Comment by stefano.verna, Sep 26, 2007

this is so cleaver.

Comment by wadeonuffer, Sep 26, 2007

Thanks,

I think that this will solve some of my issues with handing over the final product to a customer then go back a month later and it is all messed up.

Thanks alot...

Comment by carla.hawks, Sep 26, 2007

just in time.

Comment by stu.steel, Sep 30, 2007

Another important step in creating a CMS system that will allow normal users to publish that doesn't look like cruft.

Comment by bennobo, Oct 01, 2007

You are a hero!

Comment by bennobo, Oct 01, 2007

You are a hero!

Comment by interlekt, Oct 15, 2007

erfqerqrfwfe

Comment by IMFrolov, Jan 07, 2008

Wrong link to FigureHandler.js There must be http://easy-designs.googlecode.com/svn/trunk/FigureHandler/working/FigureHandler.js instead of http://easy-designs.googlecode.com/svn/trunk/FauxSelect/working/FigureHandler.js


Sign in to add a comment