diff options
author | Nivesh Rajbhandari | 2012-03-24 13:53:34 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-24 13:53:34 -0700 |
commit | 5e8faa47e1b2507a09d04fea4325006e5eab2f25 (patch) | |
tree | 56683c1be0485f560ff49e8125f0b19dd42199f3 /js/mediators | |
parent | 2946d01666ff81f913bd06d1ac1381ed42b4a010 (diff) | |
parent | 7ee75fef18c21275cf29740a6fdd81ea90e41f45 (diff) | |
download | ninja-5e8faa47e1b2507a09d04fea4325006e5eab2f25.tar.gz |
Merge branch 'refs/heads/montage-integration' into WebGL-Animation-CheckBox
Diffstat (limited to 'js/mediators')
-rw-r--r-- | js/mediators/io-mediator.js | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 18a517a5..1efbb8bb 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -348,7 +348,7 @@ exports.IoMediator = Montage.create(Component, { | |||
348 | } | 348 | } |
349 | } | 349 | } |
350 | //Checking for webGL elements in document | 350 | //Checking for webGL elements in document |
351 | if (template.webgl && template.webgl.length > 0) { | 351 | if (template.webgl && template.webgl.length > 1) {//TODO: Should be length 0, hack for a temp fix |
352 | var rdgeDirName, rdgeVersion; | 352 | var rdgeDirName, rdgeVersion; |
353 | //Copy webGL library if needed | 353 | //Copy webGL library if needed |
354 | for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { | 354 | for (var i in this.application.ninja.coreIoApi.ninjaLibrary.libs) { |
@@ -532,8 +532,6 @@ function loadWebGL (e) {\n\ | |||
532 | getUrlfromNinjaUrl: { | 532 | getUrlfromNinjaUrl: { |
533 | enumerable: false, | 533 | enumerable: false, |
534 | value: function (url, fileRootUrl, fileUrl) { | 534 | value: function (url, fileRootUrl, fileUrl) { |
535 | //console.log("Params: ", url, fileRootUrl, fileUrl); | ||
536 | //console.log("Getting: " + url); | ||
537 | // | 535 | // |
538 | if (url.indexOf(fileRootUrl) !== -1) { | 536 | if (url.indexOf(fileRootUrl) !== -1) { |
539 | url = url.replace(new RegExp(fileRootUrl.replace(/\//gi, '\\\/'), 'gi'), ''); | 537 | url = url.replace(new RegExp(fileRootUrl.replace(/\//gi, '\\\/'), 'gi'), ''); |
@@ -561,13 +559,63 @@ function loadWebGL (e) {\n\ | |||
561 | // | 559 | // |
562 | url = (path+newURL).replace(/\/\//gi, '/'); | 560 | url = (path+newURL).replace(/\/\//gi, '/'); |
563 | } | 561 | } |
564 | //console.log("Returning: " + url); | ||
565 | //console.log("-----"); | ||
566 | // | 562 | // |
567 | return url; | 563 | return url; |
568 | } | 564 | } |
569 | }, | 565 | }, |
570 | //////////////////////////////////////////////////////////////////// | 566 | //////////////////////////////////////////////////////////////////// |
567 | // | ||
568 | getDocRootUrl: { | ||
569 | value: function () { | ||
570 | return this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); | ||
571 | } | ||
572 | }, | ||
573 | //////////////////////////////////////////////////////////////////// | ||
574 | // | ||
575 | getNinjaPropUrlRedirect: { | ||
576 | enumerable: false, | ||
577 | value: function (prop/* , root */) { | ||
578 | //Checking for property value to not contain a full direct URL | ||
579 | if (!prop.match(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi)) { | ||
580 | //Checking for attributes and type of source | ||
581 | if (prop.indexOf('href') !== -1 || prop.indexOf('src') !== -1) { | ||
582 | //From HTML attribute | ||
583 | //if (root) { | ||
584 | //prop = (root+prop).replace(/"([^"]*)"/gi, this.getNinjaUrlPrepend.bind(this)); | ||
585 | //} else { | ||
586 | prop = prop.replace(/"([^"]*)"/gi, this.getNinjaUrlPrepend.bind(this)); | ||
587 | //} | ||
588 | } else if (prop.indexOf('url') !== -1) { | ||
589 | //From CSS property | ||
590 | //if (root) { | ||
591 | //prop = (root+prop).replace(/[^()\\""\\'']+/g, cssUrlToNinjaUrl.bind(this)); | ||
592 | //} else { | ||
593 | prop = prop.replace(/[^()\\""\\'']+/g, cssUrlToNinjaUrl.bind(this)); | ||
594 | //} | ||
595 | function cssUrlToNinjaUrl (s) { | ||
596 | if (s !== 'url') { | ||
597 | s = this.getDocRootUrl() + s; | ||
598 | } | ||
599 | return s; | ||
600 | } | ||
601 | } | ||
602 | } | ||
603 | return prop; | ||
604 | } | ||
605 | }, | ||
606 | //////////////////////////////////////////////////////////////////// | ||
607 | // | ||
608 | getNinjaUrlPrepend: { | ||
609 | enumerable: false, | ||
610 | value: function (url) { | ||
611 | if (url.indexOf('data:') !== -1) { | ||
612 | return url; | ||
613 | } else { | ||
614 | return '"'+this.getDocRootUrl()+url.replace(/\"/gi, '')+'"'; | ||
615 | } | ||
616 | } | ||
617 | }, | ||
618 | //////////////////////////////////////////////////////////////////// | ||
571 | //Method to return a string from CSS rules (to be saved to a file) | 619 | //Method to return a string from CSS rules (to be saved to a file) |
572 | getCssFromRules: { | 620 | getCssFromRules: { |
573 | enumerable: false, | 621 | enumerable: false, |