diff --git a/src/core/_boiler_.js b/src/core/_boiler_.js index bc7d0d7..b5a0f3f 100644 --- a/src/core/_boiler_.js +++ b/src/core/_boiler_.js @@ -1,21 +1,26 @@ -/* - * Here we define the frequently accessed core classes of boilerplatejs. We are creating a object - * that carry these classes as properties of it. This object is then used as a namespace when - * accessing the core classes. This is a trick we use to aggregate classes under namespaces - * since javascript has no formal way of grouping functions in to namespace. - */ -define(function (require) { - - /* - * Here you will notice we are not returning a function from this AMD module. We are returning a - * plain javascript object with its properties holding references to core classes (functions). - * We use 'require' function from requirejs inside the object to load appropriate core classes - * from the respective AMD modules. - */ - return { - Context : require("./core/context"), - DomController : require("./core/dom-controller"), - UrlController : require("./core/url-controller"), - UiPanel: require("./core/ui-panel") - }; +/* + * Here we define the frequently accessed core classes of boilerplatejs. We are creating a object + * that carry these classes as properties of it. This object is then used as a namespace when + * accessing the core classes. This is a trick we use to aggregate classes under namespaces + * since javascript has no formal way of grouping functions in to namespace. + */ +define(function (require) { + + /* + * Here you will notice we are not returning a function from this AMD module. We are returning a + * plain javascript object with its properties holding references to core classes (functions). + * We use 'require' function from requirejs inside the object to load appropriate core classes + * from the respective AMD modules. + */ + + /** + @type Script + @namespace Boiler + **/ + return { + Context : require("./core/context"), + DomController : require("./core/dom-controller"), + UrlController : require("./core/url-controller"), + UiPanel: require("./core/ui-panel") + }; }); diff --git a/src/core/context.js b/src/core/context.js index 8391a70..a26dcb7 100644 --- a/src/core/context.js +++ b/src/core/context.js @@ -1,150 +1,196 @@ -/* -* Context is one of the most important classes in boilerplate. This represents a sandboxed environment -* for writing group of functionalities. Contexts can be nested to create hierachies for complex -* implementations. -* For example, -* a product suit may have multiple products, -* and a product may have multiple modules, -* and a module may have multiple submodules. -* -* It is possible to create such hierachies by nesting contexts. Context can provide several -* necessary services such as 'settings store', 'pub-sub event infrastructure', 'logging', etc. -*/ -define(['./helpers/mediator', './helpers/settings', './helpers/storage', './helpers/localizer'], function (Mediator, Settings, Storage, Localizer) { - - /* - * This is the constructor function for the context and it takes a reference to a parent - * context. If supplied, it will be initialized to support chaining of it's functionalities. - * For example, all child contexts will inherit the settings of its parent contexts. Event notifications - * will bubble through the context hierachy so that inter context communication is possibe - * within a hierachy tree. - * - * Lets assign the function to a variable which we will be returning at the end of the script. Below - * the constructor function, you can find instance methods for Context class. This might appear strange - * since they are defined outside the class body and attached to 'prototype' of the class. Although it is - * possible to define methods within the class body, we use this approach for better performance. For - * more information read about prototypes in javascripts. - */ - var Context = function (uniqueId, parentContext) { - if (uniqueId) { - this.id = uniqueId; - } else { - throw "an id must be defined for a context"; - } - this.parentContext = parentContext; - this.mediator = this.parentContext ? this.parentContext.mediator : new Mediator(); - this.settings = this.parentContext ? new Settings(this.parentContext.settings) : new Settings(); - }; - - Context.prototype.getUid = function () { - return this.id; - }; - - /* - * This is the method to get settings from the context. This will return a object that has - * settings as object properties. Consimers can simply use the settings property keys - * to retrieve values. For example, context.getSettings().base-server-url will look for a - * setting object defined under 'base-server-url' preperty. - * - * If context is a part of a context hierachy, the settings object returned will contain - * settings of all parent contexts. Settings from child contexts will override settings from - * parent contexts, if same key exists. - * - * To improve performance, it is a good practice to store the returned object and reduce the - * number of calls to this method. - */ - Context.prototype.getSettings = function () { - return this.settings.items(); - }; - - /* - * One can pass an object containing settings as properties in it. If the existing - * settings contain properties with same key, those will be replaced. - */ - Context.prototype.addSettings = function (newSettings) { - this.settings.load(newSettings); - }; - - /* - * This is the method to raise an event in the context. All subscribers in the same context hierachy - * will be notified. first parameter is the event name as a string, and the next parameter is the - * event data as a object. - */ - Context.prototype.notify = function (event, params) { - this.mediator.notify(event, params); - }; - - /* - * The method for subscribing to recieve events. first parameter is the name of the event you wish - * to recieve. Next is the callback function incase event has occurred. Callback function may have a - * parameter in case it is interesting to recieve the event data as well. - */ - Context.prototype.listen = function (event, fn) { - this.mediator.listen(event, fn); - }; - - /* - * It is possible to use the context as a medium to share objects. Since context is usually - * passed arround, it serves the purpose of sharing well. - * @param {key} name of the object to store - * @param {objectToStore} object to store in - */ - Context.prototype.persistObject = function (key, objectToStore) { - Storage.persist(key, objectToStore); - }; - - /* - * Allows developers to retrieve objects that are stored (using 'store' method) in - * this context. - * @param {key} name of the object - * @return The stored object if found, else 'undefined' - */ - Context.prototype.retreiveObject = function (key) { - return Storage.retreive(key); - }; - - /* - * Removed the object stored in persistance store - * @param {key} name of the object to be removed - */ - Context.prototype.removeObject = function (key) { - return Storage.remove(key); - }; - - /* - * Set the language for the whole system. Will cause the page to refresh - */ - Context.prototype.setLanguage = function (lang) { - return Localizer.setLanguage(lang); - }; - - /* - * Clear any language settings stored. Falls back to browser language detection - */ - Context.prototype.clearLanguage = function () { - return Localizer.clearLanguage(); - }; - - - /* - * If someone is interested in obtaining the parent context, this method could be used. But it is not a - * good practice to work directly on contexts other than your immediate. Instead use events to communicate. - */ - Context.prototype.getParentContext = function () { - return this.parentContext; - }; - - /* - * Helper method to construct child contexts under this parent context. - * Children will recieve a reference to this object through a constructor argument. - */ - Context.prototype.loadChildContexts = function (children) { - for (var i = 0; i < children.length; i++) { - var ChildContextClass = children[i]; - new ChildContextClass(this); //initializes the module - } - }; - - //now we have built our Context class with methods. Lets return it so that callers may instantiate. - return Context; +define(['./helpers/mediator', './helpers/settings', './helpers/storage', './helpers/localizer'], function (Mediator, Settings, Storage, Localizer) { + + /* + * This is the constructor function for the context and it takes a reference to a parent + * context. If supplied, it will be initialized to support chaining of it's functionalities. + * For example, all child contexts will inherit the settings of its parent contexts. Event notifications + * will bubble through the context hierachy so that inter context communication is possibe + * within a hierachy tree. + * + * Lets assign the function to a variable which we will be returning at the end of the script. Below + * the constructor function, you can find instance methods for Context class. This might appear strange + * since they are defined outside the class body and attached to 'prototype' of the class. Although it is + * possible to define methods within the class body, we use this approach for better performance. For + * more information read about prototypes in javascripts. + */ + + /** + Context is one of the most important classes in boilerplate. This represents a sandboxed environment + for writing group of functionalities. Contexts can be nested to create hierachies for complex + implementations. + For example, + a product suit may have multiple products, + and a product may have multiple modules, + and a module may have multiple submodules. + + It is possible to create such hierachies by nesting contexts. Context can provide several + necessary services such as 'settings store', 'pub-sub event infrastructure', 'logging', etc. + + @namespace Boiler + @module BoilerCoreClasses + @class Context + @constructor + @param {Object} uniqueId + @param {Object} parentContext reference to a parent context + **/ + var Context = function (uniqueId, parentContext) { + if (uniqueId) { + this.id = uniqueId; + } else { + throw "an id must be defined for a context"; + } + this.parentContext = parentContext; + this.mediator = this.parentContext ? this.parentContext.mediator : new Mediator(); + this.settings = this.parentContext ? new Settings(this.parentContext.settings) : new Settings(); + }; + /** + Returns the context id + + @method getUid + @return {Object} context id + **/ + Context.prototype.getUid = function () { + return this.id; + }; + + /** + * This is the method to get settings from the context. This will return a object that has + * settings as object properties. Consimers can simply use the settings property keys + * to retrieve values. For example, context.getSettings().base-server-url will look for a + * setting object defined under 'base-server-url' preperty. + * + * If context is a part of a context hierachy, the settings object returned will contain + * settings of all parent contexts. Settings from child contexts will override settings from + * parent contexts, if same key exists. + * + * To improve performance, it is a good practice to store the returned object and reduce the + * number of calls to this method. + + @method getSettings + @return {Object} settings + **/ + Context.prototype.getSettings = function () { + return this.settings.items(); + }; + + /** + * One can pass an object containing settings as properties in it. If the existing + * settings contain properties with same key, those will be replaced. + + @method addSettings + @param {Object} newSettings object containing settings as properties in it + **/ + Context.prototype.addSettings = function (newSettings) { + this.settings.load(newSettings); + }; + + /** + * This is the method to raise an event in the context. All subscribers in the same context hierachy + * will be notified. first parameter is the event name as a string, and the next parameter is the + * event data as a object. + + @method notify + @param {String} event Event name + @param {Object} params Event data + **/ + Context.prototype.notify = function (event, params) { + this.mediator.notify(event, params); + }; + + /** + * The method for subscribing to recieve events. first parameter is the name of the event you wish + * to recieve. Next is the callback function incase event has occurred. Callback function may have a + * parameter in case it is interesting to recieve the event data as well. + + @method listen + @param {String} event Event name + @param {Object} fn Callback function + **/ + Context.prototype.listen = function (event, fn) { + this.mediator.listen(event, fn); + }; + + /** + * It is possible to use the context as a medium to share objects. Since context is usually + * passed arround, it serves the purpose of sharing well. + + @method persistObject + @param {String} key name of the object to store + @param {Object} objectToStore object to store in + **/ + Context.prototype.persistObject = function (key, objectToStore) { + Storage.persist(key, objectToStore); + }; + + /** + * Allows developers to retrieve objects that are stored (using 'store' method) in + * this context. + + @method retreiveObject + @param {String} key name of the object + @return {Object} object The stored object if found, else 'undefined' + **/ + Context.prototype.retreiveObject = function (key) { + return Storage.retreive(key); + }; + + /** + * Remove the object stored in persistance store. + + @method removeObject + @param {String} key Name of the object to be removed + @return {Object} object + **/ + Context.prototype.removeObject = function (key) { + return Storage.remove(key); + }; + + /** + * Set the language for the whole system. Will cause the page to refresh + + @method setLanguage + @param {String} lang + @return {Object} object + **/ + Context.prototype.setLanguage = function (lang) { + return Localizer.setLanguage(lang); + }; + + /** + * Clear any language settings stored. Falls back to browser language detection + + @method clearLanguage + @return {Object} object + **/ + Context.prototype.clearLanguage = function () { + return Localizer.clearLanguage(); + }; + + /** + * If someone is interested in obtaining the parent context, this method could be used. But it is not a + * good practice to work directly on contexts other than your immediate. Instead use events to communicate. + + @method getParentContext + @return {Object} parentContext Parent context object + **/ + Context.prototype.getParentContext = function () { + return this.parentContext; + }; + + /** + * Helper method to construct child contexts under this parent context. + * Children will recieve a reference to this object through a constructor argument. + + @method loadChildContexts + @param {ObjectArray} children + **/ + Context.prototype.loadChildContexts = function (children) { + for (var i = 0; i < children.length; i++) { + var ChildContextClass = children[i]; + new ChildContextClass(this); //initializes the module + } + }; + + //now we have built our Context class with methods. Lets return it so that callers may instantiate. + return Context; }); diff --git a/src/core/dom-controller.js b/src/core/dom-controller.js index 45e5b48..14ce343 100644 --- a/src/core/dom-controller.js +++ b/src/core/dom-controller.js @@ -1,30 +1,35 @@ -define([], function () { - - - var DomController = function (context) { - - var self = this; - self.handles = {}; - - return { - addRoutes: function (newHandles) { - _.extend(self.handles, newHandles); - }, - - start: function () { - for (path in self.handles) { - var HandlerClass = self.handles[path]; - $("." + path).each(function (index) { - var paramString = $(this).attr("params"); - var params = paramString ? eval("({" + paramString + "})") : {}; - var handlerObj = new HandlerClass(context); - handlerObj.activate($(this), params); - }); - } - } - }; - - }; - - return DomController; +define([], function () { + + /** + * dom-controller class + * @class DomController + * @constructor + * @param {Object} context + */ + var DomController = function (context) { + + var self = this; + self.handles = {}; + + return { + addRoutes: function (newHandles) { + _.extend(self.handles, newHandles); + }, + + start: function () { + for (path in self.handles) { + var HandlerClass = self.handles[path]; + $("." + path).each(function (index) { + var paramString = $(this).attr("params"); + var params = paramString ? eval("({" + paramString + "})") : {}; + var handlerObj = new HandlerClass(context); + handlerObj.activate($(this), params); + }); + } + } + }; + + }; + + return DomController; }); diff --git a/src/core/helpers/_helpers_.js b/src/core/helpers/_helpers_.js new file mode 100644 index 0000000..19fd612 --- /dev/null +++ b/src/core/helpers/_helpers_.js @@ -0,0 +1,16 @@ +define(function (require) { + + /** + @type Script + @namespace Boiler.Helpers + **/ + return { + Localizer : require("./core/helpers/localizer"), + Logger : require("./core/helpers/logger"), + Mediator : require("./core/helpers/mediator"), + Router : require("./core/helpers/router"), + Settings : require("./core/helpers/settings"), + Storage : require("./core/helpers/storage"), + Styler : require("./core/helpers/styler") + }; +}); diff --git a/src/core/helpers/localizer.js b/src/core/helpers/localizer.js index 4e005e8..78ab494 100644 --- a/src/core/helpers/localizer.js +++ b/src/core/helpers/localizer.js @@ -14,10 +14,24 @@ }); } - + /** + Localizer class + + @class Localizer + @constructor + **/ var Localizer = function() { }; + /** + Returns an object containing parameters for localization + + @method localize + @static + @param {Object} text + @param {Object} nlsObject + @return {Object} + **/ Localizer.localize = function(text, nlsObject) { var compiled = _.template(text); return compiled({ @@ -25,12 +39,25 @@ }); }; + /** + Sets the language + + @method setLanguage + @static + @param {Object} locale + **/ Localizer.setLanguage = function(locale) { console.log(locale); Storage.persist("user-language", locale); location.reload(); }; + /** + Reset the language to the default language + + @method clearLanguage + @static + **/ Localizer.clearLanguage = function() { Storage.remove("user-language"); location.reload(); diff --git a/src/core/ui-panel.js b/src/core/ui-panel.js index 8f999da..a60b6ea 100644 --- a/src/core/ui-panel.js +++ b/src/core/ui-panel.js @@ -1,51 +1,99 @@ -define(['./helpers/localizer', './helpers/styler'], function (Localizer, Styler) { - - var Panel = function (viewTemplate, parentEl, nls) { - this.viewId = this.createView(viewTemplate, parentEl, nls); - }; - - Panel.prototype.setStyleText = function(uniqueId, style) { - Styler.attachCssText(uniqueId, style); - }; - - Panel.prototype.dispose = function () { - $('#' + this.viewId).remove(); - }; - - Panel.prototype.getElementId = function () { - return this.viewId; - }; - - Panel.prototype.getJqueryElement = function () { - return $('#' + this.viewId); - }; - - Panel.prototype.getDomElement = function () { - return document.getElementById(this.viewId); - }; - - Panel.prototype.createView = function (viewText, parentElement, nls) { - // set defaults - containerType = ''; - parentElement = typeof parentElement !== 'undefined' ? parentElement : $('body'); - - //apply localization on the template - if(nls) { - viewText = Localizer.localize(viewText, nls); - } - - // create a random id for the child - var childId = _.uniqueId(['container_']); - // create the child container - - parentElement.append($(containerType, { - id : childId, - })); - // add template text to the child container as html - $('#' + childId).html(viewText); - - return childId; - }; - - return Panel; +define(['./helpers/localizer', './helpers/styler'], function (Localizer, Styler) { + + /** + ui-panel class + + @class Panel + @constructor + @param {Object} viewTemplate + @param {Object} parentEl + @param {Object} nls + **/ + var Panel = function (viewTemplate, parentEl, nls) { + this.viewId = this.createView(viewTemplate, parentEl, nls); + }; + + /** + Sets the style + + @method setStyleText + @param {Object} uniqueId + @param {Object} style + **/ + Panel.prototype.setStyleText = function(uniqueId, style) { + Styler.attachCssText(uniqueId, style); + }; + + /** + Dispose the view component + + @method dispose + **/ + Panel.prototype.dispose = function () { + $('#' + this.viewId).remove(); + }; + + /** + Returns the view id + + @method getElementId + @return viewId + **/ + Panel.prototype.getElementId = function () { + return this.viewId; + }; + + /** + Returns the jQuery element id + + @method getElementId + @return viewId + **/ + Panel.prototype.getJqueryElement = function () { + return $('#' + this.viewId); + }; + + /** + Returns the DOM element + + @method getDomElement + @return viewId + **/ + Panel.prototype.getDomElement = function () { + return document.getElementById(this.viewId); + }; + + /** + Creates a view + + @method createView + @param viewText + @param parentElement + @param nls + @return childId + **/ + Panel.prototype.createView = function (viewText, parentElement, nls) { + // set defaults + containerType = ''; + parentElement = typeof parentElement !== 'undefined' ? parentElement : $('body'); + + //apply localization on the template + if(nls) { + viewText = Localizer.localize(viewText, nls); + } + + // create a random id for the child + var childId = _.uniqueId(['container_']); + // create the child container + + parentElement.append($(containerType, { + id : childId, + })); + // add template text to the child container as html + $('#' + childId).html(viewText); + + return childId; + }; + + return Panel; }); diff --git a/src/core/url-controller.js b/src/core/url-controller.js index 1dbb7d1..559c2d0 100644 --- a/src/core/url-controller.js +++ b/src/core/url-controller.js @@ -1,50 +1,58 @@ -define(['./helpers/router'], function (Router) { - - var UrlController = function (context, parentEl) { - - var allHandles = {}; - var router = new Router(); - +define(['./helpers/router'], function (Router) { + /** + url-controller class + + @class UrlController + @uses This class uses 'router' as a dependency + @constructor + @param {Object} context + @param {Object} parentEl + **/ + var UrlController = function (context, parentEl) { + + var allHandles = {}; + var router = new Router(); + /* * Wrapper for handles. This allows us to intercept activation calls so * that we are able to execute custom logic such as deactivation of * other handles. - */ - function Wrapper(handle) { - var selfWrapper = this; - selfWrapper.handle = handle; - - this.activate = function (vals) { - // deactivate all active handles in current controller - parentEl.empty(); - // activate the requested handler - selfWrapper.handle.activate(parentEl, vals); - }; - - } - - return { - addRoutes: function (handles) { - for (path in handles) { - var HandlerClass = handles[path]; - var handlerObj = new Wrapper(new HandlerClass(context)); - router.addRoute(path, handlerObj.activate); - allHandles[path] = handlerObj; - } - - }, - - start: function () { - router.init(); - } - - }; - - }; - - UrlController.goTo = function (newPath) { - Router.routeTo(newPath); - }; - - return UrlController; + */ + function Wrapper(handle) { + var selfWrapper = this; + selfWrapper.handle = handle; + + this.activate = function (vals) { + // deactivate all active handles in current controller + parentEl.empty(); + // activate the requested handler + selfWrapper.handle.activate(parentEl, vals); + }; + + } + + return { + addRoutes: function (handles) { + for (path in handles) { + var HandlerClass = handles[path]; + var handlerObj = new Wrapper(new HandlerClass(context)); + router.addRoute(path, handlerObj.activate); + allHandles[path] = handlerObj; + } + + }, + + start: function () { + router.init(); + } + + }; + + }; + + UrlController.goTo = function (newPath) { + Router.routeTo(newPath); + }; + + return UrlController; }); diff --git a/src/global-context.js b/src/global-context.js index 6446aaf..2742f8c 100644 --- a/src/global-context.js +++ b/src/global-context.js @@ -1,30 +1,30 @@ -/* - * This file holds the function (or you may call it a 'class' if you are from .NET or Java world) - * to create a root context. 'Boiler.Context' can be nested to create a hierachy of contexts - * for complex implementations. Below we use requirejs to import following files - * '_boiler_' : Namespace for accessing the core boilerplate functions - * './settings' : The global setting ( to make available for all children contexts) - * './modules' : The object containing all sub module calsses - * - * Note: when we define the variables in AMD callback function, we use PascalCase for namespaces - * and classes ('Boiler' in the case), whereas object instances ('settings' and 'modules') - * are represented with camelCase variable names. - */ -define(["_boiler_", "./settings", "./modules/modules"], function (Boiler, settings, moduleContexts) { - - /* - * Following is our function representing GlobalContext 'class'. Others can import this - * script as a AMD module and they will obtain the function to be used as a 'class' in - * creating instances. - */ - var GlobalContext = function () { - //Lets use core Boiler classes to create our global context instance - var globalContext = new Boiler.Context("GlobalModule"); - //now lets add settings, which are to be available as global settings - globalContext.addSettings(settings); - //here we load the sub modules of the global context - globalContext.loadChildContexts(moduleContexts); - }; - - return GlobalContext; +/* + * This file holds the function (or you may call it a 'class' if you are from .NET or Java world) + * to create a root context. 'Boiler.Context' can be nested to create a hierachy of contexts + * for complex implementations. Below we use requirejs to import following files + * 'Boiler' : Namespace for accessing the core boilerplate functions + * './settings' : The global setting ( to make available for all children contexts) + * './modules' : The object containing all sub module calsses + * + * Note: when we define the variables in AMD callback function, we use PascalCase for namespaces + * and classes ('Boiler' in the case), whereas object instances ('settings' and 'modules') + * are represented with camelCase variable names. + */ +define(["Boiler", "./settings", "./modules/modules"], function (Boiler, settings, moduleContexts) { + + /* + * Following is our function representing GlobalContext 'class'. Others can import this + * script as a AMD module and they will obtain the function to be used as a 'class' in + * creating instances. + */ + var GlobalContext = function () { + //Lets use core Boiler classes to create our global context instance + var globalContext = new Boiler.Context("GlobalModule"); + //now lets add settings, which are to be available as global settings + globalContext.addSettings(settings); + //here we load the sub modules of the global context + globalContext.loadChildContexts(moduleContexts); + }; + + return GlobalContext; }); diff --git a/src/main.js b/src/main.js index 879b56f..e949840 100644 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ require.config({ i18n : '../libs/require/i18n', domReady : '../libs/require/domReady', // namespace that aggregate core classes that are in frequent use - _boiler_ : './core/_boiler_' + Boiler : './core/_boiler_' } }); diff --git a/src/modules/baseModule/language/route-handler.js b/src/modules/baseModule/language/route-handler.js index 9d985ae..e64eafc 100644 --- a/src/modules/baseModule/language/route-handler.js +++ b/src/modules/baseModule/language/route-handler.js @@ -1,27 +1,27 @@ -define(['_boiler_', 'text!./view.html', 'text!./style.css' ], function(Boiler, template, style) { - - var RouteHandler = function(moduleContext) { - return { - activate : function(parent) { - var panel = new Boiler.UiPanel(template, parent, null, style); - - panel.setStyleText("langPanelStylesheet", style); - - $('#langEn').click(function (event) { - moduleContext.setLanguage("en"); - }); - - $('#langSv').click(function (event) { - moduleContext.setLanguage("sv"); - }); - - $('#clearLang').click(function (event) { - moduleContext.clearLanguage(); - }); - } - }; - }; - - return RouteHandler; - +define(['Boiler', 'text!./view.html', 'text!./style.css' ], function(Boiler, template, style) { + + var RouteHandler = function(moduleContext) { + return { + activate : function(parent) { + var panel = new Boiler.UiPanel(template, parent, null, style); + + panel.setStyleText("langPanelStylesheet", style); + + $('#langEn').click(function (event) { + moduleContext.setLanguage("en"); + }); + + $('#langSv').click(function (event) { + moduleContext.setLanguage("sv"); + }); + + $('#clearLang').click(function (event) { + moduleContext.clearLanguage(); + }); + } + }; + }; + + return RouteHandler; + }); \ No newline at end of file diff --git a/src/modules/baseModule/mainMenu/route-handler.js b/src/modules/baseModule/mainMenu/route-handler.js index 1f04a6a..020b760 100644 --- a/src/modules/baseModule/mainMenu/route-handler.js +++ b/src/modules/baseModule/mainMenu/route-handler.js @@ -1,13 +1,13 @@ -define(['_boiler_', 'text!./view.html', 'i18n!./nls/resources' ], function(Boiler, template, nls) { - - var RouteHandler = function(moduleContext) { - return { - activate : function(parent) { - new Boiler.UiPanel(template, parent, nls); - } - }; - }; - - return RouteHandler; - +define(['Boiler', 'text!./view.html', 'i18n!./nls/resources' ], function(Boiler, template, nls) { + + var RouteHandler = function(moduleContext) { + return { + activate : function(parent) { + new Boiler.UiPanel(template, parent, nls); + } + }; + }; + + return RouteHandler; + }); \ No newline at end of file diff --git a/src/modules/baseModule/module-context.js b/src/modules/baseModule/module-context.js index 6378d50..e56bf05 100644 --- a/src/modules/baseModule/module-context.js +++ b/src/modules/baseModule/module-context.js @@ -1,5 +1,12 @@ -define(['_boiler_', './mainMenu/route-handler', './language/route-handler', './theme/route-handler'], function (Boiler, MainMenuRouteHandler, LanguageRouteHandler, ThemeRouteHandler) { - +define(['Boiler', './mainMenu/route-handler', './language/route-handler', './theme/route-handler'], function (Boiler, MainMenuRouteHandler, LanguageRouteHandler, ThemeRouteHandler) { + /** + This is the main entry point to the BaseModule + + @module BaseModule + @class BaseModuleContext + @constructor + @param {Object} globalContext + **/ var BaseModuleContext = function(globalContext) { var moduleContext = new Boiler.Context("baseModule", globalContext); var controller = new Boiler.DomController(moduleContext); diff --git a/src/modules/baseModule/theme/route-handler.js b/src/modules/baseModule/theme/route-handler.js index e127c21..dee3c01 100644 --- a/src/modules/baseModule/theme/route-handler.js +++ b/src/modules/baseModule/theme/route-handler.js @@ -1,52 +1,52 @@ -define(['_boiler_', 'text!./view.html', 'text!./style.css'], function(Boiler, template, componentStyle) { - - /** - * Lets define the themes we have in the system. We use CSS text to import appropriate - * CSS file when the theme is requested. - */ - var themes = { - red : "@import url('./assets/modules/baseModule/theme/red/common.css');", - gray : "@import url('./assets/modules/baseModule/theme/gray/common.css');" - }; - - var RouteHandler = function(moduleContext) { - //unique key of this sub-module to be used when necessary - var THEME_UNIQUE_KEY = "themeStylesheet"; - - - return { - //this is the method that will be called by the handler - activate : function(parent) { - var panel = new Boiler.UiPanel(template, parent); - panel.setStyleText("themeComponentStyle", componentStyle); - - - //if we have a stored theme setting lest use it OR use default - var storedThemeKey = moduleContext.retreiveObject(THEME_UNIQUE_KEY); - if (!storedThemeKey) { - storedThemeKey = "gray"; //default - } - - //lets use the panel to set style in header - panel.setStyleText(THEME_UNIQUE_KEY, themes[storedThemeKey]); - //set the current theme selected on the select box - $(".theme select").val(storedThemeKey); - - //lets handle the theme change event from the select - $(".theme select").change(function() { - var selection = $(".theme option:selected").val(); - //read the selected value - css = themes[selection]; - //set style in header - panel.setStyleText(THEME_UNIQUE_KEY, css); - //sale in the local store - moduleContext.persistObject(THEME_UNIQUE_KEY, selection); - }); - - } - }; - }; - - return RouteHandler; - -}); +define(['Boiler', 'text!./view.html', 'text!./style.css'], function(Boiler, template, componentStyle) { + + /** + * Lets define the themes we have in the system. We use CSS text to import appropriate + * CSS file when the theme is requested. + */ + var themes = { + red : "@import url('./assets/modules/baseModule/theme/red/common.css');", + gray : "@import url('./assets/modules/baseModule/theme/gray/common.css');" + }; + + var RouteHandler = function(moduleContext) { + //unique key of this sub-module to be used when necessary + var THEME_UNIQUE_KEY = "themeStylesheet"; + + + return { + //this is the method that will be called by the handler + activate : function(parent) { + var panel = new Boiler.UiPanel(template, parent); + panel.setStyleText("themeComponentStyle", componentStyle); + + + //if we have a stored theme setting lest use it OR use default + var storedThemeKey = moduleContext.retreiveObject(THEME_UNIQUE_KEY); + if (!storedThemeKey) { + storedThemeKey = "gray"; //default + } + + //lets use the panel to set style in header + panel.setStyleText(THEME_UNIQUE_KEY, themes[storedThemeKey]); + //set the current theme selected on the select box + $(".theme select").val(storedThemeKey); + + //lets handle the theme change event from the select + $(".theme select").change(function() { + var selection = $(".theme option:selected").val(); + //read the selected value + css = themes[selection]; + //set style in header + panel.setStyleText(THEME_UNIQUE_KEY, css); + //sale in the local store + moduleContext.persistObject(THEME_UNIQUE_KEY, selection); + }); + + } + }; + }; + + return RouteHandler; + +}); diff --git a/src/modules/sampleModule1/departments/component.js b/src/modules/sampleModule1/departments/component.js index b3bce92..bf343e5 100644 --- a/src/modules/sampleModule1/departments/component.js +++ b/src/modules/sampleModule1/departments/component.js @@ -1,12 +1,12 @@ -define(['_boiler_', 'text!./view.html', './viewmodel'], - function (Boiler, template, ViewModel) { - - var Component = function (moduleContext, parent, params) { - var panel = new Boiler.UiPanel(template, parent); - var vm = new ViewModel(moduleContext, params.initvalue); - ko.applyBindings(vm, panel.getDomElement()); - }; - - return Component; - +define(['Boiler', 'text!./view.html', './viewmodel'], + function (Boiler, template, ViewModel) { + + var Component = function (moduleContext, parent, params) { + var panel = new Boiler.UiPanel(template, parent); + var vm = new ViewModel(moduleContext, params.initvalue); + ko.applyBindings(vm, panel.getDomElement()); + }; + + return Component; + }); \ No newline at end of file diff --git a/src/modules/sampleModule1/helloEarth/component.js b/src/modules/sampleModule1/helloEarth/component.js index 57b36a7..124a591 100644 --- a/src/modules/sampleModule1/helloEarth/component.js +++ b/src/modules/sampleModule1/helloEarth/component.js @@ -1,12 +1,12 @@ -define(['_boiler_', 'text!./view.html'], - function (Boiler, template) { - - var Component = function (moduleContext, parent, vm) { - - var panel = new Boiler.UiPanel(template, parent); - ko.applyBindings(vm, panel.getDomElement()); - }; - - return Component; - +define(['Boiler', 'text!./view.html'], + function (Boiler, template) { + + var Component = function (moduleContext, parent, vm) { + + var panel = new Boiler.UiPanel(template, parent); + ko.applyBindings(vm, panel.getDomElement()); + }; + + return Component; + }); \ No newline at end of file diff --git a/src/modules/sampleModule1/module-context.js b/src/modules/sampleModule1/module-context.js index 08031af..68b1339 100644 --- a/src/modules/sampleModule1/module-context.js +++ b/src/modules/sampleModule1/module-context.js @@ -1,19 +1,19 @@ -define(['_boiler_', './routes', './settings'], function (Boiler, routes, settings) { - - var ModuleContext = function (globalContext) { - - var moduleContext = new Boiler.Context("sampleModule1", globalContext); - moduleContext.addSettings(settings); - - var controller = new Boiler.UrlController(moduleContext, $(".appcontent")); - controller.addRoutes(routes); - controller.start(); - - var controller = new Boiler.DomController(moduleContext); - controller.addRoutes(routes); - controller.start(); - }; - - return ModuleContext; - +define(['Boiler', './routes', './settings'], function (Boiler, routes, settings) { + + var ModuleContext = function (globalContext) { + + var moduleContext = new Boiler.Context("sampleModule1", globalContext); + moduleContext.addSettings(settings); + + var controller = new Boiler.UrlController(moduleContext, $(".appcontent")); + controller.addRoutes(routes); + controller.start(); + + var controller = new Boiler.DomController(moduleContext); + controller.addRoutes(routes); + controller.start(); + }; + + return ModuleContext; + }); \ No newline at end of file diff --git a/src/modules/sampleModule2/employeeDetails/component.js b/src/modules/sampleModule2/employeeDetails/component.js index a566e0a..98fea42 100644 --- a/src/modules/sampleModule2/employeeDetails/component.js +++ b/src/modules/sampleModule2/employeeDetails/component.js @@ -1,16 +1,16 @@ -define(['_boiler_', 'text!./view.html', './viewmodel'], function (Boiler, template, ViewModel) { - - - var Component = function (moduleContext, parent, id) { - var vm = new ViewModel(moduleContext, id); - var panel = new Boiler.UiPanel(template, parent); - ko.applyBindings(vm, panel.getDomElement()); - - this.dispose = function () { - panel.dispose(); - }; - }; - - return Component; - +define(['Boiler', 'text!./view.html', './viewmodel'], function (Boiler, template, ViewModel) { + + + var Component = function (moduleContext, parent, id) { + var vm = new ViewModel(moduleContext, id); + var panel = new Boiler.UiPanel(template, parent); + ko.applyBindings(vm, panel.getDomElement()); + + this.dispose = function () { + panel.dispose(); + }; + }; + + return Component; + }); \ No newline at end of file diff --git a/src/modules/sampleModule2/employeeList/component.js b/src/modules/sampleModule2/employeeList/component.js index 88b4009..affab45 100644 --- a/src/modules/sampleModule2/employeeList/component.js +++ b/src/modules/sampleModule2/employeeList/component.js @@ -1,12 +1,12 @@ -define(['_boiler_', 'text!./view.html', './viewmodel' ], function(Boiler, template, ViewModel) { - - - var Component = function (moduleContext, parent, params) { - var vm = new ViewModel(moduleContext); - var panel = new Boiler.UiPanel(template, parent); - ko.applyBindings(vm, panel.getDomElement()); - }; - +define(['Boiler', 'text!./view.html', './viewmodel' ], function(Boiler, template, ViewModel) { + + + var Component = function (moduleContext, parent, params) { + var vm = new ViewModel(moduleContext); + var panel = new Boiler.UiPanel(template, parent); + ko.applyBindings(vm, panel.getDomElement()); + }; + return Component; }); \ No newline at end of file diff --git a/src/modules/sampleModule2/employeeList/viewmodel.js b/src/modules/sampleModule2/employeeList/viewmodel.js index 742a768..ca4ecbc 100644 --- a/src/modules/sampleModule2/employeeList/viewmodel.js +++ b/src/modules/sampleModule2/employeeList/viewmodel.js @@ -1,19 +1,19 @@ -define(['_boiler_'], function (Boiler) { - - var ViewModel = function (moduleContext) { - var self = this; - this.salesPersons = ko.observableArray(); - - this.personClicked = function (person) { - Boiler.UrlController.goTo("employee/"+ person.id); - }; - - //load the data from the server - $.getJSON(moduleContext.getSettings().urls.employees, function (result) { - self.salesPersons(result); - }); - - }; - - return ViewModel; -}); +define(['Boiler'], function (Boiler) { + + var ViewModel = function (moduleContext) { + var self = this; + this.salesPersons = ko.observableArray(); + + this.personClicked = function (person) { + Boiler.UrlController.goTo("employee/"+ person.id); + }; + + //load the data from the server + $.getJSON(moduleContext.getSettings().urls.employees, function (result) { + self.salesPersons(result); + }); + + }; + + return ViewModel; +}); diff --git a/src/modules/sampleModule2/module-context.js b/src/modules/sampleModule2/module-context.js index 6d46978..553d726 100644 --- a/src/modules/sampleModule2/module-context.js +++ b/src/modules/sampleModule2/module-context.js @@ -1,14 +1,14 @@ -define(['_boiler_', './routes', './settings'], function (Boiler, routes, settings) { - - var ModuleContext = function (globalContext) { - var moduleContext = new Boiler.Context("sampleModule2", globalContext); - moduleContext.addSettings(settings); - - var controller = new Boiler.UrlController(moduleContext, $(".appcontent")); - controller.addRoutes(routes); - controller.start(); - }; - - return ModuleContext; - +define(['Boiler', './routes', './settings'], function (Boiler, routes, settings) { + + var ModuleContext = function (globalContext) { + var moduleContext = new Boiler.Context("sampleModule2", globalContext); + moduleContext.addSettings(settings); + + var controller = new Boiler.UrlController(moduleContext, $(".appcontent")); + controller.addRoutes(routes); + controller.start(); + }; + + return ModuleContext; + }); \ No newline at end of file diff --git a/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js b/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js index 88d3234..2789d18 100644 --- a/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js +++ b/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js @@ -1,7 +1,7 @@ -define([ '_boiler_', 'text!./view.html'],function( Boiler, viewText) { +define([ 'Boiler', 'text!./view.html'],function( Boiler, viewText) { var Component = function(vm, parentEl) { - var panel = new Boiler.UiPanel(viewText, parentEl); + var panel = new Boiler.UiPanel(viewText, parentEl); ko.applyBindings(vm, panel.getDomElement()); return{ diff --git a/src/modules/sampleModule2/salesDashboard/component.js b/src/modules/sampleModule2/salesDashboard/component.js index dcbe9a4..85d8eb0 100644 --- a/src/modules/sampleModule2/salesDashboard/component.js +++ b/src/modules/sampleModule2/salesDashboard/component.js @@ -1,4 +1,4 @@ -define([ '_boiler_', 'text!./view.html', './chartViewPanel/component', './treeViewPanel/component' ], +define([ 'Boiler', 'text!./view.html', './chartViewPanel/component', './treeViewPanel/component' ], function(Boiler, parentViewText, ChartViewComponent, TreeViewComponent) { var Component = function(parentEl, vm) { diff --git a/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js b/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js index 355c3f3..f43cba2 100644 --- a/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js +++ b/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js @@ -1,8 +1,8 @@ -define([ '_boiler_', 'text!./view.html'],function( Boiler, viewText) { +define([ 'Boiler', 'text!./view.html'],function( Boiler, viewText) { var Component = function(vm, parentEl) { - var panel = new Boiler.UiPanel(viewText, parentEl); + var panel = new Boiler.UiPanel(viewText, parentEl); ko.applyBindings(vm, panel.getDomElement()); return{ diff --git a/tests/tests.js b/tests/tests.js index 808c790..05ee124 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -1,21 +1,21 @@ -require.config({ - baseUrl : "../src/", //we will set the application's src folder as the base url -}); - -require.config({ - paths : { - text : './libs/require/text', - order : './libs/require/order', - i18n : './libs/require/i18n', - - _boiler_ : './core/_boiler_' - } -}); - - -require([ - '../tests/core/helpers/settings', - '../tests/core/helpers/router' , - '../tests/core/helpers/mediator' - -], function() {}); +require.config({ + baseUrl : "../src/", //we will set the application's src folder as the base url +}); + +require.config({ + paths : { + text : './libs/require/text', + order : './libs/require/order', + i18n : './libs/require/i18n', + + Boiler : './core/Boiler' + } +}); + + +require([ + '../tests/core/helpers/settings', + '../tests/core/helpers/router' , + '../tests/core/helpers/mediator' + +], function() {}); diff --git a/tools/documentation/README.md b/tools/documentation/README.md new file mode 100644 index 0000000..ffe0e69 --- /dev/null +++ b/tools/documentation/README.md @@ -0,0 +1,3 @@ +Download and install Node.js +Run npm -g install yuidocjs +Run document.bat (via Command line or by double clicking) \ No newline at end of file diff --git a/tools/documentation/document.bat b/tools/documentation/document.bat new file mode 100644 index 0000000..419fa4b --- /dev/null +++ b/tools/documentation/document.bat @@ -0,0 +1,6 @@ +set CURRENTDIR=%CD% +cd ../.. +yuidoc --themedir %CURRENTDIR%\template -o %CURRENTDIR%\docs src +cd \ +echo %CD% +cd %CURRENTDIR% \ No newline at end of file diff --git a/tools/documentation/template/assets/css/external-small.png b/tools/documentation/template/assets/css/external-small.png new file mode 100644 index 0000000..759a1cd Binary files /dev/null and b/tools/documentation/template/assets/css/external-small.png differ diff --git a/tools/documentation/template/assets/css/logo.png b/tools/documentation/template/assets/css/logo.png new file mode 100644 index 0000000..b7689e3 Binary files /dev/null and b/tools/documentation/template/assets/css/logo.png differ diff --git a/tools/documentation/template/assets/css/main.css b/tools/documentation/template/assets/css/main.css new file mode 100644 index 0000000..5b6e4db --- /dev/null +++ b/tools/documentation/template/assets/css/main.css @@ -0,0 +1,429 @@ +/* +Font sizes for all selectors other than the body are given in percentages, +with 100% equal to 13px. To calculate a font size percentage, multiply the +desired size in pixels by 7.6923076923. + +Here's a quick lookup table: + +10px - 76.923% +11px - 84.615% +12px - 92.308% +13px - 100% +14px - 107.692% +15px - 115.385% +16px - 123.077% +17px - 130.769% +18px - 138.462% +19px - 146.154% +20px - 153.846% +*/ + +html { + background: #fff; + color: #333; + overflow-y: scroll; +} + +body { + font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif; + margin: 0; + padding: 0; +} + +/* -- Links ----------------------------------------------------------------- */ +a { + color: #356de4; + text-decoration: none; +} + +a:hover { text-decoration: underline; } + +/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from + sight until it's focused. */ +.jump { + position: absolute; + padding: 3px 6px; + left: -99999px; + top: 0; +} + +.jump:focus { left: 40%; } + +/* -- Paragraphs ------------------------------------------------------------ */ +p { margin: 1.3em 0; } +dd p, td p { margin-bottom: 0; } +dd p:first-child, td p:first-child { margin-top: 0; } + +/* -- Headings -------------------------------------------------------------- */ +h1, h2, h3, h4, h5, h6 { + color: #D98527;/*was #f80*/ + font-family: 'Trebuchet MS', sans-serif; + font-weight: bold; + line-height: 1.1; + margin: 1.1em 0 0.5em; +} + +h1 { + font-size: 184.6%; + color: #30418C; + margin: 0.75em 0 0.5em; +} + +h2 { + font-size: 153.846%; + color: #E48A2B; +} + +h3 { font-size: 138.462%; } + +h4 { + border-bottom: 1px solid #DBDFEA; + color: #E48A2B; + font-size: 115.385%; + font-weight: normal; + padding-bottom: 2px; +} + +h5, h6 { font-size: 107.692%; } + +/* -- Code and examples ----------------------------------------------------- */ +code, kbd, pre, samp { + font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; + font-size: 92.308%; + line-height: 1.35; +} + +p code, p kbd, p samp { + background: #FCFBFA; + border: 1px solid #EFEEED; + padding: 0 3px; +} + +a code, a kbd, a samp, +pre code, pre kbd, pre samp, +table code, table kbd, table samp, +.intro code, .intro kbd, .intro samp, +.toc code, .toc kbd, .toc samp { + background: none; + border: none; + padding: 0; +} + +pre.code, pre.terminal, pre.cmd { + overflow-x: auto; + *overflow-x: scroll; + padding: 0.3em 0.6em; +} + +pre.code { + background: #FCFBFA; + border: 1px solid #EFEEED; + border-left-width: 5px; +} + +pre.terminal, pre.cmd { + background: #F0EFFC; + border: 1px solid #D0CBFB; + border-left: 5px solid #D0CBFB; +} + +/* Don't reduce the font size of // elements inside
+   blocks. */
+pre code, pre kbd, pre samp { font-size: 100%; }
+
+/* Used to denote text that shouldn't be selectable, such as line numbers or
+   shell prompts. Guess which browser this doesn't work in. */
+.noselect {
+    -moz-user-select: -moz-none;
+    -khtml-user-select: none;
+    -webkit-user-select: none;
+    -o-user-select: none;
+    user-select: none;
+}
+
+/* -- Lists ----------------------------------------------------------------- */
+dd { margin: 0.2em 0 0.7em 1em; }
+dl { margin: 1em 0; }
+dt { font-weight: bold; }
+
+/* -- Tables ---------------------------------------------------------------- */
+caption, th { text-align: left; }
+
+table {
+    border-collapse: collapse;
+    width: 100%;
+}
+
+td, th {
+    border: 1px solid #fff;
+    padding: 5px 12px;
+    vertical-align: top;
+}
+
+td { background: #E6E9F5; }
+td dl { margin: 0; }
+td dl dl { margin: 1em 0; }
+td pre:first-child { margin-top: 0; }
+
+th {
+    background: #D2D7E6;/*#97A0BF*/
+    border-bottom: none;
+    border-top: none;
+    color: #000;/*#FFF1D5*/
+    font-family: 'Trebuchet MS', sans-serif;
+    font-weight: bold;
+    line-height: 1.3;
+    white-space: nowrap;
+}
+
+
+/* -- Layout and Content ---------------------------------------------------- */
+#doc {
+    margin: auto;
+    min-width: 1024px;
+}
+
+#main { width: 754px; }
+#sidebar { width: 270px; margin: 0 15px; }
+
+.content { padding: 0 20px 0 25px; }
+
+/* -- Sidebar --------------------------------------------------------------- */
+.sidebox {
+    background: #F9F9FC;/*E6E9F5*/
+    border: 1px solid #D4D8EB;
+
+    -moz-border-radius: 4px;
+    -webkit-border-radius: 4px;
+    border-radius: 4px;
+    -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+    -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+    box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+    font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'Helvetica', 'Arial', sans-serif;
+    margin: 0 0 15px 0;
+    padding-bottom: 1px;
+}
+
+.sidebox h2 {
+    background: #E5E6F1;
+    -moz-border-radius: 4px 4px 0 0;
+    -webkit-border-radius: 4px 4px 0 0;
+    border-radius: 4px 4px 0 0;
+    color: #5E6BA4;
+    font-weight: bold;
+    font-size: 107.692%;
+    margin: 0;
+    padding: 4px 7px 5px;
+}
+
+.sidebox .bd {
+    font-size: 84.615%;
+    padding: 0 5px 0 8px;
+}
+
+.sidebox li { list-style-type: disc; color:#D4D5E3; }
+
+.sidebox ol, .sidebox ul {
+    margin-left: 0;
+    padding-left: 16px;
+}
+
+.sidebox ol ol, .sidebox ol ul,
+.sidebox ul ol, .sidebox ul ul {
+    margin: 0;
+    padding-left: 16px;
+}
+
+/* -- Table of Contents ----------------------------------------------------- */
+
+/* The #toc id refers to the single global table of contents, while the .toc
+   class refers to generic TOC lists that could be used throughout the page. */
+
+.toc code, .toc kbd, .toc samp { font-size: 100%; }
+.toc li { font-weight: bold; }
+.toc li li { font-weight: normal; }
+
+/* -- Intro and Example Boxes ----------------------------------------------- */
+.intro, .example { margin-bottom: 2em; }
+
+.example {
+    -moz-border-radius: 4px;
+    -webkit-border-radius: 4px;
+    border-radius: 4px;
+    -moz-box-shadow: 0 0 5px #bfbfbf;
+    -webkit-box-shadow: 0 0 5px #bfbfbf;
+    box-shadow: 0 0 5px #bfbfbf;
+    padding: 1em;
+}
+
+.intro {
+    background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
+}
+
+/* -- Other Styles ---------------------------------------------------------- */
+
+/* These are probably YUI-specific, and should be moved out of Selleck's default
+   theme. */
+
+.button {
+    border: 1px solid #dadada;
+    -moz-border-radius: 3px;
+    -webkit-border-radius: 3px;
+    border-radius: 3px;
+    color: #444;
+    display: inline-block;
+    font-family: Helvetica, Arial, sans-serif;
+    font-size: 92.308%;
+    font-weight: bold;
+    padding: 4px 13px 3px;
+    -moz-text-shadow: 1px 1px 0 #fff;
+    -webkit-text-shadow: 1px 1px 0 #fff;
+    text-shadow: 1px 1px 0 #fff;
+    white-space: nowrap;
+
+    background: #EFEFEF; /* old browsers */
+    background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
+    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
+    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
+}
+
+.button:hover {
+    border-color: #466899;
+    color: #fff;
+    text-decoration: none;
+    -moz-text-shadow: 1px 1px 0 #222;
+    -webkit-text-shadow: 1px 1px 0 #222;
+    text-shadow: 1px 1px 0 #222;
+
+    background: #6396D8; /* old browsers */
+    background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
+    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
+    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
+}
+
+.newwindow { text-align: center; }
+
+.header .version em {
+    display: block;
+    text-align: right;
+}
+
+.yui3-skin-sam #classdocs .yui3-tabview-panel {
+    background-color: transparent;
+}
+
+.yui3-skin-sam #classdocs .yui3-tabview-panel {
+    border: none;
+}
+
+.yui3-skin-sam .yui3-tabview .yui3-tab,
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected,
+.yui3-skin-sam .yui3-tabview .yui3-tab-hover {
+    background: -moz-linear-gradient(center top , #F4F0EC 0%, #D6D2CE 100%) repeat scroll 0 0 transparent;
+    border-bottom: 1px solid #DEDCD9;
+    border-right: 1px solid #CDCBC8;
+    border-left: 1px solid #CDCBC8;
+    border-top: 1px solid #DADADA;
+    color: #333333;
+    text-decoration: none;
+}
+.yui3-skin-sam .yui3-tabview .yui3-tab-label,
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected .yui3-tab-label {
+    border: none;
+    background: none;
+    font-size: 100%;
+    color: #000;
+}
+
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected,
+.yui3-skin-sam .yui3-tabview .yui3-tab-hover {
+    background: none;
+    background-color: #fff;
+    border-bottom-color: #FFFFFF;
+    border-top: 2px solid #8193C9;
+    font-weight: bold;
+    color: #000;
+
+}
+
+.yui3-skin-sam .yui3-tabview-list {
+    border-color: #DFDFDF;
+    border-width: 0 0 1px; 
+}
+
+
+a.external {
+    background-image: url(external-small.png);
+    background-repeat: no-repeat;
+    background-position: 0 0;
+    padding-left: 16px;
+}
+
+#classdocs .item {
+    border-bottom: 1px solid #466899;
+    margin: 1em 0;
+    padding: 1.5em;
+}
+
+#classdocs .item .params p,
+    #classdocs .item .returns p,{
+    display: inline;
+}
+
+#classdocs .item em code, #classdocs .item em.comment {
+    color: green;
+}
+
+#classdocs .item em.comment a {
+    color: green;
+    text-decoration: underline;
+}
+
+#classdocs .foundat {
+    font-size: 11px;
+    font-style: normal;
+}
+
+.attrs .emits {
+    margin-left: 2em;
+    padding: .5em;
+    border-left: 1px dashed #ccc;
+}
+
+abbr {
+    border-bottom: 1px dashed #ccc;
+    font-size: 80%;
+    cursor: help;
+}
+
+.prettyprint li.L0, 
+.prettyprint li.L1, 
+.prettyprint li.L2, 
+.prettyprint li.L3, 
+.prettyprint li.L5, 
+.prettyprint li.L6, 
+.prettyprint li.L7, 
+.prettyprint li.L8 {
+    list-style: decimal;
+}
+
+ul li p {
+    margin-top: 0;
+}
+
+.method .name {
+    font-size: 110%;
+}
+
+#hd {
+    background: -moz-linear-gradient(center top , #DCDBD9 0%, #F6F5F3 100%) repeat scroll 0 0 transparent;
+    border-bottom: 1px solid #DFDFDF;
+    padding: 0 15px 1px 20px;
+    margin-bottom: 15px;
+}
+
+#hd img {
+    margin-right: 10px;
+    vertical-align: middle;
+}
+
diff --git a/tools/documentation/template/assets/js/tabs.js b/tools/documentation/template/assets/js/tabs.js
new file mode 100644
index 0000000..77ab37c
--- /dev/null
+++ b/tools/documentation/template/assets/js/tabs.js
@@ -0,0 +1,38 @@
+YUI({
+    insertBefore: 'site_styles'
+}).use('tabview', function(Y) {
+    var classdocs = Y.one('#classdocs'),
+        tabviewIndexTable = {};
+    if (classdocs) {
+        if (classdocs.all('li').size()) {
+            var tabview = new Y.TabView({ srcNode: classdocs });
+            tabview.render();
+			classdocs.all('li a').each(function (item, index) {
+				var hash = item.get(['hash']);
+					type = hash.substring(1);
+				if (!tabviewIndexTable[type]) {
+					tabviewIndexTable[type] = index;
+				}
+			})
+			Y.all('.sidebox.on-page').each(function (item, index) {
+				var children = item.all('li a');
+				children.each(function (cItem, cIndex) {
+					return function () {
+						var handleClick = function (e) {
+							var node      = Y.one(this),
+								hash      = node.get(['hash']),
+								hashValue = hash.substring(1).split('_'),
+								type      = hashValue.shift(),
+								ogKey     = hashValue.join('_'); // in case the hash had other underscores
+							if (tabviewIndexTable[type] > -1 && tabviewIndexTable[type] !== currentTab) {
+								currentTab = tabviewIndexTable[type];
+								tabview.selectChild(tabviewIndexTable[type]);
+							}
+						}
+						Y.on('click', handleClick, cItem)
+					}()
+				})
+			});
+        }
+    }
+});
diff --git a/tools/documentation/template/assets/js/yui-prettify.js b/tools/documentation/template/assets/js/yui-prettify.js
new file mode 100644
index 0000000..18de864
--- /dev/null
+++ b/tools/documentation/template/assets/js/yui-prettify.js
@@ -0,0 +1,17 @@
+YUI().use('node', function(Y) {
+    var code = Y.all('.prettyprint.linenums');
+    if (code.size()) {
+        code.each(function(c) {
+            var lis = c.all('ol li'),
+                l = 1;
+            lis.each(function(n) {
+                n.prepend('');
+                l++;
+            });
+        });
+        var h = location.hash;
+        location.hash = '';
+        h = h.replace('LINE_', 'LINENUM_');
+        location.hash = h;
+    }
+});
diff --git a/tools/documentation/template/assets/vendor/prettify/CHANGES.html b/tools/documentation/template/assets/vendor/prettify/CHANGES.html
new file mode 100644
index 0000000..b50b841
--- /dev/null
+++ b/tools/documentation/template/assets/vendor/prettify/CHANGES.html
@@ -0,0 +1,130 @@
+
+  
+    
+    Change Log
+  
+  
+    README
+
+    

