The Art & Science of JavaScript

Book description

A compilation of seven spectacular and inspiration JavaScript projects, presented in full color and written by a renowned group of industry leaders.

Table of contents

  1. The Art & Science Of JavaScript (1/2)
  2. The Art & Science Of JavaScript (2/2)
  3. Table of Contents (1/2)
  4. Table of Contents (2/2)
  5. Preface
    1. Who Should Read This Book?
    2. What’s Covered in This Book?
    3. The Book’s Web Site
      1. The Code Archive
      2. Updates and Errata
    4. The SitePoint Forums
    5. The SitePoint Newsletters
    6. Your Feedback
    7. Conventions Used in This Book
      1. Code Samples
      2. Tips, Notes, and Warnings
  6. Fun with Tables
    1. Anatomy of a Table
      1. Accessing Table Elements with getElementById
      2. Accessing Table Elements with getElementsByTagName
    2. Sortable Columns
      1. Making Our Tables Sortable
        1. Making the Sort Functionality Accessible
        2. Handling Events and Scope Issues
        3. Adding Some Class
      2. Performing the Sort (1/3)
      3. Performing the Sort (2/3)
      4. Performing the Sort (3/3)
        1. Parsing the Content
        2. Implementing a Bubble Sort
        3. Managing Heading States
        4. Rearranging the Table
    3. Creating Draggable Columns
      1. Making the Table’s Columns Draggable (1/3)
      2. Making the Table’s Columns Draggable (2/3)
      3. Making the Table’s Columns Draggable (3/3)
        1. The Phantom Column
        2. Accessible Dragging
        3. Event Handling
        4. The onmousedown Event Handler
        5. The onmousemove Event Handler
        6. The onmouseup Event Handler
      4. Dragging Columns without a Mouse (1/2)
      5. Dragging Columns without a Mouse (2/2)
    4. Summary
  7. Creating Client-side Badges
    1. Badges—an Introduction
      1. Too Many Badges Spoil the Broth
        1. Performance Issues
        2. User Experience Issues
      2. Out-of-the-box Badges
      3. Server-side Badges
      4. Custom Client-side Badges
        1. Benefits of Custom Client-side Badges
        2. Introducing the Example Badge
    2. Client-side Badge Options: Ajax and JSON
      1. The Problem with Ajax
      2. JSON: the Lightweight Native Data Format
      3. Providing a Fallback for Failed Connections
    3. Planning the Badge Script
    4. The Complete Badge Script
      1. Defining Configuration Variables
      2. Defining Public Methods
      3. Defining Private Methods
    5. Calling for Server Backup
    6. Summary
  8. Vector Graphics with canvas
    1. Working with canvas
      1. The canvas API
      2. Thinking About Vector Graphics
      3. Creating Shapes (1/4)
      4. Creating Shapes (2/4)
      5. Creating Shapes (3/4)
      6. Creating Shapes (4/4)
        1. Creating Rectangles
        2. Creating Paths
        3. Bézier Curves
    2. Creating a Pie Chart
      1. Drawing the Chart
        1. Calculating the Color of a Segment
        2. Determining the Dimensions of a Segment
        3. Initializing the Page
      2. Casting a Shadow
      3. Updating the Chart Dynamically (1/2)
      4. Updating the Chart Dynamically (2/2)
    3. canvas in Internet Explorer
    4. Summary
  9. Debugging and Profiling with Firebug
    1. Installing and Running Firebug
      1. Installing Firefox and Firebug
      2. First Steps with Firebug
      3. Opening, Closing, and Resizing Firebug
      4. Enabling and Disabling Firebug
    2. The Many Faces of Firebug
      1. Common Components
      2. The Firebug Views
        1. The Console View
        2. The HTML View
        3. The CSS View
        4. The Script View
        5. The DOM View
        6. The Net View
      3. Switching Views
    3. Using Firebug
      1. Performing Rapid Application Development
      2. Monitoring, Logging, and Executing with the Console
      3. Viewing and Editing On the Fly
      4. Debugging Your Application
      5. Performance Tuning Your Application
    4. Related Tools
      1. Firebug Lite
      2. YSlow
      3. Microsoft Tools
      4. Other Firefox Extensions
    5. Summary
  10. Metaprogramming with JavaScript
    1. The Building Blocks
      1. (Nearly) Everything Is a Hash
      2. Finding and Iterating through Properties in an Object
      3. Detecting Types
      4. There Are No Classes in JavaScript
      5. Detecting whether a Function Was Called with new
      6. Functions Are Objects
      7. Understanding the arguments Array
        1. Using callee to Store Properties Between Function Calls
      8. Comprehending Closures
        1. What is a Closure?
        2. Partial Function Application
        3. The Self-executing Function Pattern
        4. The Module Pattern
    2. Metaprogramming Techniques
      1. Creating Functions with Default Arguments
      2. Working with Built-ins
      3. Creating Self-optimizing Functions
      4. Aspect-oriented Programming on a Shoestring
      5. Better APIs through Dynamic Functions
      6. Creating Dynamic Constructors
      7. Simulating Traditional Object Orientation (1/2)
      8. Simulating Traditional Object Orientation (2/2)
        1. In the Beginning …
        2. Classes in Prototype 1.6
        3. Implementing Domain-specific Languages
    3. Summary
  11. Building a 3D Maze with CSS and JavaScript
    1. Basic Principles
      1. Making Triangles
      2. Defining the Floor Plan
      3. Creating Perspective
    2. Making a Dynamic View
      1. Core Methods
        1. The createDungeonView Method
        2. The resetDungeonView Method
        3. The applyDungeonView Method
      2. Applying the Finishing Touches
      3. Limitations of This Approach
    3. Creating the Map View
    4. Adding Captions
    5. Designing a Floor Plan
    6. Further Developments
      1. Using the Callback
      2. Blue-sky Possibilities
    7. Summary
  12. Flickr and Google Maps Mashups
    1. APIs, Mashups, and Widgets! Oh, My!
      1. Flickr and Google Maps
      2. Drawing a Map
      3. Geotagging Photos
      4. Getting at the Data
        1. The Flickr API
        2. Flickr Feeds
    2. JSON
      1. The Same-origin Restriction (1/2)
      2. The Same-origin Restriction (2/2)
        1. Enabling Cross-domain JSON
        2. Cross-domain JSON on Demand
    3. Pulling it All Together
      1. Enhancing Our Widget (1/2)
      2. Enhancing Our Widget (2/2)
        1. Adding Map Controls
        2. Creating Clickable Thumbnails
        3. Highlighting the Current Thumbnail
        4. Displaying an Info Window
        5. Recentering the Map
      3. Putting it All Together
    4. Taking Things Further
    5. Summary
  13. Index (1/2)
  14. Index (2/2)

Product information

  • Title: The Art & Science of JavaScript
  • Author(s): Cameron Adams, James Edwards, Christian Heilmann, Michael Mahemoff, Ara Pehlivanian, Dan Webb, Simon Willison
  • Release date: December 2007
  • Publisher(s): SitePoint
  • ISBN: 9780980285840