Created
September 4, 2017 17:15
-
-
Save steverob/14a0adb9ed012ebc50187a3a8bb96527 to your computer and use it in GitHub Desktop.
jQuery File Upload BeforeAdd Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jQuery File Upload Processing Plugin | |
* https://github.com/blueimp/jQuery-File-Upload | |
* | |
* Copyright 2012, Sebastian Tschan | |
* https://blueimp.net | |
* | |
* Licensed under the MIT license: | |
* https://opensource.org/licenses/MIT | |
*/ | |
/* jshint nomen:false */ | |
/* global define, require, window */ | |
;(function (factory) { | |
'use strict'; | |
if (typeof define === 'function' && define.amd) { | |
// Register as an anonymous AMD module: | |
define([ | |
'jquery', | |
'./jquery.fileupload' | |
], factory); | |
} else if (typeof exports === 'object') { | |
// Node/CommonJS: | |
factory( | |
require('jquery'), | |
require('./jquery.fileupload') | |
); | |
} else { | |
// Browser globals: | |
factory( | |
window.jQuery | |
); | |
} | |
}(function ($) { | |
'use strict'; | |
// var originalAdd = $.blueimp.fileupload.prototype.options.add; | |
// The File Upload Processing plugin extends the fileupload widget | |
// with file processing functionality: | |
$.widget('blueimp.fileupload', $.blueimp.fileupload, { | |
options: { | |
onBeforeAdd: function (e, data) { | |
// no-op | |
} | |
}, | |
_onAdd: function (e, data) { | |
this.options.onBeforeAdd(e, data); | |
this._super(e, data); | |
} | |
}); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment