From 86cafc77f55ee2b42f4602911d322760d8683972 Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Mon, 23 Apr 2018 01:05:02 -0500 Subject: cool pufferchick on hover --- src/SMAPI.Web/Views/Index/Index.cshtml | 7 ++++--- .../wwwroot/Content/images/pufferchick-cool.png | Bin 0 -> 2921 bytes src/SMAPI.Web/wwwroot/Content/js/index.js | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png create mode 100644 src/SMAPI.Web/wwwroot/Content/js/index.js diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 4efb9f8a..c13c94a5 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -4,6 +4,7 @@ @model StardewModdingAPI.Web.ViewModels.IndexModel @section Head { + }

@@ -13,14 +14,14 @@

- Download SMAPI @Model.StableVersion.Version
+ Download SMAPI @Model.StableVersion.Version
@if (Model.BetaVersion != null) { - Download SMAPI @Model.BetaVersion.Version
for Stardew Valley 1.3 beta

+ Download SMAPI @Model.BetaVersion.Version
for Stardew Valley 1.3 beta

} Install guide
FAQs
- +

Get help

diff --git a/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png b/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png new file mode 100644 index 00000000..63eb8970 Binary files /dev/null and b/src/SMAPI.Web/wwwroot/Content/images/pufferchick-cool.png differ diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js new file mode 100644 index 00000000..54fdf6d9 --- /dev/null +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -0,0 +1,16 @@ +document.addEventListener('DOMContentLoaded', setupHover, false); + +function setupHover() { + var pufferchick = document.getElementById("pufferchick"); + var downloadLinks = document.getElementsByClassName("download"); + + for (var downloadLink of downloadLinks) { + downloadLink.addEventListener("mouseenter", function () { + pufferchick.src = "Content/images/pufferchick-cool.png"; + }); + + downloadLink.addEventListener("mouseleave", function () { + pufferchick.src = "favicon.ico"; + }); + } +} -- cgit From 2bc9184464261f918abe142de566cd82cf565918 Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Mon, 23 Apr 2018 01:53:32 -0500 Subject: use jQuery --- src/SMAPI.Web/Views/Index/Index.cshtml | 1 + src/SMAPI.Web/wwwroot/Content/js/index.js | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index c13c94a5..8ae23a45 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -4,6 +4,7 @@ @model StardewModdingAPI.Web.ViewModels.IndexModel @section Head { + } diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index 54fdf6d9..c53592f8 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -1,16 +1,10 @@ -document.addEventListener('DOMContentLoaded', setupHover, false); - -function setupHover() { - var pufferchick = document.getElementById("pufferchick"); - var downloadLinks = document.getElementsByClassName("download"); - - for (var downloadLink of downloadLinks) { - downloadLink.addEventListener("mouseenter", function () { - pufferchick.src = "Content/images/pufferchick-cool.png"; - }); - - downloadLink.addEventListener("mouseleave", function () { - pufferchick.src = "favicon.ico"; - }); - } -} +$(document).ready(function () { + var pufferchick = $("#pufferchick"); + $(".download").each(function (index, element) { + $(element).hover(function () { + pufferchick.attr("src", "Content/images/pufferchick-cool.png"); + }, function () { + pufferchick.attr("src", "favicon.ico"); + }) + }); +}); -- cgit From 82f418a38baeb44f68601708ebbd3c4af03ef6da Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Mon, 23 Apr 2018 01:58:18 -0500 Subject: add missing semicolon --- src/SMAPI.Web/wwwroot/Content/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index c53592f8..46f78fbe 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -5,6 +5,6 @@ $(document).ready(function () { pufferchick.attr("src", "Content/images/pufferchick-cool.png"); }, function () { pufferchick.attr("src", "favicon.ico"); - }) + }); }); }); -- cgit From 371d7fa05317f107f7b97a7b5db93e176039418d Mon Sep 17 00:00:00 2001 From: Dan Volchek Date: Mon, 23 Apr 2018 02:01:14 -0500 Subject: use implicit iteration instead --- src/SMAPI.Web/wwwroot/Content/js/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index 46f78fbe..ac05df05 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -1,10 +1,8 @@ $(document).ready(function () { var pufferchick = $("#pufferchick"); - $(".download").each(function (index, element) { - $(element).hover(function () { - pufferchick.attr("src", "Content/images/pufferchick-cool.png"); - }, function () { - pufferchick.attr("src", "favicon.ico"); - }); + $(".download").hover(function () { + pufferchick.attr("src", "Content/images/pufferchick-cool.png"); + }, function () { + pufferchick.attr("src", "favicon.ico"); }); }); -- cgit