aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index e9ed86d7..1edcc06c 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