github.com/jincm/wesharechain@v0.0.0-20210122032815-1537409ce26a/app/lib/plupload-2.1.2/examples/events.html (about) 1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 5 6 <title>Plupload - Events example</title> 7 8 <!-- production --> 9 <script type="text/javascript" src="../js/plupload.full.min.js"></script> 10 11 12 <!-- debug 13 <script type="text/javascript" src="../js/moxie.js"></script> 14 <script type="text/javascript" src="../js/plupload.dev.js"></script> 15 --> 16 17 </head> 18 <body style="font: 13px Verdana; background: #eee; color: #333"> 19 20 <h1>Events example</h1> 21 22 <div id="container"> 23 <a id="pickfiles" href="javascript:;">[Select files]</a> 24 <a id="uploadfiles" href="javascript:;">[Upload files]</a> 25 </div> 26 27 <br /> 28 <pre id="console"></pre> 29 30 <script type="text/javascript"> 31 var uploader = new plupload.Uploader({ 32 // General settings 33 runtimes : 'silverlight,html4', 34 browse_button : 'pickfiles', // you can pass in id... 35 url : 'upload.php', 36 chunk_size : '1mb', 37 unique_names : true, 38 39 // Resize images on client-side if we can 40 resize : { width : 320, height : 240, quality : 90 }, 41 42 filters : { 43 max_file_size : '10mb', 44 45 // Specify what files to browse for 46 mime_types: [ 47 {title : "Image files", extensions : "jpg,gif,png"}, 48 {title : "Zip files", extensions : "zip"} 49 ] 50 }, 51 52 flash_swf_url : '../js/Moxie.swf', 53 silverlight_xap_url : '../js/Moxie.xap', 54 55 // PreInit events, bound before the internal events 56 preinit : { 57 Init: function(up, info) { 58 log('[Init]', 'Info:', info, 'Features:', up.features); 59 }, 60 61 UploadFile: function(up, file) { 62 log('[UploadFile]', file); 63 64 // You can override settings before the file is uploaded 65 // up.setOption('url', 'upload.php?id=' + file.id); 66 // up.setOption('multipart_params', {param1 : 'value1', param2 : 'value2'}); 67 } 68 }, 69 70 // Post init events, bound after the internal events 71 init : { 72 PostInit: function() { 73 // Called after initialization is finished and internal event handlers bound 74 log('[PostInit]'); 75 76 document.getElementById('uploadfiles').onclick = function() { 77 uploader.start(); 78 return false; 79 }; 80 }, 81 82 Browse: function(up) { 83 // Called when file picker is clicked 84 log('[Browse]'); 85 }, 86 87 Refresh: function(up) { 88 // Called when the position or dimensions of the picker change 89 log('[Refresh]'); 90 }, 91 92 StateChanged: function(up) { 93 // Called when the state of the queue is changed 94 log('[StateChanged]', up.state == plupload.STARTED ? "STARTED" : "STOPPED"); 95 }, 96 97 QueueChanged: function(up) { 98 // Called when queue is changed by adding or removing files 99 log('[QueueChanged]'); 100 }, 101 102 OptionChanged: function(up, name, value, oldValue) { 103 // Called when one of the configuration options is changed 104 log('[OptionChanged]', 'Option Name: ', name, 'Value: ', value, 'Old Value: ', oldValue); 105 }, 106 107 BeforeUpload: function(up, file) { 108 // Called right before the upload for a given file starts, can be used to cancel it if required 109 log('[BeforeUpload]', 'File: ', file); 110 }, 111 112 UploadProgress: function(up, file) { 113 // Called while file is being uploaded 114 log('[UploadProgress]', 'File:', file, "Total:", up.total); 115 }, 116 117 FileFiltered: function(up, file) { 118 // Called when file successfully files all the filters 119 log('[FileFiltered]', 'File:', file); 120 }, 121 122 FilesAdded: function(up, files) { 123 // Called when files are added to queue 124 log('[FilesAdded]'); 125 126 plupload.each(files, function(file) { 127 log(' File:', file); 128 }); 129 }, 130 131 FilesRemoved: function(up, files) { 132 // Called when files are removed from queue 133 log('[FilesRemoved]'); 134 135 plupload.each(files, function(file) { 136 log(' File:', file); 137 }); 138 }, 139 140 FileUploaded: function(up, file, info) { 141 // Called when file has finished uploading 142 log('[FileUploaded] File:', file, "Info:", info); 143 }, 144 145 ChunkUploaded: function(up, file, info) { 146 // Called when file chunk has finished uploading 147 log('[ChunkUploaded] File:', file, "Info:", info); 148 }, 149 150 UploadComplete: function(up, files) { 151 // Called when all files are either uploaded or failed 152 log('[UploadComplete]'); 153 }, 154 155 Destroy: function(up) { 156 // Called when uploader is destroyed 157 log('[Destroy] '); 158 }, 159 160 Error: function(up, args) { 161 // Called when error occurs 162 log('[Error] ', args); 163 } 164 } 165 }); 166 167 168 function log() { 169 var str = ""; 170 171 plupload.each(arguments, function(arg) { 172 var row = ""; 173 174 if (typeof(arg) != "string") { 175 plupload.each(arg, function(value, key) { 176 // Convert items in File objects to human readable form 177 if (arg instanceof plupload.File) { 178 // Convert status to human readable 179 switch (value) { 180 case plupload.QUEUED: 181 value = 'QUEUED'; 182 break; 183 184 case plupload.UPLOADING: 185 value = 'UPLOADING'; 186 break; 187 188 case plupload.FAILED: 189 value = 'FAILED'; 190 break; 191 192 case plupload.DONE: 193 value = 'DONE'; 194 break; 195 } 196 } 197 198 if (typeof(value) != "function") { 199 row += (row ? ', ' : '') + key + '=' + value; 200 } 201 }); 202 203 str += row + " "; 204 } else { 205 str += arg + " "; 206 } 207 }); 208 209 var log = document.getElementById('console'); 210 log.innerHTML += str + "\n"; 211 } 212 213 uploader.init(); 214 215 </script> 216 </body> 217 </html>