Browse Source

Implement deletions export to CSV file

better-rectangles
Tissevert 8 months ago
parent
commit
7d8d1ec557
3 changed files with 19 additions and 1 deletions
  1. +4
    -0
      gui.css
  2. +3
    -0
      index.html
  3. +12
    -1
      src/Main.js

+ 4
- 0
gui.css View File

@ -16,6 +16,10 @@ html, body {
width: 3.5em;
}
#exportDeletions {
cursor: pointer;
}
#workzone {
padding: 1em;
background: #fffdf5;


+ 3
- 0
index.html View File

@ -21,6 +21,9 @@
<span>
<input id="editMode" type="checkbox" name="editMode"/><label for="editMode">Éditer</label>
</span>
<span>
<a download="scories.csv" id="exportDeletions" title="Exporter la liste des suppressions">💾</a>
</span>
</div>
<div id="workzone">
</div>


+ 12
- 1
src/Main.js View File

@ -9,6 +9,7 @@ var fileNumber = document.getElementById('fileNumber');
var fileName = document.getElementById('fileName');
var wcThreshold = document.getElementById('wcThreshold');
var editMode = document.getElementById('editMode');
var exportDeletions = document.getElementById('exportDeletions');
var currentALTOFile = null;
var deletedWords = {};
@ -20,8 +21,9 @@ inputFiles.addEventListener('change', function() {
});
wcThreshold.addEventListener('change', refresh);
editMode.addEventListener('change', syncEditMode);
fileNumber.addEventListener('change', updatePageNumber);
editMode.addEventListener('change', syncEditMode);
exportDeletions.addEventListener('click', doExportDeletions);
window.addEventListener('keydown', function(e) {
switch(e.keyCode) {
case 0x25: moveFile(-1); break;
@ -95,3 +97,12 @@ function wordEdit(e) {
console.log(deletedWords);
}
}
function doExportDeletions() {
var column = ['ID'];
for(var id in deletedWords) {
column.push(id);
}
var data = encodeURIComponent(column.join('\n'));
exportDeletions.href = 'data:text/csv,' + data;
}

Loading…
Cancel
Save