From 066b2ac7f97f5c664c54a7da5ea37b09a8133be9 Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Wed, 7 Oct 2015 02:35:23 -0700 Subject: [PATCH] fix learn button --- server/views/partials/navbar.jade | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/views/partials/navbar.jade b/server/views/partials/navbar.jade index 6a51f98145..7108bd05b4 100644 --- a/server/views/partials/navbar.jade +++ b/server/views/partials/navbar.jade @@ -27,3 +27,19 @@ nav.navbar.navbar-default.navbar-fixed-top.nav-height .hidden-xs.hidden-sm a(href='/' + user.username) img.profile-picture.float-right(src='#{user.picture}') +script. + $(document).ready(function() { + $('.learn-btn').click(function(e) { + var challengeDashedName = null; + e.preventDefault(); + if (typeof dashedName === "string") { + return location.reload(); + } + if (typeof localStorage !== 'undefined') { + challengeDashedName = localStorage.getItem('currentDashedName'); + } + window.location = challengeDashedName ? + '/challenges/' + challengeDashedName : + '/map'; + }); + });