From c0f0e1ba8e74d5f22be9664740a4dc51aa824bf6 Mon Sep 17 00:00:00 2001 From: volchek2 Date: Fri, 3 Nov 2017 23:31:56 -0500 Subject: Allow raw and upload popups to be closed with escape key and clicking outside of them --- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 31 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') 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); } -- cgit From 99278f0be19c63a32a7d5eba94d7a0cd88dd288c Mon Sep 17 00:00:00 2001 From: volchek2 Date: Fri, 3 Nov 2017 23:32:52 -0500 Subject: Fix braces --- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index 7a4d2d60..c6073f31 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -117,8 +117,9 @@ smapi.logParser = function(sectionUrl, pasteID) { }); $("#popup-raw").on("click", function (e) { - if (e.target.id === "popup-raw") + if (e.target.id === "popup-raw") { $("#popup-raw").fadeOut(400); + } }); if (pasteID) { -- cgit From 31002a7e52f7360e0979d9ddf1380c55451311eb Mon Sep 17 00:00:00 2001 From: volchek2 Date: Sat, 4 Nov 2017 00:28:59 -0500 Subject: check whether the popup is open before closing it with esc --- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index c6073f31..19287c24 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -106,7 +106,10 @@ smapi.logParser = function(sectionUrl, pasteID) { $(document).on("keydown", function (e) { if (e.which == 27) { - closeUploadPopUp(); + if ($("#popup-upload").css("display") !== "none" && $("#popup-upload").css("opacity") == 1) { + closeUploadPopUp(); + } + $("#popup-raw").fadeOut(400); } }); -- cgit From 01131cb50e36cb6884a43a5a32ec4fff69a92085 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 1 Dec 2017 22:55:42 -0500 Subject: rm unneeded log parser debug info --- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index 19287c24..d5c6974a 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -270,11 +270,8 @@ smapi.logParser = function(sectionUrl, pasteID) { function loadData() { try { stage = "loadData.Pre"; - var start = performance.now(); parseData(); renderData(); - var end = performance.now(); - $(".always").prepend("
Log processed in: " + (Math.round((end - start) * 100) / 100) + ' ms (View raw)

'); $("#viewraw").on("click", function() { $("#dataraw").val($("#input").val()); $("#popup-raw").fadeIn(); -- cgit From 188cd2403df315087ac646e04ba7d10449b7f709 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 1 Dec 2017 23:36:53 -0500 Subject: rename log parser tabs ID --- src/SMAPI.Web/Views/LogParser/Index.cshtml | 2 +- src/SMAPI.Web/wwwroot/Content/css/log-parser.css | 14 +++++++------- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index d90f1e35..705ed961 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -23,7 +23,7 @@ @if (Model.PasteID != null) {

Parsed log