Known Issues

+
    +
  • Perl formatting is really crappy. Partly because the author is lazy and + partly because Perl is + hard to parse. +
  • On some browsers, <code> elements with newlines in the text + which use CSS to specify white-space:pre will have the newlines + improperly stripped if the element is not attached to the document at the time + the stripping is done. Also, on IE 6, all newlines will be stripped from + <code> elements because of the way IE6 produces + innerHTML. Workaround: use <pre> for code with + newlines. +
+ +

Change Log

+

29 March 2007

+
    +
  • Added tests for PHP support + to address + issue 3. +
  • Fixed + bug: prettyPrintOne was not halting. This was not + reachable through the normal entry point. +
  • Fixed + bug: recursing into a script block or PHP tag that was not properly + closed would not silently drop the content. + (test) +
  • Fixed + bug: was eating tabs + (test) +
  • Fixed entity handling so that the caveat +
    +

    Caveats: please properly escape less-thans. x&lt;y + instead of x<y, and use " instead of + &quot; for string delimiters.

    +
    + is no longer applicable. +
  • Added noisefree's C# + patch +
  • Added a distribution that has comments and + whitespace removed to reduce download size from 45.5kB to 12.8kB. +
+

4 Jul 2008

+
    +
  • Added language specific formatters that are triggered by the presence + of a lang-<language-file-extension>
  • +
  • Fixed bug: python handling of '''string''' +
  • Fixed bug: / in regex [charsets] should not end regex +
