diff options
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index 8e30ae12..7a4d2d60 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -37,6 +37,14 @@ smapi.logParser = function(sectionUrl, pasteID) { $("#input").val(""); $("#popup-upload").fadeIn(); }); + + var closeUploadPopUp = function () { + $("#popup-upload").fadeOut(400, function () { + $("#input").val(memory); + memory = ""; + }); + }; + $("#popup-upload").on({ 'dragover dragenter': function(e) { e.preventDefault(); @@ -58,6 +66,10 @@ smapi.logParser = function(sectionUrl, pasteID) { }, this, file, $("#input")); reader.readAsText(file); } + }, + 'click': function (e) { + if (e.target.id === "popup-upload") + closeUploadPopUp(); } }); @@ -91,15 +103,24 @@ smapi.logParser = function(sectionUrl, pasteID) { $("#uploader").fadeOut(); } }); - $("#cancel").on("click", function() { - $("#popup-upload").fadeOut(400, function() { - $("#input").val(memory); - memory = ""; - }); + + $(document).on("keydown", function (e) { + if (e.which == 27) { + closeUploadPopUp(); + $("#popup-raw").fadeOut(400); + } }); + $("#cancel").on("click", closeUploadPopUp); + $("#closeraw").on("click", function() { $("#popup-raw").fadeOut(400); }); + + $("#popup-raw").on("click", function (e) { + if (e.target.id === "popup-raw") + $("#popup-raw").fadeOut(400); + }); + if (pasteID) { getData(pasteID); } |