From 7e259f6167c6afedb9db47a7d160f03d2a3d4dcd Mon Sep 17 00:00:00 2001 From: Dave Gandy Date: Wed, 27 Sep 2017 21:36:00 -0400 Subject: [PATCH] Updating banner --- src/_includes/navbar.html | 3 +++ src/_layouts/base.html | 1 + src/assets/js/site.js | 27 +++++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/_includes/navbar.html b/src/_includes/navbar.html index 3b4cc5561..c5fdcef5f 100644 --- a/src/_includes/navbar.html +++ b/src/_includes/navbar.html @@ -3,6 +3,9 @@
+
+ +
diff --git a/src/_layouts/base.html b/src/_layouts/base.html index 3a784def0..405c0d265 100644 --- a/src/_layouts/base.html +++ b/src/_layouts/base.html @@ -55,6 +55,7 @@ + diff --git a/src/assets/js/site.js b/src/assets/js/site.js index 4a3ab007a..90ab57a32 100644 --- a/src/assets/js/site.js +++ b/src/assets/js/site.js @@ -3,10 +3,10 @@ $(function () { var ads = [ { - quote: "September is your last chance to get FA Pro and ALL KS rewards for just $40!", + quote: "September is your last chance to get FA Pro and ALL KS rewards for $40.", class: "fa5", url: "https://fontawesome.com/?utm_source=font_awesome_homepage&utm_medium=display&utm_campaign=september_last_chance&utm_content=banner", - btn_text: "Pre-order FA Pro!  ", + btn_text: "Check out FA Pro!  ", }, ]; @@ -34,6 +34,27 @@ $(function () { // Yippee! We can use localStorage awesomeness } + function timeLeft() { + var now, ksEndsAt, hoursLeft, minutesLeft, humanized; + + try { + now = moment(); + ksEndsAt = moment("2017-10-01 00:00:00-05"); + hoursLeft = ksEndsAt.diff(now, "hours"); + minutesLeft = ksEndsAt.diff(now, "minutes") - hoursLeft * 60; + } catch (e) {} + + if (hoursLeft < 0 || minutesLeft < 0) { + return; + } + + humanized = hoursLeft + " " + ((hoursLeft === 1) ? "hour" : "hours") + ", " + minutesLeft + " " + ((minutesLeft === 1) ? "minute" : "minutes"); + + $('#time-left-message').html('Just ' + humanized + ' left before the price goes up!'); + + setTimeout(timeLeft, 2000); + } + function storageAvailable(type) { try { var storage = window[type], @@ -51,6 +72,8 @@ $(function () { random_number = Math.floor(Math.random() * ads.length); random_ad = ads[random_number]; + timeLeft(); + $('#banner').addClass(random_ad.class); $('#rotating-message').html(random_ad.quote); $('#rotating-url').attr("href", random_ad.url);