From d887480cc3da8a7b96857f6e85c017f6bcf6ad3c Mon Sep 17 00:00:00 2001 From: Taka Kojima Date: Sun, 5 Feb 2012 05:35:18 -0800 Subject: [PATCH] Refactor, getting rid of JSDocs, documentation lives better outside of src code, also making lots of changes for better usage inside a node.js environment --- Makefile | 17 +- bin/minion-cli.js | 7 +- bin/minion.Interface.js | 7 +- bin/minion.js | 1456 ----------------- dist/minion-1.4.4.js | 4 +- dist/minion-1.4.4.min.js | 4 +- dist/minion-latest.js | 4 +- dist/minion-latest.min.js | 4 +- getting_started.md => docs/getting_started.md | 0 {bin => docs}/sample.conf.json | 0 gh-pages | 1 - {src => lib}/minion.baseclass.js | 14 +- {src => lib}/minion.class.js | 28 +- {src => lib}/minion.header.js | 2 +- lib/minion.js | 16 + {src => lib}/minion.main.js | 94 +- lib/minion.node.js | 12 + {src => lib}/minion.notifications.js | 20 - {src => lib}/minion.singleton.js | 13 +- {src => lib}/minion.static.js | 6 - lib/version.txt | 1 + package.json | 12 +- readme.md | 36 +- src/jsdoc-conf.json | 27 - src/minion-jsdoc-template/README.md | 191 --- src/minion-jsdoc-template/allclasses.tmpl | 17 - src/minion-jsdoc-template/allfiles.tmpl | 58 - src/minion-jsdoc-template/class.tmpl | 599 ------- src/minion-jsdoc-template/class.tmpl_old | 647 -------- src/minion-jsdoc-template/docsindex.tmpl | 9 - src/minion-jsdoc-template/header.html | 2 - src/minion-jsdoc-template/index.tmpl | 65 - src/minion-jsdoc-template/js/htmlparser.js | 310 ---- src/minion-jsdoc-template/js/jsdom.js | 508 ------ .../js/mootools-1.2.4-core-server.js | 1092 ------------- src/minion-jsdoc-template/js/showdown.js | 419 ----- .../js/showdown_license.txt | 34 - src/minion-jsdoc-template/publish.js | 533 ------ src/minion-jsdoc-template/static/blue.css | 247 --- src/minion-jsdoc-template/static/default.css | 266 --- src/minion-jsdoc-template/symbol.tmpl | 35 - src/minion-jsdoc-template/symbolindex.tmpl | 90 - src/minion-jsdoc-template/userdoc.tmpl | 35 - 43 files changed, 85 insertions(+), 6857 deletions(-) delete mode 100644 bin/minion.js rename getting_started.md => docs/getting_started.md (100%) rename {bin => docs}/sample.conf.json (100%) delete mode 160000 gh-pages rename {src => lib}/minion.baseclass.js (91%) rename {src => lib}/minion.class.js (72%) rename {src => lib}/minion.header.js (69%) create mode 100644 lib/minion.js rename {src => lib}/minion.main.js (79%) create mode 100644 lib/minion.node.js rename {src => lib}/minion.notifications.js (90%) rename {src => lib}/minion.singleton.js (79%) rename {src => lib}/minion.static.js (74%) create mode 100644 lib/version.txt delete mode 100644 src/jsdoc-conf.json delete mode 100755 src/minion-jsdoc-template/README.md delete mode 100755 src/minion-jsdoc-template/allclasses.tmpl delete mode 100755 src/minion-jsdoc-template/allfiles.tmpl delete mode 100755 src/minion-jsdoc-template/class.tmpl delete mode 100755 src/minion-jsdoc-template/class.tmpl_old delete mode 100755 src/minion-jsdoc-template/docsindex.tmpl delete mode 100755 src/minion-jsdoc-template/header.html delete mode 100755 src/minion-jsdoc-template/index.tmpl delete mode 100755 src/minion-jsdoc-template/js/htmlparser.js delete mode 100755 src/minion-jsdoc-template/js/jsdom.js delete mode 100755 src/minion-jsdoc-template/js/mootools-1.2.4-core-server.js delete mode 100755 src/minion-jsdoc-template/js/showdown.js delete mode 100755 src/minion-jsdoc-template/js/showdown_license.txt delete mode 100755 src/minion-jsdoc-template/publish.js delete mode 100755 src/minion-jsdoc-template/static/blue.css delete mode 100755 src/minion-jsdoc-template/static/default.css delete mode 100755 src/minion-jsdoc-template/symbol.tmpl delete mode 100755 src/minion-jsdoc-template/symbolindex.tmpl delete mode 100755 src/minion-jsdoc-template/userdoc.tmpl diff --git a/Makefile b/Makefile index 2a23713..e2cd615 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ OVERRIDING=default -SRC_DIR = src +SRC_DIR = lib TEST_DIR = test PREFIX = . @@ -39,7 +39,7 @@ b=0 all: core node -core: min docs +core: min @@echo "minion build complete." minion: @@ -53,30 +53,21 @@ minion: sed 's/@VERSION/'"${VER}"'/' > ${minion}; @@cp ${minion} ${minion_LATEST} - @@cp ${minion} ${PREFIX}/bin/minion.js; min: minion @@${COMPILER} ${minion} > ${minion_MIN} @@cat ${HEADER} ${minion_MIN} | \ sed 's/@DATE/'"${DATE}"'/' | \ - sed 's/@VERSION/'"${VER}"'/' > bin/tmp + sed 's/@VERSION/'"${VER}"'/' > tmp - @@mv bin/tmp ${minion_MIN} + @@mv tmp ${minion_MIN} @@cp ${minion_MIN} ${minion_LATEST_MIN} -docs: minion - node_modules/jsdoc-toolkit/app/run.js -c=${SRC_DIR}/jsdoc-conf.json - size: minion min @@gzip -c ${minion_MIN} > ${minion_MIN}.gz; \ wc -c ${minion} ${minion_MIN} ${minion_MIN}.gz; @@rm ${minion_MIN}.gz; \ -push_docs: docs - cd gh-pages; git add .; \ - git commit -am "updated docs"; \ - git push origin gh-pages - node: @@node make.js \ No newline at end of file diff --git a/bin/minion-cli.js b/bin/minion-cli.js index 6c1f2ac..1fed2c9 100755 --- a/bin/minion-cli.js +++ b/bin/minion-cli.js @@ -1,12 +1,9 @@ #!/usr/bin/env node - -minion = require("./minion.js"); - var argv = require('optimist').argv; - var method = argv._[0]; +var minion = require("../lib/minion.js"); -minion.provides("./minion.Interface.js", "minion.Interface"); +require("./minion.Interface.js"); minion.require("minion.Interface", function(Interface) { diff --git a/bin/minion.Interface.js b/bin/minion.Interface.js index 0cff91f..db1e4a7 100644 --- a/bin/minion.Interface.js +++ b/bin/minion.Interface.js @@ -1,4 +1,3 @@ -minion = require('./minion.js'); var fs = require("fs"); var color = require("ansi-color").set; var jshint = require("jshint").JSHINT; @@ -397,14 +396,14 @@ minion.define("minion", { this.build(); } })); - } + } }, // Cleans up any watchers on this._filesToWatch files. - _unwatchFiles : function(){ + _unwatchFiles : function() { for(var i = 0; i < this._filesToWatch.length; i ++) { var file = this._filesToWatch[i]; fs.unwatchFile(file); - } + } } }) diff --git a/bin/minion.js b/bin/minion.js deleted file mode 100644 index e8c719e..0000000 --- a/bin/minion.js +++ /dev/null @@ -1,1456 +0,0 @@ -/* - * minion.JS v1.4.4 - * http://minion.org - * - * (c) 2011, Taka Kojima - * Licensed under the MIT License - * - * Date: Sat Jan 21 23:51:10 2012 -0800 - */ - /** - -@fileOverview - -

MinionJS - Cross-Platform & Cross-Browser JavaScript Inheritance

- -

Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions:

- -

The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software.

- -

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE.

