From 3e2889b94d5e6af93ec0eaca114802e30c8c38ef Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 27 Feb 2012 14:29:17 -0800 Subject: Updating credits --- credits.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/credits.html b/credits.html index 1cc36c78..082eefd4 100644 --- a/credits.html +++ b/credits.html @@ -95,5 +95,14 @@
  • License: http://www.opensource.org/licenses/mit-license.php
  • + +
    + js-beautify + +
    \ No newline at end of file -- cgit v1.2.3 From f872077e947916496235f4e871511ce890953d04 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 27 Feb 2012 14:38:59 -0800 Subject: Updating legal copy --- js/mediators/io-mediator.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 7efed29b..733e44b2 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js @@ -345,10 +345,21 @@ exports.IoMediator = Montage.create(Component, { //////////////////////////////////////////////////////////////////// //Pretty methods (minified) /* - is-beautify javascript code courtesy of Einar Lielmanis: - Code from https://github.com/einars/js-beautify - License https://github.com/einars/js-beautify/blob/master/license.txt - Used with author's permission + is-beautify javascript code courtesy of Einar Lielmanis: + Code from https://github.com/einars/js-beautify + License https://github.com/einars/js-beautify/blob/master/license.txt + Used with author's permission, as stated below + + Copyright (c) 2009 - 2011, Einar Lielmanis + 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. */ //For HTML, including any JS or CSS (single string/file) getPrettyHtml: { -- cgit v1.2.3 From 6054d13cf1254447d2396889eafc6a953f0b8d4a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 27 Feb 2012 21:09:44 -0800 Subject: adding the template-creator class Signed-off-by: Valerio Virgillito --- node_modules/tools/template-creator.js | 113 +++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 node_modules/tools/template-creator.js diff --git a/node_modules/tools/template-creator.js b/node_modules/tools/template-creator.js new file mode 100644 index 00000000..6b50cc1e --- /dev/null +++ b/node_modules/tools/template-creator.js @@ -0,0 +1,113 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
    + No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
    + (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
    */ +/** + @module montage/tools/template/template-creator + @requires montage/ui/template +*/ + +exports = typeof exports !== "undefined" ? exports : {}; + +var Montage = require("montage/core/core").Montage; +var Template = require("montage/ui/template").Template; + +/** + @class module:montage/tools/template/template-creator.TemplateCreator + @extends module:montage/ui/template.Template +*/ +var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @lends module:montage/tools/template/template-creator.TemplateCreator# */ { + initWithDocument: { + value: function(doc, montageJsPath) { + return this.initWithHeadAndBodyElements(doc.head, doc.body, montageJsPath); + } + }, + + initWithBodyElement: { + value: function(body, montageJsPath) { + return this.initWithHeadAndBodyElements(null, body, montageJsPath); + } + }, + + initWithHeadAndBodyElements: { + value: function(head, body, montageJsPath) { + var serializer = this.serializer, + objects = {}, + components = {}, + doc, + script, + self = this; + + this._objectNamesIndex = {}; + doc = this._document = document.implementation.createHTMLDocument(""); + + function copyNode(sourceNode, targetNode, isRootNode) { + var childNodes = sourceNode.childNodes, + childNode, + targetChildNode, + label, + script, + component = isRootNode ? null : sourceNode.controller; + + if (component) { + label = self._generateLabelForComponent(component); + targetNode.setAttribute("id", label); + component._element = targetNode; + components[label] = component; + } else { + for (var i = 0; (childNode = childNodes[i]); i++) { + targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); + copyNode(childNode, targetChildNode); + } + } + } + + if (head) { + doc.head.innerHTML = head.innerHTML; + } + if (montageJsPath) { + script = doc.createElement("script"); + script.setAttribute("src", montageJsPath); + doc.head.appendChild(script); + doc.head.insertBefore(doc.createTextNode("\n "), script); + } + + // try to make things look nice... + var html = doc.documentElement; + html.insertBefore(doc.createTextNode("\n"), doc.head); + html.insertBefore(doc.createTextNode("\n"), doc.body); + html.appendChild(doc.createTextNode("\n")); + if (!head) { + // the first child is the title + doc.head.insertBefore(doc.createTextNode("\n "), doc.head.firstChild); + } + + copyNode(body, this._document.body, true); + this._ownerSerialization = serializer.serialize(components); + this._externalObjects = serializer.getExternalObjects(); + + return this; + } + }, + + _componentNamesIndex: { + value: null + }, + + _generateLabelForComponent: {value: function(component) { + var componentInfo = Montage.getInfoForObject(component), + componentLabel = componentInfo.label, + componentName, + index; + + if (componentLabel) { + return componentLabel; + } else { + componentName = componentInfo.objectName.toLowerCase(); + index = this._componentNamesIndex[componentName] || 1; + this._componentNamesIndex[componentName] = index + 1; + return componentName + index; + } + }}, +}); \ No newline at end of file -- cgit v1.2.3