summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/wwwroot
diff options
context:
space:
mode:
authorvolchek2 <volchek2@illinois.edu>2017-11-03 23:31:56 -0500
committervolchek2 <volchek2@illinois.edu>2017-11-03 23:31:56 -0500
commitc0f0e1ba8e74d5f22be9664740a4dc51aa824bf6 (patch)
tree1a7a9530d5b035aa0f497b33eca63e4cbe532607 /src/SMAPI.Web/wwwroot
parenta6071feaf84518c436fba0d148e3ea7d547663da (diff)
downloadSMAPI-c0f0e1ba8e74d5f22be9664740a4dc51aa824bf6.tar.gz
SMAPI-c0f0e1ba8e74d5f22be9664740a4dc51aa824bf6.tar.bz2
SMAPI-c0f0e1ba8e74d5f22be9664740a4dc51aa824bf6.zip
Allow raw and upload popups to be closed with escape key and clicking outside of them
Diffstat (limited to 'src/SMAPI.Web/wwwroot')
-rw-r--r--src/SMAPI.Web/wwwroot/Content/js/log-parser.js31
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);
}