summaryrefslogtreecommitdiffstats
path: root/static/upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/upload.js')
-rw-r--r--static/upload.js77
1 files changed, 0 insertions, 77 deletions
diff --git a/static/upload.js b/static/upload.js
deleted file mode 100644
index abd264e..0000000
--- a/static/upload.js
+++ /dev/null
@@ -1,77 +0,0 @@
-var fileUploader = {};
-
-fileUploader.init = function() {
- var uploader = new plupload.Uploader({
- runtimes : 'html5,flash,html4,silverlight',
- browse_button : 'pickfiles',
- container : 'container',
- max_file_size : '10mb',
- url : '/',
- flash_swf_url : '/static/plupload/js/plupload.flash.swf',
- silverlight_xap_url : '/static/plupload/js/plupload.silverlight.xap',
- multipart_params: {},
- filters : [
- {title : "Image files", extensions : "jpg,gif,png"},
- {title : "Data Compression", extensions : "zip,tar.gz"},
- {title : "Additional", extensions : "pdf,gs"}
- ],
- });
-
- uploader.bind('Init', function(up, params) {
- console.log("using runtime: " + params.runtime);
- $('#upload-form').html('<p id="modern-form">'+
- ' <a id="pickfiles" href="#">Add files</a> |'+
- ' <a id="uploadfiles" href="#">Upload</a>'+
- '</p>'+
- '<ul id="filelist"><li>No runtime found.</li></ul>');
- $('#filelist').html('<li id="no-files">No Files Added</li>');
-
- });
-
- $('#uploadfiles').live('click', function(e) {
- uploader.start();
- e.preventDefault();
- });
-
- uploader.init();
-
- uploader.bind('BeforeUpload', function(up, file) {
- uploader.settings.multipart_params.tags = $('input[name='+file.id +']').val();
- });
-
- uploader.bind('FilesAdded', function(up, files) {
- $('#no-files').remove()
- $.each(files, function(i, file) {
- $('#filelist').append(
- '<li id="' + file.id + '">' +
- '<label for="">' +
- file.name + ' (' + plupload.formatSize(file.size) + ')' +
- '</label>' +
- '<input type="text" placeholder="Tags (comma-separated)" name="'+file.id+'" />' +
- '<b></b>' +
- '</li>');
- });
-
- up.refresh(); // Reposition Flash/Silverlight
- });
-
- uploader.bind('UploadProgress', function(up, file) {
- $('#' + file.id + " input").attr('disabled', true);
- $('#' + file.id + " b").html(file.percent + "%");
- });
-
- uploader.bind('Error', function(up, err) {
- $('#filelist').append("<div>Error: " + err.code +
- ", Message: " + err.message +
- (err.file ? ", File: " + err.file.name : "") +
- "</div>"
- );
-
- up.refresh(); // Reposition Flash/Silverlight
- });
-
- uploader.bind('FileUploaded', function(up, file, response) {
- var responseObj = jQuery.parseJSON(response.response)
- $('#'+file.id).html('<a href="'+responseObj.url+'">'+file.name+'</a>');
- });
-};