diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-16 01:11:13 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-16 01:11:13 -0400 |
commit | c9a6d327110806d20877c477095238846a8d83bf (patch) | |
tree | 491b9b39ec0403067d0998226777a9a355004b9f /src/SMAPI.Web/wwwroot/Content/js/index.js | |
parent | 6c08f774250b252c09b282a663b3947acb3a6741 (diff) | |
download | SMAPI-c9a6d327110806d20877c477095238846a8d83bf.tar.gz SMAPI-c9a6d327110806d20877c477095238846a8d83bf.tar.bz2 SMAPI-c9a6d327110806d20877c477095238846a8d83bf.zip |
update web UI to let players download from new Nexus page (#547)
Diffstat (limited to 'src/SMAPI.Web/wwwroot/Content/js/index.js')
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/js/index.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index 016d5fa4..8fa1c26f 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -1,6 +1,7 @@ $(document).ready(function () { + /* enable pufferchick */ var pufferchick = $("#pufferchick"); - $(".download").hover( + $(".cta-dropdown").hover( function () { pufferchick.attr("src", "Content/images/pufferchick-cool.png"); }, @@ -8,4 +9,26 @@ $(document).ready(function () { pufferchick.attr("src", "favicon.ico"); } ); + + /* enable download dropdowns */ + $(".cta-dropdown a.download").each(function(i, button) { + button = $(button); + var wrapper = button.parent(".cta-dropdown"); + var button = wrapper.find(".download"); + var dropdownContent = wrapper.find(".dropdown-content"); + + $(window).on("click", function(e) { + var target = $(e.target); + + // toggle dropdown on button click + if (target.is(button) || $.contains(button.get(0), target.get(0))) { + e.preventDefault(); + dropdownContent.toggle(); + } + + // else hide dropdown + else + dropdownContent.hide(); + }); + }); }); |