W.I.P collab Editor:

- Fix collab editor define global variable conflicts with some other libraries which use define global
This commit is contained in:
Hadi Nategh 2016-08-16 12:52:26 +02:00
parent e8a0028cf8
commit 704a47a182
2 changed files with 15 additions and 15 deletions

View File

@ -96,7 +96,7 @@
else { return $opt.defaults[o]; }
}
};
// EVENTS
// catchAll(event, ...)
// fileSuccess(file), fileProgress(file), fileAdded(file, event), fileRetry(file), fileError(file, message),
@ -118,8 +118,8 @@
if(event=='fileerror') $.fire('error', args[2], args[1]);
if(event=='fileprogress') $.fire('progress');
};
// INTERNAL HELPER METHODS (handy, but ultimately not part of uploading)
var $h = {
stopEvent: function(e){
@ -197,7 +197,7 @@
var errorCount = 0;
var o = $.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback', 'fileType', 'fileTypeErrorCallback']);
if (typeof(o.maxFiles)!=='undefined' && o.maxFiles<(fileList.length+$.files.length)) {
// if single-file upload, file is already added, and trying to add 1 new file, simply replace the already-added file
// if single-file upload, file is already added, and trying to add 1 new file, simply replace the already-added file
if (o.maxFiles===1 && $.files.length===1 && fileList.length===1) {
$.removeFile($.files[0]);
} else {
@ -209,7 +209,7 @@
$h.each(fileList, function(file){
var fileName = file.name.split('.');
var fileType = fileName[fileName.length-1].toLowerCase();
if (o.fileType.length > 0 && !$h.contains(o.fileType, fileType)) {
o.fileTypeErrorCallback(file, errorCount++);
return false;
@ -359,7 +359,7 @@
}
});
return(uploading);
};
};
$.isComplete = function(){
var outstanding = false;
$h.each($.chunks, function(chunk){
@ -436,7 +436,7 @@
// Add data from the query options
var params = [];
var customQuery = $.getOpt('query');
var customQuery = $.getOpt('query');
if(typeof customQuery == 'function') customQuery = customQuery($.fileObj, $);
$h.each(customQuery, function(k,v){
params.push([encodeURIComponent(k), encodeURIComponent(v)].join('='));
@ -507,7 +507,7 @@
$.callback('retry', $.message());
$.abort();
$.retries++;
var retryInterval = $.getOpt('chunkRetryInterval');
var retryInterval = $.getOpt('chunkRetryInterval');
if(retryInterval !== undefined) {
$.pendingRetry = true;
setTimeout($.send, retryInterval);
@ -539,10 +539,10 @@
});
var func = ($.fileObj.file.slice ? 'slice' : ($.fileObj.file.mozSlice ? 'mozSlice' : ($.fileObj.file.webkitSlice ? 'webkitSlice' : 'slice'))),
bytes = $.fileObj.file[func]($.startByte,$.endByte),
bytes = $.fileObj.file[func]($.startByte,$.endByte),
data = null,
target = $.getOpt('target');
if ($.getOpt('method') === 'octet') {
// Add data from the query options
data = bytes;
@ -559,7 +559,7 @@
});
data.append($.getOpt('fileParameterName'), bytes);
}
$.xhr.open('POST', target);
$.xhr.timeout = $.getOpt('xhrTimeout');
$.xhr.withCredentials = $.getOpt('withCredentials');
@ -799,8 +799,8 @@
return(this);
};
// Avoid confilict with wodocollabtexteditor which uses dojo framework
var define;
// Node.js-style export for Node and Component
if (typeof module != 'undefined') {
module.exports = Resumable;

File diff suppressed because one or more lines are too long