+

5 Jul 2008

+
    +
  • Defined language extensions for Lisp and Lua +
+

14 Jul 2008

+
    +
  • Language handlers for F#, OCAML, SQL +
  • Support for nocode spans to allow embedding of line + numbers and code annotations which should not be styled or otherwise + affect the tokenization of prettified code. + See the issue 22 + testcase. +
+

6 Jan 2009

+
    +
  • Language handlers for Visual Basic, Haskell, CSS, and WikiText
  • +
  • Added .mxml extension to the markup style handler for + Flex MXML files. See + issue 37. +
  • Added .m extension to the C style handler so that Objective + C source files properly highlight. See + issue 58. +
  • Changed HTML lexer to use the same embedded source mechanism as the + wiki language handler, and changed to use the registered + CSS handler for STYLE element content. +
+

21 May 2009

+
    +
  • Rewrote to improve performance on large files. + See benchmarks.
  • +
  • Fixed bugs with highlighting of Haskell line comments, Lisp + number literals, Lua strings, C preprocessor directives, + newlines in Wiki code on Windows, and newlines in IE6.
  • +
+

14 August 2009

+
    +
  • Fixed prettifying of <code> blocks with embedded newlines. +
+

3 October 2009

+
    +
  • Fixed prettifying of XML/HTML tags that contain uppercase letters. +
