Commits

Gary Chambers committed d505d7e

Removed compiled output files.

Comments (0)

Files changed (2)

build/jazz-0.1.1.js

-/**
-Base Jazz object
-
-@module Jazz
-**/
-var Jazz = window.Jazz || {};/**
-General utility functions
-
-@class Util
-@static
-@category core
-**/
-Jazz.Util = (function(window, document, undefined) {
-	"use strict";
-
-	var Util;
-	Util = {};
-
-	/**
-	No-op function to be used as fallback for optional function callback parameters
-
-	@method noop
-	@return {Undefined}
-	**/
-	Util.noop = function noop() {};
-
-	return Util;
-
-})(this, this.document);/**
-Utility functions for general objects.
-Acts as a compatibility layer for incomplete API implementations
-
-@class Obj
-@static
-@category core
-**/
-Jazz.Obj = (function(window, document, undefined) {
-	"use strict";
-
-	var Obj,
-		_objProto;
-
-	Obj = {};
-	_objProto = Object.prototype;
-
-	/**
-	Create a new object constructor,
-	inheriting from the specified object
-
-	@method create
-	@param {Object} obj An object instance to use as the prototype of the newly created constructor
-	@return {Function} An object constructor
-	**/
-	Obj.create = function create(obj)
-	{
-		var Constructor;
-
-		if(Object.create)
-		{
-			return Object.create(obj);
-		}
-
-		Constructor = function() {};
-		Constructor.prototype = obj;
-		return new Constructor();
-	};
-
-	/**
-	Shallow copy properties and methods from one object to another
-
-	@method extend
-	@param {Object} dest The destination object
-	@param {Object} src The source object
-	@return {Undefined}
-	**/
-	Obj.extend = function extend(dest, src)
-	{
-		var prop;
-
-		for(prop in src)
-		{
-			dest[prop] = src[prop];
-		}
-	};
-
-	/**
-	Get the type of the specified object as a string
-
-	@method getType
-	@param {Mixed} obj Any object or primitive
-	@return {String} The type of the input object as a titlecase string
-	**/
-	Obj.getType = function getType(obj)
-	{
-		return /^\[object\s(.+)\]$/.exec(_objProto.toString.call(obj))[1];
-	};
-
-	/**
-	Perform a strict comparison between the type
-	of the input object and the specified type
-
-	@method isType
-	@param {Mixed} obj Any object or primitive
-	@param {String} type The comparison type as a titlecase string
-	@return {Boolean} Returns true if the type matches
-	**/
-	Obj.isType = function isType(obj, type)
-	{
-		return type === Obj.getType(obj);
-	};
-
-	return Obj;
-
-})(this, this.document);/**
-Utility methods for iterable objects.
-Acts as a compatability layer for environments
-with incomplete API implementations.
-
-@class Iter
-@static
-@category core
-**/
-Jazz.Iter = (function(window, document, undefined) {
-	"use strict";
-
-	var Iter,
-		_arrayProto;
-
-	Iter = {};
-	_arrayProto = Array.prototype;
-
-	/**
-	Loops through the specified iterable object and
-	fires the callback function on each member.
-
-	@method forEach
-	@param {Mixed} iter Any iterable object
-	@param {Function} fn The callback function, fired for each member of the iterable object
-	@return {Undefined}
-	**/
-	Iter.forEach = function forEach(iter, fn)
-	{
-		var i,
-			key,
-			length;
-
-		if(Jazz.Obj.isType(iter, "Array"))
-		{
-			if(_arrayProto.forEach)
-			{
-				return _arrayProto.forEach.call(iter, fn);
-			}
-
-			i = 0;
-			length = iter.length >>> 0;
-
-			for( ; i < length; i++ )
-			{
-				fn.call(null, iter[i], i, iter);
-			}
-		}
-		else
-		{
-			for(key in iter)
-			{
-				fn.call(null, iter[key], key, iter);
-			}
-		}
-	};
-
-	/**
-	Determines whether an item appears in a collection.
-
-	@method inCollection
-	@param {Mixed} haystack Any iterable object
-	@param {Mixed} needle Any primitive value
-	@return {Boolean}
-	**/
-	Iter.inCollection = function inCollection(haystack, needle)
-	{
-		return Jazz.Obj.isType(haystack, "Object") ?
-			needle in haystack :
-			Iter.indexOf(haystack, needle) !== -1;
-	};
-
-	/**
-	Returns the zero-index of an item in an iterable object
-
-	@method indexOf
-	@param {Mixed} haystack Any iterable object
-	@param {Mixed} needle Any primitive value
-	@return {Number} The zero-based index of the first match of the needle in haystack, or -1 if no match is found
-	**/
-	Iter.indexOf = function indexOf(haystack, needle)
-	{
-		var i,
-			index,
-			length;
-
-		if(_arrayProto.indexOf)
-		{
-			return _arrayProto.indexOf.call(haystack, needle);
-		}
-
-		i = 0;
-		index = -1;
-		length = haystack.length >>> 0;
-
-		for( ; i < length; i++ )
-		{
-			if(needle === haystack[i])
-			{
-				index = i;
-				break;
-			}
-		}
-
-		return index;
-	};
-
-	/**
-	Converts any iterable object to a native array
-
-	@method toArray
-	@param {Mixed} iter Any iterable object
-	@return {Array}
-	**/
-	Iter.toArray = function toArray(iter)
-	{
-		return _arrayProto.slice.call(iter);
-	};
-
-	return Iter;
-
-})(this, this.document);/**
-String utility methods.
-
-@class String
-@static
-**/
-Jazz.String = (function(window, document, undefined)
-{
-	"use strict";
-
-	var Str;
-	Str = {};
-
-	/**
-	Check whether a word/phrase exists in a string.
-	This only performs whole token matching. Use built-in
-	methods for substring matching.
-
-	@method contains
-	@param {String} text The string to search
-	@param {String} item The target string
-	@return {Boolean}
-	**/
-	Str.contains = function contains(text, item)
-	{
-		var pattern;
-		pattern = new RegExp("(:?^|\\b)" + item + "(?:\\b|$)");
-		return pattern.test(text);
-	};
-
-	return Str;
-
-})(this, this.document);/**
-Utility methods for functions and object constructors
-
-@class Func
-@static
-@category core
-**/
-Jazz.Func = (function(window, document, undefined) {
-	"use strict";	
-
-	var Func,
-		_funcProto;
-
-	Func = {};
-	_funcProto = Function.prototype;
-
-	/**
-	Binds a function to the specified context
-
-	@method bind
-	@param {Function} fn The target function
-	@param {Object} context The required context object
-	@return {Function}
-	**/
-	Func.bind = function bind(fn, context)
-	{
-		if(_funcProto.bind)
-		{
-			return _funcProto.bind.call(fn, context);
-		}
-
-		return function()
-		{
-			fn.call(context);
-		};
-	};
-
-	/**
-	Attaches a method to the prototype of the specifiec context
-
-	@method method
-	@param {Function} context Any object constructor
-	@param {String} name The name of the method to be added
-	@param {Function} fn The function body of the attached method
-	@return {Undefined}
-	**/
-	Func.method = function method(context, name, fn)
-	{
-		context.prototype[name] = fn;
-	};
-
-	return Func;
-
-})(this, this.document);/**
-Dynamic namespace manager.
-Primary mechanism for adding module extensions.
-
-@class NS
-@static
-@category core
-**/
-Jazz.NS = (function(window, document, undefined) {
-	"use strict";
-
-	var NS;
-
-	NS = {};
-
-	/**
-	Return an existing Jazz module namespace if it exists.
-
-	@method get
-	@param {String} name
-	@param {Mixed} defaultValue* An optional fallback value to return if the specified namespace does not exist.
-	@return {Mixed} The specified namespace, if it exists; otherwise the fallback value or undefined
-	**/
-	NS.get = function get(name, defaultValue)
-	{
-		var module,
-			path,
-			segment;
-
-		module = Jazz;
-		path = name.split(".");
-
-		for(segment in path)
-		{
-			if(!module.hasOwnProperty(segment))
-			{
-				module = defaultValue;
-				break;
-			}
-
-			module = module[segment];
-		}
-
-		return module;
-	};
-
-	/**
-	Create a new Jazz module namespace
-
-	@method set
-	@param {String} name The name of the new module namespace
-	@param {Mixed} constructor If the new module is an instantiable class, this is the constructor function;
-		otherwise, this is the properties for a singleton object.
-	@param {Object} props* If a function constructor is passed, this object will form the object prototype.
-	@return {Undefined}
-	**/
-	NS.set = function set(name, constructor, props)
-	{
-		var module,
-			path,
-			segment;
-
-		module = Jazz;
-		path = name.split(".");
-
-		for(segment in path)
-		{
-			if(!module.hasOwnProperty(segment))
-			{
-				module[segment] = {};
-				module = module[segment];
-			}
-		}
-
-		if(Jazz.Obj.isType(constructor, "Function"))
-		{
-			module = constructor;
-			Jazz.Obj.extend(module.prototype, props);
-		}
-		else
-		{
-			Jazz.Obj.extend(module, props);
-		}
-	};
-
-	/**
-	Deletes an existing namespace
-
-	@method unset
-	@param {String} name The name of the namespace
-	@return {Undefined}
-	**/
-	NS.unset = function unset(name)
-	{
-		var module;
-		module = NS.get(name);
-		
-		if(module)
-		{
-			module = undefined;
-		}
-	};
-
-	return NS;
-
-})(this, this.document);/**
-Modularised storage manager. Supports multiple sandboxed config stores.
-
-@class Storage
-@constructor
-**/
-Jazz.Storage = (function(window, document, undefined) {
-	"use strict";
-
-	var Storage,
-		_cache;
-
-	_cache = {};
-
-	Storage = function Storage(key)
-	{
-		this.values = {};
-		_cache[key] = this;
-	};
-
-	Jazz.Obj.extend(Storage.prototype, {
-
-		/**
-		Gets the Storage item identified by the given key.
-		Optionally falls back to a defined default value.
-
-		@method get
-		@param {String} key The item key
-		@param {Mixed} defaultValue The fallback value
-		@return {Mixed}
-		**/
-		get: function get(key, defaultValue)
-		{
-			return this.values.hasOwnProperty(key) ?
-				this.values[key] :
-				defaultValue;
-		},
-
-		/**
-		Sets the Storage item identified by the given key
-		to the specified value. Existing Storage settings
-		by the same key will be overwritten.
-
-		@method set
-		@param {String} key The item key
-		@param {Mixed} value The item value
-		@return {Undefined}
-		**/
-		set: function set(key, value)
-		{
-			this.values[key] = value;
-		},
-
-		/**
-		Unsets the Storage item identified by the given key.
-
-		@method unset
-		@param {String} key
-		@return {Undefined}
-		**/
-		unset: function unset(key)
-		{
-			if(this.values.hasOwnProperty(key)) delete this.values[key];
-		}
-
-	});
-
-	Jazz.Obj.extend(Storage, {
-
-		/**
-		Loads the Storage context identified by the given key.
-		If the requested context does not exist, it is created.
-
-		@method load
-		@static
-		@param {String} key The namespace for the Storage context
-		@return {Object} The Storage context
-		**/
-		load: function load(key)
-		{
-			return _cache[key]
-				|| new Storage(key);
-		}
-
-	});
-
-	return Storage;
-
-})(this, this.document);/**
-Event handler abstraction
-
-@class Event
-@static
-**/
-Jazz.Event = (function(window, document, undefined) {
-	"use strict";
-	
-	var Event,
-		EventWrapper,
-
-		_createListener,
-		_getListener,
-
-		_Listeners,
-		_Methods,
-
-		_DOMREADY,
-		_WINLOADED;
-
-	_DOMREADY = false;
-	_WINLOADED = true;
-
-	Event = {};
-
-	/**
-	Compatibility wrapper around the native event API
-
-	@class EventWrapper
-	@constructor
-	@private
-	**/
-	EventWrapper = function EventWrapper(evt)
-	{
-		this.nativeEvent = evt;
-		this.target = this.nativeEvent.target
-			|| this.nativeEvent.srcElement;
-	};
-
-	Jazz.Obj.extend(EventWrapper.prototype, {
-
-		/**
-		Prevent the event from triggering the default action.
-
-		@method preventDefault
-		@return {Undefined}
-		**/
-		preventDefault: function preventDefault()
-		{
-			if("preventDefault" in this.nativeEvent)
-			{
-				this.nativeEvent.preventDefault();
-			}
-
-			this.nativeEvent.returnValue = false;
-		},
-
-		/**
-		Prevent the event from propagating up the DOM tree
-
-		@method stopPropagation
-		@return {Undefined}
-		**/
-		stopPropagation: function stopPropagation()
-		{
-			if("stopPropagation" in this.nativeEvent)
-			{
-				this.nativeEvent.stopPropagation();
-			}
-
-			this.nativeEvent.cancelbubble = true;
-		}
-
-	});
-
-	_Listeners = Jazz.Storage.load("event:listeners");
-
-	/**
-	Cache and return the wrapped listener function body
-
-	@method _createListener
-	@private
-	@param {Function} fn The listener function body
-	@param {String} evt The bound event
-	@param {Mixed} context The targeted object
-	@return {Function} The wrapped listener body
-	**/
-	_createListener = function _createListener(fn, evt, context)
-	{
-		return _Listeners.set(fn.toString(), function(evt)
-		{
-			fn.call(context, new EventWrapper(evt || window.event));
-		});
-	};
-
-	/**
-	Return the cached instance of the listener body
-
-	@method _getListener
-	@private
-	@param {Function} fn The listener function body
-	@return {Function} The wrapped listener body
-	**/
-	_getListener = function _getListener(fn)
-	{
-		return _Listeners.get(fn.toString()) || Jazz.Util.noop;
-	};
-
-	_Methods = {
-
-		on: {
-			
-			standard: function(obj, evt, fn)
-			{
-				obj.addEventListener(evt, _createListener(fn, evt, obj), false);
-			},
-
-			msie: function(obj, evt, fn)
-			{
-				obj.attachEvent("on" + evt, _createListener(fn, evt, obj));
-			},
-
-			fallback: function(obj, evt, fn)
-			{
-				obj["on" + evt] = _createListener(fn, evt, obj);
-			}
-
-		},
-
-		off: {
-
-			standard: function(obj, evt, fn)
-			{
-				obj.removeEventListener(evt, _getListener(fn), false);
-			},
-
-			msie: function(obj, evt, fn)
-			{
-				obj.detachEvent("on" + evt, _getListener(fn));
-			},
-
-			fallback: function(obj, evt, fn)
-			{
-				obj["on" + evt] = null;
-			}
-
-		}
-
-	};
-
-	/**
-	Bind a listener to the specified event on the target object.
-	If the event is window#load or document#DOMContentLoaded,
-	check if this event has been fired and invoke listener
-	immediately if required.
-
-	@method on
-	@param {Mixed} obj The target object
-	@param {String} evt The event to bind
-	@param {Function} fn The event listener function body
-	@return {Undefined}
-	**/
-	Event.on = function on(obj, evt, fn)
-	{
-		var complete;
-
-		complete = 
-			(_WINLOADED && obj === window && evt === "load") 
-			|| (_DOMREADY && obj === document && evt === "DOMContentLoaded");
-
-		if(complete)
-		{
-			_createListener(fn, evt, obj).call(null, new EventWrapper({}));
-			return;
-		}
-
-		return Event.on._method.apply(null, Jazz.Iter.toArray(arguments));
-	};
-
-	/**
-	Dynamically assign the appropriate event listener API
-	for the current environment.
-
-	@method on._method
-	@private
-	@param {Mixed} obj The target object
-	@param {String} evt The event to bind
-	@param {Function} fn The event listener function body
-	@return {Undefined}
-	**/
-	Event.on._method =
-		(window.addEventListener && _Methods.on.standard)
-			|| (window.attachEvent && _Methods.on.msie)
-			|| _Methods.on.fallback;
-		
-	/**
-	Unbind a listener from the target object
-
-	@method off
-	@param {Mixed} obj The target object
-	@param {String} evt The event to unbind
-	@param {Function} fn The event listener function body
-	@return {Undefined}
-	**/
-	Event.off =
-		(window.removeEventListener && _Methods.off.standard)
-			|| (window.detachEvent && _Methods.off.msie)
-			|| _Methods.off.fallback;
-
-	return Event;
-
-})(this, this.document);/**
-Lightweight Ajax request methods; for a more complete implementation,
-use a dedicated Ajax library, such as jQuery.ajax
-
-@class Ajax
-@static
-**/
-(function(window, document, undefined) {
-	"use strict";
-
-	var _createXHR,
-		_encodeData;
-
-	/**
-	Accessor for the current environment's implementation
-	of the XMLHttpRequest object
-
-	@method _createXHR
-	@private
-	@return {XMLHttpRequest}
-	**/
-	_createXHR = window.ActiveXObject ?
-		
-		function() {
-			return new window.ActiveXObject("Microsoft.XMLHTTP");
-		} :
-		
-		function() {
-			return new window.XMLHttpRequest();
-		};
-
-	/**
-	Serializes an object to a URL encoded string.
-
-	@method _encodeData
-	@private
-	@param {Object} data The data to be encoded
-	@return {String} The encoded string
-	**/
-	_encodeData = function _encodeData(data)
-	{
-		var key,
-			output,
-			value;
-
-		output = [];
-
-		for(key in data)
-		{
-			value = data[key];
-
-			if(Jazz.Obj.isType(data[key], "Object"))
-			{
-				value = _encodeData(data[key]);
-			}
-
-			output.push(key + "=" + value);
-		}
-
-		return output.join("&");
-	};
-
-	Jazz.NS.set("Ajax", {
-		
-		/**
-		Peforms an Ajax get request. Proxies Jazz.Ajax.request.
-
-		@method get
-		@param {String} url The URL of the resource
-		@param {Function} [success] The success callback
-		@param {Function} [error] The error callback
-		@return {Object} Returns the XMLHttpRequest object
-		**/
-		get: function get(url, success, error)
-		{
-			return Jazz.Ajax.request({
-				url: url,
-				type: "GET",
-
-				success: success,
-				error: error
-			});
-		},
-
-		/**
-		Peforms an Ajax post. Proxies Jazz.Ajax.request.
-
-		@method post
-		@param {String} url The URL of the resource
-		@param {Object} [data] A dictionary representing the post data
-		@param {Function} [success] The success callback
-		@param {Function} [error] The error callback
-		@return {Object} Returns the XMLHttpRequest object
-		**/
-		post: function post(url, data, success, error)
-		{
-			return Jazz.Ajax.request({
-				url: url,
-				data: data,
-				type: "POST",
-
-				success: success,
-				error: error
-			});
-		},
-
-		/**
-		Performs an Ajax request based on the passed parameters.
-		As with other implementations, this will send the 'X-Requested-With'
-		header to identify itself as Ajax
-
-		@method request
-		@param {Object} opts A dictionary of options
-		@return {Object} Returns the XMLHttpRequest object
-		**/
-		request: function request(opts)
-		{
-			var data,
-				options,
-				xhr;
-
-			xhr = _createXHR();
-
-			options = {
-				url:		opts.url		|| '',
-				data:		opts.data		|| {},
-				type:		opts.type		|| "GET",
-				
-				user:		opts.user		|| "",
-				password:	opts.password	|| "",
-
-				success:	opts.success	|| Jazz.Util.noop,
-				error:		opts.error		|| Jazz.Util.noop
-			};
-
-			data = _encodeData(options.data);
-
-			xhr.open(
-				options.type,
-				options.url,
-				true,
-				options.user,
-				options.password
-			);
-
-			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
-
-			if(options.type === "POST")
-			{
-				Jazz.Iter.forEach(
-					{
-						"Content-Type": "application/x-www-form-urlencoded",
-						"Content-Length": data.length,
-						"Connection": "close"
-					},
-
-					function(value, key)
-					{
-						xhr.setRequestHeader(key, value);
-					}
-				);
-			}
-
-			Jazz.Event.on(xhr, "readystatechange", function(e) {
-				if(this.readyState === 4)
-				{
-					if(this.status === 200)
-					{
-						options.success(this.responseText, xhr);
-					}
-					else
-					{
-						options.error(this);
-					}
-				}
-			});
-
-			xhr.send(options.data);
-
-			return xhr;
-		}
-
-	});
-
-})(this, this.document);/**
-Bootstraps external resources into the current environment.
-Handles nested dependencies and deferred resource loading.
-By default, resources will load after the window.onload event.
-
-@class Bootstrap
-@constructor
-@category addon
-**/
-Jazz.NS.set("Bootstrap", (function(window, document, undefined) {
-	"use strict";
-
-	var Bootstrap,
-
-		_isLocal,
-		_load,
-		_queue;
-
-	Bootstrap = function Bootstrap()
-	{
-		var args,
-			self;
-
-		self = this;
-
-		this.callbacks = [];
-		this.dependencies = null;
-		this.resources = [];
-		
-		this.event = Bootstrap.Config.get("event", {});
-		
-		this.defer = false;
-		this.wait = 0;
-
-		args = Jazz.Iter.toArray(arguments);
-		this.add.apply(this, args);
-
-		if(!this.defer)
-		{
-			if(this.event.hasOwnProperty("elem")
-				&& this.event.hasOwnProperty("type"))
-			{
-				Jazz.Event.on(this.event.elem, this.event.type, function(e)
-				{
-					_queue(self);
-				});
-			}
-			else
-			{
-				_queue(self);
-			}
-		}
-	};
-
-	Jazz.Iter.forEach(["Alias", "Cache", "Config"], function(key)
-	{
-		Bootstrap[ key ] = Jazz.Storage.load("bootstrap:" + key.toLowerCase());
-	});
-
-	Bootstrap.Config.set("_loadEvent",
-		"addEventListener" in window ?
-			"load" :
-			"readystatechange"
-	);
-
-	Bootstrap.Config.set("event", {
-		elem: window,
-		type: "load"
-	});
-
-	/**
-	Determines whether the resource is local or remote
-
-	@method _isLocal
-	@private
-	@param {String} path The resource pathname
-	@return {Boolean}
-	**/
-	_isLocal = function _isLocal(path)
-	{
-		// TODO: add hostname checking for schemeless URIs
-		return !/^(?:https?:)?\/\//.test(path);
-	};
-
-	/**
-	Loads the defined dependency graph.
-	
-	@method _load
-	@private
-	@param {Object} bootstrap An instance of Jazz.Bootstrap
-	@param {Function} fn Callback to be invoked after all resources have loaded
-	@return {Undefined}
-	**/
-	_load = function _load(bootstrap, fn)
-	{
-		if(!bootstrap.dependencies)
-		{
-			fn();
-			return;
-		}
-
-		_load(bootstrap.dependencies, function()
-		{
-			var counter;
-			counter = 0;
-
-			Jazz.Iter.forEach(bootstrap.resources, function(path)
-			{
-				var resolvedPath,
-					script;
-
-				if(Bootstrap.Cache.get(path))
-				{
-					fn();
-					return;
-				}
-
-				script = document.createElement("script");
-
-				Jazz.Event.on(script, Bootstrap.Config.get("_loadEvent", "load"), function(e)
-				{
-					var complete;
-
-					complete =
-						!this.readyState
-							|| this.readyState === "complete"
-							|| this.readyState === "loaded";
-
-					if(complete)
-					{
-						counter++;
-
-						if(counter === bootstrap.resources.length)
-						{
-							Bootstrap.Cache.set(path, true);
-							fn();
-						}
-					}
-				});
-
-				resolvedPath = Bootstrap.Alias.get(path, path);
-
-				if(Bootstrap.Config.get("debug")
-					&& _isLocal(resolvedPath))
-				{
-					resolvedPath = resolvedPath + "?_tstamp=" + (new Date()).getTime();
-				}
-
-				script.setAttribute("src", resolvedPath);
-			});
-		});
-	};
-
-	/**
-	Queues the resource loader for execution.
-	Always fires a timeout - default 0ms - to push invocation down the execution stack.
-
-	@method _queue
-	@private
-	@param {Object} bootsrap An instance of Jazz.Bootstrap
-	@return {Undefined}
-	**/
-	_queue = function _queue(bootstrap)
-	{
-		var args;
-		args = [bootstrap, function()
-		{
-			Jazz.Iter.forEach(bootstrap.callbacks, function(fn)
-			{
-				fn();
-			});
-		}];
-
-		window.setTimeout(function() {
-			_load.apply(null, args);
-		}, bootstrap.wait);
-	};
-
-	Jazz.Obj.extend(Bootstrap.prototype, {
-
-		/**
-		Adds resources to the bootstrap queue for parallel loading.
-
-		@method add
-		@param {String} path* One or more resource paths
-		@chainable
-		**/
-		add: function add()
-		{
-			this.resources = this.resource.concat(
-				Jazz.Iter.toArray(arguments)
-			);
-
-			return this;
-		},
-
-		after: function after(fn)
-		{
-			this.callbacks.push(fn);
-		},
-
-		/**
-		Delays invocation for a specified number of milliseconds.
-		Used in combination with "Bootstrap#on", this will delay invocation
-		for the specified time, *after* the event has fired.
-
-		@method delay
-		@param {Number} wait The number of milliseconds to delay invocation
-		@chainable
-		**/
-		delay: function(wait)
-		{
-			this.wait = wait;
-			return this;
-		},
-
-		/**
-		Defines the dependency tree for the queued resources
-
-		@method depends
-		@param {Mixed} path* One or more resource paths, or nested arrays indicating a tree structure
-		@chainable
-		**/
-		depends: function depends()
-		{
-			var args,
-				loader;
-
-			args = Jazz.Iter.toArray(arguments);
-
-			loader = this.dependencies || new Bootstrap();
-			loader.defer = true;
-
-			loader.add.apply(loader, args);
-			
-			return this;
-		},
-
-		/**
-		Marks the resource chain for immediate invocation.
-
-		@method now
-		@chainable
-		**/
-		now: function now()
-		{
-			this.event = {};
-			return this.delay(0);
-		},
-
-		/**
-		Binds the loader to a specified browser event.
-
-		@method on
-		@param {HTMLElement} elem The target element of the bound event
-		@param {String} eventType The specified event
-		@chainable
-		**/
-		on: function on(elem, eventType)
-		{
-			this.event = {
-				elem: elem,
-				type: eventType
-			};
-
-			return this;
-		}
-	});
-
-	return Bootstrap;
-
-})(this, this.document));/**
-Resource prefetcher; loads deferred resources into browser cache
-
-@class Prefetch
-@constructor
-@category addon
-**/
-Jazz.NS.set("Prefetch", (function(window, document, undefined) {
-	"use strict";
-
-	var Prefetch,
-
-		_getFileType,
-		_isSameOrigin,
-		
-		_loadResources,
-		_loadImage,
-		_loadText;
-
-	Prefetch = function Prefetch()
-	{
-		this.resources = Jazz.Iter.toArray(arguments);
-		this._isTriggered = false;
-	};
-
-	/**
-	Loads the resources attached to the specified instance of Prefetch.
-	
-	@method _loadResources
-	@private
-	@param {Prefetch} prefetcher An instance of Prefetch
-	@return {Undefined}
-	**/
-	_loadResources = function _loadResources(prefetcher)
-	{
-		Jazz.Iter.forEach(prefetcher.resources, function(path)
-		{
-			var fileType;
-			fileType = _getFileType(path);
-
-			if(fileType === "image")
-			{
-				_loadImage(path);
-			}
-			else
-			{
-				if( _isSameOrigin(path) )
-				{
-					_loadText(path);
-				}
-			}
-		});
-	};
-
-	/**
-	Injects an image element into the local environment
-
-	@method _loadImage
-	@private
-	@param {String} path The path of the resource
-	@return {Undefined}
-	**/
-	_loadImage = function _loadImage(path)
-	{
-		var eventType,
-			image;
-
-		eventType = ("attachEvent" in window) ?
-			"readystatechange" :
-			"load";
-
-		image = document.createElement("image");
-
-		Jazz.Event.on(image, eventType, function()
-		{
-			var complete;
-
-			complete = !this.readyState
-				|| this.readyState === "complete"
-				|| this.readyState === "loaded";
-			
-			if(complete)
-			{
-				image = null;
-			}
-		});
-
-		image.setAttribute("src", path);
-	};
-
-	/**
-	Performs an Ajax request to load a text-based resource (script, stylesheet, etc)
-
-	@method _loadText
-	@private
-	@param {String} path The path of the resource
-	@return {Undefined}
-	**/
-	_loadText = function _loadText(path)
-	{
-		Jazz.Ajax.get(path);
-	};
-
-	/**
-	Determines whether a resource is a text file or image, based on file extension.
-
-	@method _getFileType
-	@private
-	@param {String} path The path of the resource
-	@return {Undefined}
-	**/
-	_getFileType = function _getFileType(path)
-	{
-		var ext,
-			fileType;
-
-		ext = /([^\.]+)$/.exec(path);
-
-		if(ext)
-		{
-			ext = ext[1].toLowerCase();
-		}
-
-		switch(ext)
-		{
-			case "png":
-			case "jpg":
-			case "jpeg":
-			case "bmp":
-			case "gif":
-				fileType = "image";
-				break;
-
-			default:
-				fileType = "text";
-				break;
-		}
-
-		return fileType;
-	};
-
-	/**
-	Determines whether a resource is cross-origin.
-	Loading of cross-origin text files is currently not supported.
-
-	@method _isSameOrigin
-	@private
-	@param {String} path The path of the resource
-	@return {Undefined}
-	**/
-	_isSameOrigin = function _isSameOrigin(path)
-	{
-		var hostName,
-			returnValue = true;
-
-		hostName = /^(?:https?:)?\/\/([^\/]+).*$/.exec(path);
-
-		if(hostName)
-		{
-			hostName = hostName[1];
-			returnValue = window.location.hostname === hostName;
-		}
-
-		return returnValue;
-	};
-
-	Jazz.Obj.extend(Prefetch.prototype, {
-
-		/**
-		Adds one or more resources to the prefetch queue
-
-		@method add
-		@param {String} path* One or more resource paths
-		@chainable
-		**/
-		add: function add()
-		{
-			this.resources = this.resources.concat(
-				Jazz.Iter.toArray(arguments)
-			);
-
-			return this;
-		},
-
-		/**
-		Binds the resource prefetcher to the specified event.
-		If the event has already fired, the prefetcher will invoke immediately.
-		
-		@method on
-		@param {HTMLElement} elem The target of the bound event
-		@param {String} evt The specified event
-		@chainable
-		**/
-		on: function on(elem, evt)
-		{
-			var self;
-
-			if(this._isTriggered)
-			{
-				_loadResources(this);
-			}
-			else
-			{
-				self = this;
-
-				Jazz.Event.on(elem, evt, function(e) {
-					_loadResources(self);
-				});
-			}
-
-			return this;
-		}
-
-	});
-
-	return Prefetch;
-
-})(this, this.document));/**
-Template rendering engine
-
-@class Template
-@constructor
-@category addon
-**/
-Jazz.NS.set("Template", (function(window, document, undefined) {
-	"use strict";
-
-	var Template,
-
-		_compileTemplate,
-		_loadTemplate;
-
-	/**
-	Compiles a template string into a dynamic function.
-
-	@method _compileTemplate
-	@private
-	@param {String} template The raw template string
-	@return {Function} The compiled template
-	**/
-	_compileTemplate = function _compileTemplate(template)
-	{
-		/*
-		Via John Resig, 2008.
-		http://ejohn.org/blog/javascript-micro-templating/
-		TODO: Replace this with something more configurable.
-		*/
-
-		return new Function("obj",
-			"var p=[],print=function(){p.push.apply(p,arguments);};" +
-
-			// Introduce the data as local variables using with(){}
-			"with(obj||{}){p.push('" +
-
-			// Convert the template into pure JavaScript
-			template
-				.replace(/[\r\t\n]/g, " ")
-				.split("<%").join("\t")
-				.replace(/((^|%>)[^\t]*)'/g, "$1\r")
-				.replace(/\t=(.*?)%>/g, "',$1,'")
-				.split("\t").join("');")
-				.split("%>").join("p.push('")
-				.split("\r").join("\\'")
-
-			+ "');}return p.join('');");
-	};
-
-	/**
-	Loads a template from a remote path, or from cache if available.
-
-	@method _loadTemplate
-	@private
-	@param {Object} template The template loader instance
-	@return {Undefined}
-	**/
-	_loadTemplate = function _loadTemplate(template)
-	{
-		var context,
-			func,
-			path;
-
-		context = template.options.context;
-		path = template.options.path;
-
-		func = Template.Cache.get(path);
-
-		if(func)
-		{
-			window.setTimeout(function() {
-				func(context);
-			}, 0);
-
-			return;
-		}
-
-		Jazz.Ajax.get(path, function(tmpl)
-		{
-			func = Template.Config.get("engine", _compileTemplate)(tmpl);
-			func(context);
-			Template.Cache.set(path, func);
-		});
-	};
-
-	Template = function Template(path, options)
-	{
-		this.options = {
-			context: {},
-			elem: null,
-			path: path
-		};
-
-		this.callbacks = {
-			error: [],
-			success: []
-		};
-
-		Jazz.Iter.forEach(options, function(value, key)
-		{
-			if(this.options.hasOwnProperty(key))
-			{
-				this.options[key] = value;
-			}
-		});
-
-		Jazz.Iter.forEach(["error", "success"], function(method)
-		{
-			if(options.hasOwnProperty(method)
-				&& Jazz.Obj.isType(options[method], "Function"))
-			{
-				this.callbacks[method].push(
-					options[method]
-				);
-			}
-		});
-
-		_loadTemplate(this);
-	};
-
-	Jazz.Iter.forEach(["Cache", "Config", "Engines"], function(key)
-	{
-		Template[ key ] = Jazz.Storage.load("template:" + key.toLowerCase());
-	});
-
-	Jazz.Obj.extend(Template, {
-		/**
-		Registers an alternative templating engine.
-
-		@method register
-		@param {String} name The namespace of the templating engine
-		@param {Function} fn The compilation function
-		@return {Undefined}
-		**/
-		register: function register(name, fn)
-		{
-			Template.Engines.set(name, fn);
-		},
-
-		/**
-		Use the specified templating engine.
-		If the templating engine cannot be found, the library default is used.
-
-		@method use
-		@param {String} name
-		@return {Undefined}
-		**/
-		use: function use(name)
-		{
-			Template.Config.set("engine",
-				Template.Engines.get(name)
-			);
-		}
-	});
-
-	Jazz.Obj.extend(Template.prototype, {
-		/**
-		Bind the rendered template to an element.
-		Once loaded, the template will be automatically overwrite the contents of this element.
-
-		@method bind
-		@param {HTMLElement} The element to which the template partial is bound
-		@chainable
-		**/
-		bind: function bind(elem)
-		{
-			this.elem = elem;
-			return this;
-		},
-
-		/**
-		Attaches a context dictionary to be passed to the template partial.
-		This extends the existing template context unless override is specified.
-
-		@method context	
-		@param {Object} data A dictionary of values to be used as the data context for the template partial
-		@param {Boolean} override* Indicates that the existing context should be overridden
-		@chainable	
-		**/
-		context: function context(data, override)
-		{
-			if(override)
-			{
-				Jazz.Obj.extend(this.options.context, data);
-			}
-			else
-			{
-				this.options.context = data;
-			}
-
-			return this;
-		},
-
-		/**
-		Binds a success or error callback to the template loader.
-
-		@method on
-		@param {String} type The callback type - either 'error' or 'success'
-		@param {Function} fn The callback function
-		@chainable
-		**/
-		on: function on(type, fn)
-		{
-			if(Jazz.Iter.inCollection(["error", "success"], type))
-			{
-				this.callbacks.push(fn);
-			}
-
-			return this;
-		}
-	});
-
-	return Template;
-
-})(this, this.document));/**
-Client-side routing library.
-Defaults to using History API, but falls back to hashbang URLs.
-
-@class Router
-@static
-**/
-Jazz.NS.set("Router", (function(window, document, undefined) {
-	"use strict";
-
-	var Router,
-		_Routes;
-
-	_Routes = Jazz.Storage.load("router:routes");
-	Router = {};
-
-	/**
-	Bind a callback function to the designated route and request method.
-
-	@method bind
-	@param {Object} opts The route definition
-	@return {Undefined}
-	**/
-	Router.bind = function bind(opts)
-	{
-		var options;
-
-		options = {
-			route: opts.route || "/",
-			types: opts.types || ["get", "post"],
-			callback: opts.callback || Jazz.Util.noop
-		};
-
-		Jazz.Iter.forEach(options.types, function(type)
-		{
-			var key,
-				routes;
-
-			key = type + "://" + options.route;
-			
-			routes = _Routes.get(key, []);
-			routes.push(options.callback);
-
-			_Routes.set(key, routes);
-		});
-	};
-
-	Jazz.Iter.forEach(
-		{
-			/**
-			Bind a callback function to any request method.
-
-			@method any
-			@param {String} route The designated route
-			@param {Function} callback The callback function
-			@return {Undefined}
-			**/
-			"any": "get post",
-			
-			/**
-			Bind a callback to a get request.
-
-			@method get
-			@param {String} route The designated route
-			@param {Function} callback The callback function
-			@return {Undefined}
-			**/
-			"get": "get",
-			
-			/**
-			Bind a callback to a post request.
-
-			@method post
-			@param {String} route The designated route
-			@param {Function} callback The callback function
-			@return {Undefined}
-			**/
-			"post": "post"
-		},
-		
-		function(types, method)
-		{
-			Router[ method ] = function(route, callback)
-			{
-				Router.bind({
-					route: route,
-					types: types.split(" "),
-					callback: callback
-				});
-			};
-		}
-	);
-
-	/**
-	Trigger the callback queue attached to the specified type and route
-
-	@method trigger
-	@param {String} type A space-separated list of request methods
-	@param {String} route The target route
-	@return {Undefined}
-	**/
-	Router.trigger = function trigger(type, route)
-	{
-
-	};
-
-	Jazz.Event.on(document.body, "click", function(e)
-	{
-		var target,
-			href;
-
-		target = e.target;
-
-		if(target.nodeName === "A"
-			&& !Jazz.String.contains(target.getAttribute("rel"), "external"))
-		{
-			href = target.getAttribute("href");
-
-			if(href.length && href.charAt(0) !== "#")
-			{
-				Router.trigger("get", href);
-			}
-		}
-	});
-
-	return Router;
-
-})(this, this.document));

build/jazz-0.1.1.min.js

-var Jazz=window.Jazz||{};Jazz.Util=(function(c,a,e){var d;d={};d.noop=function b(){};return d})(this,this.document);Jazz.Obj=(function(f,i,c){var d,a;d={};a=Object.prototype;d.create=function e(j){var k;if(Object.create){return Object.create(j)}k=function(){};k.prototype=j;return new k()};d.extend=function g(j,k){var l;for(l in k){j[l]=k[l]}};d.getType=function h(j){return/^\[object\s(.+)\]$/.exec(a.toString.call(j))[1]};d.isType=function b(k,j){return j===d.getType(k)};return d})(this,this.document);Jazz.Iter=(function(f,g,b){var a,i;a={};i=Array.prototype;a.forEach=function e(j,m){var l,k,n;if(Jazz.Obj.isType(j,"Array")){if(i.forEach){return i.forEach.call(j,m)}l=0;n=j.length>>>0;for(;l<n;l++){m.call(null,j[l],l,j)}}else{for(k in j){m.call(null,j[k],k,j)}}};a.inCollection=function d(j,k){return Jazz.Obj.isType(j,"Object")?k in j:a.indexOf(j,k)!==-1};a.indexOf=function h(m,n){var k,j,l;if(i.indexOf){return i.indexOf.call(m,n)}k=0;j=-1;l=m.length>>>0;for(;k<l;k++){if(n===m[k]){j=k;break}}return j};a.toArray=function c(j){return i.slice.call(j)};return a})(this,this.document);Jazz.String=(function(d,a,e){var c;c={};c.contains=function b(h,f){var g;g=new RegExp("(:?^|\\b)"+f+"(?:\\b|$)");return g.test(h)};return c})(this,this.document);Jazz.Func=(function(d,a,e){var c,b;c={};b=Function.prototype;c.bind=function g(i,h){if(b.bind){return b.bind.call(i,h)}return function(){i.call(h)}};c.method=function f(i,h,j){i.prototype[h]=j};return c})(this,this.document);Jazz.NS=(function(d,a,f){var c;c={};c.get=function b(i,h){var j,l,k;j=Jazz;l=i.split(".");for(k in l){if(!j.hasOwnProperty(k)){j=h;break}j=j[k]}return j};c.set=function g(h,k,j){var i,m,l;i=Jazz;m=h.split(".");for(l in m){if(!i.hasOwnProperty(l)){i[l]={};i=i[l]}}if(Jazz.Obj.isType(k,"Function")){i=k;Jazz.Obj.extend(i.prototype,j)}else{Jazz.Obj.extend(i,j)}};c.unset=function e(h){var i;i=c.get(h);if(i){i=f}};return c})(this,this.document);Jazz.Storage=(function(d,e,c){var i,a;a={};i=function i(j){this.values={};a[j]=this};Jazz.Obj.extend(i.prototype,{get:function b(k,j){return this.values.hasOwnProperty(k)?this.values[k]:j},set:function f(j,k){this.values[j]=k},unset:function h(j){if(this.values.hasOwnProperty(j)){delete this.values[j]}}});Jazz.Obj.extend(i,{load:function g(j){return a[j]||new i(j)}});return i})(this,this.document);Jazz.Event=(function(g,i,c){var n,d,a,m,k,l,h,b;h=false;b=true;n={};d=function d(o){this.nativeEvent=o;this.target=this.nativeEvent.target||this.nativeEvent.srcElement};Jazz.Obj.extend(d.prototype,{preventDefault:function f(){if("preventDefault" in this.nativeEvent){this.nativeEvent.preventDefault()}this.nativeEvent.returnValue=false},stopPropagation:function j(){if("stopPropagation" in this.nativeEvent){this.nativeEvent.stopPropagation()}this.nativeEvent.cancelbubble=true}});k=Jazz.Storage.load("event:listeners");a=function a(q,o,p){return k.set(q.toString(),function(r){q.call(p,new d(r||g.event))})};m=function m(o){return k.get(o.toString())||Jazz.Util.noop};l={on:{standard:function(q,o,p){q.addEventListener(o,a(p,o,q),false)},msie:function(q,o,p){q.attachEvent("on"+o,a(p,o,q))},fallback:function(q,o,p){q["on"+o]=a(p,o,q)}},off:{standard:function(q,o,p){q.removeEventListener(o,m(p),false)},msie:function(q,o,p){q.detachEvent("on"+o,m(p))},fallback:function(q,o,p){q["on"+o]=null}}};n.on=function e(r,p,q){var o;o=(b&&r===g&&p==="load")||(h&&r===i&&p==="DOMContentLoaded");if(o){a(q,p,r).call(null,new d({}));return}return n.on._method.apply(null,Jazz.Iter.toArray(arguments))};n.on._method=(g.addEventListener&&l.on.standard)||(g.attachEvent&&l.on.msie)||l.on.fallback;n.off=(g.removeEventListener&&l.off.standard)||(g.detachEvent&&l.off.msie)||l.off.fallback;return n})(this,this.document);(function(g,a,h){var f,b;f=g.ActiveXObject?function(){return new g.ActiveXObject("Microsoft.XMLHTTP")}:function(){return new g.XMLHttpRequest()};b=function b(l){var j,i,k;i=[];for(j in l){k=l[j];if(Jazz.Obj.isType(l[j],"Object")){k=b(l[j])}i.push(j+"="+k)}return i.join("&")};Jazz.NS.set("Ajax",{get:function c(j,k,i){return Jazz.Ajax.request({url:j,type:"GET",success:k,error:i})},post:function d(j,k,l,i){return Jazz.Ajax.request({url:j,data:k,type:"POST",success:l,error:i})},request:function e(j){var k,i,l;l=f();i={url:j.url||"",data:j.data||{},type:j.type||"GET",user:j.user||"",password:j.password||"",success:j.success||Jazz.Util.noop,error:j.error||Jazz.Util.noop};k=b(i.data);l.open(i.type,i.url,true,i.user,i.password);l.setRequestHeader("X-Requested-With","XMLHttpRequest");if(i.type==="POST"){Jazz.Iter.forEach({"Content-Type":"application/x-www-form-urlencoded","Content-Length":k.length,Connection:"close"},function(n,m){l.setRequestHeader(m,n)})}Jazz.Event.on(l,"readystatechange",function(m){if(this.readyState===4){if(this.status===200){i.success(this.responseText,l)}else{i.error(this)}}});l.send(i.data);return l}})})(this,this.document);Jazz.NS.set("Bootstrap",(function(g,j,d){var e,k,h,i;e=function e(){var n,m;m=this;this.callbacks=[];this.dependencies=null;this.resources=[];this.event=e.Config.get("event",{});this.defer=false;this.wait=0;n=Jazz.Iter.toArray(arguments);this.add.apply(this,n);if(!this.defer){if(this.event.hasOwnProperty("elem")&&this.event.hasOwnProperty("type")){Jazz.Event.on(this.event.elem,this.event.type,function(o){i(m)})}else{i(m)}}};Jazz.Iter.forEach(["Alias","Cache","Config"],function(m){e[m]=Jazz.Storage.load("bootstrap:"+m.toLowerCase())});e.Config.set("_loadEvent","addEventListener" in g?"load":"readystatechange");e.Config.set("event",{elem:g,type:"load"});k=function k(m){return !/^(?:https?:)?\/\//.test(m)};h=function h(m,n){if(!m.dependencies){n();return}h(m.dependencies,function(){var o;o=0;Jazz.Iter.forEach(m.resources,function(r){var q,p;if(e.Cache.get(r)){n();return}p=j.createElement("script");Jazz.Event.on(p,e.Config.get("_loadEvent","load"),function(t){var s;s=!this.readyState||this.readyState==="complete"||this.readyState==="loaded";if(s){o++;if(o===m.resources.length){e.Cache.set(r,true);n()}}});q=e.Alias.get(r,r);if(e.Config.get("debug")&&k(q)){q=q+"?_tstamp="+(new Date()).getTime()}p.setAttribute("src",q)})})};i=function i(n){var m;m=[n,function(){Jazz.Iter.forEach(n.callbacks,function(o){o()})}];g.setTimeout(function(){h.apply(null,m)},n.wait)};Jazz.Obj.extend(e.prototype,{add:function l(){this.resources=this.resource.concat(Jazz.Iter.toArray(arguments));return this},after:function a(m){this.callbacks.push(m)},delay:function(m){this.wait=m;return this},depends:function c(){var n,m;n=Jazz.Iter.toArray(arguments);m=this.dependencies||new e();m.defer=true;m.add.apply(m,n);return this},now:function b(){this.event={};return this.delay(0)},on:function f(n,m){this.event={elem:n,type:m};return this}});return e})(this,this.document));Jazz.NS.set("Prefetch",(function(g,j,c){var e,i,d,h,a,b;e=function e(){this.resources=Jazz.Iter.toArray(arguments);this._isTriggered=false};h=function h(l){Jazz.Iter.forEach(l.resources,function(n){var m;m=i(n);if(m==="image"){a(n)}else{if(d(n)){b(n)}}})};a=function a(n){var l,m;l=("attachEvent" in g)?"readystatechange":"load";m=j.createElement("image");Jazz.Event.on(m,l,function(){var o;o=!this.readyState||this.readyState==="complete"||this.readyState==="loaded";if(o){m=null}});m.setAttribute("src",n)};b=function b(l){Jazz.Ajax.get(l)};i=function i(n){var m,l;m=/([^\.]+)$/.exec(n);if(m){m=m[1].toLowerCase()}switch(m){case"png":case"jpg":case"jpeg":case"bmp":case"gif":l="image";break;default:l="text";break}return l};d=function d(m){var n,l=true;n=/^(?:https?:)?\/\/([^\/]+).*$/.exec(m);if(n){n=n[1];l=g.location.hostname===n}return l};Jazz.Obj.extend(e.prototype,{add:function k(){this.resources=this.resources.concat(Jazz.Iter.toArray(arguments));return this},on:function f(n,l){var m;if(this._isTriggered){h(this)}else{m=this;Jazz.Event.on(n,l,function(o){h(m)})}return this}});return e})(this,this.document));Jazz.NS.set("Template",(function(g,j,c){var h,e,d;e=function e(l){return new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj||{}){p.push('"+l.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');")};d=function d(m){var l,n,o;l=m.options.context;o=m.options.path;n=h.Cache.get(o);if(n){g.setTimeout(function(){n(l)},0);return}Jazz.Ajax.get(o,function(p){n=h.Config.get("engine",e)(p);n(l);h.Cache.set(o,n)})};h=function h(m,l){this.options={context:{},elem:null,path:m};this.callbacks={error:[],success:[]};Jazz.Iter.forEach(l,function(o,n){if(this.options.hasOwnProperty(n)){this.options[n]=o}});Jazz.Iter.forEach(["error","success"],function(n){if(l.hasOwnProperty(n)&&Jazz.Obj.isType(l[n],"Function")){this.callbacks[n].push(l[n])}});d(this)};Jazz.Iter.forEach(["Cache","Config","Engines"],function(l){h[l]=Jazz.Storage.load("template:"+l.toLowerCase())});Jazz.Obj.extend(h,{register:function k(l,m){h.Engines.set(l,m)},use:function a(l){h.Config.set("engine",h.Engines.get(l))}});Jazz.Obj.extend(h.prototype,{bind:function i(l){this.elem=l;return this},context:function b(m,l){if(l){Jazz.Obj.extend(this.options.context,m)}else{this.options.context=m}return this},on:function f(m,l){if(Jazz.Iter.inCollection(["error","success"],m)){this.callbacks.push(l)}return this}});return h})(this,this.document));Jazz.NS.set("Router",(function(e,a,f){var b,d;d=Jazz.Storage.load("router:routes");b={};b.bind=function g(i){var h;h={route:i.route||"/",types:i.types||["get","post"],callback:i.callback||Jazz.Util.noop};Jazz.Iter.forEach(h.types,function(l){var k,j;k=l+"://"+h.route;j=d.get(k,[]);j.push(h.callback);d.set(k,j)})};Jazz.Iter.forEach({any:"get post",get:"get",post:"post"},function(h,i){b[i]=function(j,k){b.bind({route:j,types:h.split(" "),callback:k})}});b.trigger=function c(i,h){};Jazz.Event.on(a.body,"click",function(j){var i,h;i=j.target;if(i.nodeName==="A"&&!Jazz.String.contains(i.getAttribute("rel"),"external")){h=i.getAttribute("href");if(h.length&&h.charAt(0)!=="#"){b.trigger("get",h)}}});return b})(this,this.document));