diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/io/system | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-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/io/system')
-rw-r--r-- | js/io/system/chromeapi.js | 354 | ||||
-rwxr-xr-x | js/io/system/coreioapi.js | 570 | ||||
-rwxr-xr-x | js/io/system/fileio.js | 350 | ||||
-rw-r--r-- | js/io/system/ninjalibrary.js | 490 | ||||
-rwxr-xr-x | js/io/system/projectio.js | 98 |
5 files changed, 931 insertions, 931 deletions
diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js index 0650385f..887ee634 100644 --- a/js/io/system/chromeapi.js +++ b/js/io/system/chromeapi.js | |||
@@ -32,9 +32,9 @@ POSSIBILITY OF SUCH DAMAGE. | |||
32 | //////////////////////////////////////////////////////////////////////// | 32 | //////////////////////////////////////////////////////////////////////// |
33 | NOTES: | 33 | NOTES: |
34 | 34 | ||
35 | The init function starts up the file system API, and a size must be | 35 | The init function starts up the file system API, and a size must be |
36 | set, no unlimited available as of now. | 36 | set, no unlimited available as of now. |
37 | 37 | ||
38 | //////////////////////////////////////////////////////////////////////// | 38 | //////////////////////////////////////////////////////////////////////// |
39 | ///////////////////////////////////////////////////////////////////// */ | 39 | ///////////////////////////////////////////////////////////////////// */ |
40 | // | 40 | // |
@@ -42,31 +42,31 @@ var Montage = require("montage/core/core").Montage; | |||
42 | //////////////////////////////////////////////////////////////////////// | 42 | //////////////////////////////////////////////////////////////////////// |
43 | // | 43 | // |
44 | exports.ChromeApi = Montage.create(Object.prototype, { | 44 | exports.ChromeApi = Montage.create(Object.prototype, { |
45 | //////////////////////////////////////////////////////////////////// | 45 | //////////////////////////////////////////////////////////////////// |
46 | //Needs size in MBs for fileSystem init | 46 | //Needs size in MBs for fileSystem init |
47 | init: { | 47 | init: { |
48 | enumerable: true, | 48 | enumerable: true, |
49 | value: function(size) { | 49 | value: function(size) { |
50 | // | 50 | // |
51 | if (window.webkitRequestFileSystem) { | 51 | if (window.webkitRequestFileSystem) { |
52 | //Current way to init Chrome's fileSystem API | 52 | //Current way to init Chrome's fileSystem API |
53 | window.webkitRequestFileSystem(window.PERSISTENT, size*1024*1024, function (fs) { | 53 | window.webkitRequestFileSystem(window.PERSISTENT, size*1024*1024, function (fs) { |
54 | //Storing reference to instance | 54 | //Storing reference to instance |
55 | this.fileSystem = fs; | 55 | this.fileSystem = fs; |
56 | //Dispatching action ready event | 56 | //Dispatching action ready event |
57 | var readyEvent = document.createEvent("CustomEvent"); | 57 | var readyEvent = document.createEvent("CustomEvent"); |
58 | readyEvent.initEvent('ready', true, true); | 58 | readyEvent.initEvent('ready', true, true); |
59 | this.dispatchEvent(readyEvent); | 59 | this.dispatchEvent(readyEvent); |
60 | //Building data of local Ninja Library | 60 | //Building data of local Ninja Library |
61 | this._listNinjaChromeLibrary(); | 61 | this._listNinjaChromeLibrary(); |
62 | }.bind(this), function (e) {return false}); //Returns false on error (not able to init) | 62 | }.bind(this), function (e) {return false}); //Returns false on error (not able to init) |
63 | // | 63 | // |
64 | return true; | 64 | return true; |
65 | } else { | 65 | } else { |
66 | //No fileSystem API | 66 | //No fileSystem API |
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | } | 69 | } |
70 | }, | 70 | }, |
71 | //////////////////////////////////////////////////////////////////// | 71 | //////////////////////////////////////////////////////////////////// |
72 | // | 72 | // |
@@ -77,217 +77,217 @@ exports.ChromeApi = Montage.create(Object.prototype, { | |||
77 | //////////////////////////////////////////////////////////////////// | 77 | //////////////////////////////////////////////////////////////////// |
78 | // | 78 | // |
79 | fileSystem: { | 79 | fileSystem: { |
80 | enumerable: false, | 80 | enumerable: false, |
81 | get: function() { | 81 | get: function() { |
82 | return this._fileSystem; | 82 | return this._fileSystem; |
83 | }, | 83 | }, |
84 | set: function(value) { | 84 | set: function(value) { |
85 | this._fileSystem = value; | 85 | this._fileSystem = value; |
86 | } | 86 | } |
87 | }, | 87 | }, |
88 | //////////////////////////////////////////////////////////////////// | 88 | //////////////////////////////////////////////////////////////////// |
89 | // | 89 | // |
90 | fileNew: { | 90 | fileNew: { |
91 | enumerable: true, | 91 | enumerable: true, |
92 | value: function(filePath, content, callback) { | 92 | value: function(filePath, content, callback) { |
93 | // | 93 | // |
94 | this.fileSystem.root.getFile(filePath, {create: true}, function(f) { | 94 | this.fileSystem.root.getFile(filePath, {create: true}, function(f) { |
95 | // | 95 | // |
96 | f.createWriter(function(writer) { | 96 | f.createWriter(function(writer) { |
97 | // | 97 | // |
98 | var mime, blob = new window.WebKitBlobBuilder, type = filePath.split('.'); | 98 | var mime, blob = new window.WebKitBlobBuilder, type = filePath.split('.'); |
99 | type = type[type.length-1]; | 99 | type = type[type.length-1]; |
100 | switch (type) { | 100 | switch (type) { |
101 | case 'bmp': | 101 | case 'bmp': |
102 | mime = 'image/bmp'; | 102 | mime = 'image/bmp'; |
103 | break; | 103 | break; |
104 | case 'gif': | 104 | case 'gif': |
105 | mime = 'image/gif'; | 105 | mime = 'image/gif'; |
106 | break; | 106 | break; |
107 | case 'jpeg': | 107 | case 'jpeg': |
108 | mime = 'image/jpeg'; | 108 | mime = 'image/jpeg'; |
109 | break; | 109 | break; |
110 | case 'jpg': | 110 | case 'jpg': |
111 | mime = 'image/jpeg'; | 111 | mime = 'image/jpeg'; |
112 | break; | 112 | break; |
113 | case 'png': | 113 | case 'png': |
114 | mime = 'image/png'; | 114 | mime = 'image/png'; |
115 | break; | 115 | break; |
116 | case 'rtf': | 116 | case 'rtf': |
117 | mime = 'application/rtf'; | 117 | mime = 'application/rtf'; |
118 | break; | 118 | break; |
119 | case 'tif': | 119 | case 'tif': |
120 | mime = 'image/tiff'; | 120 | mime = 'image/tiff'; |
121 | break; | 121 | break; |
122 | case 'tiff': | 122 | case 'tiff': |
123 | mime = 'image/tiff'; | 123 | mime = 'image/tiff'; |
124 | break; | 124 | break; |
125 | case 'pdf': | 125 | case 'pdf': |
126 | mime = 'application/pdf'; | 126 | mime = 'application/pdf'; |
127 | break; | 127 | break; |
128 | case 'zip': | 128 | case 'zip': |
129 | mime = 'application/zip'; | 129 | mime = 'application/zip'; |
130 | break; | 130 | break; |
131 | case 'svg': | 131 | case 'svg': |
132 | mime = 'image/svg+xml'; | 132 | mime = 'image/svg+xml'; |
133 | break; | 133 | break; |
134 | default: | 134 | default: |
135 | mime = 'text/'+type; | 135 | mime = 'text/'+type; |
136 | break; | 136 | break; |
137 | } | 137 | } |
138 | // | 138 | // |
139 | blob.append(content); | 139 | blob.append(content); |
140 | writer.write(blob.getBlob(mime)); | 140 | writer.write(blob.getBlob(mime)); |
141 | // | 141 | // |
142 | if (callback) callback(true); | 142 | if (callback) callback(true); |
143 | }, function (e) {if (callback) callback(false)}); | 143 | }, function (e) {if (callback) callback(false)}); |
144 | }, function (e) {if (callback) callback(false)}); | 144 | }, function (e) {if (callback) callback(false)}); |
145 | } | 145 | } |
146 | }, | 146 | }, |
147 | //////////////////////////////////////////////////////////////////// | 147 | //////////////////////////////////////////////////////////////////// |
148 | // | 148 | // |
149 | fileDelete: { | 149 | fileDelete: { |
150 | enumerable: true, | 150 | enumerable: true, |
151 | value: function(filePath, callback) { | 151 | value: function(filePath, callback) { |
152 | this.fileSystem.root.getFile(filePath, {create: false}, function(file) { | 152 | this.fileSystem.root.getFile(filePath, {create: false}, function(file) { |
153 | file.remove(function() { | 153 | file.remove(function() { |
154 | if (callback) callback(true); | 154 | if (callback) callback(true); |
155 | }); | 155 | }); |
156 | }, function (e) {if (callback) callback(false)}); | 156 | }, function (e) {if (callback) callback(false)}); |
157 | } | 157 | } |
158 | }, | 158 | }, |
159 | //////////////////////////////////////////////////////////////////// | 159 | //////////////////////////////////////////////////////////////////// |
160 | // | 160 | // |
161 | fileContent: { | 161 | fileContent: { |
162 | enumerable: true, | 162 | enumerable: true, |
163 | value: function(filePath, callback) { | 163 | value: function(filePath, callback) { |
164 | // | 164 | // |
165 | this.fileSystem.root.getFile(filePath, {}, function(f) { | 165 | this.fileSystem.root.getFile(filePath, {}, function(f) { |
166 | f.file(function(file) { | 166 | f.file(function(file) { |
167 | var reader = new FileReader(); | 167 | var reader = new FileReader(); |
168 | reader.onloadend = function(e) { | 168 | reader.onloadend = function(e) { |
169 |