+

19 July 2010

+
    +
  • Added support for line numbers. Bug + 22
  • +
  • Added YAML support. Bug + 123
  • +
  • Added VHDL support courtesy Le Poussin.
  • +
  • IE performance improvements. Bug + 102 courtesy jacobly.
  • +
  • A variety of markup formatting fixes courtesy smain and thezbyg.
  • +
  • Fixed copy and paste in IE[678]. +
  • Changed output to use &#160; instead of + &nbsp; so that the output works when embedded in XML. + Bug + 108.
  • +
+ + diff --git a/tools/documentation/template/assets/vendor/prettify/COPYING b/tools/documentation/template/assets/vendor/prettify/COPYING new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/tools/documentation/template/assets/vendor/prettify/COPYING @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tools/documentation/template/assets/vendor/prettify/README.html b/tools/documentation/template/assets/vendor/prettify/README.html new file mode 100644 index 0000000..c6fe1a3 --- /dev/null +++ b/tools/documentation/template/assets/vendor/prettify/README.html @@ -0,0 +1,203 @@ + + + + + Javascript code prettifier + + + + + + + + + + Languages : CH +

Javascript code prettifier

+ +

Setup

+
    +
  1. Download a distribution +
  2. Include the script and stylesheets in your document + (you will need to make sure the css and js file are on your server, and + adjust the paths in the script and link tag) +
    +<link href="prettify.css" type="text/css" rel="stylesheet" />
    +<script type="text/javascript" src="prettify.js"></script>
    +
  3. Add onload="prettyPrint()" to your + document's body tag. +
  4. Modify the stylesheet to get the coloring you prefer
  5. +
