aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tools
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tools')
-rwxr-xr-xnode_modules/tools/package.json14
-rwxr-xr-x[-rw-r--r--]node_modules/tools/template/template-creator.js (renamed from node_modules/tools/template-creator.js)42
2 files changed, 33 insertions, 23 deletions
diff --git a/node_modules/tools/package.json b/node_modules/tools/package.json
new file mode 100755
index 00000000..5d830af3
--- /dev/null
+++ b/node_modules/tools/package.json
@@ -0,0 +1,14 @@
1
2{
3 "name": "tools",
4 "version": "0.1.0",
5 "description": "Montage Tools",
6 "main": "tools",
7 "mappings": {
8 "montage" : "../montage/"
9 },
10 "dependency": {
11 "montage" : "0.8"
12 }
13
14} \ No newline at end of file
diff --git a/node_modules/tools/template-creator.js b/node_modules/tools/template/template-creator.js
index e312cd32..374353f0 100644..100755
--- a/node_modules/tools/template-creator.js
+++ b/node_modules/tools/template/template-creator.js
@@ -23,39 +23,38 @@ var TemplateCreator = exports.TemplateCreator = Montage.create(Template, /** @le
23 return this.initWithHeadAndBodyElements(doc.head, doc.body, montageJsPath); 23 return this.initWithHeadAndBodyElements(doc.head, doc.body, montageJsPath);
24 } 24 }
25 }, 25 },
26 26
27 initWithBodyElement: { 27 initWithBodyElement: {
28 value: function(body, montageJsPath) { 28 value: function(body, montageJsPath) {
29 return this.initWithHeadAndBodyElements(null, body, montageJsPath); 29 return this.initWithHeadAndBodyElements(null, body, montageJsPath);
30 } 30 }
31 }, 31 },
32 32
33 initWithHeadAndBodyElements: { 33 initWithHeadAndBodyElements: {
34 value: function(head, body, components, montageJsPath) { 34 value: function(head, body, montageJsPath) {
35 var serializer = this.serializer, 35 var serializer = this.serializer,
36 objects = {}, 36 objects = {},
37 //components = {}, 37 components = {},
38 doc, 38 doc,
39 script, 39 script,
40 self = this; 40 self = this;
41 41
42 this._objectNamesIndex = {}; 42 this._componentNamesIndex = {};
43 //doc = this._document = document.implementation.createHTMLDocument(""); 43 doc = this._document = document.implementation.createHTMLDocument("");
44 44
45 /* 45 function copyNode(sourceNode, targetNode, isRootNode) {
46function copyNode(sourceNode, targetNode, isRootNode) {
47 var childNodes = sourceNode.childNodes, 46 var childNodes = sourceNode.childNodes,
48 childNode, 47 childNode,
49 targetChildNode, 48 targetChildNode,
50 label, 49 label,
51 script, 50 script,
52 component = isRootNode ? null : sourceNode.controller; 51 component = isRootNode ? null : sourceNode.controller;
53 52
54 if (component) { 53 if (component) {
55 label = self._generateLabelForComponent(component); 54 label = self._generateLabelForComponent(component);
56 targetNode.setAttribute("id", label); 55 targetNode.setAttribute("id", label);
57 component._element = targetNode; 56 component._element = targetNode;
58 //components[label] = component; 57 components[label] = component;
59 } else { 58 } else {
60 for (var i = 0; (childNode = childNodes[i]); i++) { 59 for (var i = 0; (childNode = childNodes[i]); i++) {
61 targetChildNode = targetNode.appendChild(childNode.cloneNode(false)); 60 targetChildNode = targetNode.appendChild(childNode.cloneNode(false));
@@ -63,10 +62,8 @@ function copyNode(sourceNode, targetNode, isRootNode) {
63 } 62 }
64 } 63 }
65 } 64 }
66*/ 65
67 66 if (head) {
68 /*
69if (head) {
70 doc.head.innerHTML = head.innerHTML; 67 doc.head.innerHTML = head.innerHTML;
71 } 68 }
72 if (montageJsPath) { 69 if (montageJsPath) {
@@ -75,7 +72,7 @@ if (head) {
75 doc.head.appendChild(script); 72 doc.head.appendChild(script);
76 doc.head.insertBefore(doc.createTextNode("\n "), script); 73 doc.head.insertBefore(doc.createTextNode("\n "), script);
77 } 74 }
78 75
79 // try to make things look nice... 76 // try to make things look nice...
80 var html = doc.documentElement; 77 var html = doc.documentElement;
81 html.insertBefore(doc.createTextNode("\n"), doc.head); 78 html.insertBefore(doc.createTextNode("\n"), doc.head);
@@ -85,20 +82,19 @@ if (head) {
85 // the first child is the title 82 // the first child is the title
86 doc.head.insertBefore(doc.createTextNode("\n "), doc.head.firstChild); 83 doc.head.insertBefore(doc.createTextNode("\n "), doc.head.firstChild);
87 } 84 }
88*/ 85
89 86 copyNode(body, this._document.body, true);
90 //copyNode(body, this._document.body, true);
91 this._ownerSerialization = serializer.serialize(components); 87 this._ownerSerialization = serializer.serialize(components);
92 this._externalObjects = serializer.getExternalObjects(); 88 this._externalObjects = serializer.getExternalObjects();
93 89
94 return this; 90 return this;
95 } 91 }
96 }, 92 },
97 93
98 _componentNamesIndex: { 94 _componentNamesIndex: {
99 value: null 95 value: null
100 }, 96 },
101 97
102 _generateLabelForComponent: {value: function(component) { 98 _generateLabelForComponent: {value: function(component) {
103 var componentInfo = Montage.getInfoForObject(component), 99 var componentInfo = Montage.getInfoForObject(component),
104 componentLabel = componentInfo.label, 100 componentLabel = componentInfo.label,