| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* globals NaClTerm, lib */ | 7 /* globals NaClTerm, lib */ |
| 8 | 8 |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 fileEntry.createWriter(function(fileWriter) { | 25 fileEntry.createWriter(function(fileWriter) { |
| 26 // Note: write() can take a File or Blob object. | 26 // Note: write() can take a File or Blob object. |
| 27 fileWriter.write(file); | 27 fileWriter.write(file); |
| 28 log("File uploaded!\n"); | 28 log("File uploaded!\n"); |
| 29 }, fsErrorHandler); | 29 }, fsErrorHandler); |
| 30 }, fsErrorHandler); | 30 }, fsErrorHandler); |
| 31 } | 31 } |
| 32 | 32 |
| 33 function uploadFiles(evt) { | 33 function uploadFiles(evt) { |
| 34 var files = evt.srcElement.files; | 34 var files = evt.srcElement.files; |
| 35 for (var i = 0; i < files.length; i++) { | 35 var i; |
| 36 for (i = 0; i < files.length; i++) { |
| 36 uploadFile(files[i]); | 37 uploadFile(files[i]); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 function onInitFS(fs) { | 41 function onInitFS(fs) { |
| 41 var upload = document.getElementById('upload'); | 42 var upload = document.getElementById('upload'); |
| 42 if (upload !== null) { | 43 if (upload !== null) { |
| 43 upload.addEventListener('change', uploadFiles, false); | 44 upload.addEventListener('change', uploadFiles, false); |
| 44 window.fs = fs; | 45 window.fs = fs; |
| 45 } | 46 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 NaClTerm.init(); | 58 NaClTerm.init(); |
| 58 } | 59 } |
| 59 ); | 60 ); |
| 60 } | 61 } |
| 61 | 62 |
| 62 window.onload = function() { | 63 window.onload = function() { |
| 63 lib.init(function() { | 64 lib.init(function() { |
| 64 onInit(); | 65 onInit(); |
| 65 }); | 66 }); |
| 66 }; | 67 }; |
| OLD | NEW |