+ +

Usage

+

Put code snippets in + <pre class="prettyprint">...</pre> + or <code class="prettyprint">...</code> + and it will automatically be pretty printed. + + + + +
The original + Prettier +
class Voila {
+public:
+  // Voila
+  static const string VOILA = "Voila";
+
+  // will not interfere with embedded tags.
+}
+ +
class Voila {
+public:
+  // Voila
+  static const string VOILA = "Voila";
+
+  // will not interfere with embedded tags.
+}
+
+ +

FAQ

+

Which languages does it work for?

+

The comments in prettify.js are authoritative but the lexer + should work on a number of languages including C and friends, + Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. + It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl + and Ruby, but, because of commenting conventions, doesn't work on + Smalltalk, or CAML-like languages.

+ +

LISPy languages are supported via an extension: + lang-lisp.js.

+

And similarly for + CSS, + Haskell, + Lua, + OCAML, SML, F#, + Visual Basic, + SQL, + Protocol Buffers, and + WikiText.. + +

If you'd like to add an extension for your favorite language, please + look at src/lang-lisp.js and file an + issue including your language extension, and a testcase.

+ +

How do I specify which language my code is in?

+

You don't need to specify the language since prettyprint() + will guess. You can specify a language by specifying the language extension + along with the prettyprint class like so:

