diff --git a/OOMAnalyser.html b/OOMAnalyser.html index 2d8cedb..3875668 100644 --- a/OOMAnalyser.html +++ b/OOMAnalyser.html @@ -180,6 +180,31 @@ function goBack() { window.history.back(); } + +// Add listener after the document has been loaded completely +window.addEventListener('DOMContentLoaded', function() { + let dropArea = document.getElementById('input'); + dropArea.addEventListener('drop', file_dragged, false); +}); + +// Event handler triggered if a file has been dragged +function file_dragged(event) { + let file = event.dataTransfer.files[0] + event.preventDefault() + read_and_display_file(file) + return true; +}; + +// Read and display local file +function read_and_display_file(file) { + let reader = new FileReader(); + reader.onload = function(e) { + let textarea_oom = document.getElementById('textarea_oom') + textarea_oom.value = reader.result; + } + reader.readAsText(file); +} + @@ -210,7 +235,13 @@ function goBack() {

Step 1 - Enter your OOM message

- + +
+
+ +

@@ -792,6 +823,7 @@ function goBack() {
  • Fix: Trigger process isn't part of process table
  • Update to Transcrypt 3.7
  • Line "Killed process" can contain the process UID
  • +
  • Add drag-and-drop support for files
  • ...