url-encoder icon indicating copy to clipboard operation
url-encoder copied to clipboard

adding drag & drop functionality to page

Open HeimMatthias opened this issue 2 years ago • 0 comments

Hi May I suggest you add drag & drop functionality to the input field on the main page?

function dropfile(file) {
  var reader = new FileReader();
  reader.onload = function(e) {
    init.value = e.target.result;
	init.dispatchEvent(new Event("input"));
  };
  reader.readAsText(file, "UTF-8");
}

document.getElementById("init").ondrop = function(e) {
  e.preventDefault();
  var file = e.dataTransfer.files[0];
  dropfile(file);
};

HeimMatthias avatar May 24 '23 14:05 HeimMatthias