+
<pre class="prettyprint lang-html">
+  The lang-* class specifies the language file extensions.
+  File extensions supported by default include
+    "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
+    "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
+    "xhtml", "xml", "xsl".
+</pre>
+ +

It doesn't work on <obfuscated code sample>?

+

Yes. Prettifying obfuscated code is like putting lipstick on a pig + — i.e. outside the scope of this tool.

+ +

Which browsers does it work with?

+

It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. + Look at the test page to see if it + works in your browser.

+ +

What's changed?

+

See the change log

+ +

Why doesn't Prettyprinting of strings work on WordPress?

+

Apparently wordpress does "smart quoting" which changes close quotes. + This causes end quotes to not match up with open quotes. +

This breaks prettifying as well as copying and pasting of code samples. + See + WordPress's help center for info on how to stop smart quoting of code + snippets.

+ +

How do I put line numbers in my code?

+

You can use the linenums class to turn on line + numbering. If your code doesn't start at line number 1, you can + add a colon and a line number to the end of that class as in + linenums:52. + +

For example +

<pre class="prettyprint linenums:4"
+>// This is line 4.
+foo();
+bar();
+baz();
+boo();
+far();
+faz();
+<pre>
+ produces +
// This is line 4.
+foo();
+bar();
+baz();
+boo();
+far();
+faz();
+
+ +

