this.hashPrefix='!';//Should be empty or null if no html5 search engine framework is not being used.
this.isLoading=false;
this.postLoadHandler=null;
//
// Applications should alter this value. Use #!/xxx if using HTML5's search engine protocols.
//
this.defaultUrl='#/landing';
//
// These page classes can be modified by the website to include any style class that might be applied to a page section viewed through the layout manager.
// If no metadata is provide for a view, or for any property of a view, then the defaults will be used (url is derrived from the view name by adding .html, the rest are null).
// Example:
// layoutManager.viewMetadata = {
// home: {
// url: 'home.html',
// classes: ['fullPage'],
// load: 'alert("starting loading home");',
// loaded: 'alert("loaded home");',
// unload: 'alert("starting unloading home");',
// unloaded: 'alert("unloaded home");',
// fadeIn: 'menuBar, leftNav',
// fadeOut: 'bottomBar'
// },
// anotherViewName: {...}
// }
//
this.viewMetadata={};
//
// The defaults to be used for the view metadata if any values are not provided for a view. Any value may be empty. Url is not utilized (url's default to the view name + ".html").
// Sets the handler to be run immediately or after the display currently being shown is completed.
// @param fn The function to be run. This allows the code to change the display, even if the display is in the middle of changing.
//
this.setPostLoadHandler=function(fn){
if(_this.isLoading){
_this.postLoadHandler=fn;
}
else{
fn();
}
}
//
// Displays the new URL and hides the lastUrl.
// Passed elements can define "load", "loaded", "unload", and "unloaded" functions (as attributes OR as jquery 'data') that will be called. The present tense functions will be called prior to the fades and are passed the jquery element object, along with a LayoutManager instance allowing alterations of what becomes visible and invisible. The past tense functions are called after the fades and are passed only the jquery elements involved.
// Passed elements may also have attributes OR jquery 'data' named: 'fadeIn' and 'fadeOut' that each contain a jquery object, or a comma delimited list of jquery selectors to fade IN and OUT upon loading (these lists fade type are inverted when unloading).
//If there is a load function then call it now passing the element being displayed, and the fadeManager reference.//
if(unloadFunction){
if(typeofunloadFunction=='string'){
if(unloadFunction.length>0){
varelement=oldContainer;
//Call the unload function passing the jquery object for the element being unloaded and hidden, and the fade manager so that additional fade in/out's can be specified.//
eval(unloadFunction);
}
}
else{
//Call the unload function passing the jquery object for the element being unloaded and hidden, and the fade manager so that additional fade in/out's can be specified.//
unloadFunction(oldContainer,fadeManager);
}
}
if(loadFunction){
if(typeofloadFunction=='string'){
if(loadFunction.length>0){
varelement=container;
//Call the load function passing the jquery object for the element being unloaded and hidden, and the fade manager so that additional fade in/out's can be specified.//
eval(loadFunction);
}
}
else{
//Call the load function passing the jquery object for the element being loaded and displayed, and the fade manager so that additional fade in/out's can be specified.//
loadFunction(container,fadeManager);
}
}
//Remove fade elements that match. No reason to fade things out and in at the same time.//