aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/document/templates/html/main.js4
-rw-r--r--js/mediators/io-mediator.js60
2 files changed, 8 insertions, 56 deletions
diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js
index 2696dfa0..ffa3fab2 100644
--- a/js/document/templates/html/main.js
+++ b/js/document/templates/html/main.js
@@ -40,9 +40,9 @@ exports.Main = Montage.create(Component, {
40 40
41 }; 41 };
42 // 42 //
43 window.mjsTemplateCreator = TemplateCreator.create(); 43 window.mjsTemplateCreator = TemplateCreator;
44 // 44 //
45 window.mjsTemplate = Template.create(); 45 window.mjsTemplate = Template;
46 46
47 47
48 // Dispatch event when this template has loaded. 48 // Dispatch event when this template has loaded.
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 7f7bd72a..b1916446 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -222,8 +222,11 @@ exports.IoMediator = Montage.create(Component, {
222 //TODO: Improve reference for rootUrl 222 //TODO: Improve reference for rootUrl
223 var regexRootUrl, 223 var regexRootUrl,
224 rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])), 224 rootUrl = this.application.ninja.coreIoApi.rootUrl + escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1])),
225 montageTemplate = template.mjsTemplateCreator.initWithDocument(template.document), 225 mjsCreator = template.mjsTemplateCreator.create(),
226 mJsSerialization; 226 mJsSerialization,
227 montageTemplate;
228 //
229 montageTemplate = mjsCreator.initWithDocument(template.document);
227 //Setting up expression for parsing URLs 230 //Setting up expression for parsing URLs
228 regexRootUrl = new RegExp(rootUrl.replace(/\//gi, '\\\/'), 'gi'); 231 regexRootUrl = new RegExp(rootUrl.replace(/\//gi, '\\\/'), 'gi');
229 //Injecting head and body into old document 232 //Injecting head and body into old document
@@ -567,58 +570,8 @@ function loadWebGL (e) {\n\
567 } 570 }
568 // 571 //
569 mjstag.innerHTML = mJsSerialization; 572 mjstag.innerHTML = mJsSerialization;
573 mjsCreator = null;
570 } 574 }
571
572
573 //
574
575 /*
576for (var m in template.mjs) {
577 mjsComponents.push(template.mjs[m]);
578 mjsCounter++;
579 }
580 //
581 if (template.mjs && mjsCounter > 0) {
582 var mjsDirName, mjsVersion,
583 mjscode = temp.initWithHeadAndBodyElements(template.file.content.document.documentElement.head, template.file.content.document.documentElement.body, mjsComponents)._ownerSerialization;
584 //Copy Montage library if needed
585 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
586 //Checking for Montage library to be available
587 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Montage') {
588 mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase();
589 mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version;
590 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, mjsDirName);
591 //TODO: Fix to allow no overwrite and nested locations
592 var packjson = this.application.ninja.coreIoApi.createFile({ uri: template.file.root + 'package.json', contents: '{"mappings": {"montage": "' + mjsDirName + '/"}}' });
593 } else {
594 //TODO: Error handle no available library to copy
595 }
596 }
597 //
598 if (!mjslibtag) {
599 mjslibtag = template.file.content.document.createElement('script');
600 mjslibtag.setAttribute('type', 'text/javascript');
601 mjslibtag.setAttribute('src', mjsDirName + '/montage.js');
602 mjslibtag.setAttribute('data-mjs-lib', 'true');
603 template.file.content.document.head.appendChild(mjslibtag);
604 }
605 //
606 if (!mjstag) {
607 mjstag = template.file.content.document.createElement('script');
608 mjstag.setAttribute('type', 'text/montage-serialization');
609 template.file.content.document.head.appendChild(mjstag);
610 }
611 //
612 mjstag.innerHTML = mjscode;
613 }
614*/
615
616
617
618
619
620
621
622 //Cleaning URLs from HTML 575 //Cleaning URLs from HTML
623 var cleanHTML; 576 var cleanHTML;
624 if (ninjaWrapper) { 577 if (ninjaWrapper) {
@@ -639,7 +592,6 @@ for (var m in template.mjs) {
639 cleanHTML = cleanHTML.replace(/ninja-viewport/gi, 'div'); 592 cleanHTML = cleanHTML.replace(/ninja-viewport/gi, 'div');
640 cleanHTML = cleanHTML.replace(/ninja-content/gi, 'div'); 593 cleanHTML = cleanHTML.replace(/ninja-content/gi, 'div');
641 } 594 }
642
643 // 595 //
644 return this.getPrettyHtml(cleanHTML.replace(this.getAppTemplatesUrlRegEx(), '')); 596 return this.getPrettyHtml(cleanHTML.replace(this.getAppTemplatesUrlRegEx(), ''));
645 } 597 }