-
-
Save feltnerm/5724683 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* A variety of helper functions to help me. | |
*/ | |
var helpme = (function () { | |
'use strict'; | |
var obj = { | |
createFineUploader: function (element, button, autoupload, request, | |
validation, retry, chunking, resume, | |
deleteFile, cors, paste, camera) { | |
var options, el, btn, au, req, val, ret, chunk, res, del, c, p, cam; | |
el = element; | |
btn = button || null | |
au = autoupload || true; | |
req = request || { endpoint: '/upload', params: {}, paramsInBody: true, customHeaders: {}, forceMultipart: true}; | |
val = validation || { allowedExtensions: [], acceptFiles: null, sizeLimit: 0, minSizeLimit: 0, itemLimit: 0, stopOnFirstInvalidFile: true }; | |
ret = retry || { enableAuto: false, maxAutoAttempts: 3}; | |
chunk = chunking || { enabled: false }; | |
res = resume || { enabled: false }; | |
del = deleteFile || { endabled: false, endpoint: '/upload', customHeaders: {}, params: {} }; | |
c = cors || { expected: false, sendCredentials: false }; | |
p = paste || { targetElement: null }; | |
cam = camera || { ios: false }; | |
options = { | |
debug: true, | |
multiple: true, | |
maxConnections: 3, | |
disableCancelForFormUploads: false, | |
autoUpload: true, | |
element: el, | |
button: button, | |
request: req, | |
validation: val, | |
retry: ret, | |
chunking: chunk, | |
resume: res, | |
deleteFile: del, | |
cors: c, | |
paste: p, | |
camera: cam | |
}; | |
return new qq.FineUploader(options); | |
} | |
}; | |
return obj; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment