forked from Botanical/BotanJS
72 lines
1.5 KiB
JavaScript
72 lines
1.5 KiB
JavaScript
|
(function(){
|
||
|
var ns = __namespace( "Astro.Bootstrap" );
|
||
|
var debug = __import( "System.Debug" );
|
||
|
|
||
|
// __import( "Dandelion.CSSReset" ); CSS_RESERVATION
|
||
|
// __import( "Dandelion.CSSAnimations" ); CSS_RESERVATION
|
||
|
|
||
|
var infs = [];
|
||
|
|
||
|
// Init Helper, body onload
|
||
|
var regInitFunc = function( f ) { infs[ infs.length ] = f; };
|
||
|
|
||
|
var inited = false;
|
||
|
var consoleExists = false;
|
||
|
var SyntaxHighlighterExists = false;
|
||
|
var CConsole = "Components.Console";
|
||
|
|
||
|
var SyntaxHighlighter = "Libraries.SyntaxHighlighter";
|
||
|
|
||
|
var init = function()
|
||
|
{
|
||
|
if( inited ) return;
|
||
|
inited = true;
|
||
|
|
||
|
if( consoleExists )
|
||
|
{
|
||
|
// The + is to prevent resolver resolving this class
|
||
|
// since this is optional
|
||
|
new ( __import( CConsole ) );
|
||
|
}
|
||
|
|
||
|
var l = infs.length;
|
||
|
debug.Info( "[Astro.Blog] init(" + l + ")" );
|
||
|
for( var i = 0; i < l; i ++ )
|
||
|
{
|
||
|
infs[i]();
|
||
|
}
|
||
|
|
||
|
if( SyntaxHighlighterExists )
|
||
|
{
|
||
|
debug.Info( "[SyntaxHighlighter] Initializing" );
|
||
|
|
||
|
/** @type {Libraries.SyntaxHighlighter} */
|
||
|
var synt = __import( SyntaxHighlighter );
|
||
|
synt.highlight();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/*{{{ Class Catching */
|
||
|
BotanJS.addEventListener( "NS_EXPORT", function( e )
|
||
|
{
|
||
|
switch( e.data.name )
|
||
|
{
|
||
|
case CConsole:
|
||
|
consoleExists = true;
|
||
|
break;
|
||
|
case SyntaxHighlighter:
|
||
|
SyntaxHighlighterExists = true;
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
try {
|
||
|
__import( CConsole );
|
||
|
consoleExists = true;
|
||
|
} catch( e ) { };
|
||
|
/* End Console Catching }}}*/
|
||
|
|
||
|
ns[ NS_EXPORT ]( EX_FUNC, "init", init );
|
||
|
ns[ NS_EXPORT ]( EX_FUNC, "regInit", regInitFunc )
|
||
|
})();
|