mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-25 04:11:49 +02:00
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:
parent
e8a0028cf8
commit
704a47a182
@ -96,7 +96,7 @@
|
|||||||
else { return $opt.defaults[o]; }
|
else { return $opt.defaults[o]; }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// EVENTS
|
// EVENTS
|
||||||
// catchAll(event, ...)
|
// catchAll(event, ...)
|
||||||
// fileSuccess(file), fileProgress(file), fileAdded(file, event), fileRetry(file), fileError(file, message),
|
// 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=='fileerror') $.fire('error', args[2], args[1]);
|
||||||
if(event=='fileprogress') $.fire('progress');
|
if(event=='fileprogress') $.fire('progress');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// INTERNAL HELPER METHODS (handy, but ultimately not part of uploading)
|
// INTERNAL HELPER METHODS (handy, but ultimately not part of uploading)
|
||||||
var $h = {
|
var $h = {
|
||||||
stopEvent: function(e){
|
stopEvent: function(e){
|
||||||
@ -197,7 +197,7 @@
|
|||||||
var errorCount = 0;
|
var errorCount = 0;
|
||||||
var o = $.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback', 'fileType', 'fileTypeErrorCallback']);
|
var o = $.getOpt(['maxFiles', 'minFileSize', 'maxFileSize', 'maxFilesErrorCallback', 'minFileSizeErrorCallback', 'maxFileSizeErrorCallback', 'fileType', 'fileTypeErrorCallback']);
|
||||||
if (typeof(o.maxFiles)!=='undefined' && o.maxFiles<(fileList.length+$.files.length)) {
|
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) {
|
if (o.maxFiles===1 && $.files.length===1 && fileList.length===1) {
|
||||||
$.removeFile($.files[0]);
|
$.removeFile($.files[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -209,7 +209,7 @@
|
|||||||
$h.each(fileList, function(file){
|
$h.each(fileList, function(file){
|
||||||
var fileName = file.name.split('.');
|
var fileName = file.name.split('.');
|
||||||
var fileType = fileName[fileName.length-1].toLowerCase();
|
var fileType = fileName[fileName.length-1].toLowerCase();
|
||||||
|
|
||||||
if (o.fileType.length > 0 && !$h.contains(o.fileType, fileType)) {
|
if (o.fileType.length > 0 && !$h.contains(o.fileType, fileType)) {
|
||||||
o.fileTypeErrorCallback(file, errorCount++);
|
o.fileTypeErrorCallback(file, errorCount++);
|
||||||
return false;
|
return false;
|
||||||
@ -359,7 +359,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return(uploading);
|
return(uploading);
|
||||||
};
|
};
|
||||||
$.isComplete = function(){
|
$.isComplete = function(){
|
||||||
var outstanding = false;
|
var outstanding = false;
|
||||||
$h.each($.chunks, function(chunk){
|
$h.each($.chunks, function(chunk){
|
||||||
@ -436,7 +436,7 @@
|
|||||||
|
|
||||||
// Add data from the query options
|
// Add data from the query options
|
||||||
var params = [];
|
var params = [];
|
||||||
var customQuery = $.getOpt('query');
|
var customQuery = $.getOpt('query');
|
||||||
if(typeof customQuery == 'function') customQuery = customQuery($.fileObj, $);
|
if(typeof customQuery == 'function') customQuery = customQuery($.fileObj, $);
|
||||||
$h.each(customQuery, function(k,v){
|
$h.each(customQuery, function(k,v){
|
||||||
params.push([encodeURIComponent(k), encodeURIComponent(v)].join('='));
|
params.push([encodeURIComponent(k), encodeURIComponent(v)].join('='));
|
||||||
@ -507,7 +507,7 @@
|
|||||||
$.callback('retry', $.message());
|
$.callback('retry', $.message());
|
||||||
$.abort();
|
$.abort();
|
||||||
$.retries++;
|
$.retries++;
|
||||||
var retryInterval = $.getOpt('chunkRetryInterval');
|
var retryInterval = $.getOpt('chunkRetryInterval');
|
||||||
if(retryInterval !== undefined) {
|
if(retryInterval !== undefined) {
|
||||||
$.pendingRetry = true;
|
$.pendingRetry = true;
|
||||||
setTimeout($.send, retryInterval);
|
setTimeout($.send, retryInterval);
|
||||||
@ -539,10 +539,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var func = ($.fileObj.file.slice ? 'slice' : ($.fileObj.file.mozSlice ? 'mozSlice' : ($.fileObj.file.webkitSlice ? 'webkitSlice' : 'slice'))),
|
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,
|
data = null,
|
||||||
target = $.getOpt('target');
|
target = $.getOpt('target');
|
||||||
|
|
||||||
if ($.getOpt('method') === 'octet') {
|
if ($.getOpt('method') === 'octet') {
|
||||||
// Add data from the query options
|
// Add data from the query options
|
||||||
data = bytes;
|
data = bytes;
|
||||||
@ -559,7 +559,7 @@
|
|||||||
});
|
});
|
||||||
data.append($.getOpt('fileParameterName'), bytes);
|
data.append($.getOpt('fileParameterName'), bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.xhr.open('POST', target);
|
$.xhr.open('POST', target);
|
||||||
$.xhr.timeout = $.getOpt('xhrTimeout');
|
$.xhr.timeout = $.getOpt('xhrTimeout');
|
||||||
$.xhr.withCredentials = $.getOpt('withCredentials');
|
$.xhr.withCredentials = $.getOpt('withCredentials');
|
||||||
@ -799,8 +799,8 @@
|
|||||||
|
|
||||||
return(this);
|
return(this);
|
||||||
};
|
};
|
||||||
|
// Avoid confilict with wodocollabtexteditor which uses dojo framework
|
||||||
|
var define;
|
||||||
// Node.js-style export for Node and Component
|
// Node.js-style export for Node and Component
|
||||||
if (typeof module != 'undefined') {
|
if (typeof module != 'undefined') {
|
||||||
module.exports = Resumable;
|
module.exports = Resumable;
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user