How do I prevent a portion of markup from being marked as code?

+

You can use the nocode class to identify a span of markup + that is not code. +

<pre class=prettyprint>
+int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
+  Continuation of comment */
+int y = bar();
+</pre>
+produces +
+int x = foo();  /* This is a comment  This is not code
+  Continuation of comment */
+int y = bar();
+
+ +

For a more complete example see the issue22 + testcase.

+ +

I get an error message "a is not a function" or "opt_whenDone is not a function"

+

If you are calling prettyPrint via an event handler, wrap it in a function. + Instead of doing +

+ addEventListener('load', prettyPrint, false); +
+ wrap it in a closure like +
+ addEventListener('load', function (event) { prettyPrint() }, false); +
+ so that the browser does not pass an event object to prettyPrint which + will confuse it. + +


+ + + + diff --git a/tools/documentation/template/assets/vendor/prettify/prettify-min.css b/tools/documentation/template/assets/vendor/prettify/prettify-min.css new file mode 100644 index 0000000..9b554aa --- /dev/null +++ b/tools/documentation/template/assets/vendor/prettify/prettify-min.css @@ -0,0 +1 @@ +.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} \ No newline at end of file diff --git a/tools/documentation/template/assets/vendor/prettify/prettify-min.js b/tools/documentation/template/assets/vendor/prettify/prettify-min.js new file mode 100644 index 0000000..3dec993 --- /dev/null +++ b/tools/documentation/template/assets/vendor/prettify/prettify-min.js @@ -0,0 +1,35 @@ +window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y}; +(function(){function y(b){return b.replace(L,"&").replace(M,"<").replace(N,">")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name"); +for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1), +8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;eh[0]){h[1]+1>h[0]&&a.push("-"); +a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b, +f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, +null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, +null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, +null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("");j=null}if(!j&&q){j=q;n.push('')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1 ");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g, +d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?" \r\n":h===7?" 
\r":" \r":" 
":"
";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'
  • ';var F=g[1]&&g[1].length?g[1]-1:0;n.push('
    1. ");s=function(){var D=v[++F%10];return j?""+D+'':D}}else s=h; +for(;;)if(m");j=null}n.push(o[m+1]);m+=2}else if(t");g&&n.push("
    ");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja, +"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=", +"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=//g,X=/\"/g,ea=/</g,fa=/>/g,ga=/'/g,ha=/"/g,ja=/&/g,ia=/ /g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|