aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 11:52:06 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch)
tree8f0f55557bd0c47a84e49c1977c950645d284607 /js/io
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
downloadninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz
Expand tabs
Diffstat (limited to 'js/io')
-rw-r--r--js/io/system/chromeapi.js352
-rwxr-xr-xjs/io/system/coreioapi.js564
-rwxr-xr-xjs/io/system/fileio.js348
-rw-r--r--js/io/system/ninjalibrary.js488
-rwxr-xr-xjs/io/system/projectio.js98
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.html90
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.js170
-rwxr-xr-xjs/io/ui/cloudpopup.reel/css/cloudpopup.scss160
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.css12
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js18
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js2
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css22
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js14
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.css6
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js2
15 files changed, 1173 insertions, 1173 deletions
diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js
index 0650385f..3561a617 100644
--- a/js/io/system/chromeapi.js
+++ b/js/io/system/chromeapi.js
@@ -32,9 +32,9 @@ POSSIBILITY OF SUCH DAMAGE.
32//////////////////////////////////////////////////////////////////////// 32////////////////////////////////////////////////////////////////////////
33NOTES: 33NOTES:
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//
44exports.ChromeApi = Montage.create(Object.prototype, { 44exports.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,213 +77,213 @@ 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,