Moved web root into root of project; this makes deployment easier.
Also deleted 'docs', which is now redundant.
This commit is contained in:
parent
a5204c66b9
commit
743d8a1740
1592 changed files with 53626 additions and 139250 deletions
1045
vendor/node_modules/papaparse/player/player.css
generated
vendored
Normal file
1045
vendor/node_modules/papaparse/player/player.css
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
78
vendor/node_modules/papaparse/player/player.html
generated
vendored
Normal file
78
vendor/node_modules/papaparse/player/player.html
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Papa Parse Player</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="player.css">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
|
||||
<script src="../papaparse.js"></script>
|
||||
<script src="player.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1><a href="http://papaparse.com">Papa Parse</a> Player</h1>
|
||||
|
||||
<div class="grid-container">
|
||||
|
||||
<div class="grid-25">
|
||||
<label><input type="checkbox" id="download"> Download</label>
|
||||
<label><input type="checkbox" id="stream"> Stream</label>
|
||||
<label><input type="checkbox" id="chunk"> Chunk</label>
|
||||
<label><input type="checkbox" id="worker"> Worker thread</label>
|
||||
<label><input type="checkbox" id="header"> Header row</label>
|
||||
<label><input type="checkbox" id="dynamicTyping"> Dynamic typing</label>
|
||||
<label><input type="checkbox" id="fastmode"> Fast mode</label>
|
||||
<label><input type="checkbox" id="skipEmptyLines"> Skip empty lines</label>
|
||||
<label><input type="checkbox" id="step-pause"> Pause on step</label>
|
||||
<label><input type="checkbox" id="print-steps"> Log each step/chunk</label>
|
||||
|
||||
<label>Delimiter: <input type="text" size="5" placeholder="auto" id="delimiter"> <a href="javascript:" id="insert-tab">tab</a></label>
|
||||
|
||||
Line Endings:
|
||||
|
||||
<label style="display: inline;"><input type="radio" name="newline" id="newline-auto" checked>Auto</label>
|
||||
<label style="display: inline;"><input type="radio" name="newline" id="newline-n">\n</label>
|
||||
<label style="display: inline;"><input type="radio" name="newline" id="newline-r">\r</label>
|
||||
<label style="display: inline;"><input type="radio" name="newline" id="newline-rn">\r\n</label>
|
||||
|
||||
<label>Preview: <input type="number" min="0" max="1000" placeholder="default" id="preview"></label>
|
||||
|
||||
<label>Encoding: <input type="text" id="encoding" placeholder="default" size="10"></label>
|
||||
|
||||
<label>Comment char: <input type="text" size="5" maxlength="1" placeholder="default" id="comments"></label>
|
||||
|
||||
<label>Papa.LocalChunkSize: <input type="number" min="0" placeholder="default" id="localChunkSize"></label>
|
||||
|
||||
<label>Papa.RemoteChunkSize: <input type="number" min="0" placeholder="default" id="remoteChunkSize"></label>
|
||||
</div>
|
||||
|
||||
<div class="grid-75 text-center">
|
||||
|
||||
<textarea id="input" placeholder="Input">Column 1,Column 2,Column 3,Column 4
|
||||
1-1,1-2,1-3,1-4
|
||||
2-1,2-2,2-3,2-4
|
||||
3-1,3-2,3-3,3-4
|
||||
40,41,42,43
|
||||
"Quoted field",No quotes,"Foo","bar",extra
|
||||
"Field quoted with
|
||||
line break"</textarea>
|
||||
|
||||
<br>
|
||||
<b>or</b>
|
||||
<br>
|
||||
|
||||
<input type="file" id="files" multiple>
|
||||
|
||||
<br><br>
|
||||
|
||||
<button id="submit-parse">Parse</button>
|
||||
|
||||
<button id="submit-unparse">Unparse</button>
|
||||
|
||||
<br><br>
|
||||
|
||||
<i>Open the Console in your browser's inspector tools to see results.</i>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
180
vendor/node_modules/papaparse/player/player.js
generated
vendored
Normal file
180
vendor/node_modules/papaparse/player/player.js
generated
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
var stepped = 0, chunks = 0, rows = 0;
|
||||
var start, end;
|
||||
var parser;
|
||||
var pauseChecked = false;
|
||||
var printStepChecked = false;
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#submit-parse').click(function()
|
||||
{
|
||||
stepped = 0;
|
||||
chunks = 0;
|
||||
rows = 0;
|
||||
|
||||
var txt = $('#input').val();
|
||||
var localChunkSize = $('#localChunkSize').val();
|
||||
var remoteChunkSize = $('#remoteChunkSize').val();
|
||||
var files = $('#files')[0].files;
|
||||
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;
|
||||
|
||||
pauseChecked = $('#step-pause').prop('checked');
|
||||
printStepChecked = $('#print-steps').prop('checked');
|
||||
|
||||
|
||||
if (files.length > 0)
|
||||
{
|
||||
if (!$('#stream').prop('checked') && !$('#chunk').prop('checked'))
|
||||
{
|
||||
for (var i = 0; i < files.length; i++)
|
||||
{
|
||||
if (files[i].size > 1024 * 1024 * 10)
|
||||
{
|
||||
alert("A file you've selected is larger than 10 MB; please choose to stream or chunk the input to prevent the browser from crashing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
start = performance.now();
|
||||
|
||||
$('#files').parse({
|
||||
config: config,
|
||||
before: function(file, inputElem)
|
||||
{
|
||||
console.log("Parsing file:", file);
|
||||
},
|
||||
complete: function()
|
||||
{
|
||||
console.log("Done with all files.");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
start = performance.now();
|
||||
var results = Papa.parse(txt, config);
|
||||
console.log("Synchronous parse results:", results);
|
||||
}
|
||||
});
|
||||
|
||||
$('#submit-unparse').click(function()
|
||||
{
|
||||
var input = $('#input').val();
|
||||
var delim = $('#delimiter').val();
|
||||
var header = $('#header').prop('checked');
|
||||
|
||||
var results = Papa.unparse(input, {
|
||||
delimiter: delim,
|
||||
header: header,
|
||||
});
|
||||
|
||||
console.log("Unparse complete!");
|
||||
console.log("--------------------------------------");
|
||||
console.log(results);
|
||||
console.log("--------------------------------------");
|
||||
});
|
||||
|
||||
$('#insert-tab').click(function()
|
||||
{
|
||||
$('#delimiter').val('\t');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function buildConfig()
|
||||
{
|
||||
return {
|
||||
delimiter: $('#delimiter').val(),
|
||||
newline: getLineEnding(),
|
||||
header: $('#header').prop('checked'),
|
||||
dynamicTyping: $('#dynamicTyping').prop('checked'),
|
||||
preview: parseInt($('#preview').val() || 0),
|
||||
step: $('#stream').prop('checked') ? stepFn : undefined,
|
||||
encoding: $('#encoding').val(),
|
||||
worker: $('#worker').prop('checked'),
|
||||
comments: $('#comments').val(),
|
||||
complete: completeFn,
|
||||
error: errorFn,
|
||||
download: $('#download').prop('checked'),
|
||||
fastMode: $('#fastmode').prop('checked'),
|
||||
skipEmptyLines: $('#skipEmptyLines').prop('checked'),
|
||||
chunk: $('#chunk').prop('checked') ? chunkFn : undefined,
|
||||
beforeFirstChunk: undefined,
|
||||
};
|
||||
|
||||
function getLineEnding()
|
||||
{
|
||||
if ($('#newline-n').is(':checked'))
|
||||
return "\n";
|
||||
else if ($('#newline-r').is(':checked'))
|
||||
return "\r";
|
||||
else if ($('#newline-rn').is(':checked'))
|
||||
return "\r\n";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function stepFn(results, parserHandle)
|
||||
{
|
||||
stepped++;
|
||||
rows += results.data.length;
|
||||
|
||||
parser = parserHandle;
|
||||
|
||||
if (pauseChecked)
|
||||
{
|
||||
console.log(results, results.data[0]);
|
||||
parserHandle.pause();
|
||||
return;
|
||||
}
|
||||
|
||||
if (printStepChecked)
|
||||
console.log(results, results.data[0]);
|
||||
}
|
||||
|
||||
function chunkFn(results, streamer, file)
|
||||
{
|
||||
if (!results)
|
||||
return;
|
||||
chunks++;
|
||||
rows += results.data.length;
|
||||
|
||||
parser = streamer;
|
||||
|
||||
if (printStepChecked)
|
||||
console.log("Chunk data:", results.data.length, results);
|
||||
|
||||
if (pauseChecked)
|
||||
{
|
||||
console.log("Pausing; " + results.data.length + " rows in chunk; file:", file);
|
||||
streamer.pause();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function errorFn(error, file)
|
||||
{
|
||||
console.log("ERROR:", error, file);
|
||||
}
|
||||
|
||||
function completeFn()
|
||||
{
|
||||
end = performance.now();
|
||||
if (!$('#stream').prop('checked')
|
||||
&& !$('#chunk').prop('checked')
|
||||
&& arguments[0]
|
||||
&& arguments[0].data)
|
||||
rows = arguments[0].data.length;
|
||||
|
||||
console.log("Finished input (async). Time:", end-start, arguments);
|
||||
console.log("Rows:", rows, "Stepped:", stepped, "Chunks:", chunks);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue