aboutsummaryrefslogtreecommitdiff
path: root/js/document/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/mediators')
-rwxr-xr-xjs/document/mediators/template.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/js/document/mediators/template.js b/js/document/mediators/template.js
index 4065f471..c68cfe72 100755
--- a/js/document/mediators/template.js
+++ b/js/document/mediators/template.js
@@ -47,7 +47,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
47 // 47 //
48 getAppTemplatesUrlRegEx: { 48 getAppTemplatesUrlRegEx: {
49 value: function () { 49 value: function () {
50 var regex = new RegExp(chrome.extension.getURL(this.application.ninja.currentDocument.model.views.design.iframe.src.split(chrome.extension.getURL('/'))[1]).replace(/\//gi, '\\\/'), 'gi'); 50 var regex = new RegExp(chrome.extension.getURL(this.application.ninja.currentDocument.model.views.design.document.baseURI.split(chrome.extension.getURL('/'))[1]).replace(/\//gi, '\\\/'), 'gi');
51 return regex; 51 return regex;
52 } 52 }
53 }, 53 },
@@ -326,7 +326,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
326 } 326 }
327 } 327 }
328 } 328 }
329 } else if (template.css) { 329 } else if (template.css && saveExternalData) {
330 //Getting all style and link tags 330 //Getting all style and link tags
331 var styleCounter = 0, 331 var styleCounter = 0,
332 docStyles = template.file.content.document.getElementsByTagName('style'), 332 docStyles = template.file.content.document.getElementsByTagName('style'),
@@ -480,7 +480,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
480 //Copy webGL library if needed 480 //Copy webGL library if needed
481 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { 481 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
482 //Checking for RDGE library to be available 482 //Checking for RDGE library to be available
483 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE') { 483 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'RDGE' && saveExternalData) {
484 rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); 484 rdgeDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase();
485 rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; 485 rdgeVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version;
486 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, rdgeDirName, function(result) {libsobserver.canvasCopied = result; this.libCopied(libsobserver);}.bind(this)); 486 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, rdgeDirName, function(result) {libsobserver.canvasCopied = result; this.libCopied(libsobserver);}.bind(this));
@@ -564,7 +564,7 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
564 webgllibtag.setAttribute('data-ninja-canvas-json', this.application.ninja.coreIoApi.rootUrl+'/'+cvsDataFileUrl); 564 webgllibtag.setAttribute('data-ninja-canvas-json', this.application.ninja.coreIoApi.rootUrl+'/'+cvsDataFileUrl);
565 webgllibtag.setAttribute('data-ninja-canvas-libpath', rdgeDirName); 565 webgllibtag.setAttribute('data-ninja-canvas-libpath', rdgeDirName);
566 // 566 //
567 if (cvsDataFileCheck.status === 404 || cvsDataFileCheck.status === 204) { 567 if (saveExternalData && (cvsDataFileCheck.status === 404 || cvsDataFileCheck.status === 204)) {
568 //Saving file 568 //Saving file
569 cvsDataFileOperation = this.application.ninja.ioMediator.fio.saveFile({uri: cvsDataFilePath, contents: json}); 569 cvsDataFileOperation = this.application.ninja.ioMediator.fio.saveFile({uri: cvsDataFilePath, contents: json});
570 } else { 570 } else {
@@ -592,13 +592,13 @@ exports.TemplateDocumentMediator = Montage.create(Component, {
592 592
593 593
594 //TODO: Make proper Montage method 594 //TODO: Make proper Montage method
595 595 var mjsDirName, mjsVersion;
596 //Checking for Montage 596 //Checking for Montage
597 if (mJsSerialization) { 597 if (mJsSerialization) {
598 //Copy Montage library if needed 598 //Copy Montage library if needed
599 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { 599 for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) {
600 //Checking for Montage library to be available 600 //Checking for Montage library to be available
601 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Montage') { 601 if (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name === 'Montage' && saveExternalData) {
602 mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase(); 602 mjsDirName = (this.application.ninja.coreIoApi.ninjaLibrary.libs[i].name + this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version).toLowerCase();
603 mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version; 603 mjsVersion = this.application.ninja.coreIoApi.ninjaLibrary.libs[i].version;
604 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, mjsDirName, function(result) {libsobserver.montageCopied = result; this.libCopied(libsobserver);}.bind(this)); 604 this.application.ninja.coreIoApi.ninjaLibrary.copyLibToCloud(template.file.root, mjsDirName, function(result) {libsobserver.montageCopied = result; this.libCopied(libsobserver);}.bind(this));