aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/controllers/elements/element-controller.js3
-rwxr-xr-xjs/document/document-html.js2
-rwxr-xr-xjs/document/models/html.js10
-rwxr-xr-xjs/document/views/design.js10
-rw-r--r--js/mediators/io-mediator.js25
-rw-r--r--node_modules/montage-google/feed-reader/feed-entry.reel/feed-entry.html22
-rw-r--r--node_modules/montage-google/feed-reader/feed-reader.reel/feed-reader.html43
-rw-r--r--node_modules/montage-google/feed-reader/feed-reader.reel/feed-reader.js14
-rwxr-xr-xnode_modules/tools/template/template-creator.js1
9 files changed, 83 insertions, 47 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 7bb07976..01e132d7 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -11,6 +11,9 @@ exports.ElementController = Montage.create(Component, {
11 11
12 addElement: { 12 addElement: {
13 value: function(el, styles) { 13 value: function(el, styles) {
14
15 if (el.getAttribute) el.setAttribute('data-ninja-node', 'true');
16
14 if(this.application.ninja.timeline.currentLayerSelected) { 17 if(this.application.ninja.timeline.currentLayerSelected) {
15 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); 18 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
16 19
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 8cc61026..33a41a8e 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -62,6 +62,8 @@ exports.HtmlDocument = Montage.create(Component, {
62 parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach 62 parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach
63 views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic 63 views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic
64 }); 64 });
65 //Calling the any init routines in the model
66 this.model.init();
65 //Initiliazing views and hiding 67 //Initiliazing views and hiding
66 if (this.model.views.design.initialize(this.model.parentContainer)) { 68 if (this.model.views.design.initialize(this.model.parentContainer)) {
67 //Hiding iFrame, just initiliazing 69 //Hiding iFrame, just initiliazing
diff --git a/js/document/models/html.js b/js/document/models/html.js
index 9f5599a2..9aa0d27e 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -18,6 +18,14 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
18 value: false 18 value: false
19 }, 19 },
20 //////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////
21 //Called by the document immidiately after the model is created
22 init: {
23 value:function() {
24 //Creating instance of the webGL helper for this model
25 this.webGlHelper = webGlDocumentHelper.create();
26 }
27 },
28 ////////////////////////////////////////////////////////////////////
21 // 29 //
22 selectionContainer: { 30 selectionContainer: {
23 value: [] 31 value: []
@@ -52,7 +60,7 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
52 //////////////////////////////////////////////////////////////////// 60 ////////////////////////////////////////////////////////////////////
53 // 61 //
54 webGlHelper: { 62 webGlHelper: {
55 value: webGlDocumentHelper 63 value: null
56 }, 64 },
57 //////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////
58 // 66 //
diff --git a/js/document/views/design.js b/js/document/views/design.js
index dd8754ed..9aeb370a 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -124,7 +124,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
124 // 124 //
125 onTemplateLoad: { 125 onTemplateLoad: {
126 value: function (e) { 126 value: function (e) {
127 //console.log(this.iframe.contentWindow); 127 //TODO: Remove, this is a temp patch for webRequest API gate
128 this.application.ninja.documentController.redirectRequests = true; 128 this.application.ninja.documentController.redirectRequests = true;
129 //TODO: Add support to constructing URL with a base HREF 129 //TODO: Add support to constructing URL with a base HREF
130 var basetag = this.content.document.getElementsByTagName('base'); 130 var basetag = this.content.document.getElementsByTagName('base');
@@ -240,7 +240,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
240 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]); 240 this.document.body.removeChild(this.document.getElementsByTagName('ninjaloadinghack')[0]);
241 //Getting style and link tags in document 241 //Getting style and link tags in document
242 var stags = this.document.getElementsByTagName('style'), 242 var stags = this.document.getElementsByTagName('style'),
243 ltags = this.document.getElementsByTagName('link'), i, 243 ltags = this.document.getElementsByTagName('link'), i, orgNodes,
244 scripttags = this.document.getElementsByTagName('script'); 244 scripttags = this.document.getElementsByTagName('script');
245 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles) 245 //Temporarily checking for disabled special case (we must enabled for Ninja to access styles)
246 this.ninjaDisableAttribute(stags); 246 this.ninjaDisableAttribute(stags);
@@ -281,6 +281,12 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
281 } 281 }
282 //Storing node list for reference (might need to store in the model) 282 //Storing node list for reference (might need to store in the model)
283 this._liveNodeList = this.model.documentRoot.getElementsByTagName('*'); 283 this._liveNodeList = this.model.documentRoot.getElementsByTagName('*');
284 //Getting list of original nodes
285 orgNodes = this.document.getElementsByTagName('*');
286 //TODO: Figure out if this is ideal for identifying nodes created by Ninja
287 for (var n in orgNodes) {
288 if (orgNodes[n].getAttribute) orgNodes[n].setAttribute('data-ninja-node', 'true');
289 }
284 //Initiliazing document model 290 //Initiliazing document model
285 document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body"); 291 document.application.njUtils.makeElementModel(this.model.documentRoot, "Body", "body");
286 //Makign callback if specified 292 //Makign callback if specified
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index e9ed86d7..4dbf32d5 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -277,6 +277,8 @@ exports.IoMediator = Montage.create(Component, {
277 rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), 277 rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])),
278 mjsCreator = template.mjsTemplateCreator.create(), 278 mjsCreator = template.mjsTemplateCreator.create(),
279 mJsSerialization, 279 mJsSerialization,
280 toremovetags = [],
281 presentNodes,
280 montageTemplate; 282 montageTemplate;
281 //Creating instance of template creator 283 //Creating instance of template creator
282 montageTemplate = mjsCreator.initWithDocument(template.document); 284 montageTemplate = mjsCreator.initWithDocument(template.document);
@@ -299,23 +301,34 @@ exports.IoMediator = Montage.create(Component, {
299 template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value); 301 template.file.content.document.body.setAttribute(template.body.attributes[n].name, template.body.attributes[n].value);
300 } 302 }
301 } 303 }
302 //TODO: Add attribute copying for <HEAD> and <HTML>
303 304
304 305
305 //console.log(template.file.content.document.getElementsByTagName('html')[0].innerHTML); 306
307 //TODO: Add attribute copying for <HEAD> and <HTML>
306 308
307 309
310
311 //Getting list of current nodes (Ninja DOM)
312 presentNodes = template.file.content.document.getElementsByTagName('*');
313 //Looping through nodes to determine origin and removing if not inserted by Ninja
314 for (var n in presentNodes) {
315 if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') === null) {
316 toremovetags.push(presentNodes[n]);
317 } else if (presentNodes[n].getAttribute && presentNodes[n].getAttribute('data-ninja-node') !== null) {
318 //Removing attribute
319 presentNodes[n].removeAttribute('data-ninja-node');
320 }
321 }
308 //Getting all CSS (style or link) tags 322 //Getting all CSS (style or link) tags
309 var styletags = template.file.content.document.getElementsByTagName('style'), 323 var styletags = template.file.content.document.getElementsByTagName('style'),
310 linktags = template.file.content.document.getElementsByTagName('link'), 324 linktags = template.file.content.document.getElementsByTagName('link'),
311 toremovetags = [],
312 njtemplatetags = template.file.content.document.querySelectorAll('[data-ninja-template]'); 325 njtemplatetags = template.file.content.document.querySelectorAll('[data-ninja-template]');
313 326
314 ////////////////////////////////////////////////// 327 //////////////////////////////////////////////////
315 //TODO: Remove, temp hack, this is to be fixed by Montage 328 //TODO: Remove, temp hack, this is to be fixed by Montage
316 var basetags = template.file.content.document.getElementsByTagName('base'); 329 var basetags = template.file.content.document.getElementsByTagName('base');
317 for (var g in basetags) { 330 for (var g in basetags) {
318 if (basetags[g].getAttribute) toremovetags.push(basetags[g]); 331 if (basetags[g].getAttribute && basetags[g].href && basetags[g].href.indexOf('chrome-extension://') !== -1) toremovetags.push(basetags[g]);
319 } 332 }
320 ////////////////////////////////////////////////// 333 //////////////////////////////////////////////////
321 334
@@ -392,7 +405,7 @@ exports.IoMediator = Montage.create(Component, {
392 for (var n in docLinks) { 405 for (var n in docLinks) {
393 if (docLinks[n].attributes) { 406 if (docLinks[n].attributes) {
394 for (var m in docLinks[n].attributes) { 407 for (var m in docLinks[n].attributes) {
395 if (docLinks[n].attributes[m].name && docLinks[n].attributes[m].name.indexOf('data-ninja') != -1) { 408 if (docLinks[n].attributes[m].name && docLinks[n].attributes[m].name.indexOf('data-ninja') !== -1) {
396 docLinks[n].removeAttribute(docLinks[n].attributes[m].name); 409 docLinks[n].removeAttribute(docLinks[n].attributes[m].name);
397 } 410 }
398 } 411 }
@@ -404,7 +417,7 @@ exports.IoMediator = Montage.create(Component, {
404 if (template.css[i].ownerNode.getAttribute) { 417 if (template.css[i].ownerNode.getAttribute) {
405 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.css[i].ownerNode.getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll 418 if (template.css[i].ownerNode.getAttribute('data-ninja-uri') === null && !template.css[i].ownerNode.getAttribute('data-ninja-template')) {//TODO: Use querySelectorAll
406 //Inseting data from rules array into <style> as string 419 //Inseting data from rules array into <style> as string
407 if (docStyles[styleCounter] && !template.css[i].ownerNode.getAttribute('data-ninja-external-url')) { 420 if (docStyles[styleCounter] && !template.css[i].ownerNode.getAttribute('data-ninja-external-url') && template.css[i].ownerNode.getAttribute('data-ninja-node')) {
408 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules); 421 docStyles[styleCounter].innerHTML = this.getCssFromRules(template.css[i].cssRules);
409 styleCounter++; 422 styleCounter++;
410 } 423 }
diff --git a/node_modules/montage-google/feed-reader/feed-entry.reel/feed-entry.html b/node_modules/montage-google/feed-reader/feed-entry.reel/feed-entry.html
index 6b2e51e2..8e9b3371 100644
--- a/node_modules/montage-google/feed-reader/feed-entry.reel/feed-entry.html
+++ b/node_modules/montage-google/feed-reader/feed-entry.reel/feed-entry.html
@@ -6,8 +6,7 @@
6 <script type="text/montage-serialization"> 6 <script type="text/montage-serialization">
7{ 7{
8 "title": { 8 "title": {
9 "module": "montage/ui/dynamic-text.reel", 9 "prototype": "montage/ui/dynamic-text.reel",
10 "name": "DynamicText",
11 "properties": { 10 "properties": {
12 "element": {"#": "entry-title"} 11 "element": {"#": "entry-title"}
13 }, 12 },
@@ -20,8 +19,7 @@
20 } 19 }
21