diff options
Diffstat (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js')
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index e6c7591c..6ae1707e 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -115,12 +115,10 @@ smapi.logParser = function (data, sectionUrl) { *********/ var input = $("#input"); if (input.length) { - // get elements + // instructions per OS var systemOptions = $("input[name='os']"); var systemInstructions = $("div[data-os]"); - var submit = $("#submit"); - // instruction OS chooser var chooseSystem = function () { systemInstructions.hide(); systemInstructions.filter("[data-os='" + $("input[name='os']:checked").val() + "']").show(); @@ -128,34 +126,12 @@ smapi.logParser = function (data, sectionUrl) { systemOptions.on("click", chooseSystem); chooseSystem(); - // disable submit if it's empty - var toggleSubmit = function () { - var hasText = !!input.val().trim(); - submit.prop("disabled", !hasText); - } - input.on("input", toggleSubmit); - toggleSubmit(); - - // drag & drop file - input.on({ - 'dragover dragenter': function (e) { - e.preventDefault(); - e.stopPropagation(); - }, - 'drop': function (e) { - var dataTransfer = e.originalEvent.dataTransfer; - if (dataTransfer && dataTransfer.files.length) { - e.preventDefault(); - e.stopPropagation(); - var file = dataTransfer.files[0]; - var reader = new FileReader(); - reader.onload = $.proxy(function (file, $input, event) { - $input.val(event.target.result); - toggleSubmit(); - }, this, file, $("#input")); - reader.readAsText(file); - } - } + // file upload + smapi.fileUpload({ + chooseFileLink: $("#choose-file-link"), + chooseFileInput: $("#inputFile"), + contentArea: input, + submitButton: $("#submit") }); } }; |