-
    +
    • TRACE
    • DEBUG
    • INFO
    • diff --git a/src/SMAPI.Web/wwwroot/Content/css/log-parser.css b/src/SMAPI.Web/wwwroot/Content/css/log-parser.css index 975e9c2e..9affa79e 100644 --- a/src/SMAPI.Web/wwwroot/Content/css/log-parser.css +++ b/src/SMAPI.Web/wwwroot/Content/css/log-parser.css @@ -124,7 +124,7 @@ input[type="button"] { color: green; } -#tabs { +#filters { border-bottom: 0; display: block; margin: 0; @@ -132,7 +132,7 @@ input[type="button"] { background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(210, 235, 249, 1) 100%); } -#tabs li { +#filters li { margin: 5px 1px 0 0; height: 25px; display: inline-block; @@ -152,24 +152,24 @@ input[type="button"] { box-shadow: inset 0px 0px 1px 1px rgba(0, 0, 0, .2); } -#tabs li:hover { +#filters li:hover { background-color: #fee; } -#tabs li:first-child { +#filters li:first-child { margin-left: 5px; } -#tabs li.active { +#filters li.active { background: #cfc; border-color: #008800; } -#tabs li.active:hover { +#filters li.active:hover { background: #efe; } -#tabs li.notice { +#filters li.notice { color: #000000; background: transparent; border: 0; diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index d5c6974a..b2bea673 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -27,7 +27,7 @@ smapi.logParser = function(sectionUrl, pasteID) { regexDate = /\[\d{2}:\d{2}:\d{2} TRACE SMAPI\] Log started at (.*?) UTC/g, regexPath = /\[\d{2}:\d{2}:\d{2} DEBUG SMAPI\] Mods go here: (.*?)(?:\n|$)/g; - $("#tabs li:not(.notice)").on("click", function(evt) { + $("#filters li").on("click", function(evt) { var t = $(evt.currentTarget); t.toggleClass("active"); $("#output").toggleClass(t.text().toLowerCase()); -- cgit From e2b19d8a6ba5deb5a3e04c21c8e35cc04aea16b3 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 2 Dec 2017 01:05:12 -0500 Subject: rm body template so filters can be moved into the output area --- src/SMAPI.Web/Views/LogParser/Index.cshtml | 70 +++++++++++++------------- src/SMAPI.Web/wwwroot/Content/js/log-parser.js | 42 ++++++++++------ 2 files changed, 64 insertions(+), 48 deletions(-) (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js') diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 705ed961..a18586a9 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -33,39 +33,41 @@
    • Click tabs to toggle message visibility
    } -
    - +
    + @@ -102,8 +104,8 @@
    - - + +
    diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js index b2bea673..95949a8b 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js +++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js @@ -8,6 +8,7 @@ smapi.logParser = function(sectionUrl, pasteID) { var stage, flags = $("#modflags"), output = $("#output"), + error = $("#error"), filters = 0, memory = "", versionInfo, @@ -15,7 +16,6 @@ smapi.logParser = function(sectionUrl, pasteID) { modMap, modErrors, logInfo, - templateBody = $("#template-body").text(), templateModentry = $("#template-modentry").text(), templateCss = $("#template-css").text(), templateLogentry = $("#template-logentry").text(), @@ -30,7 +30,7 @@ smapi.logParser = function(sectionUrl, pasteID) { $("#filters li").on("click", function(evt) { var t = $(evt.currentTarget); t.toggleClass("active"); - $("#output").toggleClass(t.text().toLowerCase()); + output.toggleClass(t.text().toLowerCase()); }); $("#upload-button").on("click", function() { memory = $("#input").val() || ""; @@ -38,13 +38,13 @@ smapi.logParser = function(sectionUrl, pasteID) { $("#popup-upload").fadeIn(); }); - var closeUploadPopUp = function () { - $("#popup-upload").fadeOut(400, function () { + var closeUploadPopUp = function() { + $("#popup-upload").fadeOut(400, function() { $("#input").val(memory); memory = ""; }); }; - + $("#popup-upload").on({ 'dragover dragenter': function(e) { e.preventDefault(); @@ -67,7 +67,7 @@ smapi.logParser = function(sectionUrl, pasteID) { reader.readAsText(file); } }, - 'click': function (e) { + 'click': function(e) { if (e.target.id === "popup-upload") closeUploadPopUp(); } @@ -89,12 +89,12 @@ smapi.logParser = function(sectionUrl, pasteID) { }) .fail(function(xhr, textStatus) { $("#uploader").fadeOut(); - $("#output").html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: Upload

    Error: ' + textStatus + ': ' + xhr.responseText + "
    " + $("#input").val() + "
    "); + error.html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: Upload

    Error: ' + textStatus + ': ' + xhr.responseText + "
    " + $("#input").val() + "
    "); }) .then(function(data) { $("#uploader").fadeOut(); if (!data.success) - $("#output").html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: Upload

    Error: ' + data.error + "
    " + $("#input").val() + "
    "); + error.html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: Upload

    Error: ' + data.error + "
    " + $("#input").val() + "
    "); else location.href = (sectionUrl.replace(/\/$/, "") + "/" + data.id); }); @@ -104,7 +104,7 @@ smapi.logParser = function(sectionUrl, pasteID) { } }); - $(document).on("keydown", function (e) { + $(document).on("keydown", function(e) { if (e.which == 27) { if ($("#popup-upload").css("display") !== "none" && $("#popup-upload").css("opacity") == 1) { closeUploadPopUp(); @@ -119,7 +119,7 @@ smapi.logParser = function(sectionUrl, pasteID) { $("#popup-raw").fadeOut(400); }); - $("#popup-raw").on("click", function (e) { + $("#popup-raw").on("click", function(e) { if (e.target.id === "popup-raw") { $("#popup-raw").fadeOut(400); } @@ -201,7 +201,13 @@ smapi.logParser = function(sectionUrl, pasteID) { ]; stage = "parseData.parseInfo"; var date = dataDate ? new Date(dataDate[1] + "Z") : null; - versionInfo = [dataInfo[1], dataInfo[2], dataInfo[3], date ? date.getFullYear() + "-" + ("0" + date.getMonth().toString()).substr(-2) + "-" + ("0" + date.getDay().toString()).substr(-2) + " at " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + " " + date.toLocaleTimeString("en-us", { timeZoneName: "short" }).split(" ")[2] : "No timestamp found", dataPath[1]]; + versionInfo = { + apiVersion: dataInfo[1], + gameVersion: dataInfo[2], + platform: dataInfo[3], + logDate: date ? date.getFullYear() + "-" + ("0" + date.getMonth().toString()).substr(-2) + "-" + ("0" + date.getDay().toString()).substr(-2) + " at " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds() + " " + date.toLocaleTimeString("en-us", { timeZoneName: "short" }).split(" ")[2] : "No timestamp found", + modsPath: dataPath[1] + }; stage = "parseData.parseMods"; while ((match = regexMod.exec(dataMods))) { modErrors[match[1]] = 0; @@ -221,7 +227,13 @@ smapi.logParser = function(sectionUrl, pasteID) { function renderData() { stage = "renderData.pre"; - output.html(prepare(templateBody, versionInfo)); + + output.find("#api-version").text(versionInfo.apiVersion); + output.find("#game-version").text(versionInfo.gameVersion); + output.find("#platform").text(versionInfo.platform); + output.find("#log-started").text(versionInfo.logDate); + output.find("#mods-path").text(versionInfo.modsPath); + var modslist = $("#modslist"), log = $("#log"), modCache = [], y = 0; for (; y < modInfo.length; y++) { var errors = modErrors[modInfo[y][0]], @@ -258,6 +270,8 @@ smapi.logParser = function(sectionUrl, pasteID) { log.append(logCache.join("")); $("#modlink-r").on("click", removeFilter); $("#modlink-a").on("click", selectAll); + + $("#log-data").show(); } function prepare(str, arr) { @@ -279,7 +293,7 @@ smapi.logParser = function(sectionUrl, pasteID) { stage = "loadData.Post"; } catch (err) { - $("#output").html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: ' + stage + "

    " + err + '
    '); + error.html('

    Parsing failed!

    Parsing of the log failed, details follow.
     

    Stage: ' + stage + "

    " + err + '
    ');
                 $("#rawlog").text($("#input").val());
             }
         }
    @@ -291,7 +305,7 @@ smapi.logParser = function(sectionUrl, pasteID) {
                     $("#input").val(data.content);
                     loadData();
                 } else {
    -                $("#output").html('

    Fetching the log failed!

    ' + data.error + '

    '); + error.html('

    Fetching the log failed!

    ' + data.error + '

    ');
                     $("#rawlog").text($("#input").val());
                 }
                 $("#uploader").fadeOut();
    -- 
    cgit 
    
    
    From 3927014d701bf7ee1a824ccaf613fb7ca2f8185d Mon Sep 17 00:00:00 2001
    From: Jesse Plamondon-Willard 
    Date: Sat, 2 Dec 2017 01:26:28 -0500
    Subject: redesign log parser filters
    
    ---
     src/SMAPI.Web/Views/LogParser/Index.cshtml       | 77 ++++++++++++------------
     src/SMAPI.Web/wwwroot/Content/css/log-parser.css | 43 +++----------
     src/SMAPI.Web/wwwroot/Content/js/log-parser.js   |  2 +-
     3 files changed, 45 insertions(+), 77 deletions(-)
    
    (limited to 'src/SMAPI.Web/wwwroot/Content/js/log-parser.js')
    
    diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml
    index a18586a9..50e86ee6 100644
    --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml
    +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml
    @@ -23,49 +23,46 @@
     @if (Model.PasteID != null)
     {
         

    Parsed log

    -
      -
    • TRACE
    • -
    • DEBUG
    • -
    • INFO
    • -
    • ALERT
    • -
    • WARN
    • -
    • ERROR
    • -
    • Click tabs to toggle message visibility
    • -
    }
    -