Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Time for action—documenting the ImageCaption plugin


Let's document the ImageCaption plugin with the standard MooTools More plugin documentation block comment (sometimes abbreviated as docblock comments).

  1. Open ImageCaption.js in your source code editor.

  2. At the very top of the file, insert the following docblock comment.

    Script:
    …
    …
    License:
    Authors:
    */
    var ImageCaption = new Class({
    Implements: [Options],
    options: {
    wrapperClass: 'imageCaption',
    wrapperType: 'span',
    captionType: 'span',
    captionPosition: 'after'
    },
    ...
    
  3. Finally, fill in the information. This is where our design sheet comes in handy for the description of the script; we can simply take what we wrote down in the "What it will do" column of the design sheet we developed, and modify it as necessary. Use tab spaces to indent the docblock comment items.

    Script: ImageCaption.js
    Takes the alt property (or title property) of an image, and insert it as HTML text to serve as a photo caption (its description).
    License:
    MIT-style license...