Updating banner

This commit is contained in:
Dave Gandy 2017-09-27 21:36:00 -04:00
parent 9a5db2d886
commit 7e259f6167
3 changed files with 29 additions and 2 deletions

View file

@ -3,6 +3,9 @@
<div class="message-container">
<div class="tagline">
<span id="rotating-message"></span>
<div class="time-left">
<span id="time-left-message"></span>
</div>
</div>
<div class="action">
<a id="rotating-url" class="btn btn-primary btn-lg btn-block" href="" target="_blank"></a>

View file

@ -55,6 +55,7 @@
<script src="https://cdn.jsdelivr.net/underscorejs/1.8.3/underscore-min.js" integrity="sha256-obZACiHd7gkOk9iIL/pimWMTJ4W/pBsKu+oZnSeBIek=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/backbonejs/1.2.2/backbone-min.js" integrity="sha256-p6bkfFqmxtebrKOS+wyGi+Qf3d111eWUQP67keyXJ6Q=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/jsdelivr-rum/1.5/jsdelivr-rum.min.js" integrity="sha256-HlY2rbkgbiHhtilMXmQ86rjL/EIxGDtdg9GU9/T2ZxE=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/momentjs/2.15.1/moment.min.js" integrity="sha256-4PIvl58L9q7iwjT654TQJM+C/acEyoG738iL8B8nhXg=" crossorigin="anonymous"></script>
<script src="{{ page.relative_path }}assets/js/site.js"></script>
<script src="{{ page.relative_path }}assets/js/search.js"></script>
<script src="{{ page.relative_path }}assets/js/monetization.js" type="text/javascript"></script>

View file

@ -3,10 +3,10 @@ $(function () {
var ads = [
{
quote: "September is your last chance to get FA Pro and <strong>ALL</strong> KS rewards for just $40!",
quote: "September is your last chance to get FA Pro and <strong>ALL</strong> 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! &nbsp;<i class='fas fas-external-link'></i>",
btn_text: "Check out FA Pro! &nbsp;<i class='fas fas-external-link'></i>",
},
];
@ -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 <span class="duration">' + humanized + '</span> 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);