aboutsummaryrefslogtreecommitdiff
path: root/js/document/helpers
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/document/helpers
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts: js/components/gradientpicker.reel/gradientpicker.js js/components/tools-properties/text-properties.reel/text-properties.js js/document/views/base.js js/document/views/design.js js/helper-classes/3D/StageLine.js js/helper-classes/3D/draw-utils.js js/lib/drawing/world.js js/lib/geom/circle.js js/lib/geom/line.js js/lib/geom/rectangle.js js/lib/geom/shape-primitive.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/flag-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/water-material.js js/panels/Materials/materials-library-panel.reel/materials-library-panel.html js/panels/Materials/materials-library-panel.reel/materials-library-panel.js js/panels/Materials/materials-popup.reel/materials-popup.html js/panels/Materials/materials-popup.reel/materials-popup.js js/tools/LineTool.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/document/helpers')
-rwxr-xr-xjs/document/helpers/url-parser.js118
-rwxr-xr-xjs/document/helpers/webgl-helper.js318
2 files changed, 218 insertions, 218 deletions
diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js
index 9c663e8a..353593eb 100755
--- a/js/document/helpers/url-parser.js
+++ b/js/document/helpers/url-parser.js
@@ -30,81 +30,81 @@ POSSIBILITY OF SUCH DAMAGE.
30 30
31//////////////////////////////////////////////////////////////////////// 31////////////////////////////////////////////////////////////////////////
32// 32//
33var Montage = require("montage/core/core").Montage, 33var Montage = require("montage/core/core").Montage,
34 Component = require("montage/ui/component").Component; 34 Component = require("montage/ui/component").Component;
35//////////////////////////////////////////////////////////////////////// 35////////////////////////////////////////////////////////////////////////
36// 36//
37exports.UrlParser = Montage.create(Component, { 37exports.UrlParser = Montage.create(Component, {
38 //////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////
39 // 39 //
40 hasTemplate: { 40 hasTemplate: {
41 value: false 41 value: false
42 }, 42 },
43 //////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////
44 // 44 //
45 parseStyleUrls: { 45 parseStyleUrls: {
46 value: function (css, href, local) { 46 value: function (css, href, local) {
47 // 47 //
48 if (local) { 48 if (local) {
49 var fileCouldDirUrl = href.split(href.split('/')[href.split('/').length-1])[0]; 49 var fileCouldDirUrl = href.split(href.split('/')[href.split('/').length-1])[0];
50 } else { 50 } else {
51 //TODO: Add logic for external URLs 51 //TODO: Add logic for external URLs
52 } 52 }
53 //TODO: Clean up functions 53 //TODO: Clean up functions
54 css = css.replace(/url\(()(.+?)\1\)/g, parseToNinjaUrl.bind(this)); 54 css = css.replace(/url\(()(.+?)\1\)/g, parseToNinjaUrl.bind(this));
55 // 55 //
56 function parseToNinjaUrl (prop) { 56 function parseToNinjaUrl (prop) {
57 // 57 //
58 return prop.replace(/[^()\\""\\'']+/g, prefixWithNinjaUrl.bind(this)); 58 return prop.replace(/[^()\\""\\'']+/g, prefixWithNinjaUrl.bind(this));
59 } 59 }
60 // 60 //
61 function prefixWithNinjaUrl (url) { 61 function prefixWithNinjaUrl (url) {
62 // 62 //
63 if (url !== 'url' && !url.match(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi)) { 63 if (url !== 'url' && !url.match(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi)) {
64 url = fileCouldDirUrl+url; 64 url = fileCouldDirUrl+url;
65 } 65 }
66 // 66 //
67 return url; 67 return url;
68 } 68 }
69 // 69 //
70 return css; 70 return css;
71 } 71 }
72 }, 72 },
73 //////////////////////////////////////////////////////////////////// 73 ////////////////////////////////////////////////////////////////////
74 // 74 //
75 loadLocalStyleSheet: { 75 loadLocalStyleSheet: {
76 value: function (href) { 76 value: function (href) {
77 //Getting file URI (not URL since we must load through I/O API) 77 //Getting file URI (not URL since we must load through I/O API)
78 var css = {}, file; 78 var css = {}, file;
79 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; 79 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1];
80 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl); 80 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl);
81 //Loading data from CSS file 81 //Loading data from CSS file
82 file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); 82 file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri});
83 //Checking for file to be writable on disk 83 //Checking for file to be writable on disk
84 css.writable = JSON.parse(this.application.ninja.coreIoApi.isFileWritable({uri: css.fileUri}).content).readOnly; 84 css.writable = JSON.parse(this.application.ninja.coreIoApi.isFileWritable({uri: css.fileUri}).content).readOnly;
85 //Returning loaded file 85 //Returning loaded file
86 if (file && file.content) { 86 if (file && file.content) {
87 //Getting file contents 87 //Getting file contents
88 css.content = this.parseStyleUrls(file.content, href, true); 88 css.content = this.parseStyleUrls(file.content, href, true);
89 //Returning CSS object 89 //Returning CSS object
90 return css; 90 return css;
91 } else { 91 } else {
92 return false; 92 return false;
93 } 93 }
94 } 94 }
95 }, 95 },
96 //////////////////////////////////////////////////////////////////// 96 ////////////////////////////////////////////////////////////////////
97 // 97 //
98 loadExternalStyleSheet: { 98 loadExternalStyleSheet: {
99 value: function (href) { 99 value: function (href) {
100 //Loading external file 100 //Loading external file
101 var file = this.application.ninja.coreIoApi.readExternalFile({url: href, binary: false}); 101 var file = this.application.ninja.coreIoApi.readExternalFile({url: href, binary: false});
102 //Returning file 102 //Returning file
103 return file; 103 return file;
104 } 104 }
105 } 105 }
106 //////////////////////////////////////////////////////////////////// 106 ////////////////////////////////////////////////////////////////////
107 //////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////
108}); 108});
109//////////////////////////////////////////////////////////////////////// 109////////////////////////////////////////////////////////////////////////
110//////////////////////////////////////////////////////////////////////// 110////////////////////////////////////////////////////////////////////////
diff --git a/js/document/helpers/webgl-helper.js b/js/document/helpers/webgl-helper.js
index 4d73758b..93bc1e93 100755
--- a/js/document/helpers/webgl-helper.js
+++ b/js/document/helpers/webgl-helper.js
@@ -30,72 +30,72 @@ POSSIBILITY OF SUCH DAMAGE.
30 30
31//////////////////////////////////////////////////////////////////////// 31////////////////////////////////////////////////////////////////////////
32// 32//
33var Montage = require("montage/core/core").Montage, 33var Montage = require("montage/core/core").Montage,
34 Component = require("montage/ui/component").Component, 34 Component = require("montage/ui/component").Component,
35 MaterialsModel = require("js/models/materials-model").MaterialsModel, 35 MaterialsModel = require("js/models/materials-model").MaterialsModel,
36 NJUtils = require("js/lib/NJUtils").NJUtils, 36 NJUtils = require("js/lib/NJUtils").NJUtils,
37 GLWorld = require("js/lib/drawing/world").World; 37 GLWorld = require("js/lib/drawing/world").World;
38//////////////////////////////////////////////////////////////////////// 38////////////////////////////////////////////////////////////////////////
39// 39//
40exports.webGlDocumentHelper = Montage.create(Component, { 40exports.webGlDocumentHelper = Montage.create(Component, {
41 //////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////
42 // 42 //
43 hasTemplate: { 43 hasTemplate: {
44 value: false 44 value: false
45 }, 45 },
46 //////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////
47 //This is set when the design view is ready, for local reference 47 //This is set when the design view is ready, for local reference
48 iframe: { 48 iframe: {
49 value: null 49 value: null
50 }, 50 },
51 //////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////
52 // 52 //
53 _glData: { 53 _glData: {
54 value: null 54 value: null
55 }, 55 },
56 //////////////////////////////////////////////////////////////////// 56 ////////////////////////////////////////////////////////////////////
57 // 57 //
58 glData: { 58 glData: {
59 // 59 //
60 get: function() { 60 get: function() {
61 // 61 //
62 var elt = this.iframe.contentWindow.document.body; 62 var elt = this.iframe.contentWindow.document.body;
63 // 63 //
64 if (elt) { 64 if (elt) {
65 var matLib = MaterialsModel.exportMaterials(); 65 var matLib = MaterialsModel.exportMaterials();
66 this._glData = [matLib]; 66 this._glData = [matLib];
67 this.collectGLData(this.iframe.contentWindow.document, this._glData ); 67 this.collectGLData(this.iframe.contentWindow.document, this._glData );
68 } else { 68 } else {
69 this._glData = null 69 this._glData = null
70 } 70 }
71 // 71 //
72 return this._glData; 72 return this._glData;
73 }, 73 },
74 // 74 //
75 set: function(value) { 75 set: function(value) {
76 // 76 //
77 var elt = this.iframe.contentWindow.document.body; 77 var elt = this.iframe.contentWindow.document.body;
78 // 78 //
79