Behavior

Behaviors can be added to a webpage by including one, or more of the following JavaScript libraries. Please note that these scripts should ONLY be used to enhance user experience, and should never be required for basic use.

Great care went into the development and testing of these scripts but bugs and/or browser inconsistency issues may still exist. The libraries are offered with no warranty, and thus PCC or the developers behind the script cannot be held when responsible when your computer melts right in front of your eyes.

When testing scripts, make sure you test features, not browsers! The JS libraries follow this rule, so tests for required features are provided, if a feature doesn't exist the function will either attempt a less advanced command, or (and finally) fail silently. Functions in the JS Library make use of the tests internally so there is no need to test features before calling an included function.

All tests result in a variable holding a boolean (true/false) value and should be used in the following fashion…

function SuperDooperFunction() {
		if(!feature_var) return;
		[...if you made it here than the feature is available, run some code...]
		}

Where possible feature variables (set in pcclib.js) can include:

  • DOM - basic DOM support, functions getElementById and getElementsByName exist.
  • advDOM - the slightly more advanced and crucial createElement function exists

Main Library (pcclib.js)

The PCC JavaScript Libraries is a collection of tests, settings, and functions providing basic functionality to PCC websites. It is packaged in a single file for easy, cacheable, inclusion on any page. To include the library in your page add the following line to the <head> of your document…

Settings and Global Variables

Included in the library is comprehensive list of settings and useful variables that define both defaults for key PCC website behaviors, and client settings and conditions.

  • popups - A hash of PCC's default popup window settings.
    • normal - no special settings.
    • form - 760px wide, 500px tall, with scrollbars and resizable.
    • notice - 240px wide, 200px tall, used for small alert type windows.
    • screen - 640px wide, 480px tall, with status bar.
  • re - A hash of commonly used Regular Expressions
    • index - match common index pages (i.e. index.html).
    • email - match email addresses.
    • pccemail - match email address ending in @pcc.edu.

Function Reference

Sooner or later function abilities and usage will be documented here.

Collapsible Lists (dl-collapse.js)

Adds ability to create collapsible definition lists. Needs further documentation.

Check Lists (checklist.js)

Adds ability to create check lists. Needs further documentation.

Flash Multimedia (swfobject.js)

Adds ability to insert a flash object onto the page. Needs further documentation.

Mootools (mootools.js)

Mootools is very compact and modular, Object-Oriented JavaScript framework alternative to the scriptaculous framework. It allows us to quickly implement those lovely "Web 2.0" effects. Currently we only use a select subsection of the full library available at: mootools.net/download.

Slimbox (slimbox.js)

Slimbox is a very compact clone of the popular Lightbox, written by Christophe Beyls using the ultra compact mootools framework. It was designed to be small, efficient, more convenient and 100% compatible with the original Lightbox. Our version has been slightly modified to meet our particular needs.