|
|
@ -1,4 +1,4 @@ |
|
|
|
var stepped = 0; |
|
|
|
var stepped = 0, chunks = 0, rows = 0; |
|
|
|
var start, end; |
|
|
|
var start, end; |
|
|
|
|
|
|
|
|
|
|
|
$(function() |
|
|
|
$(function() |
|
|
@ -6,10 +6,22 @@ $(function() |
|
|
|
$('#submit').click(function() |
|
|
|
$('#submit').click(function() |
|
|
|
{ |
|
|
|
{ |
|
|
|
stepped = 0; |
|
|
|
stepped = 0; |
|
|
|
|
|
|
|
chunks = 0; |
|
|
|
|
|
|
|
rows = 0; |
|
|
|
|
|
|
|
|
|
|
|
var txt = $('#input').val(); |
|
|
|
var txt = $('#input').val(); |
|
|
|
|
|
|
|
var localChunkSize = $('#localChunkSize').val(); |
|
|
|
|
|
|
|
var remoteChunkSize = $('#remoteChunkSize').val(); |
|
|
|
var files = $('#files')[0].files; |
|
|
|
var files = $('#files')[0].files; |
|
|
|
var config = buildConfig(); |
|
|
|
var config = buildConfig(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Chunk size does not get reset if changed and then set back to empty/default value
|
|
|
|
|
|
|
|
if (localChunkSize) |
|
|
|
|
|
|
|
Papa.LocalChunkSize = localChunkSize; |
|
|
|
|
|
|
|
if (remoteChunkSize) |
|
|
|
|
|
|
|
Papa.RemoteChunkSize = remoteChunkSize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (files.length > 0) |
|
|
|
if (files.length > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
start = performance.now(); |
|
|
|
start = performance.now(); |
|
|
@ -54,17 +66,32 @@ function buildConfig() |
|
|
|
worker: $('#worker').prop('checked'), |
|
|
|
worker: $('#worker').prop('checked'), |
|
|
|
comments: $('#comments').val(), |
|
|
|
comments: $('#comments').val(), |
|
|
|
complete: completeFn, |
|
|
|
complete: completeFn, |
|
|
|
download: $('#download').prop('checked') |
|
|
|
download: $('#download').prop('checked'), |
|
|
|
|
|
|
|
keepEmptyRows: $('#keepEmptyRows').prop('checked'), |
|
|
|
|
|
|
|
chunk: $('#chunk').prop('checked') ? chunkFn : undefined |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function stepFn(results, parser) |
|
|
|
function stepFn(results, parser) |
|
|
|
{ |
|
|
|
{ |
|
|
|
stepped++; |
|
|
|
stepped++; |
|
|
|
|
|
|
|
rows += results.data.length; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function chunkFn(results, file) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!results) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
chunks++; |
|
|
|
|
|
|
|
rows += results.data.length; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function completeFn() |
|
|
|
function completeFn() |
|
|
|
{ |
|
|
|
{ |
|
|
|
end = performance.now(); |
|
|
|
end = performance.now(); |
|
|
|
|
|
|
|
if (arguments[0] && arguments[0].data) |
|
|
|
|
|
|
|
rows = arguments[0].data.length; |
|
|
|
|
|
|
|
|
|
|
|
console.log("Finished input. Time:", end-start, arguments); |
|
|
|
console.log("Finished input. Time:", end-start, arguments); |
|
|
|
|
|
|
|
console.log("Rows:", rows, "Stepped:", stepped, "Chunks:", chunks); |
|
|
|
} |
|
|
|
} |