Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/splits-io. a speedrunning data store and analysis engine splits.io
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738import {saveAs} from "file-saver";
document.addEventListener('turbolinks:load', function() { $("form#convert").submit((evt) => { evt.preventDefault(); let formData = new FormData(); formData.set("file", $("#convert-file-input")[0].files[0]); formData.set("format", $("#convert-format-select").val());
$("#dropzone-overlay").fadeTo(125, 0.9); $("#droplabel").text("Converting file..."); window.isUploading = true; window.showSpinner("#fff");
$.ajax({ method: "POST", url: "/api/v4/convert", data: formData, cache: false, processData: false, contentType: false, success: (response, textStatus, xhr) => { window.isUploading = false; window.spinner.stop(); let filename = xhr.getResponseHeader("X-Filename"); var blob = new Blob([response]); saveAs(blob, filename); $("#dropzone-overlay").fadeOut(125); }, error: (xhr) => { window.isUploading = false; window.spinner.stop(); $("#droplabel").text(`Error converting: ${xhr.responseJSON.message}`); } }); })})