o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1328243689.829132:@value{I"
class:EFI"BundledAsset;
FI"id;
F"%040d2b6f47257f3e7438b42f814e7b2cI"logical_path;
F")imperavi-rails/imperavi/dd_upload.jsI"
pathname;
F"e/home/tanraya/sandbox/imperavi-rails/app/assets/javascripts/imperavi-rails/imperavi/dd_upload.jsI"content_type;
FI"application/javascript;
FI"
mtime;
FI"2012-02-03T10:30:14+06:00;
FI" body;
FI"? /*
Plugin Drag and drop Upload v1.0.0
http://imperavi.com/
Copyright 2011, Imperavi Ltd.
*/
(function($){
// Initialization
$.fn.dragupload = function(options)
{
return this.each(function() {
var obj = new Construct(this, options);
obj.init();
});
};
// Options and variables
function Construct(el, options) {
this.opts = $.extend({
url: false,
success: false,
maxfilesize: 10485760, // 10MB
preview: false,
text: RLANG.drop_file_here,
atext: RLANG.or_choose
}, options);
this.$el = $(el);
};
// Functionality
Construct.prototype = {
init: function()
{
if (!$.browser.opera && !$.browser.msie)
{
this.droparea = $('
');
this.dropareabox = $('' + this.opts.text + '
');
this.dropalternative = $('' + this.opts.atext + '
');
this.droparea.append(this.dropareabox);
this.$el.before(this.droparea);
this.$el.before(this.dropalternative);
// drag over
this.dropareabox.bind('dragover', function() { return this.ondrag(); }.bind2(this));
// drag leave
this.dropareabox.bind('dragleave', function() { return this.ondragleave(); }.bind2(this));
// drop
this.dropareabox.get(0).ondrop = function(event) {
event.preventDefault();
this.dropareabox.removeClass('hover').addClass('drop');
var file = event.dataTransfer.files[0];
var fd = new FormData();
fd.append('file', file);
$.ajax({
url: this.opts.url,
data: fd,
//xhr: provider,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data)
{
if (this.opts.success !== false) this.opts.success(data);
if (this.opts.preview === true) this.dropareabox.html(data);
//else this.dropareabox.text(this.opts.success_text);
}.bind2(this)
});
}.bind2(this);
}
},
ondrag: function()
{
this.dropareabox.addClass('hover');
return false;
},
ondragleave: function()
{
this.dropareabox.removeClass('hover');
return false;
}
};
})(jQuery);
;
FI"asset_paths;
F["e/home/tanraya/sandbox/imperavi-rails/app/assets/javascripts/imperavi-rails/imperavi/dd_upload.jsI"dependency_paths;
F[{I" path;
F"e/home/tanraya/sandbox/imperavi-rails/app/assets/javascripts/imperavi-rails/imperavi/dd_upload.jsI"
mtime;
FIu: Time
d€øSæx
:@_zoneI" YEKT;
T:
nano_numi:
nano_deni:
submicro"y0:offseti`TI"hexdigest;
F"%366fd0a97dc98060be556c296db46d8bI"
_version;
F"%46dde6621c301f4928e3b34efee9e3b5