-*/ - - -/** -* Global MinionJS Object with Static methods. -* -* @namespace -*/ - -/* - TODO: - - Multiple inheritance - - Independent library support, i.e. ability to do minion.require("minion.libs.jquery") to load jquery - - __preDefine method on Classes, takes 1 argument, a callback that gets called once __preDefine does all it needs to do -*/ - -var minion = (function (root) { - - "use strict"; - - // If Array.indexOf is not defined, let's define it. - Array.prototype.indexOf = Array.prototype.indexOf || function (a, b) { - if (!this.length || !(this instanceof Array) || arguments.length < 1) { - return -1; - } - - b = b || 0; - - if (b >= this.length) { - return -1; - } - - while (b < this.length) { - if (this[b] === a) { - return b; - } - b += 1; - } - return -1; - }; - - var _classMappings = []; - var _aliases = ["minion"]; - - var _separator = "."; - var _class_path = ""; - var _file_suffix = ""; - - var _initialized; - - var _loadQueue = []; - var _extendQueue = []; - - var _waitID; - var _waitingForLoad = []; - var _loadedFiles = []; - var _notificationManager; - var _waitInterval = 500; - - var _isNode = (typeof window === "undefined"); - - var _root = root; - var _ns = {}; - var _errorTimeout = 1e4; - - /** - * @exports _minion as minion - * @class - */ - var _minion = {}; - - /*================= HELPER FUNCTIONS =================*/ - - /** @private */ - var _isArray = Array._isArray || function (a) { - return a instanceof Array; - }; - - /** @private */ - var _isObject = function (obj) { - return typeof obj === "object"; - }; - - /** @private */ - var _isString = function (s) { - return typeof s === 'string' || s instanceof String; - }; - - /** @private */ - var _isFunction = function (fn) { - return typeof fn === "function"; - }; - - /** @private */ - var _strToArray = function (s) { - return (!_isArray(s)) ? [s] : s; - }; - - /** @private */ - var _concatArray = function (a, b, forceUnique) { - b = b || []; - if(!forceUnique){ - return a || [].concat(b); - } - - // Force unique values - b = [].concat(b); - a = a || []; - - for(var i = 0, l = a.length; i < l; i += 1){ - if(b.indexOf(a[i]) < 0){ - b[b.length] = a[i]; - } - } - - return b; - }; - - /** @private */ - var _copyToNS = function(o1,o2){ - for (var i in o1) { - if(o1.hasOwnProperty(i)){ - o2[i] = o1[i]; - } - } - }; - - /** @private */ - var _removeFromNS = function(o1,o2){ - for (var i in o1) { - if(o1.hasOwnProperty(i)){ - o2[i] = null; - delete o2[i]; - } - } - }; - - - // Recursively checks dependencies - /** @private */ - var _areDependenciesLoaded = function (o) { - o = _minion.get(o, false); - var i; - - if (!o.__isDefined) { - return false; - } - if (o.__dependencies) { - for (i = 0; i < o.__dependencies.length; i += 1) { - if (!_areDependenciesLoaded(o.__dependencies[i])) { - return false; - } - } - } - return true; - }; - - /** @private */ - var _checkLoadQueue = function () { - var i, j, q, dependenciesLoaded, classes, classesArray; - q = {}; - classes = {}; - classesArray = []; - - for (i = _loadQueue.length - 1; i >= 0; i --) { - - q = _loadQueue[i]; - dependenciesLoaded = true; - - for (j = 0; j < q.c.length; j ++) { - dependenciesLoaded = _areDependenciesLoaded(q.c[j]); - if (!dependenciesLoaded) { - break; - } - } - - if (dependenciesLoaded) { - if (q.cb) { - q.cb.apply(_root, _minion.get(q.c)); - } - _loadQueue.splice(i, 1); - } - } - }; - - /** @private */ - var _checkExtendQueue = function () { - var eq = _extendQueue; - var i, superClass, ns, id; - - for (i = eq.length - 1; i >= 0; i --) { - - ns = eq[i].split(_separator); - id = ns.splice(ns.length - 1, 1)[0]; - ns = _minion.get(ns.join(_separator), false); - - if (ns[id].__toExtend) { - superClass = _minion.get(ns[id].__extendedFrom, false); - if (superClass.__isDefined) { - - ns[id].__toExtend = false; - delete ns[id].__toExtend; - - ns[id] = _minion.extend(ns[id].__extendedFrom, ns[id]); - - eq.splice(i, 1); - setTimeout(_checkExtendQueue, 0); - return; - } - } - } - _checkLoadQueue(); - }; - - /** @private */ - var _checkWaitQueue = function () { - - var w = _waitingForLoad; - var i, o; - - if (_waitID) { - clearTimeout(_waitID); - } - - for (i = 0; i < w.length; i += 1) { - o = w[i]; - o.e += 50; - - if (_minion.isDefined(o.c)) { - o.s.onload(); - } - - else if (o.e >= _errorTimeout) { - o.s.onerror(); - } - } - - if (w.length > 0) { - _waitID = setTimeout(_checkWaitQueue, _waitInterval); - } - }; - - /** - * Injects a Script tag into the DOM - * - * @param f The path of the file to inject. - * @param c The class which maps to the file we are injecting. - * @private - */ - - var _inject = function(f, c) { - - var doc = document; - var body = "body"; - - var injectObj, script; - - if (!doc[body]) { - return setTimeout(function(){ - _inject(f,c); - }, 0); - } - - script = doc.createElement("script"); - script.async = true; - - injectObj = { - f : f, // File - c : c, // Class - e : 0, // Elapsed Time - s : script // Script - }; - - _waitingForLoad.push(injectObj); - - /** @ignore */ - script.onreadystatechange = /** @ignore */ script.onload = function (e) { - if (_minion.isDefined(c)) { - injectObj.s.onload = injectObj.s.onreadystatechange = null; - injectObj.s.onerror = null; - _waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1); - } - }; - - /** @ignore */ - script.onerror = function (e) { - injectObj.s.onerror = null; - _waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1); - throw new Error(injectObj.c + " failed to load. Attempted to load from file: " + injectObj.f); - }; - - script.src = f; - - // Append the script to the document body - doc[body].appendChild(script); - }; - - /** - * Does all the loading of JS files - * - * @param q The queue to be loaded - * @private - */ - - var _load = function (q) { - - _loadQueue.push(q); - - for (var i = 0; i < q.f.length; i += 1) { - - if(_isNode){ - require(q.f[i]); - } - else{ - _inject(q.f[i], q.c[i]); - } - } - - /* - If the load times out, fire onerror after the time defined by _errorTimeout (default is 10 seconds) - (can be changed through minion.config({minion.errorTimeout : ms}); - */ - _waitID = setTimeout(_checkWaitQueue, _waitInterval); - }; - - /** - * Used by minion.get() and minion.define(). - * Get the namespace/Class, or creates it if it does not exist. Also optionally creates Objects in the specified namepsace. - * - * @param {String|Object}id The fully qualified namespace. - * @param {Boolean} autoCreate Whether or not to create a blank object if the namespace does not yet exist. - * @param {Object} [definitions] An object of class definitions which will be added to the namespace. - * @returns {Object} The object that represents the fully qualified namespace passed in as the first argument. - * @private - */ - - var _namespace = function (id, autoCreate, definitions) { - id = id || ""; - definitions = definitions || false; - - var ns = _ns; - var i; - - if (id && !_isObject(id) && !_isFunction(id)) { - var parts = id.split(_separator); - - if (_aliases.indexOf(parts[0]) > -1) { - ns = _minion; - parts.splice(0,1); - } - - for (i = 0; i < parts.length; i += 1) { - if (!ns[parts[i]]) { - if (autoCreate) { - ns[parts[i]] = {}; - } - else{ - return false; - } - } - ns = ns[parts[i]]; - } - } - - else if (id !== "") { - ns = id; - } - else{ - return false; - } - - if (definitions) { - - definitions.require = _concatArray(definitions.require); - var cr = definitions.require; - - for (var className in definitions) { - - if (className !== "require") { - - var qualifiedName = id + _separator + className; - var c = definitions[className]; - - if (c.__extendedFrom) { - cr.push(c.__extendedFrom); - } - - if (c.__toExtend) { - if (_extendQueue.indexOf(qualifiedName) < 0) { - _extendQueue.push(qualifiedName); - } - } - - c.__static = c.__static || {}; - - c.__nsID = id; - c.__ns = ns; - c.__class = className; - - if (cr.length > 0) { - c.__dependencies = _concatArray(c.__dependencies, cr, true); - _minion.require(cr); - } - - if (_minion.isDefined(c) && c.prototype) { - var proto = c.prototype; - proto.__nsID = id; - proto.__ns = ns; - proto.__class = className; - - if (cr.length > 0) { - proto.__dependencies = _concatArray(proto.__dependencies, cr, true); - } - } - - ns[className] = c; - } - } - } - - return ns; - }; - - /*================= END OF HELPER FUNCTIONS =================*/ - - - /** - * Configure minion. - * - * @public - * @param {Object} configObj Configuration object, possible properties are : classPath, separator and fileSuffix - */ - - _minion.configure = function (configObj) { - - configObj = configObj || {}; - - _class_path = configObj.classPath || _class_path; - _class_path = (_class_path.lastIndexOf("/") === _class_path.length - 1) ? _class_path : _class_path + "/"; - - _separator = configObj.separator || _separator; - _file_suffix = configObj.fileSuffix || _file_suffix; - - if(configObj.paths){ - for(var i = 0; i < configObj.paths.length; i ++){ - var m = configObj.paths[i]; - _minion.provides(m.file, m.classes); - } - } - - _initialized = true; - }; - - /** - * Alias minion under a different namespace. I.e. var woot = minion.alias("woot"); - * - * @public - * @param {String} alias The name of the namespace to alias minion under. - */ - - _minion.alias = function (alias) { - _aliases.push(alias); - return _minion; - }; - - /** - * Gets the object by it's fully qualified identifier. - * - * @public - * @param {String} id The identifier to get - * @returns {Object|Boolean} The object that represents the identifier or false if it has not yet been defined. - */ - - _minion.get = function (id) { - if(!_isArray(id)){ - return _namespace(id, false); - } - else{ - var classes = _minion.use(id, {}); - var classesArray = []; - - for (var c in classes) { - if(classes.hasOwnProperty(c)) { - classesArray.push(classes[c]); - } - } - - return classesArray; - } - }; - - /** - * Defines Classes under the given namespace. - * - * @public - * @param {String} id The namespace to define the Classes under. - * @param {Object} [definitions] An object of class definitions which will be added to the namespace - * @returns {Object} The object that represents the namespace passed in as the first argument. - */ - _minion.define = function (id, definitions) { - var r = _namespace(id, true, definitions); - _checkExtendQueue(); - return r; - }; - - /** - * Gets the URL for a given identifier. - * - * @public - * @param {String} id The fully qualified name to look up. - * @returns {String} The URL of the file that maps to the fully qualified name. - */ - - _minion.getURL = function (id) { - - if (_classMappings[id]) { - return _classMappings[id]; - } - - var isDir = id.indexOf("*") > -1; - id = isDir ? id.replace(".*", "") : id; - var url = _class_path + id.replace(new RegExp('\\' + _separator, 'g'), '/') + (isDir ? "" : '.js') + ((_file_suffix) ? "?" + _file_suffix : ""); - - return url; - }; - - /** - * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined)
- * NOTE: Classes that have not yet loaded all of their dependencies, will return FALSE for this check. - * - * @public - * @param {String|Object} id The fully qualfied class name, or an Object. - * @returns {Boolean} Whether or not this is defined. - */ - - _minion.isDefined = function (id) { - id = (!_isObject(id) && !_isFunction(id)) ? _namespace(id, false) : id; - return (id) ? id.__isDefined : false; - }; - - /** - * Extends a given class asynchronously. - * - * @public - * @param {String} id The fully qualified name of the Class you want to extend. - * @param {Object} obj A new Class Object - * @returns {Object} The extended Class, or, if still waiting on dependencies, the original Object with a few more properties for internal minion use. - */ - - _minion.extend = function (id, obj) { - - // If the Class exists and is a minion class, then return the extended object. - if (_minion.isDefined(id)) { - obj = _minion.get(id).__extend(obj); - } - else{ - obj.__toExtend = true; - } - - obj.__extendedFrom = id; - - return obj; - }; - - /** - * Tells minion that filePath provides the class definitions for these classes. - * Useful in cases where you group specific things into minfiied js files. - * - * @public - * @param {String} file The path of a JS file. - * @param {String|Array} definitions Fully qualfiied name(s) of class(es) - */ - - _minion.provides = function (file, definitions) { - - // If classes is a String, create an array - definitions = _strToArray(definitions); - - // If the file is not absolute, prepend the _class_path - //file = (!new RegExp("(http://|/)[^ :]+").test(file)) ? _class_path + file : file; - - for (var i = 0; i < definitions.length; i += 1) { - _classMappings[definitions[i]] = file; - } - }; - - /** - * Asyncrhonously loads in js files for the classes specified. - * If the classes have already been loaded, or are already defined, the callback function is invoked immediately. - * - * @public - * @param {String|Array} ids The fully qualified name(s) of the class(es) to load. - * @param {Function} callback The function to call once all classes (and their dependencies) have been loaded. - */ - - _minion.require = function (ids, callback) { - if (!_initialized) { - _minion.configure(); - } - - ids = _strToArray(ids); - - var fileList = []; - var classList = []; - - for (var i = 0; i < ids.length; i ++) { - - var id = ids[i]; - var file = _minion.getURL(id); - var get = _minion.get(id); - - classList.push(id); - - if ((_loadedFiles.indexOf(file) < 0) && !_minion.get(id)) { - fileList.push(file); - _loadedFiles.push(file); - } - } - - if (fileList.length > 0) { - - var q = { - f : fileList, - c : classList, - cb : callback - }; - - //_load(q); - setTimeout(function(){_load(q);}, 0); - } - - else if (callback) { - callback.apply(_root, _minion.get(ids)); - } - }; - - /** - * Copies an array of classes (by their fully qualified names) to the specified object/scope. - * - * By calling minion.use("test.Example", obj), you will be able to refer to test.Example as just obj.Example. - * - * Identifiers can contain the* wildcard character as its last segment (eg: test.*) - * which will import all Classes under the given namespace. - * - * @public - * @param {String|Array} ids The fully qualfiied name(s) to import into the global namespace. - * @param {Object=[root]} The scope to use. - * @returns {Object} Returns the object passed in as the second argument, with the classes passed in as the first argument as properties. - */ - - _minion.use = function (ids, scope) { - - ids = ids || []; - ids = _strToArray(ids); - scope = scope || _ns; - - if (scope === _ns) { - _minion.unuse(); - } - - var i, id, obj, ns, n; - - for (i = 0; i < ids.length; i += 1) { - - id = ids[i]; - - obj = _minion.get(id, true); - ns = id.split(_separator); - id = ns.splice(ns.length - 1, 1)[0]; - ns = _minion.get(ns.join(_separator), false); - - if (id === '*') { - // injects all ids under namespace into the root namespace - for (n in ns) { - if(ns.hasOwnProperty(n)){ - scope[n] = ns[n]; - } - } - } - else{ - // injects this id into the root namespace - if (ns[id]) { - scope[id] = ns[id]; - } - } - } - - return scope; - }; - - /** @private */ - _minion.enableNotifications = function () { - if (_minion.isDefined("minion.NotificationManager")) { - if (!_notificationManager) { - _notificationManager = new (minion.get("minion.NotificationManager"))(); - - /** @private */ - _minion.subscribe = function () { - _notificationManager.subscribe.apply(_notificationManager, arguments); - }; - - /** @private */ - _minion.unsubscribe = function () { - _notificationManager.unsubscribe.apply(_notificationManager, arguments); - }; - - /** @private */ - _minion.publish = function () { - _notificationManager.publish.apply(_notificationManager, arguments); - }; - - /** @private */ - _minion.holdNotification = function () { - _notificationManager.holdNotification.apply(_notificationManager, arguments); - }; - - /** @private */ - _minion.releaseNotification = function () { - _notificationManager.releaseNotification.apply(_notificationManager, arguments); - }; - - /** @private */ - _minion.cancelNotification = function () { - _notificationManager.cancelNotification.apply(_notificationManager, arguments); - }; - } - } - }; - - /* - Define minion as an AMD module, if define is defined (and has .amd as a property) - */ - if (typeof _root.define === "function" && _root.define.amd) { - _root.define([], function () { - return _minion; - }); - } - - // Export for node - if (_isNode){ - module.exports = _minion; - } - - return _minion; - -})(this);(function(){ - - "use strict"; - - //* @ignore */ - minion.define("minion", { - - /** - * The minion Base Class - * Classical JavaScript Inheritance (or an attempt thereof) - * minion.Class is the ONLY Class to extend this directly, do not directly extend this Class. - * Largely taken from: http://ejohn.org/blog/simple-javascript-inheritance/ - * @ignore */ - - __BaseClass__ : (function() { - - /* - Attempts to shallow copy objects, so as to not have a bunch of references lying around in object instances - Otherwise, it is bad news bears doing something like this.nArray.push() in a Class method - because it modifies nArray on prototype, and thus any other instances of said Class - */ - var _copy = function (obj) { - var i, attr, c; - - // Null, undefined, number, boolean, string, function all get returned immediately, no need to copy them. - if (!obj || typeof obj !== "object") { - return obj; - } - - if (obj instanceof Date) { - return new Date().setTime(obj.getTime()); - } - - if (obj instanceof Array) { - return obj.concat(); - } - - if (typeof obj === "object") { - c = {}; - for (attr in obj) { - if (obj.hasOwnProperty(attr)) { - c[attr] = obj[attr]; - } - } - return c; - } - // If it fails, just return the original object. - return obj; - }; - - var _createSuperFunction = function (fn, superFn) { - return function() { - var tmp = this.__super || null; - - // Reference the prototypes method, as super temporarily - this.__super = superFn; - - var ret = fn.apply(this, arguments); - - // Reset this.__super - if(tmp){this.__super = tmp;} - else{this.__super = null; delete this.__super;} - return ret; - }; - }; - - // Checks the function contents to see if it has a reference to __super - var _doesCallSuper = /xyz/.test(function(){var xyz;}) ? /\b__super\b/ : /.*/; - - /** @ignore */ - var _baseClass = function(){}; - - _baseClass.__isDefined = true; - - /** @ignore */ - _baseClass.__extend = function(obj) { - - // By passing "__no_init__" as the first argument, we skip calling the constructor and other initialization; - var This = this; - var _proto = new This("__no_init__"); - var _perInstanceProps = {}; - var _this = this; - - // Copy the object's properties onto the prototype - for(var name in obj) { - - if(obj.hasOwnProperty(name)) { - - if(name !== "__static"){ - // If we're overwriting an existing function that calls this.__super, do a little super magic. - if(typeof obj[name] === "function" && typeof _proto[name] === "function" && _doesCallSuper.test(obj[name])){ - _proto[name] = _createSuperFunction(obj[name], _proto[name]); - } - else{ - _proto[name] = obj[name]; - } - } - - /* - If it's an array or an object, we need to make a per instance copy of these values, so as to not affect other - instances when dealing with Arrays or Objects. - */ - else if (typeof obj[name] === "object" && name.indexOf("__") !== 0) { - _perInstanceProps[name] = obj[name]; - } - } - } - - var _class = function() { - - if(arguments[0] !== "__no_init__"){ - - /* - Handy for referencing dependencies. If a Class requires example.Test, then you can reference said class - in any method by this.__imports.Test; - - This method is preferred over this.use_dependencies(), as you have to explicitly call this.unuse_dependencies() - to be responsible, at the end of every method. - */ - if(!_class.prototype.hasOwnProperty("__imports")){ - _class.prototype.__imports = minion.use(this.__dependencies, {}); - } - - if(!this.__preInit){ - - for (var attr in _perInstanceProps) { - if (_perInstanceProps.hasOwnProperty(attr)) { - this[attr] = _copy(_perInstanceProps[attr]); - } - } - - // All real construction is actually done in the init method - return this.init.apply(this, arguments); - } - - else{ - return this.__preInit.apply(this, arguments); - } - - } - }; - - // Set the prototype and Constructor accordingly. - _class.prototype = _proto; - //* @ignore */ - _class.prototype.constructor = _class; - - // Expose the extend method - //* @ignore */ - _class.__extend = _baseClass.__extend; - - _class.prototype.__extend = (function(scope, fn){ - return function(){ - return fn.apply(scope, arguments); - }; - })(_class, _class.__extend); - - /* - Custom minion properties, anything beginning with an __ on a Class or instance, is populated and used by minion. - The "__" prefix is used to avoid naming conflictions with developers, and allows - us to not have to impose a list of reserved words on developers. - */ - - _class.__ns = obj.__ns || ""; - _class.__nsID = obj.__nsID || ""; - _class.__class = obj.__class || ""; - _class.__dependencies = obj.__dependencies || []; - - /* - Add all static methods and properties that are defined in the __static object. - Only write to it if it doesn't already exist, to disable overwriting things we actually need for minion by malicious or - plain bad code. - */ - var prop; - - if(obj.__static){ - _class.__static = _class.__static || {}; - for(prop in obj.__static){ - if(!_class[prop]){ - _class[prop] = obj.__static[prop]; - _class.__static[prop] = obj.__static[prop]; - } - } - _class.__static = obj.__static; - } - - if(this.__static){ - _class.__static = _class.__static || {}; - for(prop in this.__static){ - if(!_class[prop]){ - _class[prop] = this.__static[prop]; - _class.__static[prop] = this.__static[prop]; - } - } - } - - if(_class.__static.__isStatic){ - - var StaticClass = _class; - var s = new StaticClass(); - - s.__static = _class.__static; - - for(prop in _class.__static){ - s[prop] = _class.__static[prop]; - } - - return s; - } - - return _class; - }; - - return _baseClass; - - })() - }); - -})();(function(){ - - "use strict"; - - minion.define("minion", { - - /** @lends minion.Class# */ - - Class : minion.extend("minion.__BaseClass__", { - - __static : { - __isDefined: true - }, - - /** - * - * The base minion Class. All Classes are required to be descendants - * of this class, either directly, or indirectly. - * - * @constructs - */ - init: function(){ - if(!this._interestHandlers){ - this._interestHandlers = []; - } - }, - - /** - * Local version of window.setTimeout that keeps scope of this.
- * - * @returns {Number} A timeout ID - */ - setTimeout : function(func, delay){ - return setTimeout(this.proxy(func), delay); - }, - - /** - * Local version of window.setInterval that keeps scope of this.
- * - * @returns {Number} An interval ID - */ - setInterval : function(func, delay){ - return setInterval(this.proxy(func), delay); - }, - - /** - * Shorthand for func.bind(this)
- * or rather, $.proxy(func, this) in jQuery terms - * - * @returns {Function} The proxied function - */ - proxy : function(func){ - var bind = function (context) { - if (!context) {return this;} - var this_ = this; - return function() { - return this_.apply(context, Array.prototype.slice.call(arguments)); - }; - }; - - return bind.call(func, this); - }, - - /** - * Subscribes to a notification. - * - * @public - * @param {String} name The name of the Notification you are subscribing to. - * @param {Function} handler A function to be called upon receiving the given Notification. - */ - - subscribe : function(name, handler, priority){ - if(!this._interestHandlers){ - this._interestHandlers = []; - } - if(handler && !this._interestHandlers[name]){ - minion.subscribe(this, name, priority); - this._interestHandlers[name] = handler; - } - }, - - /** - * Unsubscribes from a notification. - * - * @public - * @param {String} name The name of the Notification you are unsubscribing from. - */ - - unsubscribe : function(name){ - if(this._interestHandlers && this._interestHandlers[name]){ - this._interestHandlers[name] = null; - delete this._interestHandlers[name]; - } - minion.unsubscribe(this, name); - }, - - /** - * Unsubscribes from all notifications registered via this.subscribe(); - */ - - unsubscribeAll : function(){ - for(var interest in this._interestHandlers){ - if(this._interestHandlers.hasOwnProperty(interest)){ - this.unsubscribe(interest); - } - } - this._interestHandlers = []; - }, - - /** - * Publishes a notification with the specified data. - * - * @param {String} name The name of the Notification you are publishing. - * @param {Object} data An object of data you want to send with the Notification. - * @param {Function} callback A callback function to be invoked if Notification.respond() is called - */ - - publish : function(name, data, callback){ - minion.publish(name, data, this, callback); - }, - - /** @ignore */ - handleNotification : function(n){ - var handler = this._interestHandlers[n.name]; - if(handler){ - this.proxy(handler)(n); - } - } - - }) - }); - -})(); (function(){ - - "use strict"; - - minion.define("minion", { - - /** @lends minion.Singleton# */ - - Singleton : minion.extend("minion.Class", { - - /** - * - * A way to easily implement Singletons. - * - * @constructs - * @extends minion.Class - */ - init : function(){ - - }, - - /** @ignore */ - __preInit : function(){ - if(this.constructor.__instance){ - return this.constructor.__instance; - } - - this.init.apply(this, arguments); - - this.constructor.__instance = this; - return this.constructor.__instance; - }, - - /** @ignore */ - __static : { - - /** @lends minion.Singleton# */ - __isSingleton: true, - - /** - * - * Returns the instance of this Singleton. If this Class has not yet been instantiated, creates a new instance and returns that. - * Otherwise, it returns the already existing reference. - * - * @memberOf minion.Singleton# - */ - getInstance : function(){ - if(!this.__instance){ - var This = this; - this.__instance = new This(); - return this.__instance; - } - return this.__instance; - } - } - - }) - }); - -})();(function(){ - - "use strict"; - - minion.define("minion", { - - /** @lends minion.Static# */ - - Static : minion.extend("minion.Singleton", { - - __static : { - __isDefined : true, - __isStatic : true - - }, - - /** - * - * A way to easily implement Static Classes. - * - * @constructs - * @extends minion.Singleton - */ - init : function(){ - - } - - }) - }); - -})();(function(){ - - "use strict"; - - minion.define("minion", { - - /** @lends minion.Notification# */ - - Notification : minion.extend("minion.Class", { - - data : {}, - name : "", - dispatcher : null, - status : 0, // 0 : Closed; 1 : Pending; 2 : Hold - pointer : 0, - callback : null, - - /** - * - * Notifications are the backbone of Minion's pub/sub model. - * You should not have to construct Notification's directly, as the publish() method does this for you. - * - * @constructs - * @param {String} name The name of the Notification. - * @param {Object} data An object of data associated with the Notification. - * @param {Function} callback A callback function. This gets invoked by calling Notification.respond(); - */ - init : function(name, data, callback) { - this.name = name; - this.data = data; - this.callback = callback; - }, - - /** - * - * Holds a notification. Useful if you want to do other things before other instances receive this Notification, - * - * @public - */ - hold : function() { - this.status = 2; - }, - - /** - * - * Releases a Notification, call this at some point after hold(); - * - * @public - */ - - release : function() { - this.status = 1; - minion.releaseNotification(this); - }, - - /** - * - * Cancels a Notification, any instances interested in this Notification higher up the chain will not receive it. - * - * @public - */ - - cancel : function() { - minion.cancelNotification(this); - - this.data = {}; - this.name = ""; - this.status = 0; - this.pointer = 0; - this.dispatcher = null; - this.callback = null; - }, - - /** - * - * Dispatches a Notification. You will rarely ever construct or call dispatch() on Notifications directly, as the publish() method handles all of this. - * - * @param {Object} obj An Object referencing what is dispatching this Notification. - * @public - */ - - dispatch : function(obj) { - this.status = 1; - this.pointer = 0; - this.dispatcher = obj; - - minion.publish(this); - }, - - /** - * - * Responds to a Notification. Pretty much just calls the callback function that is passed when constructing a new function. - * - * @public - */ - - respond : function () { - if(this.callback) { - this.callback.apply(typeof this.dispatcher == "object" ? this.dispatcher : this, arguments); - this.callback = null; - this.cancel(); - } - } - }) - }); - - - minion.define("minion", { - - /* - This Class handles all the nitty gritty Notification stuff. - TODO: Be nice and add some comments for other people :) - */ - - require : [ - "minion.Notification" - ], - - NotificationManager : minion.extend("minion.Singleton", { - - _pendingNotifications: [], - _pendingNotificationNames : [], - _interests: {}, - _removeQueue: [], - - subscribe : function(obj, name, priority) { - - priority = isNaN(priority) ? -1 : priority; - this._interests[name] = this._interests[name] || []; - - if(priority <= -1 || priority >= this._interests[name].length){ - this._interests[name].push(obj); - } - else{ - this._interests[name].splice(priority, 0, obj); - } - }, - - unsubscribe : function(obj, name){ - if(name instanceof Array){ - for(var i = 0; i < name.length; i ++){ - this.unsubscribe(obj, name[i]); - } - return; - } - var objIndex = this._interests[name].indexOf(obj); - if(obj && objIndex > -1){ - - if(this._pendingNotificationNames.indexOf(name) > -1) { - var rq = this._removeQueue[name] = this._removeQueue[name] || []; - rq.push(obj); - } - else{ - this._interests[name].splice(objIndex, 1); - } - } - }, - - publish : function(notification, data, obj, callback){ - - if(!(notification instanceof this.__imports.Notification)){ - notification = new this.__imports.Notification(notification, data, callback); - notification.status = 1; - notification.pointer = 0; - notification.dispatcher = obj; - } - - var name = notification.name; - - if(this._interests[name]){ - this._pendingNotifications.push(notification); - this._pendingNotificationNames.push(name); - this._notifyObjects(notification); - } - }, - - _notifyObjects : function(notification){ - - var name = notification.name; - - while(notification.pointer < this._interests[name].length) { - if(notification.status === 1){ - if(this._interests[name][notification.pointer].handleNotification){ - this._interests[name][notification.pointer].handleNotification(notification); - } - notification.pointer ++; - } - else{ - return; - } - } - - if(notification.status === 1 && !notification.callback) { - this.cancelNotification(notification); - } - }, - - getNotification : function(name) { - for(var i = 0; i < this._pendingNotifications.length; i ++){ - if(this._pendingNotifications[i].name === name){ - return this._pendingNotifications[i]; - } - } - }, - - releaseNotification : function(notification){ - notification.status = 1; - if(this._pendingNotifications.indexOf(notification) > -1){ - this._notifyObjects(notification); - } - }, - - cancelNotification : function(notification){ - if(notification){ - - var name = notification.name; - - this._pendingNotifications.splice(this._pendingNotifications.indexOf(notification), 1); - - notification.status = 0; - - if(this._removeQueue[name]){ - for(var i = 0; i < this._removeQueue.length; i ++){ - this.unsubscribe(this._removeQueue[name][i], name); - } - this._removeQueue[name] = null; - delete this._removeQueue[name]; - } - - notification = null; - } - } - - }) - - }); - - minion.enableNotifications(); - -})(); diff --git a/dist/minion-1.4.4.js b/dist/minion-1.4.4.js index e8c719e..b1648ad 100644 --- a/dist/minion-1.4.4.js +++ b/dist/minion-1.4.4.js @@ -5,7 +5,7 @@ * (c) 2011, Taka Kojima * Licensed under the MIT License * - * Date: Sat Jan 21 23:51:10 2012 -0800 + * Date: Sat Feb 4 07:13:18 2012 -0800 */ /** @@ -1125,7 +1125,7 @@ var minion = (function (root) { }) }); -})(); (function(){ +})();(function(){ "use strict"; diff --git a/dist/minion-1.4.4.min.js b/dist/minion-1.4.4.min.js index eefef99..a16a9c9 100644 --- a/dist/minion-1.4.4.min.js +++ b/dist/minion-1.4.4.min.js @@ -5,6 +5,6 @@ * (c) 2011, Taka Kojima * Licensed under the MIT License * - * Date: Sat Jan 21 23:51:10 2012 -0800 + * Date: Sat Feb 4 07:13:18 2012 -0800 */ - var minion=function(a){"use strict",Array.prototype.indexOf=Array.prototype.indexOf||function(a,b){if(!!this.length&&this instanceof Array&&arguments.length>=1){b=b||0;if(b=0;a--){c=h[a],d=!0;for(b=0;b=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b-1&&(f=s,h.splice(0,1));for(g=0;g0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c-1&&c-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c=1){b=b||0;if(b=0;a--){c=h[a],d=!0;for(b=0;b=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b-1&&(f=s,h.splice(0,1));for(g=0;g0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c-1&&c-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c=1){b=b||0;if(b=0;a--){c=h[a],d=!0;for(b=0;b=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b-1&&(f=s,h.splice(0,1));for(g=0;g0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c-1&&c-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;c=1){b=b||0;if(b=0;a--){c=h[a],d=!0;for(b=0;b=0;b--){e=a[b].split(d),f=e.splice(e.length-1,1)[0],e=s.get(e.join(d),!1);if(e[f].__toExtend){c=s.get(e[f].__extendedFrom,!1);if(c.__isDefined){e[f].__toExtend=!1,delete e[f].__toExtend,e[f]=s.extend(e[f].__extendedFrom,e[f]),a.splice(b,1),setTimeout(D,0);return}}}C()},E=function(){var a=k,b,c;j&&clearTimeout(j);for(b=0;b=r&&c.s.onerror();a.length>0&&(j=setTimeout(E,n))},F=function(a,b){var c=document,d="body",e,f;if(!c[d])return setTimeout(function(){F(a,b)},0);f=c.createElement("script"),f.async=!0,e={f:a,c:b,e:0,s:f},k.push(e),f.onreadystatechange=f.onload=function(a){s.isDefined(b)&&(e.s.onload=e.s.onreadystatechange=null,e.s.onerror=null,k.splice(k.indexOf(e),1))},f.onerror=function(a){throw e.s.onerror=null,k.splice(k.indexOf(e),1),Error(e.c+" failed to load. Attempted to load from file: "+e.f)},f.src=a,c[d].appendChild(f)},G=function(a){h.push(a);for(var b=0;b-1&&(f=s,h.splice(0,1));for(g=0;g0&&(m.__dependencies=y(m.__dependencies,j,!0),s.require(j));if(s.isDefined(m)&&m.prototype){var n=m.prototype;n.__nsID=a,n.__ns=f,n.__class=k,j.length>0&&(n.__dependencies=y(n.__dependencies,j,!0))}f[k]=m}}return f};return s.configure=function(a){a=a||{},e=a.classPath||e,e=e.lastIndexOf("/")===e.length-1?e:e+"/",d=a.separator||d,f=a.fileSuffix||f;if(a.paths)for(var b=0;b-1;a=c?a.replace(".*",""):a;var g=e+a.replace(RegExp("\\"+d,"g"),"/")+(c?"":".js")+(f?"?"+f:"");return g},s.isDefined=function(a){return a=!u(a)&&!w(a)?H(a,!1):a,a?a.__isDefined:!1},s.extend=function(a,b){return s.isDefined(a)?b=s.get(a).__extend(b):b.__toExtend=!0,b.__extendedFrom=a,b},s.provides=function(a,c){c=x(c);for(var d=0;d0){var j={f:c,c:d,cb:b};setTimeout(function(){G(j)},0)}else b&&b.apply(p,s.get(a))},s.use=function(a,b){a=a||[],a=x(a),b=b||q,b===q&&s.unuse();var c,e,f,g,h;for(c=0;c-1&&c-1)if(this._pendingNotificationNames.indexOf(b)>-1){var e=this._removeQueue[b]=this._removeQueue[b]||[];e.push(a)}else this._interests[b].splice(d,1)},publish:function(a,b,c,d){a instanceof this.__imports.Notification||(a=new this.__imports.Notification(a,b,d),a.status=1,a.pointer=0,a.dispatcher=c);var e=a.name;this._interests[e]&&(this._pendingNotifications.push(a),this._pendingNotificationNames.push(e),this._notifyObjects(a))},_notifyObjects:function(a){var b=a.name;while(a.pointer-1&&this._notifyObjects(a)},cancelNotification:function(a){if(a){var b=a.name;this._pendingNotifications.splice(this._pendingNotifications.indexOf(a),1),a.status=0;if(this._removeQueue[b]){for(var c=0;cthis.
- * - * @returns {Number} A timeout ID */ setTimeout : function(func, delay){ return setTimeout(this.proxy(func), delay); @@ -36,18 +32,14 @@ /** * Local version of window.setInterval that keeps scope of this.
- * - * @returns {Number} An interval ID */ setInterval : function(func, delay){ return setInterval(this.proxy(func), delay); }, /** - * Shorthand for func.bind(this)
- * or rather, $.proxy(func, this) in jQuery terms - * - * @returns {Function} The proxied function + * Shorthand for func.bind(this) + * or rather, $.proxy(func, this) in jQuery terms */ proxy : function(func){ var bind = function (context) { @@ -63,10 +55,6 @@ /** * Subscribes to a notification. - * - * @public - * @param {String} name The name of the Notification you are subscribing to. - * @param {Function} handler A function to be called upon receiving the given Notification. */ subscribe : function(name, handler, priority){ @@ -81,9 +69,6 @@ /** * Unsubscribes from a notification. - * - * @public - * @param {String} name The name of the Notification you are unsubscribing from. */ unsubscribe : function(name){ @@ -109,17 +94,12 @@ /** * Publishes a notification with the specified data. - * - * @param {String} name The name of the Notification you are publishing. - * @param {Object} data An object of data you want to send with the Notification. - * @param {Function} callback A callback function to be invoked if Notification.respond() is called */ publish : function(name, data, callback){ minion.publish(name, data, this, callback); }, - /** @ignore */ handleNotification : function(n){ var handler = this._interestHandlers[n.name]; if(handler){ diff --git a/src/minion.header.js b/lib/minion.header.js similarity index 69% rename from src/minion.header.js rename to lib/minion.header.js index e99df3a..735589f 100644 --- a/src/minion.header.js +++ b/lib/minion.header.js @@ -2,7 +2,7 @@ * minion.JS v@VERSION * http://minion.org * - * (c) 2011, Taka Kojima + * (c) 2012, Taka Kojima (taka@gigafied.com) * Licensed under the MIT License * * Date: @DATE diff --git a/lib/minion.js b/lib/minion.js new file mode 100644 index 0000000..a08e7dd --- /dev/null +++ b/lib/minion.js @@ -0,0 +1,16 @@ +/* + Yes, we're assigning "minion" as a global var. Deal with it, it solves more issues than it creates doing it this way. + The reason being, as a huge part of Minion is working in the browser, minion is a global var in the browser. + Thus, it carries over into node.js. +*/ + +module.exports = minion = require("./minion.main.js"); + +require("./minion.baseclass.js"); +require("./minion.class.js"); +require("./minion.singleton.js"); +require("./minion.static.js"); +require("./minion.notifications.js"); +require("./minion.node.js"); + +minion.build(); \ No newline at end of file diff --git a/src/minion.main.js b/lib/minion.main.js similarity index 79% rename from src/minion.main.js rename to lib/minion.main.js index b66dfd0..f134efa 100755 --- a/src/minion.main.js +++ b/lib/minion.main.js @@ -34,6 +34,8 @@ THE SOFTWARE.

TODO: - Multiple inheritance - Independent library support, i.e. ability to do minion.require("minion.libs.jquery") to load jquery + - AMD Compliant? + - minion.provides("namespace.*"); - __preDefine method on Classes, takes 1 argument, a callback that gets called once __preDefine does all it needs to do */ @@ -86,40 +88,30 @@ var minion = (function (root) { var _ns = {}; var _errorTimeout = 1e4; - /** - * @exports _minion as minion - * @class - */ var _minion = {}; /*================= HELPER FUNCTIONS =================*/ - /** @private */ var _isArray = Array._isArray || function (a) { return a instanceof Array; }; - /** @private */ var _isObject = function (obj) { return typeof obj === "object"; }; - /** @private */ var _isString = function (s) { return typeof s === 'string' || s instanceof String; }; - /** @private */ var _isFunction = function (fn) { return typeof fn === "function"; }; - /** @private */ var _strToArray = function (s) { return (!_isArray(s)) ? [s] : s; }; - /** @private */ var _concatArray = function (a, b, forceUnique) { b = b || []; if(!forceUnique){ @@ -139,7 +131,6 @@ var minion = (function (root) { return b; }; - /** @private */ var _copyToNS = function(o1,o2){ for (var i in o1) { if(o1.hasOwnProperty(i)){ @@ -148,7 +139,6 @@ var minion = (function (root) { } }; - /** @private */ var _removeFromNS = function(o1,o2){ for (var i in o1) { if(o1.hasOwnProperty(i)){ @@ -160,7 +150,7 @@ var minion = (function (root) { // Recursively checks dependencies - /** @private */ + var _areDependenciesLoaded = function (o) { o = _minion.get(o, false); var i; @@ -178,7 +168,7 @@ var minion = (function (root) { return true; }; - /** @private */ + var _checkLoadQueue = function () { var i, j, q, dependenciesLoaded, classes, classesArray; q = {}; @@ -206,7 +196,7 @@ var minion = (function (root) { } }; - /** @private */ + var _checkExtendQueue = function () { var eq = _extendQueue; var i, superClass, ns, id; @@ -235,7 +225,7 @@ var minion = (function (root) { _checkLoadQueue(); }; - /** @private */ + var _checkWaitQueue = function () { var w = _waitingForLoad; @@ -265,10 +255,6 @@ var minion = (function (root) { /** * Injects a Script tag into the DOM - * - * @param f The path of the file to inject. - * @param c The class which maps to the file we are injecting. - * @private */ var _inject = function(f, c) { @@ -296,7 +282,6 @@ var minion = (function (root) { _waitingForLoad.push(injectObj); - /** @ignore */ script.onreadystatechange = /** @ignore */ script.onload = function (e) { if (_minion.isDefined(c)) { injectObj.s.onload = injectObj.s.onreadystatechange = null; @@ -305,7 +290,6 @@ var minion = (function (root) { } }; - /** @ignore */ script.onerror = function (e) { injectObj.s.onerror = null; _waitingForLoad.splice(_waitingForLoad.indexOf(injectObj), 1); @@ -320,9 +304,6 @@ var minion = (function (root) { /** * Does all the loading of JS files - * - * @param q The queue to be loaded - * @private */ var _load = function (q) { @@ -349,12 +330,6 @@ var minion = (function (root) { /** * Used by minion.get() and minion.define(). * Get the namespace/Class, or creates it if it does not exist. Also optionally creates Objects in the specified namepsace. - * - * @param {String|Object}id The fully qualified namespace. - * @param {Boolean} autoCreate Whether or not to create a blank object if the namespace does not yet exist. - * @param {Object} [definitions] An object of class definitions which will be added to the namespace. - * @returns {Object} The object that represents the fully qualified namespace passed in as the first argument. - * @private */ var _namespace = function (id, autoCreate, definitions) { @@ -449,9 +424,6 @@ var minion = (function (root) { /** * Configure minion. - * - * @public - * @param {Object} configObj Configuration object, possible properties are : classPath, separator and fileSuffix */ _minion.configure = function (configObj) { @@ -476,9 +448,6 @@ var minion = (function (root) { /** * Alias minion under a different namespace. I.e. var woot = minion.alias("woot"); - * - * @public - * @param {String} alias The name of the namespace to alias minion under. */ _minion.alias = function (alias) { @@ -488,10 +457,6 @@ var minion = (function (root) { /** * Gets the object by it's fully qualified identifier. - * - * @public - * @param {String} id The identifier to get - * @returns {Object|Boolean} The object that represents the identifier or false if it has not yet been defined. */ _minion.get = function (id) { @@ -514,11 +479,6 @@ var minion = (function (root) { /** * Defines Classes under the given namespace. - * - * @public - * @param {String} id The namespace to define the Classes under. - * @param {Object} [definitions] An object of class definitions which will be added to the namespace - * @returns {Object} The object that represents the namespace passed in as the first argument. */ _minion.define = function (id, definitions) { var r = _namespace(id, true, definitions); @@ -528,10 +488,6 @@ var minion = (function (root) { /** * Gets the URL for a given identifier. - * - * @public - * @param {String} id The fully qualified name to look up. - * @returns {String} The URL of the file that maps to the fully qualified name. */ _minion.getURL = function (id) { @@ -548,12 +504,8 @@ var minion = (function (root) { }; /** - * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined)
+ * Checks to see whether the given fully qualified name or Object is defined as a minion class. (Checks for .__isDefined) * NOTE: Classes that have not yet loaded all of their dependencies, will return FALSE for this check. - * - * @public - * @param {String|Object} id The fully qualfied class name, or an Object. - * @returns {Boolean} Whether or not this is defined. */ _minion.isDefined = function (id) { @@ -563,11 +515,6 @@ var minion = (function (root) { /** * Extends a given class asynchronously. - * - * @public - * @param {String} id The fully qualified name of the Class you want to extend. - * @param {Object} obj A new Class Object - * @returns {Object} The extended Class, or, if still waiting on dependencies, the original Object with a few more properties for internal minion use. */ _minion.extend = function (id, obj) { @@ -588,10 +535,6 @@ var minion = (function (root) { /** * Tells minion that filePath provides the class definitions for these classes. * Useful in cases where you group specific things into minfiied js files. - * - * @public - * @param {String} file The path of a JS file. - * @param {String|Array} definitions Fully qualfiied name(s) of class(es) */ _minion.provides = function (file, definitions) { @@ -610,10 +553,6 @@ var minion = (function (root) { /** * Asyncrhonously loads in js files for the classes specified. * If the classes have already been loaded, or are already defined, the callback function is invoked immediately. - * - * @public - * @param {String|Array} ids The fully qualified name(s) of the class(es) to load. - * @param {Function} callback The function to call once all classes (and their dependencies) have been loaded. */ _minion.require = function (ids, callback) { @@ -664,11 +603,6 @@ var minion = (function (root) { * * Identifiers can contain the* wildcard character as its last segment (eg: test.*) * which will import all Classes under the given namespace. - * - * @public - * @param {String|Array} ids The fully qualfiied name(s) to import into the global namespace. - * @param {Object=[root]} The scope to use. - * @returns {Object} Returns the object passed in as the second argument, with the classes passed in as the first argument as properties. */ _minion.use = function (ids, scope) { @@ -711,38 +645,38 @@ var minion = (function (root) { return scope; }; - /** @private */ + _minion.enableNotifications = function () { if (_minion.isDefined("minion.NotificationManager")) { if (!_notificationManager) { _notificationManager = new (minion.get("minion.NotificationManager"))(); - /** @private */ + _minion.subscribe = function () { _notificationManager.subscribe.apply(_notificationManager, arguments); }; - /** @private */ + _minion.unsubscribe = function () { _notificationManager.unsubscribe.apply(_notificationManager, arguments); }; - /** @private */ + _minion.publish = function () { _notificationManager.publish.apply(_notificationManager, arguments); }; - /** @private */ + _minion.holdNotification = function () { _notificationManager.holdNotification.apply(_notificationManager, arguments); }; - /** @private */ + _minion.releaseNotification = function () { _notificationManager.releaseNotification.apply(_notificationManager, arguments); }; - /** @private */ + _minion.cancelNotification = function () { _notificationManager.cancelNotification.apply(_notificationManager, arguments); }; diff --git a/lib/minion.node.js b/lib/minion.node.js new file mode 100644 index 0000000..d6b2757 --- /dev/null +++ b/lib/minion.node.js @@ -0,0 +1,12 @@ +/* + Only included in the node.js version of minion. Provides the build() + watch() methods. + Can be called programatically or via the cli `minion build [options]` +*/ + +minion.build = function (opts, cb) { + +} + +minion.watch = function (opts, cb) { + +} \ No newline at end of file diff --git a/src/minion.notifications.js b/lib/minion.notifications.js similarity index 90% rename from src/minion.notifications.js rename to lib/minion.notifications.js index 92c326b..2f7f72d 100644 --- a/src/minion.notifications.js +++ b/lib/minion.notifications.js @@ -4,8 +4,6 @@ minion.define("minion", { - /** @lends minion.Notification# */ - Notification : minion.extend("minion.Class", { data : {}, @@ -19,11 +17,6 @@ * * Notifications are the backbone of Minion's pub/sub model. * You should not have to construct Notification's directly, as the publish() method does this for you. - * - * @constructs - * @param {String} name The name of the Notification. - * @param {Object} data An object of data associated with the Notification. - * @param {Function} callback A callback function. This gets invoked by calling Notification.respond(); */ init : function(name, data, callback) { this.name = name; @@ -34,18 +27,13 @@ /** * * Holds a notification. Useful if you want to do other things before other instances receive this Notification, - * - * @public */ hold : function() { this.status = 2; }, /** - * * Releases a Notification, call this at some point after hold(); - * - * @public */ release : function() { @@ -54,10 +42,7 @@ }, /** - * * Cancels a Notification, any instances interested in this Notification higher up the chain will not receive it. - * - * @public */ cancel : function() { @@ -72,11 +57,7 @@ }, /** - * * Dispatches a Notification. You will rarely ever construct or call dispatch() on Notifications directly, as the publish() method handles all of this. - * - * @param {Object} obj An Object referencing what is dispatching this Notification. - * @public */ dispatch : function(obj) { @@ -109,7 +90,6 @@ /* This Class handles all the nitty gritty Notification stuff. - TODO: Be nice and add some comments for other people :) */ require : [ diff --git a/src/minion.singleton.js b/lib/minion.singleton.js similarity index 79% rename from src/minion.singleton.js rename to lib/minion.singleton.js index dc2559b..56c8bc5 100644 --- a/src/minion.singleton.js +++ b/lib/minion.singleton.js @@ -1,25 +1,18 @@ - (function(){ +(function(){ "use strict"; minion.define("minion", { - /** @lends minion.Singleton# */ - Singleton : minion.extend("minion.Class", { /** - * * A way to easily implement Singletons. - * - * @constructs - * @extends minion.Class */ init : function(){ }, - /** @ignore */ __preInit : function(){ if(this.constructor.__instance){ return this.constructor.__instance; @@ -31,18 +24,14 @@ return this.constructor.__instance; }, - /** @ignore */ __static : { - /** @lends minion.Singleton# */ __isSingleton: true, /** * * Returns the instance of this Singleton. If this Class has not yet been instantiated, creates a new instance and returns that. * Otherwise, it returns the already existing reference. - * - * @memberOf minion.Singleton# */ getInstance : function(){ if(!this.__instance){ diff --git a/src/minion.static.js b/lib/minion.static.js similarity index 74% rename from src/minion.static.js rename to lib/minion.static.js index 25c1423..647f2a1 100644 --- a/src/minion.static.js +++ b/lib/minion.static.js @@ -4,8 +4,6 @@ minion.define("minion", { - /** @lends minion.Static# */ - Static : minion.extend("minion.Singleton", { __static : { @@ -15,11 +13,7 @@ }, /** - * * A way to easily implement Static Classes. - * - * @constructs - * @extends minion.Singleton */ init : function(){ diff --git a/lib/version.txt b/lib/version.txt new file mode 100644 index 0000000..e1df5de --- /dev/null +++ b/lib/version.txt @@ -0,0 +1 @@ +1.4.4 \ No newline at end of file diff --git a/package.json b/package.json index 94ea0ce..a2092c7 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,12 @@ "name": "minion", "version": "1.4.4", "description": "Cross-Platform & Cross-Browser JavaScript Inheritance.", - "main": "./bin/minion.js", + "main": "./lib/minion.js", "directories": { "lib": "lib", "test": "test", - "examples": "examples", + "docs": "docs", + "dist": "dist", "bin": "bin" }, "bin": { @@ -14,10 +15,11 @@ }, "dependencies": { "optimist": "0.3.x", + "ansi-color": "0.2.x" + }, + "devDependencies" : { "uglify-js": "1.2.x", - "jsdoc-toolkit": "0.0.x", - "ansi-color": "0.2.x", - "jshint": "0.5.x" + "jshint": "0.5.x" }, "repository": { "type": "git", diff --git a/readme.md b/readme.md index f0e6706..f231de3 100755 --- a/readme.md +++ b/readme.md @@ -1,13 +1,6 @@ ## MinionJS - Cross-Platform & Cross-Browser JavaScript Classical Inheritance -The goal of MinionJS is to provide easy-to-use, easy-to-learn classical inheritance for JavaScript. - -MinionJS enables you to easily namespace, create and extend custom classes. - -MinionJS handles all the nitty-gritty, so you can focus on the important stuff, like ironing out the final details of your plan for global domination. - -## Examples - +MinionJS provides easy-to-use, easy-to-learn classical inheritance for JavaScript. Easily namespace, create and extend custom classes! #### Defining a Class: @@ -41,9 +34,12 @@ MinionJS handles all the nitty-gritty, so you can focus on the important stuff, }) -That's the core of Minion, it's that simple. There's a bit more you can do obviously, but we wanted to give you an idea of -what you can do with MinionJS in under 20 lines of code. See [Getting Started](https://github.com/gigafied/minion/blob/master/getting_started.md) to dive in deeper. +That's the core of Minion, it's that simple. +## Getting Started + +https://github.com/gigafied/minion/blob/master/docs/getting_started.md +n/docs/ ####Videos: - [Overview](http://www.screenr.com/wOas) @@ -62,7 +58,7 @@ what you can do with MinionJS in under 20 lines of code. See [Getting Started](h - MinionJS does all this, all while sporting a tiny footprint of 3.8k (minified and gzipped). -#### Currently Supported: +####Currently Supported: - Node.js - IE 7+ @@ -84,24 +80,6 @@ what you can do with MinionJS in under 20 lines of code. See [Getting Started](h - MinionJS does not touch native JavaScript prototypes. I.E. no Object.prototype.someSuperAwesomeMethod___weThink(); - Damage Control. No global pollution (by default). All classes reside under the minion namespace. This is good, trust us. - -## Getting Started - -https://github.com/gigafied/minion/blob/master/getting_started.md - -## Documentation - -JSDocs available at: http://gigafied.github.com/minion/docs/ - - -## Contributing - -We want you to contribute. Fork the project, issue a pull request. Ideally, if you are adressing a specific issue, please create an issue in GitHub and reference that issue in your commits. -Write a Unit Test for your fix, so that we can be sure any future updates don't undo all your hard work :) - -We'd love to support more platforms. There is very, very little platform detection in Minion's source code. (This is a good thing, we want to keep it this way). -Getting it to work on other platforms should be relatively simple, so feel free to lend a hand! - ## License (c) 2011 Taka Kojima (the "Author"). diff --git a/src/jsdoc-conf.json b/src/jsdoc-conf.json deleted file mode 100644 index 33da7fe..0000000 --- a/src/jsdoc-conf.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - // source files to use - _: [ - 'bin/minion.js' - ], - - // document all functions, even uncommented ones - a: true, - - // including those marked @private - p: false, - - // some extra variables I want to include - D: { - "author": "Taka Kojima (taka.kojima@ff0000.com)", - "name": "minion", - "homepage": "https://github.com/gigafied/minion", - "repository": "git@github.com:gigafied/minion.git", - "noGlobal": "true" - }, - - // use this directory as the output directory - d: "gh-pages/docs", - - // use this template - t: "src/minion-jsdoc-template" -} diff --git a/src/minion-jsdoc-template/README.md b/src/minion-jsdoc-template/README.md deleted file mode 100755 index 6f5f204..0000000 --- a/src/minion-jsdoc-template/README.md +++ /dev/null @@ -1,191 +0,0 @@ -WARNING: this template is still under development and it might change every so -often. - -jsdoc-simple -============ - -jsdoc-simple is a modified jsdoc toolkit (Version 2) template with support for -additional documentation. - -## Features ## - -- Very simple and readable layout. -- Support for additional files and resources. -- Scripts and CSS-Files in additional Resource files will be copied. - automatically. So one can develop and test examples indiviually and easily - create a self contained documentation. -- Support for Markdown Resource files. -- Markdown processing for Class-, Method-, Property-, Event-descriptions. -- Dynamically filterable (using regular expressions) symbol index. -- 'cssFile' user-defined option that allows the use of a different css file for - the documentation's styling. - -An example javascript library using jsdoc-simple can be found at: [http://github.com/urso/qc.js](http://github.com/urso/qc.js) - -[Screenshots](http://github.com/urso/jsdoc-simple/wiki/Screenshots) - -## Install ## - -The whole template directory must be copied as is into jsdoc's template -directory. - -## Usage ## - -In order to use 'jsdoc-simple' you have to tell jsdoc toolkit to use it via -the '-t' flag when calling jsdoc or prepare a jsdoc toolkit configuration file -with option 't:' set to the template's directory. - -### Static Documentation ### - -You also may want to add some static documentation to the generated -documentation. To do so create a jsdoc toolkit configuration file and add the -option 'docs:' with the field 'content' being an array of files to add and -the optional field 'preprocess'. - -Every Entry in the 'content' array MUST be an object having the fields 'src' -and 'title' plus the optional field 'preprocess'. - -The 'preprocess' field MUST be a shell command to be execute on the 'src' -file. It is assumed that the command will read the file's content from stdin -and print its outcome to stdout. - -For example this will add the files intro.pdc and tutorial.pdc to the -documentation, which are preprocessed using pandoc (Haskell based markdown -program) : - - { - d: 'docs', // output directory 'docs' - a: false, // do not show all symbols - docs: { - preprocess: 'pandoc', // preprocess all files with pandoc - content: [ {src:'docsrc/intro.pdc', - title: 'Introduction' }, - {src:'docsrc/tutorial.pdc', - title: 'Tutorial'} - ] - } - } - -In the following example only the file intro.pdc is preprocessed using pandoc: - - { - d: 'docs', // output directory 'docs' - a: false, // do not show all symbols - docs: { - content: [ {src:'docsrc/intro.pdc', - preprocess: 'pandoc', // preprocess only this file with pandoc - title: 'Introduction' }, - {src:'docsrc/tutorial.html', - title: 'Tutorial'} - ] - } - } - -When using a global preprocessor for all documentations and a local one for a -file, the latter one is chosen for that file only whereas all others are -preprocessed using the former one. - -Creating the documentation then will be as easy as (with \*nix shell): - - $ run.sh -c='jsdoc.conf' -t="$JSDOCDIR/templates/jsdoc-simple" src - -### Choosing a different default CSS file ### - -jsdoc-simple gives you the ability to modify the CSS file that is used to style -the generated documentation. By default, the default.css file found within the -static folder is used. To use a different CSS file, you MUST add the desired -css file to the jsdoc-simple static folder and then define the 'cssFile' option -in one of two ways: - -On the command line: - - run.sh -c='jsdoc.conf' -t="$JSDOCDIR/templates/jsdoc-simple" -D="cssFile:myCssFile.css" - -In a configuration file: - - { - d: 'docs', // output directory 'docs' - a: false, // do not show all symbols - D: { - cssFile: 'myCssFile.css' - } - } - -**NOTE:** The value for 'cssFile' should be given without any path prefix as -it's value is already rooted within the static folder. - -## Handling additional Resources ## - -When supplying further documentation to add to the final document you may want -to add further resources like images, css files or even script files for -showcasing. To do so, the 'docs' field in the jsdoc configuration file -supports a 'resources' field, which must be an Array of File and Directory -paths to copy. - -For example: - - { - d: 'docs', // output directory 'docs' - a: false, // do not show all symbols - docs: { - resources: ['docsrc/images'], - content: [ {src:'docsrc/intro.html', - title: 'Introduction' }, - {src:'docsrc/tutorial.html', - title: 'Tutorial'} - ] - } - } - -If the additional documentation sports a valid html file with header and body, -this file will be processed as follows: - -- get body-Element of the file and copy its inner content to the final output - file - -- get header-Element and analyze tags: - - for every 'script' or 'link' tag the src/href attribute is - adjusted to the file the source was copied to - - for every 'script' or 'link' tag all files named in the src/href - attribute are automatically copied to the documentation directory - - automatically adjust path of output copied resources if needed - - copy html header into template - -Thus when writing JavaScript libraries for example you may showcase using the -relative path to your source file directory and still test it without -rebuilding the documentation. When building the documentation your library -will be copied then into the final output, such that your examples will still -work and the whole documentation is self contained and can be redistributed -without the original sources. - -Furthermore if a markdown file is given (any file ending with .mk or .markdown) -but no preprocessor, the file is automatically converted to html. - -## Using the Symbol Index ## - -The Symbol index page features a text field used for filtering. When filtering -the content of this text field is interpreted as a regular expression. Thus -typing the expression "a|b|c" will find all symbols starting with a or b or c. -Furthermore the regular expression is interpreted to be case insensitive. But -if you have symbolic names using special characters like '$' proper escaping -is needed. Meaning that if you want to filter all symbols starting with '$' -you have to type "\$". - -## Credits ## - -- JavaScript HTML Parser: - HTML Parser By John Resig (ejohn.org) - Original code by Erik Arvidsson, Mozilla Public License - http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - -- [MooTools 1.2.4 Server](http://mootools.net/developers/): - authors: The MooTools production team - -- [JSDom](http://github.com/urso/jsdom): - JavaScript DOM duck typing classes for non browser environments - -- [Showdown](http://attacklab.net/showdown/): - Markdown for JavaScript - -- [cssFile option functionality](https://github.com/cobhimself): Collin - Brooks diff --git a/src/minion-jsdoc-template/allclasses.tmpl b/src/minion-jsdoc-template/allclasses.tmpl deleted file mode 100755 index d932b82..0000000 --- a/src/minion-jsdoc-template/allclasses.tmpl +++ /dev/null @@ -1,17 +0,0 @@ - -

Index

-
    -
  • {+new Link().toFile("files.html").withText("File Index")+}
  • -
  • {+new Link().toFile("index.html").withText("Class Index")+}
  • -
  • {+new Link().toFile("symbolindex.html").withText("Symbol Index")+}
  • -
-

Classes

-
    - -
  • {! - if (thisClass.alias != "_global_") { - output += new Link().toClass(thisClass.alias); - } - !}
  • -
    -
diff --git a/src/minion-jsdoc-template/allfiles.tmpl b/src/minion-jsdoc-template/allfiles.tmpl deleted file mode 100755 index a57973f..0000000 --- a/src/minion-jsdoc-template/allfiles.tmpl +++ /dev/null @@ -1,58 +0,0 @@ - - - - - {! Link.base = ""; /* all generated links will be relative to this */ !} - JsDoc Reference - File Index - - - - - - - - {+include("header.html")+} - -
-
- {+publish.docsIndex+} -
- {+publish.classesIndex+} -
- -
-

File Index

- - -
-

{+new Link().toSrc(item.alias).withText(item.name)+}

- {+resolveLinks(item.desc)+} -
- -
Author:
-
{+item.author+}
-
- -
Version:
-
{+item.version+}
-
- {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !} - -
Location:
- -
{+location+}
-
-
-
-
-
- -
-
-
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - diff --git a/src/minion-jsdoc-template/class.tmpl b/src/minion-jsdoc-template/class.tmpl deleted file mode 100755 index 35e11be..0000000 --- a/src/minion-jsdoc-template/class.tmpl +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - {! Link.base = "../"; /* all generated links will be relative to this */ !} - JsDoc Reference - {+data.alias+} - - - - - - - - {+include("header.html")+} - - - {! - var classType = ""; - - if (data.isBuiltin()) { - classType += "Built-In "; - } - - if (data.isNamespace) { - if (data.is('FUNCTION')) { - classType += "Function "; - } - classType += "Namespace "; - } - else { - classType += "Class "; - } - !} - - -
-
- {+publish.docsIndex+} -
- {+publish.classesIndex+} -
- -
- - -

- {+classType+} -

-
    -
  • - {+ - /* new Link().toSymbol(data.alias).inner('constructor') */ - new Link().toSymbol(data.alias).withText(data.name) - +} -
  • -
-
- - - - {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - -

{+ data.isNamespace ? "Variables" : "Fields" +}

-
    - -
  • - {+new Link().toSymbol(member.alias).withText(member.name)+} -
  • -
    -
-
- - - - {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - -

{+ data.isNamespace ? "Functions" : "Methods" +}

-
    - -
  • - {+new Link().toSymbol(member.alias).withText(member.name)+} -
  • -
    -
-
- - - - {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - -

Events

-
    - -
  • {+new Link().toSymbol(member.alias).withText(member.name)+}
  • -
    -
-
- -
- -
- -

- {+classType+}{+data.alias+} -

- - -

-
Version - {+ data.version +}.
-
-
Extends - {+ - data.augments - .sort() - .map( - function($) { return new Link().toSymbol($); } - ) - .join(", ") - +}.
- - -

- {! - var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias}); - - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Fields borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - !} -
- - - -
- {! - var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Methods borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
- - -
- {! - var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Events borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
- - - - {+resolveLinks(data.classDesc)+} - - {# isn't defined in any file #} -
Defined in: {+new Link().toSrc(data.srcFile)+}. -
-

- - - -
-
- {+classType+}Detail -
- -
{! - if (data.isPrivate) output += "<private> "; - if (data.isInner) output += "<inner> "; - !} - {+ data.alias +}{+ makeSignature(data.params) +} -
- -
- {+markdownConverter.makeHtml(resolveLinks(data.desc))+} -
Author: {+data.author+}.
-
- - - -
{+example+}
-
-
- - - -
-
Parameters:
- -
- {+((item.type)?""+("{"+(new Link().toSymbol(item.type)+"} ")) : "")+} {+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+resolveLinks(data.deprecated)+} -
-
-
- -
-
Since:
-
{+ data.since +}
-
-
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
- - - -
-
- Field Detail -
- -
- -
-
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - if (member.isConstant) output += "<constant> "; - !} -
- - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+} - -
-
- {+markdownConverter.makeHtml(resolveLinks(member.desc))+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
Default Value:
-
- {+resolveLinks(member.defaultValue)+} -
-
-
-
-
-
-
- - - -
-
- Method Detail -
- -
- -
-
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} -
- - {+member.memberOf+}.{+member.name.replace(/\^\d+$/, '')+}{+makeSignature(member.params)+} - : {{+new Link().toSymbol(member.type)+}} - -
-
- {+markdownConverter.makeHtml(resolveLinks(member.desc))+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- - {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional
Default Value: {+item.defaultValue+}
-
-
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
-
- - - -
-
- Event Detail -
- -
- -
-
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} -
- - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+}{+makeSignature(member.params)+} - -
-
- {+markdownConverter.makeHtml(resolveLinks(member.desc))+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+ resolveLinks(item.desc) +}
-
-
-
- -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+ resolveLinks(item.desc) +}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
-
-
-
- - - -
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - diff --git a/src/minion-jsdoc-template/class.tmpl_old b/src/minion-jsdoc-template/class.tmpl_old deleted file mode 100755 index 101f04d..0000000 --- a/src/minion-jsdoc-template/class.tmpl_old +++ /dev/null @@ -1,647 +0,0 @@ - - - - - - {! Link.base = "../"; /* all generated links will be relative to this */ !} - JsDoc Reference - {+data.alias+} - - - - - - - - {+include("header.html")+} - - - -
- - {+publish.classesIndex+} - -
- -
- -

- {! - var classType = ""; - - if (data.isBuiltin()) { - classType += "Built-In "; - } - - if (data.isNamespace) { - if (data.is('FUNCTION')) { - classType += "Function "; - } - classType += "Namespace "; - } - else { - classType += "Class "; - } - !} - {+classType+}{+data.alias+} -

- - -

-
Version - {+ data.version +}.
-
-
Extends - {+ - data.augments - .sort() - .map( - function($) { return new Link().toSymbol($); } - ) - .join(", ") - +}.
-
- - {+resolveLinks(data.classDesc)+} - - {# isn't defined in any file #} -
Defined in: {+new Link().toSrc(data.srcFile)+}. -
-

- - - - - - - - - - - - - - - - - -
{+classType+}Summary
Constructor AttributesConstructor Name and Description
{! - if (data.isPrivate) output += "<private> "; - if (data.isInner) output += "<inner> "; - !}  -
- {+ new Link().toSymbol(data.alias).inner('constructor')+}{+ makeSignature(data.params) +} -
-
{+resolveLinks(summarize(data.desc))+}
-
-
- - - - {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - if (member.isConstant) output += "<constant> "; - !}  -
- {+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias}); - - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Fields borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - !} -
-
-
- - - - {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !}  -
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name.replace(/\^\d+$/, ''))+}{+makeSignature(member.params)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Methods borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
-
- - - {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Event Summary
Event AttributesEvent Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !}  -
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+}{+makeSignature(member.params)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Events borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
-
- - - -
-
- {+classType+}Detail -
- -
{! - if (data.isPrivate) output += "<private> "; - if (data.isInner) output += "<inner> "; - !} - {+ data.alias +}{+ makeSignature(data.params) +} -
- -
- {+resolveLinks(data.desc)+} -
Author: {+data.author+}.
-
- - - -
{+example+}
-
-
- - - -
-
Parameters:
- -
- {+((item.type)?""+("{"+(new Link().toSymbol(item.type)+"} ")) : "")+} {+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+resolveLinks(data.deprecated)+} -
-
-
- -
-
Since:
-
{+ data.since +}
-
-
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
- - - -
- Field Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - if (member.isConstant) output += "<constant> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
Default Value:
-
- {+resolveLinks(member.defaultValue)+} -
-
-
- -
-
-
- - - -
- Method Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name.replace(/\^\d+$/, '')+}{+makeSignature(member.params)+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
- - - -
- Event Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+}{+makeSignature(member.params)+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+ resolveLinks(item.desc) +}
-
-
-
- -
-
Deprecated:
-
- {+ resolveLinks(member.deprecated) +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+ resolveLinks(item.desc) +}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
- -
-
- - - -
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - diff --git a/src/minion-jsdoc-template/docsindex.tmpl b/src/minion-jsdoc-template/docsindex.tmpl deleted file mode 100755 index 9181c35..0000000 --- a/src/minion-jsdoc-template/docsindex.tmpl +++ /dev/null @@ -1,9 +0,0 @@ -

Documentation

-
    - -
  • - {+new Link().toFile(doc.outFile).withText(doc.title)+} -
  • -
    -
- diff --git a/src/minion-jsdoc-template/header.html b/src/minion-jsdoc-template/header.html deleted file mode 100755 index 353b735..0000000 --- a/src/minion-jsdoc-template/header.html +++ /dev/null @@ -1,2 +0,0 @@ - \ No newline at end of file diff --git a/src/minion-jsdoc-template/index.tmpl b/src/minion-jsdoc-template/index.tmpl deleted file mode 100755 index 44a45a9..0000000 --- a/src/minion-jsdoc-template/index.tmpl +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - JsDoc Reference - Index - - - - - - - {+include("header.html")+} - -
-
- {+publish.docsIndex+} -
- {+publish.classesIndex+} -
- -
-

Class Index

- - - -
- {! - var classType = ""; - - if (thisClass.isBuiltin()) { - classType += "Built-In "; - } - - if (thisClass.isNamespace) { - if (thisClass.is('FUNCTION')) { - classType += "Function "; - } - classType += "Namespace "; - } - else { - classType += "Class "; - } - !} - -
- {+ classType +} -
- -

{+(new Link().toSymbol(thisClass.alias))+}

- {+resolveLinks(summarize(thisClass.classDesc))+} -
-
-
-
- -
- -
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - diff --git a/src/minion-jsdoc-template/js/htmlparser.js b/src/minion-jsdoc-template/js/htmlparser.js deleted file mode 100755 index a88b1f4..0000000 --- a/src/minion-jsdoc-template/js/htmlparser.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * HTML Parser By John Resig (ejohn.org) - * Original code by Erik Arvidsson, Mozilla Public License - * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js - * - * // Use like so: - * HTMLParser(htmlString, { - * start: function(tag, attrs, unary) {}, - * end: function(tag) {}, - * chars: function(text) {}, - * comment: function(text) {} - * }); - * - * // or to get an XML string: - * HTMLtoXML(htmlString); - * - * // or to get an XML DOM Document - * HTMLtoDOM(htmlString); - * - * // or to inject into an existing document/DOM node - * HTMLtoDOM(htmlString, document); - * HTMLtoDOM(htmlString, document.body); - * - */ - -(function(){ - - // Regular Expressions for parsing tags and attributes - var startTag = /^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, - endTag = /^<\/(\w+)[^>]*>/, - attr = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; - - // Empty Elements - HTML 4.01 - var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"); - - // Block Elements - HTML 4.01 - var block = makeMap("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"); - - // Inline Elements - HTML 4.01 - var inline = makeMap("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); - - // Elements that you can, intentionally, leave open - // (and which close themselves) - var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); - - // Attributes that have their values filled in disabled="disabled" - var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); - - // Special Elements (can contain anything) - //var special = makeMap("script,style"); - var special = makeMap(""); - - var HTMLParser = this.HTMLParser = function( html, handler ) { - var index, chars, match, stack = [], last = html; - stack.last = function(){ - return this[ this.length - 1 ]; - }; - - while ( html ) { - chars = true; - - // Make sure we're not in a script or style element - if ( !stack.last() || !special[ stack.last() ] ) { - - // Comment - if ( html.indexOf(""); - - if ( index >= 0 ) { - if ( handler.comment ) - handler.comment( html.substring( 4, index ) ); - html = html.substring( index + 3 ); - chars = false; - } - - // end tag - } else if ( html.indexOf("]*>"), function(all, text){ - text = text.replace(//g, "$1") - .replace(//g, "$1"); - - if ( handler.chars ) - handler.chars( text ); - - return ""; - }); - - parseEndTag( "", stack.last() ); - } - - if ( html == last ) - throw "Parse Error: " + html; - last = html; - } - - // Clean up any remaining tags - parseEndTag(); - - function parseStartTag( tag, tagName, rest, unary ) { - if ( block[ tagName ] ) { - while ( stack.last() && inline[ stack.last() ] ) { - parseEndTag( "", stack.last() ); - } - } - - if ( closeSelf[ tagName ] && stack.last() == tagName ) { - parseEndTag( "", tagName ); - } - - unary = empty[ tagName ] || !!unary; - - if ( !unary ) - stack.push( tagName ); - - if ( handler.start ) { - var attrs = []; - - rest.replace(attr, function(match, name) { - var value = arguments[2] ? arguments[2] : - arguments[3] ? arguments[3] : - arguments[4] ? arguments[4] : - fillAttrs[name] ? name : ""; - - attrs.push({ - name: name, - value: value, - escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" - }); - }); - - if ( handler.start ) - handler.start( tagName, attrs, unary ); - } - } - - function parseEndTag( tag, tagName ) { - // If no tag name is provided, clean shop - if ( !tagName ) - var pos = 0; - - // Find the closest opened tag of the same type - else - for ( var pos = stack.length - 1; pos >= 0; pos-- ) - if ( stack[ pos ] == tagName ) - break; - - if ( pos >= 0 ) { - // Close all the open elements, up the stack - for ( var i = stack.length - 1; i >= pos; i-- ) - if ( handler.end ) - handler.end( stack[ i ] ); - - // Remove the open elements from the stack - stack.length = pos; - } - } - }; - - this.HTMLtoXML = function( html ) { - var results = ""; - - HTMLParser(html, { - start: function( tag, attrs, unary ) { - results += "<" + tag; - - for ( var i = 0; i < attrs.length; i++ ) - results += " " + attrs[i].name + '="' + attrs[i].escaped + '"'; - - results += (unary ? "/" : "") + ">"; - }, - end: function( tag ) { - results += ""; - }, - chars: function( text ) { - results += text; - }, - comment: function( text ) { - results += ""; - } - }); - - return results; - }; - - this.HTMLtoDOM = function( html, doc ) { - // There can be only one of these elements - var one = makeMap("html,head,body,title"); - - // Enforce a structure for the document - var structure = { - link: "head", - base: "head" - }; - - if ( !doc ) { - if ( typeof DOMDocument != "undefined" ) - doc = new DOMDocument(); - else if ( typeof document != "undefined" && document.implementation && document.implementation.createDocument ) - doc = document.implementation.createDocument("", "", null); - else if ( typeof ActiveX != "undefined" ) - doc = new ActiveXObject("Msxml.DOMDocument"); - - } else - doc = doc.ownerDocument || - doc.getOwnerDocument && doc.getOwnerDocument() || - doc; - - var elems = [], - documentElement = doc.documentElement || - doc.getDocumentElement && doc.getDocumentElement(); - - // If we're dealing with an empty document then we - // need to pre-populate it with the HTML document structure - if ( !documentElement && doc.createElement ) (function(){ - var html = doc.createElement("html"); - var head = doc.createElement("head"); - head.appendChild( doc.createElement("title") ); - html.appendChild( head ); - html.appendChild( doc.createElement("body") ); - doc.appendChild( html ); - })(); - - // Find all the unique elements - if ( doc.getElementsByTagName ) - for ( var i in one ) - one[ i ] = doc.getElementsByTagName( i )[0]; - - // If we're working with a document, inject contents into - // the body element - var curParentNode = one.body; - - HTMLParser( html, { - start: function( tagName, attrs, unary ) { - // If it's a pre-built element, then we can ignore - // its construction - if ( one[ tagName ] ) { - curParentNode = one[ tagName ]; - return; - } - - var elem = doc.createElement( tagName ); - - for ( var attr in attrs ) - elem.setAttribute( attrs[ attr ].name, attrs[ attr ].value ); - - if ( structure[ tagName ] && typeof one[ structure[ tagName ] ] != "boolean" ) - one[ structure[ tagName ] ].appendChild( elem ); - - else if ( curParentNode && curParentNode.appendChild ) - curParentNode.appendChild( elem ); - - if ( !unary ) { - elems.push( elem ); - curParentNode = elem; - } - }, - end: function( tag ) { - elems.length -= 1; - - // Init the new parentNode - curParentNode = elems[ elems.length - 1 ]; - }, - chars: function( text ) { - curParentNode.appendChild( doc.createTextNode( text ) ); - }, - comment: function( text ) { - // create comment node - } - }); - - return doc; - }; - - function makeMap(str){ - var obj = {}, items = str.split(","); - for ( var i = 0; i < items.length; i++ ) - obj[ items[i] ] = true; - return obj; - } -})(); diff --git a/src/minion-jsdoc-template/js/jsdom.js b/src/minion-jsdoc-template/js/jsdom.js deleted file mode 100755 index 0e45d0c..0000000 --- a/src/minion-jsdoc-template/js/jsdom.js +++ /dev/null @@ -1,508 +0,0 @@ - -/* - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (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.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Initial Developer of the Original Code is Steffen Siering. All Rights Reserved. - */ - -(function() { - - /** @scope _global_ */ - /** - * Abstract class for more specific DOM-Node classes. - * - * @class - */ - function DomAbstract(){ return this; } - - this.DomAbstract = DomAbstract; // export DomAbstract - - DomAbstract.constructor = DomAbstract; - /** @function */ - DomAbstract.prototype.__doGetElementsBy = function(){return []}; - DomAbstract.prototype.getElementsByTagName = function(){ return []; }; - DomAbstract.prototype.getElementById = function(){ return null; }; - DomAbstract.prototype.getAttribute = function(){ return ""}; - DomAbstract.prototype.setAttribute = function(){}; - DomAbstract.prototype.removeAttribute = function(){}; - DomAbstract.prototype.cloneNode = function(){}; - DomAbstract.prototype.uid = 1; - DomAbstract.prototype.nodeValue = null; - DomAbstract.prototype.firstChild = null; - DomAbstract.prototype.nextSibling = null; - DomAbstract.prototype.previousSibling = null; - DomAbstract.prototype.style = ""; - - DomAbstract.prototype.getInnerHTML = function(){}; - DomAbstract.prototype.setInnerHTML = function(val){}; - DomAbstract.prototype.getInnerText = function(){}; - DomAbstract.prototype.setInnerText = function(){}; - DomAbstract.prototype.getOuterHTML = function(){}; - DomAbstract.prototype.setOuterHTML = function(){}; - - DomAbstract.prototype.__defineGetter__("innerText", function(){ return - this.getInnerText(); - }); - DomAbstract.prototype.__defineSetter__("innerText", function(x){ - this.setInnerText(x); - }); - DomAbstract.prototype.__defineGetter__("innerHTML", function(){ - return this.getInnerHTML(); - }); - DomAbstract.prototype.__defineSetter__("innerHTML", function(x){ - this.setInnerHTML(x); - }); - DomAbstract.prototype.__defineGetter__("outerHTML", function(){ - return this.getOuterHTML(); - }); - DomAbstract.prototype.__defineSetter__("outerHTML", function(x){ - this.setOuterHTML(x); - }); - - /** @scope _global_ */ - /** - * DOM Element Node. - * - * @class - */ - function DomElement(parent, tag, attrs) { - this.nodeType = 1; - this.initialized = false; - - this.style = ""; - this.className = ''; - this.id = null; - this.lang = null; - - var attrs = !attrs ? [] : $A(attrs).filter(function(x){ - if(x.nodeName == "class") { - this.className = x.nodeValue; - return false; - } - if(x.nodeName == "id") { - this.id = x.nodeValue; - return false; - } - if(x.nodeName == "lang") { - this.lang = x.nodeValue; - return false; - } - if(x.nodeName == "style") { - this.style = x.nodeValue; - return false; - } - - return true; - }, this); - this.tagName = tag; - this.attrs = attrs; - this.parentNode = parent; - this.childNodes = []; - this.$family = true; - this.nodeName = tag.toUpperCase(); - - this.firstChild = null; - this.lastChild = null; - this.nextSibling = null; - this.previousSibling = null; - this.initialized = true; - - return this; - } - this.DomElement = DomElement; //export class DomElement - - DomElement.constructor = DomElement; - - DomElement.prototype = new DomAbstract(); - - DomElement.prototype.cloneNode = function(recursive){ - var rec = arguments.length == 0 ? true : recursive; - - var ret = new DomElement(undefined, this.tagName, this.copyAttributes); - ret.className = this.className ? this.className : ""; - ret.id = this.id ? this.id : null; - ret.lang = this.lang ? this.lang : null; - ret.style = this.style ? this.style : null; - - if(recursive){ - ret.childNodes = this.childNodes.map(function(child){ - var c = child.cloneNode(recursive); - return c; - }); - } - linkChildren(ret); - return ret; - }; - - DomElement.prototype.copyAttributes = function(){ - this.attrs.map(function(attr){ - return { nodeName: attr.nodeName, - nodeValue: attr.nodeValue, - nodeType: attr.nodeType}; - }); - }; - - DomElement.prototype.appendChild = function(newChild) { - if(newChild.parentNode) newChild.parentNode.removeChild(newChild); - this.childNodes.push(newChild); - newChild.nextSibling = null; - newChild.previousSibling = this.last; - newChild.parentNode = this; - this.lastChild = newChild; - }; - - DomElement.prototype.hasChildNodes = function() { - return this.childNodes.length > 0; - }; - - DomElement.prototype.insertBefore = function(newChild, child) { - if(arguments.length === 1 || !child) this.appendChild(newChild); - if(newChild.parentNode) newChild.parentNode.removeChild(newChild); - - newChild.parentNode = this; - newChild.previousSibling = child.previousSibling; - newChild.nextSibling = child; - child.previousSibling = newChild; - var i = this.childNodes.indexOf(child); - this.childNodes.splice(i,0,newChild); - }; - - DomElement.prototype.removeChild = function(child) { - if(!child || !child.parentNode || child.parentNode !== this) - return undefined; - - this.childNodes.erase(child); - if(child.previousSibling) { - child.previousSibling.nextSibling = child.nextSibling; - } - - if(child.nextSibling){ - child.nextSibling.previousSibling = child.previousSibling; - } - - child.parentNode = null; - child.previousSibling = child.nextSibling = null; - return child; - }; - - DomElement.prototype.replaceChild = function(newChild, oldChild) { - if(newChild.parentNode) newChild.parentNode.removeChild(newChild); - newChild.parentNode = this; - newChild.previousSibling = oldChild.previousSibling; - newChild.previousSibling.nextSibling = newChild; - newChild.nextSibling = oldChild.previousSibling; - newChild.nextSibling.previousSibling = newChild; - if(this.lastChild == oldChild) this.lastChild = newChild; - - var i = this.childNodes.indexOf(oldChild); - this.childNodes.splice(i,1,newChild); - return oldChild; - }; - - DomElement.prototype.__doGetElementsBy = function(selector, first) { - var ret = []; - - this.childNodes.map(function(elem){ - if(!elem.__doGetElementsBy) return []; - var children = elem.__doGetElementsBy(selector, first); - return selector(elem) ? - [elem].concat(children) : - children; - }).each( function(elemSubs){ - if(elemSubs && elemSubs.length>0) - ret = ret.concat(elemSubs.filter(function(x){return x})); - }); - return (!ret || ret.length == 0) ? null : ret; - }; - - DomElement.prototype.getElementsByTagName = function(name) { - return this.__doGetElementsBy( - name === "*" ? function(x){ return x.nodeType == 1; } : - function(x){ - return x.tagName == name; - }, - false); - }; - - DomElement.prototype.getElementById = function(id) { - var tmp = this.__doGetElementsBy(function(x){ return x.id == name; }, - false); - return tmp && tmp.length > 0 ? tmp[0] : undefined; - }; - - DomElement.prototype.getElement = $defined(this['Element']) ? - Element.prototype.getElement : - function(tag) { - return this.getElements(tag)[0] || null; - }; - - DomElement.prototype.getElements = $defined(this['Element']) ? - function() { - var ret = Element.prototype.getElements.apply(this, arguments); - return ret; - } : - function(tags) { - tags = tags.split(','); - var elements = null; - tags.each(function(tag){ - tag = tag.trim().toLowerCase(); - var partial = this.getElementsByTagName(tag); - elements = elements ? elements.concat(partial) : partial; - }, this); - return elements ? elements : []; - }; - - DomElement.prototype.getAttribute = function(name) { - if(name === "id") return this.id; - if(name === "lang") return this.lang; - - for(var i=0; i < this.attrs.length; i++){ - if(this.attrs[i].nodeName == name) { - return this.attrs[i].nodeValue; - } - } - return ""; - }; - - DomElement.prototype.setAttribute = function(name, value){ - for(var i=0; i < this.attrs.length; i++){ - if(this.attrs[i].nodeName == name) { - this.attrs[i].nodeValue = value; - } - } - }; - - DomElement.prototype.removeAttribute = function(name){ - for(var i=0; i < this.attrs.length; i++){ - if(this.attrs[i].nodeName == name) { - this.attrs.splice(i,1); - return; - } - } - }; - - DomElement.prototype.getProperty = $defined(this['Element']) ? - Element.prototype.getProperty : undefined, - - DomElement.prototype.setProperty = $defined(this['Element']) ? - Element.prototype.setProperty : undefined, - - DomElement.prototype.removeProperty = $defined(this['Element']) ? - Element.prototype.removeProperty : undefined, - - DomElement.prototype.getProperties = $defined(this['Element']) ? - Element.prototype.getProperties : undefined, - - DomElement.prototype.setProperties = $defined(this['Element']) ? - Element.prototype.setProperties : undefined, - - DomElement.prototype.removeProperties = $defined(this['Element']) ? - Element.prototype.removeProperties : undefined, - - DomElement.prototype.hasClass = $defined(this['Element']) ? - Element.prototype.hasClass : - function(className) { - return this.className.contains(className, ' '); - } - ; - - if ($defined(this['Element'])) { - DomElement.prototype.get = $defined(this['Element']) ? - Element.prototype.get : - undefined; - - DomElement.prototype.set = $defined(this['Element']) ? - Element.prototype.set : - undefined; - } - - DomElement.prototype.addClass = function(className) { - if (!this.hasClass(className)) { - this.className = (this.className + ' ' + className).clean(); - } - return this; - }; - - DomElement.prototype.removeClass = function(className) { - var regex = new RegExp('(^|\\s)' + className + '(?:\\s|$)'); - this.className = this.className.replace(regex, '$1'); - return this; - }; - - DomElement.prototype.toggleClass = function(className) { - return this.hasClass(className) ? - this.removeClass(className) : - this.addClass(className); - }; - - - - DomElement.prototype.getInnerHTML = function(){ - if(!this.initialized) return ""; - var strs = ""; - - if(this.childNodes && this.childNodes.length > 0) - this.childNodes.forEach(function(x){ - strs += x.getOuterHTML(); - }); - return strs; - }; - - DomElement.prototype.setInnerHTML = function(val){ - this.childNodes = parseDom(val); - linkChildren(this); - }; - - DomElement.prototype.getOuterHTML = function(){ - if(!this.initialized) return; - - var self = this; - var str = "<" + self.tagName; - function addAttrib(name, value){ - if(value) str += ' ' + name + '="' + value + '"'; - } - addAttrib('id', this.id); - addAttrib('class', this.className); - addAttrib('lang', this.lang); - addAttrib('style', this.style); - self.attrs.forEach( function(x){ - addAttrib(x.nodeName, x.nodeValue); - }); - str += ">"; - - str += this.getInnerHTML(); - str += ""; - return str; - }; - - DomElement.prototype.setOuterHTML = function(){ - throw 'property outerHTML is read only'; - }; - - /** - * DOM Text Node. - * - * @class - */ - function DomText(text) { - this.nodeType = 3; - - this.nodeValue = String(text); - this.nodeName = "#text"; - - return this; - } - - this.DomText = DomText; //export class DomText - - DomText.constructor = DomText; - DomText.prototype = new DomAbstract(); - - DomText.prototype.cloneNode = function(){ - return new DomText(this.nodeValue.substr(0)); - }; - - DomText.prototype.getOuterHTML = function(){ - return this.nodeValue; - }; - - DomText.prototype.setOuterHTML = function(val){ - var tmp = parseDom(val)[0]; - $extend( this, tmp ); - this.nodeType = tmp.nodeType; - this.nodeName = tmp.nodeName; - }; - - DomText.prototype.getInnerHTML = function(){ - return this.nodeValue; - }; - - DomText.prototype.setInnerHTML = function(val){ - return this.nodeValue; - }; - - DomText.prototype.getInnerText = function(){ - return unescape(this.nodeValue); - }; - - DomText.prototype.setInnerText = function(val){ - this.nodeValue = escape(val); - }; - - function mkElem(parent, tag, attrs, unary) { - attrs = attrs.map(function(x){ - return { nodeName: x.name, nodeValue: x.value, nodeType:2 }; - }); - return new DomElement(parent, tag, attrs); - } - - function linkChildren(elem) { - if(!elem.childNodes || elem.childNodes.length === 0 ) return; - - elem.firstChild = elem.childNodes[0]; - - var last = null; - elem.childNodes.forEach( function(child){ - child.parentNode = elem; - if(last) { - last.nextSibling = child; - child.previousSibling = last; - } - last = child; - }); - elem.lastChild = last; - last.nextSibling = null; - } - - /** - * parses DOM structure from given text. - * - * @param {String} text HTML-String to parse - * - * @return DOM Tree Root Node, or if no specific root an Array of DOM Nodes. - */ - function parseDom(text) { - var stack = []; - var elem = null; - var roots = []; - - HTMLParser(text, { - start: function( tag, attrs, unary ) { - if(unary){ - (elem ? elem.childNodes : roots). - push(mkElem(elem, tag, attrs)); - } else { - if(elem) { - stack.push(elem); - } - elem = mkElem(elem, tag, attrs, unary); - } - }, - - end: function( tag ) { - var old = stack.pop(); - ($defined(old) && old ? old.childNodes : roots).push(elem); - linkChildren(elem); - elem = old; - }, - - chars: function( text ) { - if (!text || text.trim() == "") return; - (elem ? elem.childNodes : roots).push(new DomText(text)); - } - }); - - return roots.length == 1 ? roots[0] : roots; - } - this.parseDom = parseDom; - -})(); - diff --git a/src/minion-jsdoc-template/js/mootools-1.2.4-core-server.js b/src/minion-jsdoc-template/js/mootools-1.2.4-core-server.js deleted file mode 100755 index 7723227..0000000 --- a/src/minion-jsdoc-template/js/mootools-1.2.4-core-server.js +++ /dev/null @@ -1,1092 +0,0 @@ -/* ---- - -script: Core.js - -description: The core of MooTools, contains all the base functions and the Native and Hash implementations. Required by all the other scripts. - -license: MIT-style license. - -copyright: Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/). - -authors: The MooTools production team (http://mootools.net/developers/) - -inspiration: -- Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) -- Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) - -provides: [Mootools, Native, Hash.base, Array.each, $util] - -... -*/ - -var MooTools = { - 'version': '1.2.4', - 'build': '0d9113241a90b9cd5643b926795852a2026710d4' -}; - -var Native = function(options){ - options = options || {}; - var name = options.name; - var legacy = options.legacy; - var protect = options.protect; - var methods = options.implement; - var generics = options.generics; - var initialize = options.initialize; - var afterImplement = options.afterImplement || function(){}; - var object = initialize || legacy; - generics = generics !== false; - - object.constructor = Native; - object.$family = {name: 'native'}; - if (legacy && initialize) object.prototype = legacy.prototype; - object.prototype.constructor = object; - - if (name){ - var family = name.toLowerCase(); - object.prototype.$family = {name: family}; - Native.typize(object, family); - } - - var add = function(obj, name, method, force){ - if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method; - if (generics) Native.genericize(obj, name, protect); - afterImplement.call(obj, name, method); - return obj; - }; - - object.alias = function(a1, a2, a3){ - if (typeof a1 == 'string'){ - var pa1 = this.prototype[a1]; - if ((a1 = pa1)) return add(this, a2, a1, a3); - } - for (var a in a1) this.alias(a, a1[a], a2); - return this; - }; - - object.implement = function(a1, a2, a3){ - if (typeof a1 == 'string') return add(this, a1, a2, a3); - for (var p in a1) add(this, p, a1[p], a2); - return this; - }; - - if (methods) object.implement(methods); - - return object; -}; - -Native.genericize = function(object, property, check){ - if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){ - var args = Array.prototype.slice.call(arguments); - return object.prototype[property].apply(args.shift(), args); - }; -}; - -Native.implement = function(objects, properties){ - for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties); -}; - -Native.typize = function(object, family){ - if (!object.type) object.type = function(item){ - return ($type(item) === family); - }; -}; - -(function(){ - var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String}; - for (var n in natives) new Native({name: n, initialize: natives[n], protect: true}); - - var types = {'boolean': Boolean, 'native': Native, 'object': Object}; - for (var t in types) Native.typize(types[t], t); - - var generics = { - 'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"], - 'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"] - }; - for (var g in generics){ - for (var i = generics[g].length; i--;) Native.genericize(natives[g], generics[g][i], true); - } -})(); - -var Hash = new Native({ - - name: 'Hash', - - initialize: function(object){ - if ($type(object) == 'hash') object = $unlink(object.getClean()); - for (var key in object) this[key] = object[key]; - return this; - } - -}); - -Hash.implement({ - - forEach: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this); - } - }, - - getClean: function(){ - var clean = {}; - for (var key in this){ - if (this.hasOwnProperty(key)) clean[key] = this[key]; - } - return clean; - }, - - getLength: function(){ - var length = 0; - for (var key in this){ - if (this.hasOwnProperty(key)) length++; - } - return length; - } - -}); - -Hash.alias('forEach', 'each'); - -Array.implement({ - - forEach: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this); - } - -}); - -Array.alias('forEach', 'each'); - -function $A(iterable){ - if (iterable.item){ - var l = iterable.length, array = new Array(l); - while (l--) array[l] = iterable[l]; - return array; - } - return Array.prototype.slice.call(iterable); -}; - -function $arguments(i){ - return function(){ - return arguments[i]; - }; -}; - -function $chk(obj){ - return !!(obj || obj === 0); -}; - -function $clear(timer){ - clearTimeout(timer); - clearInterval(timer); - return null; -}; - -function $defined(obj){ - return (obj != undefined); -}; - -function $each(iterable, fn, bind){ - var type = $type(iterable); - ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind); -}; - -function $empty(){}; - -function $extend(original, extended){ - for (var key in (extended || {})) original[key] = extended[key]; - return original; -}; - -function $H(object){ - return new Hash(object); -}; - -function $lambda(value){ - return ($type(value) == 'function') ? value : function(){ - return value; - }; -}; - -function $merge(){ - var args = Array.slice(arguments); - args.unshift({}); - return $mixin.apply(null, args); -}; - -function $mixin(mix){ - for (var i = 1, l = arguments.length; i < l; i++){ - var object = arguments[i]; - if ($type(object) != 'object') continue; - for (var key in object){ - var op = object[key], mp = mix[key]; - mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $mixin(mp, op) : $unlink(op); - } - } - return mix; -}; - -function $pick(){ - for (var i = 0, l = arguments.length; i < l; i++){ - if (arguments[i] != undefined) return arguments[i]; - } - return null; -}; - -function $random(min, max){ - return Math.floor(Math.random() * (max - min + 1) + min); -}; - -function $splat(obj){ - var type = $type(obj); - return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : []; -}; - -var $time = Date.now || function(){ - return +new Date; -}; - -function $try(){ - for (var i = 0, l = arguments.length; i < l; i++){ - try { - return arguments[i](); - } catch(e){} - } - return null; -}; - -function $type(obj){ - if (obj == undefined) return false; - if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name; - if (obj.nodeName){ - switch (obj.nodeType){ - case 1: return 'element'; - case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace'; - } - } else if (typeof obj.length == 'number'){ - if (obj.callee) return 'arguments'; - else if (obj.item) return 'collection'; - } - return typeof obj; -}; - -function $unlink(object){ - var unlinked; - switch ($type(object)){ - case 'object': - unlinked = {}; - for (var p in object) unlinked[p] = $unlink(object[p]); - break; - case 'hash': - unlinked = new Hash(object); - break; - case 'array': - unlinked = []; - for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]); - break; - default: return object; - } - return unlinked; -}; - - -/* ---- - -script: Array.js - -description: Contains Array Prototypes like each, contains, and erase. - -license: MIT-style license. - -requires: -- /$util -- /Array.each - -provides: [Array] - -... -*/ - -Array.implement({ - - every: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (!fn.call(bind, this[i], i, this)) return false; - } - return true; - }, - - filter: function(fn, bind){ - var results = []; - for (var i = 0, l = this.length; i < l; i++){ - if (fn.call(bind, this[i], i, this)) results.push(this[i]); - } - return results; - }, - - clean: function(){ - return this.filter($defined); - }, - - indexOf: function(item, from){ - var len = this.length; - for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){ - if (this[i] === item) return i; - } - return -1; - }, - - map: function(fn, bind){ - var results = []; - for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this); - return results; - }, - - some: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (fn.call(bind, this[i], i, this)) return true; - } - return false; - }, - - associate: function(keys){ - var obj = {}, length = Math.min(this.length, keys.length); - for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; - return obj; - }, - - link: function(object){ - var result = {}; - for (var i = 0, l = this.length; i < l; i++){ - for (var key in object){ - if (object[key](this[i])){ - result[key] = this[i]; - delete object[key]; - break; - } - } - } - return result; - }, - - contains: function(item, from){ - return this.indexOf(item, from) != -1; - }, - - extend: function(array){ - for (var i = 0, j = array.length; i < j; i++) this.push(array[i]); - return this; - }, - - getLast: function(){ - return (this.length) ? this[this.length - 1] : null; - }, - - getRandom: function(){ - return (this.length) ? this[$random(0, this.length - 1)] : null; - }, - - include: function(item){ - if (!this.contains(item)) this.push(item); - return this; - }, - - combine: function(array){ - for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); - return this; - }, - - erase: function(item){ - for (var i = this.length; i--; i){ - if (this[i] === item) this.splice(i, 1); - } - return this; - }, - - empty: function(){ - this.length = 0; - return this; - }, - - flatten: function(){ - var array = []; - for (var i = 0, l = this.length; i < l; i++){ - var type = $type(this[i]); - if (!type) continue; - array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]); - } - return array; - }, - - hexToRgb: function(array){ - if (this.length != 3) return null; - var rgb = this.map(function(value){ - if (value.length == 1) value += value; - return value.toInt(16); - }); - return (array) ? rgb : 'rgb(' + rgb + ')'; - }, - - rgbToHex: function(array){ - if (this.length < 3) return null; - if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; - var hex = []; - for (var i = 0; i < 3; i++){ - var bit = (this[i] - 0).toString(16); - hex.push((bit.length == 1) ? '0' + bit : bit); - } - return (array) ? hex : '#' + hex.join(''); - } - -}); - - -/* ---- - -script: Function.js - -description: Contains Function Prototypes like create, bind, pass, and delay. - -license: MIT-style license. - -requires: -- /Native -- /$util - -provides: [Function] - -... -*/ - -Function.implement({ - - extend: function(properties){ - for (var property in properties) this[property] = properties[property]; - return this; - }, - - create: function(options){ - var self = this; - options = options || {}; - return function(event){ - var args = options.arguments; - args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0); - if (options.event) args = [event || window.event].extend(args); - var returns = function(){ - return self.apply(options.bind || null, args); - }; - if (options.delay) return setTimeout(returns, options.delay); - if (options.periodical) return setInterval(returns, options.periodical); - if (options.attempt) return $try(returns); - return returns(); - }; - }, - - run: function(args, bind){ - return this.apply(bind, $splat(args)); - }, - - pass: function(args, bind){ - return this.create({bind: bind, arguments: args}); - }, - - bind: function(bind, args){ - return this.create({bind: bind, arguments: args}); - }, - - bindWithEvent: function(bind, args){ - return this.create({bind: bind, arguments: args, event: true}); - }, - - attempt: function(args, bind){ - return this.create({bind: bind, arguments: args, attempt: true})(); - }, - - delay: function(delay, bind, args){ - return this.create({bind: bind, arguments: args, delay: delay})(); - }, - - periodical: function(periodical, bind, args){ - return this.create({bind: bind, arguments: args, periodical: periodical})(); - } - -}); - - -/* ---- - -script: Number.js - -description: Contains Number Prototypes like limit, round, times, and ceil. - -license: MIT-style license. - -requires: -- /Native -- /$util - -provides: [Number] - -... -*/ - -Number.implement({ - - limit: function(min, max){ - return Math.min(max, Math.max(min, this)); - }, - - round: function(precision){ - precision = Math.pow(10, precision || 0); - return Math.round(this * precision) / precision; - }, - - times: function(fn, bind){ - for (var i = 0; i < this; i++) fn.call(bind, i, this); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - } - -}); - -Number.alias('times', 'each'); - -(function(math){ - var methods = {}; - math.each(function(name){ - if (!Number[name]) methods[name] = function(){ - return Math[name].apply(null, [this].concat($A(arguments))); - }; - }); - Number.implement(methods); -})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); - - -/* ---- - -script: String.js - -description: Contains String Prototypes like camelCase, capitalize, test, and toInt. - -license: MIT-style license. - -requires: -- /Native - -provides: [String] - -... -*/ - -String.implement({ - - test: function(regex, params){ - return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this); - }, - - contains: function(string, separator){ - return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1; - }, - - trim: function(){ - return this.replace(/^\s+|\s+$/g, ''); - }, - - clean: function(){ - return this.replace(/\s+/g, ' ').trim(); - }, - - camelCase: function(){ - return this.replace(/-\D/g, function(match){ - return match.charAt(1).toUpperCase(); - }); - }, - - hyphenate: function(){ - return this.replace(/[A-Z]/g, function(match){ - return ('-' + match.charAt(0).toLowerCase()); - }); - }, - - capitalize: function(){ - return this.replace(/\b[a-z]/g, function(match){ - return match.toUpperCase(); - }); - }, - - escapeRegExp: function(){ - return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - hexToRgb: function(array){ - var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); - return (hex) ? hex.slice(1).hexToRgb(array) : null; - }, - - rgbToHex: function(array){ - var rgb = this.match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHex(array) : null; - }, - - stripScripts: function(option){ - var scripts = ''; - var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(){ - scripts += arguments[1] + '\n'; - return ''; - }); - if (option === true) $exec(scripts); - else if ($type(option) == 'function') option(scripts, text); - return text; - }, - - substitute: function(object, regexp){ - return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ - if (match.charAt(0) == '\\') return match.slice(1); - return (object[name] != undefined) ? object[name] : ''; - }); - } - -}); - - -/* ---- - -script: Hash.js - -description: Contains Hash Prototypes. Provides a means for overcoming the JavaScript practical impossibility of extending native Objects. - -license: MIT-style license. - -requires: -- /Hash.base - -provides: [Hash] - -... -*/ - -Hash.implement({ - - has: Object.prototype.hasOwnProperty, - - keyOf: function(value){ - for (var key in this){ - if (this.hasOwnProperty(key) && this[key] === value) return key; - } - return null; - }, - - hasValue: function(value){ - return (Hash.keyOf(this, value) !== null); - }, - - extend: function(properties){ - Hash.each(properties || {}, function(value, key){ - Hash.set(this, key, value); - }, this); - return this; - }, - - combine: function(properties){ - Hash.each(properties || {}, function(value, key){ - Hash.include(this, key, value); - }, this); - return this; - }, - - erase: function(key){ - if (this.hasOwnProperty(key)) delete this[key]; - return this; - }, - - get: function(key){ - return (this.hasOwnProperty(key)) ? this[key] : null; - }, - - set: function(key, value){ - if (!this[key] || this.hasOwnProperty(key)) this[key] = value; - return this; - }, - - empty: function(){ - Hash.each(this, function(value, key){ - delete this[key]; - }, this); - return this; - }, - - include: function(key, value){ - if (this[key] == undefined) this[key] = value; - return this; - }, - - map: function(fn, bind){ - var results = new Hash; - Hash.each(this, function(value, key){ - results.set(key, fn.call(bind, value, key, this)); - }, this); - return results; - }, - - filter: function(fn, bind){ - var results = new Hash; - Hash.each(this, function(value, key){ - if (fn.call(bind, value, key, this)) results.set(key, value); - }, this); - return results; - }, - - every: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key) && !fn.call(bind, this[key], key)) return false; - } - return true; - }, - - some: function(fn, bind){ - for (var key in this){ - if (this.hasOwnProperty(key) && fn.call(bind, this[key], key)) return true; - } - return false; - }, - - getKeys: function(){ - var keys = []; - Hash.each(this, function(value, key){ - keys.push(key); - }); - return keys; - }, - - getValues: function(){ - var values = []; - Hash.each(this, function(value){ - values.push(value); - }); - return values; - }, - - toQueryString: function(base){ - var queryString = []; - Hash.each(this, function(value, key){ - if (base) key = base + '[' + key + ']'; - var result; - switch ($type(value)){ - case 'object': result = Hash.toQueryString(value, key); break; - case 'array': - var qs = {}; - value.each(function(val, i){ - qs[i] = val; - }); - result = Hash.toQueryString(qs, key); - break; - default: result = key + '=' + encodeURIComponent(value); - } - if (value != undefined) queryString.push(result); - }); - - return queryString.join('&'); - } - -}); - -Hash.alias({keyOf: 'indexOf', hasValue: 'contains'}); - - -/* ---- - -script: Class.js - -description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. - -license: MIT-style license. - -requires: -- /$util -- /Native -- /Array -- /String -- /Function -- /Number -- /Hash - -provides: [Class] - -... -*/ - -function Class(params){ - - if (params instanceof Function) params = {initialize: params}; - - var newClass = function(){ - Object.reset(this); - if (newClass._prototyping) return this; - this._current = $empty; - var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; - delete this._current; delete this.caller; - return value; - }.extend(this); - - newClass.implement(params); - - newClass.constructor = Class; - newClass.prototype.constructor = newClass; - - return newClass; - -}; - -Function.prototype.protect = function(){ - this._protected = true; - return this; -}; - -Object.reset = function(object, key){ - - if (key == null){ - for (var p in object) Object.reset(object, p); - return object; - } - - //delete object[key]; - - switch ($type(object[key])){ - case 'object': - var F = function(){}; - F.prototype = object[key]; - var i = new F; - object[key] = Object.reset(i); - break; - case 'array': object[key] = $unlink(object[key]); break; - } - - return object; - -}; - -new Native({name: 'Class', initialize: Class}).extend({ - - instantiate: function(F){ - F._prototyping = true; - var proto = new F; - delete F._prototyping; - return proto; - }, - - wrap: function(self, key, method){ - if (method._origin) method = method._origin; - - return function(){ - if (method._protected && this._current == null) throw new Error('The method "' + key + '" cannot be called.'); - var caller = this.caller, current = this._current; - this.caller = current; this._current = arguments.callee; - var result = method.apply(this, arguments); - this._current = current; this.caller = caller; - return result; - }.extend({_owner: self, _origin: method, _name: key}); - - } - -}); - -Class.implement({ - - implement: function(key, value){ - - if ($type(key) == 'object'){ - for (var p in key) this.implement(p, key[p]); - return this; - } - - var mutator = Class.Mutators[key]; - - if (mutator){ - value = mutator.call(this, value); - if (value == null) return this; - } - - var proto = this.prototype; - - switch ($type(value)){ - - case 'function': - if (value._hidden) return this; - proto[key] = Class.wrap(this, key, value); - break; - - case 'object': - var previous = proto[key]; - if ($type(previous) == 'object') $mixin(previous, value); - else proto[key] = $unlink(value); - break; - - case 'array': - proto[key] = $unlink(value); - break; - - default: proto[key] = value; - } - - return this; - - } - -}); - -Class.Mutators = { - - Extends: function(parent){ - - this.parent = parent; - this.prototype = Class.instantiate(parent); - - this.implement('parent', function(){ - var name = this.caller._name, previous = this.caller._owner.parent.prototype[name]; - if (!previous) throw new Error('The method "' + name + '" has no parent.'); - return previous.apply(this, arguments); - }.protect()); - - }, - - Implements: function(items){ - $splat(items).each(function(item){ - if (item instanceof Function) item = Class.instantiate(item); - this.implement(item); - }, this); - - } - -}; - - -/* ---- - -script: Class.Extras.js - -description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. - -license: MIT-style license. - -requires: -- /Class - -provides: [Chain, Events, Options] - -... -*/ - -var Chain = new Class({ - - $chain: [], - - chain: function(){ - this.$chain.extend(Array.flatten(arguments)); - return this; - }, - - callChain: function(){ - return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; - }, - - clearChain: function(){ - this.$chain.empty(); - return this; - } - -}); - -var Events = new Class({ - - $events: {}, - - addEvent: function(type, fn, internal){ - type = Events.removeOn(type); - if (fn != $empty){ - this.$events[type] = this.$events[type] || []; - this.$events[type].include(fn); - if (internal) fn.internal = true; - } - return this; - }, - - addEvents: function(events){ - for (var type in events) this.addEvent(type, events[type]); - return this; - }, - - fireEvent: function(type, args, delay){ - type = Events.removeOn(type); - if (!this.$events || !this.$events[type]) return this; - this.$events[type].each(function(fn){ - fn.create({'bind': this, 'delay': delay, 'arguments': args})(); - }, this); - return this; - }, - - removeEvent: function(type, fn){ - type = Events.removeOn(type); - if (!this.$events[type]) return this; - if (!fn.internal) this.$events[type].erase(fn); - return this; - }, - - removeEvents: function(events){ - var type; - if ($type(events) == 'object'){ - for (type in events) this.removeEvent(type, events[type]); - return this; - } - if (events) events = Events.removeOn(events); - for (type in this.$events){ - if (events && events != type) continue; - var fns = this.$events[type]; - for (var i = fns.length; i--; i) this.removeEvent(type, fns[i]); - } - return this; - } - -}); - -Events.removeOn = function(string){ - return string.replace(/^on([A-Z])/, function(full, first){ - return first.toLowerCase(); - }); -}; - -var Options = new Class({ - - setOptions: function(){ - this.options = $merge.run([this.options].extend(arguments)); - if (!this.addEvent) return this; - for (var option in this.options){ - if ($type(this.options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; - this.addEvent(option, this.options[option]); - delete this.options[option]; - } - return this; - } - -}); diff --git a/src/minion-jsdoc-template/js/showdown.js b/src/minion-jsdoc-template/js/showdown.js deleted file mode 100755 index 86b9bc1..0000000 --- a/src/minion-jsdoc-template/js/showdown.js +++ /dev/null @@ -1,419 +0,0 @@ -/* - A A L Source code at: - T C A - T K B -*/ - -var Showdown={}; -Showdown.converter=function(){ -var _1; -var _2; -var _3; -var _4=0; -this.makeHtml=function(_5){ -_1=new Array(); -_2=new Array(); -_3=new Array(); -_5=_5.replace(/~/g,"~T"); -_5=_5.replace(/\$/g,"~D"); -_5=_5.replace(/\r\n/g,"\n"); -_5=_5.replace(/\r/g,"\n"); -_5="\n\n"+_5+"\n\n"; -_5=_6(_5); -_5=_5.replace(/^[ \t]+$/mg,""); -_5=_7(_5); -_5=_8(_5); -_5=_9(_5); -_5=_a(_5); -_5=_5.replace(/~D/g,"$$"); -_5=_5.replace(/~T/g,"~"); -return _5; -}; -var _8=function(_b){ -var _b=_b.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(_c,m1,m2,m3,m4){ -m1=m1.toLowerCase(); -_1[m1]=_11(m2); -if(m3){ -return m3+m4; -}else{ -if(m4){ -_2[m1]=m4.replace(/"/g,"""); -} -} -return ""; -}); -return _b; -}; -var _7=function(_12){ -_12=_12.replace(/\n/g,"\n\n"); -var _13="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del"; -var _14="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math"; -_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,_15); -_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,_15); -_12=_12.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,_15); -_12=_12.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,_15); -_12=_12.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,_15); -_12=_12.replace(/\n\n/g,"\n"); -return _12; -}; -var _15=function(_16,m1){ -var _18=m1; -_18=_18.replace(/\n\n/g,"\n"); -_18=_18.replace(/^\n/,""); -_18=_18.replace(/\n+$/g,""); -_18="\n\n~K"+(_3.push(_18)-1)+"K\n\n"; -return _18; -}; -var _9=function(_19){ -_19=_1a(_19); -var key=_1c("
"); -_19=_19.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key); -_19=_19.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key); -_19=_19.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key); -_19=_1d(_19); -_19=_1e(_19); -_19=_1f(_19); -_19=_7(_19); -_19=_20(_19); -return _19; -}; -var _21=function(_22){ -_22=_23(_22); -_22=_24(_22); -_22=_25(_22); -_22=_26(_22); -_22=_27(_22); -_22=_28(_22); -_22=_11(_22); -_22=_29(_22); -_22=_22.replace(/ +\n/g,"
\n"); -return _22; -}; -var _24=function(_2a){ -var _2b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi; -_2a=_2a.replace(_2b,function(_2c){ -var tag=_2c.replace(/(.)<\/?code>(?=.)/g,"$1`"); -tag=_2e(tag,"\\`*_"); -return tag; -}); -return _2a; -}; -var _27=function(_2f){ -_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_30); -_2f=_2f.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_30); -_2f=_2f.replace(/(\[([^\[\]]+)\])()()()()()/g,_30); -return _2f; -}; -var _30=function(_31,m1,m2,m3,m4,m5,m6,m7){ -if(m7==undefined){ -m7=""; -} -var _39=m1; -var _3a=m2; -var _3b=m3.toLowerCase(); -var url=m4; -var _3d=m7; -if(url==""){ -if(_3b==""){ -_3b=_3a.toLowerCase().replace(/ ?\n/g," "); -} -url="#"+_3b; -if(_1[_3b]!=undefined){ -url=_1[_3b]; -if(_2[_3b]!=undefined){ -_3d=_2[_3b]; -} -}else{ -if(_39.search(/\(\s*\)$/m)>-1){ -url=""; -}else{ -return _39; -} -} -} -url=_2e(url,"*_"); -var _3e=""; -return _3e; -}; -var _26=function(_3f){ -_3f=_3f.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,_40); -_3f=_3f.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,_40); -return _3f; -}; -var _40=function(_41,m1,m2,m3,m4,m5,m6,m7){ -var _49=m1; -var _4a=m2; -var _4b=m3.toLowerCase(); -var url=m4; -var _4d=m7; -if(!_4d){ -_4d=""; -} -if(url==""){ -if(_4b==""){ -_4b=_4a.toLowerCase().replace(/ ?\n/g," "); -} -url="#"+_4b; -if(_1[_4b]!=undefined){ -url=_1[_4b]; -if(_2[_4b]!=undefined){ -_4d=_2[_4b]; -} -}else{ -return _49; -} -} -_4a=_4a.replace(/"/g,"""); -url=_2e(url,"*_"); -var _4e="\""+_4a+"\"";"+_21(m1)+""); -}); -_4f=_4f.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(_52,m1){ -return _1c("

"+_21(m1)+"

"); -}); -_4f=_4f.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(_54,m1,m2){ -var _57=m1.length; -return _1c(""+_21(m2)+""); -}); -return _4f; -}; -var _58; -var _1d=function(_59){ -_59+="~0"; -var _5a=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; -if(_4){ -_59=_59.replace(_5a,function(_5b,m1,m2){ -var _5e=m1; -var _5f=(m2.search(/[*+-]/g)>-1)?"ul":"ol"; -_5e=_5e.replace(/\n{2,}/g,"\n\n\n"); -var _60=_58(_5e); -_60=_60.replace(/\s+$/,""); -_60="<"+_5f+">"+_60+"\n"; -return _60; -}); -}else{ -_5a=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g; -_59=_59.replace(_5a,function(_61,m1,m2,m3){ -var _65=m1; -var _66=m2; -var _67=(m3.search(/[*+-]/g)>-1)?"ul":"ol"; -var _66=_66.replace(/\n{2,}/g,"\n\n\n"); -var _68=_58(_66); -_68=_65+"<"+_67+">\n"+_68+"\n"; -return _68; -}); -} -_59=_59.replace(/~0/,""); -return _59; -}; -_58=function(_69){ -_4++; -_69=_69.replace(/\n{2,}$/,"\n"); -_69+="~0"; -_69=_69.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(_6a,m1,m2,m3,m4){ -var _6f=m4; -var _70=m1; -var _71=m2; -if(_70||(_6f.search(/\n{2,}/)>-1)){ -_6f=_9(_72(_6f)); -}else{ -_6f=_1d(_72(_6f)); -_6f=_6f.replace(/\n$/,""); -_6f=_21(_6f); -} -return "
  • "+_6f+"
  • \n"; -}); -_69=_69.replace(/~0/g,""); -_4--; -return _69; -}; -var _1e=function(_73){ -_73+="~0"; -_73=_73.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(_74,m1,m2){ -var _77=m1; -var _78=m2; -_77=_79(_72(_77)); -_77=_6(_77); -_77=_77.replace(/^\n+/g,""); -_77=_77.replace(/\n+$/g,""); -_77="
    "+_77+"\n
    "; -return _1c(_77)+_78; -}); -_73=_73.replace(/~0/,""); -return _73; -}; -var _1c=function(_7a){ -_7a=_7a.replace(/(^\n+|\n+$)/g,""); -return "\n\n~K"+(_3.push(_7a)-1)+"K\n\n"; -}; -var _23=function(_7b){ -_7b=_7b.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(_7c,m1,m2,m3,m4){ -var c=m3; -c=c.replace(/^([ \t]*)/g,""); -c=c.replace(/[ \t]*$/g,""); -c=_79(c); -return m1+""+c+""; -}); -return _7b; -}; -var _79=function(_82){ -_82=_82.replace(/&/g,"&"); -_82=_82.replace(//g,">"); -_82=_2e(_82,"*_{}[]\\",false); -return _82; -}; -var _29=function(_83){ -_83=_83.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"$2"); -_83=_83.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"$2"); -return _83; -}; -var _1f=function(_84){ -_84=_84.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(_85,m1){ -var bq=m1; -bq=bq.replace(/^[ \t]*>[ \t]?/gm,"~0"); -bq=bq.replace(/~0/g,""); -bq=bq.replace(/^[ \t]+$/gm,""); -bq=_9(bq); -bq=bq.replace(/(^|\n)/g,"$1 "); -bq=bq.replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(_88,m1){
    -var pre=m1;
    -pre=pre.replace(/^  /mg,"~0");
    -pre=pre.replace(/~0/g,"");
    -return pre;
    -});
    -return _1c("
    \n"+bq+"\n
    "); -}); -return _84; -}; -var _20=function(_8b){ -_8b=_8b.replace(/^\n+/g,""); -_8b=_8b.replace(/\n+$/g,""); -var _8c=_8b.split(/\n{2,}/g); -var _8d=new Array(); -var end=_8c.length; -for(var i=0;i=0){ -_8d.push(str); -}else{ -if(str.search(/\S/)>=0){ -str=_21(str); -str=str.replace(/^([ \t]*)/g,"

    "); -str+="

    "; -_8d.push(str); -} -} -} -end=_8d.length; -for(var i=0;i=0){ -var _91=_3[RegExp.$1]; -_91=_91.replace(/\$/g,"$$$$"); -_8d[i]=_8d[i].replace(/~K\d+K/,_91); -} -} -return _8d.join("\n\n"); -}; -var _11=function(_92){ -_92=_92.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"); -_92=_92.replace(/<(?![a-z\/?\$!])/gi,"<"); -return _92; -}; -var _25=function(_93){ -_93=_93.replace(/\\(\\)/g,_94); -_93=_93.replace(/\\([`*_{}\[\]()>#+-.!])/g,_94); -return _93; -}; -var _28=function(_95){ -_95=_95.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"
    $1"); -_95=_95.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(_96,m1){ -return _98(_a(m1)); -}); -return _95; -}; -var _98=function(_99){ -function char2hex(ch){ -var _9b="0123456789ABCDEF"; -var dec=ch.charCodeAt(0); -return (_9b.charAt(dec>>4)+_9b.charAt(dec&15)); -} -var _9d=[function(ch){ -return "&#"+ch.charCodeAt(0)+";"; -},function(ch){ -return "&#x"+char2hex(ch)+";"; -},function(ch){ -return ch; -}]; -_99="mailto:"+_99; -_99=_99.replace(/./g,function(ch){ -if(ch=="@"){ -ch=_9d[Math.floor(Math.random()*2)](ch); -}else{ -if(ch!=":"){ -var r=Math.random(); -ch=(r>0.9?_9d[2](ch):r>0.45?_9d[1](ch):_9d[0](ch)); -} -} -return ch; -}); -_99=""+_99+""; -_99=_99.replace(/">.+:/g,"\">"); -return _99; -}; -var _a=function(_a3){ -_a3=_a3.replace(/~E(\d+)E/g,function(_a4,m1){ -var _a6=parseInt(m1); -return String.fromCharCode(_a6); -}); -return _a3; -}; -var _72=function(_a7){ -_a7=_a7.replace(/^(\t|[ ]{1,4})/gm,"~0"); -_a7=_a7.replace(/~0/g,""); -return _a7; -}; -var _6=function(_a8){ -_a8=_a8.replace(/\t(?=\t)/g," "); -_a8=_a8.replace(/\t/g,"~A~B"); -_a8=_a8.replace(/~B(.+?)~A/g,function(_a9,m1,m2){ -var _ac=m1; -var _ad=4-_ac.length%4; -for(var i=0;i<_ad;i++){ -_ac+=" "; -} -return _ac; -}); -_a8=_a8.replace(/~A/g," "); -_a8=_a8.replace(/~B/g,""); -return _a8; -}; -var _2e=function(_af,_b0,_b1){ -var _b2="(["+_b0.replace(/([\[\]\\])/g,"\\$1")+"])"; -if(_b1){ -_b2="\\\\"+_b2; -} -var _b3=new RegExp(_b2,"g"); -_af=_af.replace(_b3,_94); -return _af; -}; -var _94=function(_b4,m1){ -var _b6=m1.charCodeAt(0); -return "~E"+_b6+"E"; -}; -}; - diff --git a/src/minion-jsdoc-template/js/showdown_license.txt b/src/minion-jsdoc-template/js/showdown_license.txt deleted file mode 100755 index a6096c8..0000000 --- a/src/minion-jsdoc-template/js/showdown_license.txt +++ /dev/null @@ -1,34 +0,0 @@ -Copyright (c) 2007, John Fraser - -All rights reserved. - -Original Markdown copyright (c) 2004, John Gruber - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* Neither the name "Markdown" nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as -is" and any express or implied warranties, including, but not limited -to, the implied warranties of merchantability and fitness for a -particular purpose are disclaimed. In no event shall the copyright owner -or contributors be liable for any direct, indirect, incidental, special, -exemplary, or consequential damages (including, but not limited to, -procurement of substitute goods or services; loss of use, data, or -profits; or business interruption) however caused and on any theory of -liability, whether in contract, strict liability, or tort (including -negligence or otherwise) arising in any way out of the use of this -software, even if advised of the possibility of such damage. diff --git a/src/minion-jsdoc-template/publish.js b/src/minion-jsdoc-template/publish.js deleted file mode 100755 index a3581d7..0000000 --- a/src/minion-jsdoc-template/publish.js +++ /dev/null @@ -1,533 +0,0 @@ - -/** Called automatically by JsDoc Toolkit. */ -function publish(symbolSet) { - publish.conf = { // trailing slash expected for dirs - ext: ".html", - outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/", - templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/", - symbolsDir: "symbols/", - srcDir: "symbols/src/" - }; - - //Was the D option used? If not, create it so default options can be - //created - JSDOC.opt.D = JSDOC.opt.D || {}; - - // If the user did not specify a css file to use, define the cssFile option - // as the default.css file - if (!JSDOC.opt.D.cssFile) { - JSDOC.opt.D.cssFile = "default.css"; - } - - load(publish.conf.templatesDir+'js/mootools-1.2.4-core-server.js'); - load(publish.conf.templatesDir+'js/htmlparser.js'); - load(publish.conf.templatesDir+'js/jsdom.js'); - load(publish.conf.templatesDir+'js/showdown.js'); - markdownConverter = new Showdown.converter(); - - // if source output is suppressed, just display the links to the source file - if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) { - Link.prototype._makeSrcLink = function(srcFilePath) { - return "<"+srcFilePath+">"; - } - } - - // create the folders and subfolders to hold the output - IO.mkPath((publish.conf.outDir+"symbols/src").split("/")); - - // used to allow Link to check the details of things being linked to - Link.symbolSet = symbolSet; - - // create the required templates - try { - var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl"); - var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl"); - var docsIndexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"docsindex.tmpl"); - var userDocTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"userdoc.tmpl"); - } catch(e) { - print("Couldn't create the required templates: "+e); - quit(); - } - - // some ustility filters - function hasNoParent($) {return ($.memberOf == "")} - function isaFile($) {return ($.is("FILE"))} - function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)} - - // get an array version of the symbolset, useful for filtering - var symbols = symbolSet.toArray(); - - // create the hilited source code files - var files = JSDOC.opt.srcFiles; - for (var i = 0, l = files.length; i < l; i++) { - var file = files[i]; - var srcDir = publish.conf.outDir + "symbols/src/"; - makeSrcFile(file, srcDir); - } - - // get a list of all the classes in the symbolset - var classes = symbols.filter(isaClass).sort(makeSortby("alias")); - - // create a filemap in which outfiles must be to be named uniquely, - // ignoring case - if (JSDOC.opt.u) { - var filemapCounts = {}; - Link.filemap = {}; - for (var i = 0, l = classes.length; i < l; i++) { - var lcAlias = classes[i].alias.toLowerCase(); - - if (!filemapCounts[lcAlias]) filemapCounts[lcAlias] = 1; - else filemapCounts[lcAlias]++; - - Link.filemap[classes[i].alias] = - (filemapCounts[lcAlias] > 1)? - lcAlias+"_"+filemapCounts[lcAlias] : lcAlias; - } - } - - // create a class index, displayed in the left-hand column of every class - // page - - Link.base = "../"; - var docsConfig = JSDOC.opt.docs; - var hasDocsList = docsConfig !== undefined && docsConfig !== null && - docsConfig.content instanceof Array && - docsConfig.content.length > 0; - var docsList = hasDocsList ? docsConfig.content : null; - if (hasDocsList) { - for (var i = 0; i < docsList.length; i++) { - docsList[i].outFile = 'userdocs/' + i + '.html'; - } - } - - publish.docsIndex = hasDocsList ? docsIndexTemplate.process(docsList) : ""; - publish.classesIndex = classesTemplate.process(classes); // kept in memory - - // copy resources - var stdResources = copyResources(publish.conf.outDir+'userdocs/', - ((docsConfig === null || docsConfig === undefined) - || !docsConfig.resources) ? - null : - docsConfig.resources); - //var stdResources = {}; - var dynResources = {}; - - if (hasDocsList) { - IO.mkPath((publish.conf.outDir+'userdocs').split('/')); - - for (var i = 0; i < docsList.length; i++) { - var content, header = "", doc = docsList[i]; - - if (doc.preprocess || docsConfig.preprocess) { - content = processWithCommand(docsConfig.preprocess || - doc.preprocess, doc.src); - } else { - content = IO.readFile(doc.src); - ext = FilePath.fileExtension(doc.src); - if (ext === 'markdown' || ext === 'md') { - content = markdownConverter.makeHtml(content); - } - var absPath = new Packages.java.io.File(doc.src). - getAbsolutePath(); - - stdResources['=' + absPath] = doc.outFile; - } - - var docDOM = parseDom(content); - - if (docDOM instanceof Array) { - docDOM = docDOM.filter(function(d){ - return d instanceof DomText ? d.innerText == true : true; - }); - } - - if (!(docDOM instanceof Array) && docDOM.tagName.toLowerCase() === 'html') - { - content = docDOM.getElement('body').innerHTML; - header = docDOM.getElement('head') || null; - if (header) { - header.getElements("script").forEach(function (node){ - if( node.getAttribute('src') && - !isURL(node.getAttribute('src'))) - { - var src = addResource(publish.conf, - doc, - stdResources, - dynResources, - node.getAttribute('src')); - node.setAttribute('src', src); - } - }); - header.getElements("link").forEach(function (node) { - if (!isURL(node.getAttribute('href'))) { - var src = addResource(publish.conf, - doc, - stdResources, - dynResources, - node.getAttribute('href')); - node.setAttribute('href', src); - } - }); - } - header = header.innerHTML || ""; - } - - var docText = userDocTemplate.process({ content: content - , header: header - , title: doc.title - }); - - IO.saveFile(publish.conf.outDir+'userdocs/', - i + '.html', docText); - } - } - - // create each of the class pages - for (var i = 0, l = classes.length; i < l; i++) { - var symbol = classes[i]; - - symbol.events = symbol.getEvents(); // 1 order matters - symbol.methods = symbol.getMethods(); // 2 - - var output = ""; - output = classTemplate.process(symbol); - - IO.saveFile(publish.conf.outDir+"symbols/", - ((JSDOC.opt.u)? Link.filemap[symbol.alias] : - symbol.alias) + - publish.conf.ext, output); - } - - // regenerate the index with different relative links, used in the index - // pages - Link.base = ""; - publish.docsIndex = hasDocsList ? - docsIndexTemplate.process(docsList) : - ""; - - publish.classesIndex = classesTemplate.process(classes); - - // create the class index page - try { - var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl"); - } - catch(e) { print(e.message); quit(); } - - var classesIndex = classesindexTemplate.process(classes); - IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex); - - try { - var symbolIndexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+'symbolindex.tmpl'); - } catch(e) { print(e.message); quit(); } - - var symbolIndex = symbolIndexTemplate.process(buildSymbolList(classes)); - IO.saveFile(publish.conf.outDir, 'symbolindex'+publish.conf.ext, symbolIndex); - - symbolIndex = symbolIndexTemplate = null; - classesindexTemplate = classesIndex = classes = null; - - // create the file index page - try { - var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl"); - } - catch(e) { print(e.message); quit(); } - - var documentedFiles = symbols.filter(isaFile); // files that have file-level docs - var allFiles = []; // not all files have file-level docs, but we need to list every one - - for (var i = 0; i < files.length; i++) { - allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */"))); - } - - for (var i = 0; i < documentedFiles.length; i++) { - var offset = files.indexOf(documentedFiles[i].alias); - allFiles[offset] = documentedFiles[i]; - } - - allFiles = allFiles.sort(makeSortby("name")); - - // output the file index page - var filesIndex = fileindexTemplate.process(allFiles); - IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex); - fileindexTemplate = filesIndex = files = null; - - // copy static files - var staticDir = publish.conf.outDir + 'static'; - IO.mkPath(staticDir.split('/')); - IO.ls( publish.conf.templatesDir+'static' ).forEach(function(f){ - // copy all static files unless they are .css files - if (f.lastIndexOf(".css") === -1) { - IO.copyFile(f, staticDir); - } - }); - - try { - IO.copyFile(publish.conf.templatesDir + 'static/' + JSDOC.opt.D.cssFile, staticDir); - } catch (e) { - print("Could not copy CSS file because: " + e.message); - quit(); - } -} - - -/** Just the first sentence (up to a full stop). Should not break on dotted - * variable names. - */ -function summarize(desc) { - if (typeof desc != "undefined") - return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc; -} - -/** Make a symbol sorter by some attribute. */ -function makeSortby(attribute) { - return function(a, b) { - if (a[attribute] != undefined && b[attribute] != undefined) { - a = a[attribute].toLowerCase(); - b = b[attribute].toLowerCase(); - if (a < b) return -1; - if (a > b) return 1; - return 0; - } - } -} - -/** Pull in the contents of an external file at the given path. */ -function include(path) { - var path = publish.conf.templatesDir+path; - return IO.readFile(path); -} - -/** Turn a raw source file into a code-hilited page in the docs. */ -function makeSrcFile(path, srcDir, name) { - if (JSDOC.opt.s) return; - - if (!name) { - name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_"); - name = name.replace(/\:/g, "_"); - } - - var src = {path: path, name:name, charset: IO.encoding, hilited: ""}; - - if (defined(JSDOC.PluginManager)) { - JSDOC.PluginManager.run("onPublishSrc", src); - } - - if (src.hilited) { - IO.saveFile(srcDir, name+publish.conf.ext, src.hilited); - } -} - -/** Build output for displaying function parameters. */ -function makeSignature(params) { - if (!params) return "()"; - var signature = "(" - + - params.filter( - function($) { - return $.name.indexOf(".") == -1; // don't show config params in signature - } - ).map( - function($) { - return $.name; - } - ).join(", ") - + - ")"; - return signature; -} - -/** Find symbol {@link ...} strings in text and turn into html links */ -function resolveLinks(str, from) { - str = str.replace(/\{@link ([^} ]+) ?\}/gi, - function(match, symbolName) { - return new Link().toSymbol(symbolName); - } - ); - - return str; -} - -function processWithCommand(cmd, file) { - var process, line, content = IO.readFile(file); - - if(!content){ - LOG.warn('could not read file: ' + file); - quit(); - return null; - } - - process = Packages.java.lang.Runtime.getRuntime().exec(cmd); - if(!process) { - LOG.warn('unable to execute command: ' + cmd); - quit(); - return null; - } - - var textIn = new Packages.java.io.BufferedReader( - new Packages.java.io.InputStreamReader( - process.getInputStream())); - - var textOut = new Packages.java.io.PrintWriter( - new Packages.java.io.BufferedWriter( - new Packages.java.io.OutputStreamWriter( - process.getOutputStream()))); - - textOut.print(content); - textOut.close(); - - content = ""; - while ((line = textIn.readLine())) { - content += line; - content += "\n"; - } - textIn.close(); - - process.waitFor(); - if(process.exitValue() != 0) { - quit(); - return null; - } - - return content; -} - -function buildSymbolList(classes) { - var clazz, i, - tmp = {}, - ret = []; - - function addSymbol(s) { - var n = '=' + s.name; - if (!tmp[n]) { - tmp[n] = { name: s.name, - symbols: [s] }; - } else { - tmp[n].symbols.push(s); - } - } - - function addMembers(c, lst) { - if(lst){ - lst.filter(function(x){ - return x.memberOf == c.alias && !x.isNamespace || !x.isIgnored; - }).forEach(addSymbol); - } - } - - for (i = 0; i < classes.length; i++) { - clazz = classes[i]; - if(clazz.name !== '_global_') { - switch(clazz.isa) { - case 'OBJECT': - case 'CONSTRUCTOR': - addSymbol(clazz); - } - } - - addMembers(clazz, clazz.properties); - addMembers(clazz, clazz.methods); - addMembers(clazz, clazz.events); - } - - for (i in tmp) { - ret.push(tmp[i]); - } - - ret.sort(makeSortby('name')); - - return ret; -} - -function copyDirectory(todir, fromdir) { - var dir = new Packages.java.io.File(fromdir); - var m = {}; - - dir.listFiles().forEach(function(f){ - if (f.isFile()) { - IO.copyFile(f, todir, f.getName()); - m['=' + f.getAbsolutePath()] = todir+f.getName(); - } else if (f.isDirectory()) { - IO.mkPath(todir+f.getName()); - var tmp = copyDirectory(todir+f.getName()+'/', f); - for(var i in tmp) { - m[i] = tmp[i]; - } - } - }); - return m; -} - -function copyResources(todir, resources) { - var m = {}; - if (resources && resources instanceof Array) { - resources.forEach(function (r) { - var files, f = new Packages.java.io.File(r); - - if (f.isFile()) { - IO.copyFile( f.getAbsolutePath(), todir, f.getName() ); - m['=' + f.getAbsolutePath()] = - new Packages.java.io.File(todir+f.getName()). - getAbsolutePath(); - } else if (f.isDirectory()) { - IO.mkPath(todir+f.getName()); - var tmp = copyDirectory(todir+f.getName()+'/', - f.getAbsolutePath()); - for(var i in tmp) { - m[i] = tmp[i]; - } - } - }); - } - return m; -} - -function isURL(str) { - return /^http:\/\//.test(str); -} - -function findRelativePath(from, to) { - var fTo = new Packages.java.io.File(to).getAbsoluteFile(); - var fFrom = new Packages.java.io.File(from).getAbsoluteFile(); - if(!fFrom.isDirectory()) fFrom = fFrom.getParentFile(); - - var aFrom = String(fFrom.getAbsolutePath()).split(/[\\\/]/); - var aTo = String(fTo.getAbsolutePath()).split(/[\\\/]/); - - while(aFrom.length && aTo.length && aFrom[0] == aTo[0]) { - aFrom.shift(); - aTo.shift(); - } - - var path = aFrom.map(function(){ return "..";}).join('/'); - if(aFrom.length > 0) path += '/'; - path += aTo.join('/'); - return path; -} - -function addResource(conf, forDoc, staticResources, dynResources, res) { - var f = new Packages.java.io.File(forDoc.src); - var docDir = f.isDirectory() ? - f.getAbsolutePath() : - f.getAbsoluteFile().getParent(); - var resource = String(new Packages.java.io.File(docDir, res). - getCanonicalPath()); - var staticRes = staticResources['=' + resource]; - - if (staticRes) { - return findRelativePath( conf.outDir+forDoc.outFile, staticRes); - } - - var dynRes = dynResources['=' + resource]; - if (dynRes) { - return findRelativePath( conf.outDir+forDoc.outFile, dynRes); - } - - //copy resource file - var fileName = FilePath.fileName(resource); - IO.copyFile(resource, conf.outDir+'userdocs/', fileName); - var dynRes = conf.outDir+'userdocs/'+fileName; - dynResources['=' + resource] = dynRes; - - return findRelativePath(conf.outDir+forDoc.outFile, dynRes); -} - diff --git a/src/minion-jsdoc-template/static/blue.css b/src/minion-jsdoc-template/static/blue.css deleted file mode 100755 index 71b9cfc..0000000 --- a/src/minion-jsdoc-template/static/blue.css +++ /dev/null @@ -1,247 +0,0 @@ -/* default.css */ -body -{ - font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif; - min-width: 800px; - max-width: 1024px; - background-color: #ddd; -} - -.header -{ - clear: both; - background-color: #ccc; - padding: 8px; -} - -a -{ - text-decoration: none; - color: #336699; -} - -h1 -{ - font-size: 150%; - font-weight: bold; - padding: 0; - margin: 1em 0 0 .3em; - color: #336699 -} - -hr -{ - border: none 0; - border-top: 1px solid #7F8FB1; - height: 1px; -} - -pre.code -{ - display: block; - padding: 8px; - border: 1px dashed #ccc; -} - -#index -{ - margin-top: 0; - float: left; - width: 17%; - left: 8px; - padding: 0; -} - -#index h2 -{ - border-bottom: 2px groove #ddd; - -} - -#symbolList -{ - position:relative; - float:right; - margin: 0; - padding: 0 1% 0 1%; - width: 17%; -} - -#symbolList ul -{ - padding: 0; - margin: 0; - padding-left: 8px; - list-style: none; -} - -#symbolList h3 -{ - margin-top:1.2em; - margin-bottom: 0.5em; - border-bottom: 2px groove #ddd; -} - -#symbolList ul li -{ - padding: 0; - margin: 0; -} - -#content -{ - text-align: left; - position: relative; - margin-left: auto; - margin-right: auto; - padding-left: 1%; - padding-right: 1%; - width: 62%; - /* width: 600px; */ -} - -.classList -{ - list-style-type: none; - padding: 0; - margin: 0 0 0 8px; - font-family: arial, sans-serif; - font-size: 1em; - overflow: auto; -} - -.classList li -{ - padding: 0; - margin: 0 0 8px 0; -} - -.summaryTable { width: 100%; } - -h1.classTitle -{ - font-size:170%; - line-height:130%; -} - -h2 { font-size: 110%; } -caption, div.sectionTitle -{ - background-color: #336699; - color: #fff; - font-size:130%; - text-align: left; - padding: 2px 6px 2px 6px; - margin-top: 1.5em; - border: 1px #ddd solid; -} - -div.sectionTitle { margin-bottom: 8px; } -.summaryTable thead { display: none; } - -.summaryTable td -{ - vertical-align: top; - padding: 4px; - border-bottom: 1px #7F8FB1 solid; - border-right: 1px #7F8FB1 solid; -} - -/*col#summaryAttributes {}*/ -.summaryTable td.attributes -{ - border-left: 1px #7F8FB1 solid; - width: 140px; - text-align: right; -} - -.fixedFont b -{ - color: #336699; -} - -td.attributes, .fixedFont -{ - line-height: 15px; - /* color: #002EBE; */ - font-family: "Courier New",Courier,monospace; - font-size: 13px; -} - -.modifiers { - float: right; - /* padding: 0 2em 0 2em; */ - padding: 0; -} - -.member .description -{ - margin: 0.75em 0 0 0; - padding: 0 0.5em 0 0.5em; -} - -.summaryTable td.nameDescription -{ - text-align: left; - font-size: 13px; - line-height: 15px; -} - -.summaryTable td.nameDescription, .description -{ - line-height: 15px; - padding: 4px; - padding-left: 4px; -} - -.summaryTable { margin-bottom: 8px; } - -ul.inheritsList -{ - list-style: square; - margin-left: 20px; - padding-left: 0; -} - -.detailList { - margin-left: 20px; - line-height: 15px; -} -.detailList dt { margin-left: 20px; } - -.detailList .heading -{ - font-weight: bold; - padding-bottom: 6px; - margin-left: 0; -} - -.member -{ - border: 1px solid #336699; - background: #f8f8ff; - margin: 1em 0 1em 0; - padding: 0.75em; -} - -.light, td.attributes, .light a:link, .light a:visited -{ - color: #777; - font-style: italic; -} - -code { - display: block; - margin: 1em; - border: 1px solid #aaa; - padding: 1em; - background: #f8f8ff; -} - -.fineprint -{ - text-align: right; - font-size: 10px; -} - - diff --git a/src/minion-jsdoc-template/static/default.css b/src/minion-jsdoc-template/static/default.css deleted file mode 100755 index 9aa3153..0000000 --- a/src/minion-jsdoc-template/static/default.css +++ /dev/null @@ -1,266 +0,0 @@ -/* default.css */ -body -{ - font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif; - min-width: 800px; - max-width: 1024px; -} - -.header -{ - clear: both; - background-color: #ccc; - padding: 8px; -} - -a -{ - text-decoration: none; - color: #a00; -} - -h1 -{ - font-size: 150%; - font-weight: bold; - padding: 0; - margin: 1em 0 0 .3em; -} - -hr -{ - border: none 0; - border-top: 1px solid #7F8FB1; - height: 1px; -} - - -pre.code -{ - display: block; - padding: 8px; - border: 1px dashed #ccc; -} - -#index -{ - margin-top: 24px; - float: left; - /* width: 160px; */ - width: 15%; - position: fixed; - left: 8px; - /* background-color: #F3F3F3; */ - padding: 8px; -} - -#symbolList -{ - position:fixed; - right: 0%; - margin: 0; - padding: 0 0em 0 0em; - width: 17%; -} - -#symbolList ul -{ - padding: 0; - margin: 0; - padding-left: 8px; - list-style: none; -} - -#symbolList h3 -{ - margin-top:1.2em; - margin-bottom: 0.5em; -} - -#symbolList ul li -{ - padding: 0; - margin: 0; - line-height: 15px; - /* color: #002EBE; */ - font-family: "Courier New",Courier,monospace; -} - -#content -{ - text-align: left; - position: absolute; - margin-left: auto; - margin-right: auto; - padding-left: 0.3em; - padding-right: 0.5em; - left: 250px; - right: 300px; - min-width: 500px; - /* width: 600px; */ -} - -.classList -{ - list-style-type: none; - padding: 0; - margin: 0 0 0 8px; - font-family: arial, sans-serif; - font-size: 1em; - overflow: auto; -} - -.classList li -{ - padding: 0; - margin: 0 0 8px 0; -} - -.summaryTable { width: 100%; } - -h1.classTitle -{ - font-size:170%; - line-height:130%; -} - -h2 { font-size: 110%; } -caption, div.sectionTitle -{ - background-color: #ddd; - color: #343436; - font-size:130%; - text-align: left; - padding: 2px 6px 2px 6px; - margin-top: 1.5em; - border: 1px #ddd solid; -} - -div.sectionTitle { margin-bottom: 8px; } -.summaryTable thead { display: none; } - -.summaryTable td -{ - vertical-align: top; - padding: 4px; - border-bottom: 1px #7F8FB1 solid; - border-right: 1px #7F8FB1 solid; -} - -/*col#summaryAttributes {}*/ -.summaryTable td.attributes -{ - border-left: 1px #7F8FB1 solid; - width: 140px; - text-align: right; -} - -.fixedFont b -{ - color: #aa0000; -} - -td.attributes, .fixedFont -{ - line-height: 15px; - /* color: #002EBE; */ - font-family: "Courier New",Courier,monospace; - font-size: 13px; -} - -.modifiers { - float: right; - /* padding: 0 2em 0 2em; */ - padding: 0; - font-size: 12px; -} - -.member .description -{ - margin: 0.75em 0 0 0; - padding: 0.5em; -} - .member > .fixedFont{ - font-size: 18px; - } - .member > .fixedFont > .light{ - font-style: normal; - } - -.summaryTable td.nameDescription -{ - text-align: left; - font-size: 13px; - line-height: 15px; -} - -.summaryTable td.nameDescription, .description -{ - line-height: 15px; - padding: 4px; - padding-left: 4px; -} - -.summaryTable { margin-bottom: 8px; } - -ul.inheritsList -{ - list-style: square; - margin-left: 20px; - padding-left: 0; -} - -.detailList { - margin-left: 20px; - line-height: 15px; -} -.detailList dt { - margin-left: 20px; -} - - .detailList dt code .light{ - font-style: normal !important; - font-size: 11px; - - } - - .detailList dt code{ - font-family: "Courier New"; - font-size: 12px; - } - -.detailList .heading -{ - font-weight: bold; - padding-bottom: 6px; - margin-left: 0; -} - -.member -{ - border: 1px solid #ccc; - background: #f8f8ff; - margin: 3em 0 1em 0; - padding: 0.75em; -} - -.light, td.attributes, .light a:link, .light a:visited -{ - color: #777; - font-style: italic; -} - -code { - display: block; - margin: 1em; - border: 1px solid #aaa; - padding: 1em; - background: #f8f8ff; -} - -.fineprint -{ - text-align: right; - font-size: 10px; - display: none; -} diff --git a/src/minion-jsdoc-template/symbol.tmpl b/src/minion-jsdoc-template/symbol.tmpl deleted file mode 100755 index f8f4bd1..0000000 --- a/src/minion-jsdoc-template/symbol.tmpl +++ /dev/null @@ -1,35 +0,0 @@ - - {+data.name+} - {+data.memberOf+} - {+data.isStatic+} - {+data.isa+} - {+data.desc+} - {+data.classDesc+} - - - - {+method.name+} - {+method.memberOf+} - {+method.isStatic+} - {+method.desc+} - - - {+param.type+} - {+param.name+} - {+param.desc+} - {+param.defaultValue+} - - - - - - - - {+property.name+} - {+property.memberOf+} - {+property.isStatic+} - {+property.desc+} - {+property.type+} - - - diff --git a/src/minion-jsdoc-template/symbolindex.tmpl b/src/minion-jsdoc-template/symbolindex.tmpl deleted file mode 100755 index dfaa68b..0000000 --- a/src/minion-jsdoc-template/symbolindex.tmpl +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - JsDoc Reference - Index - - - - - - - - - - - {+include("header.html")+} - -
    -
    - {+publish.docsIndex+} -
    - {+publish.classesIndex+} -
    - -
    -

    Symbol Index

    -
    -
    - - - - - - - -
    {+symbol.name+} - - {+new Link().toSymbol(entry.alias)+} - -
    -
    -
    -
    -
    - ©{+JSDOC.opt.D.copyright+}
    - Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
    - - - diff --git a/src/minion-jsdoc-template/userdoc.tmpl b/src/minion-jsdoc-template/userdoc.tmpl deleted file mode 100755 index 7a41176..0000000 --- a/src/minion-jsdoc-template/userdoc.tmpl +++ /dev/null @@ -1,35 +0,0 @@ - - - - - JsDoc Reference - File Index - - - - - {+data.header+} - - - - - {+include("header.html")+} - -
    -
    - {+publish.docsIndex+} -
    - {+publish.classesIndex+} -
    - -
    - {+data.content+} - -
    -
    -
    - ©{+JSDOC.opt.D.copyright+}
    - Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
    - -