$(function () { $('.event-slider').slick({ arrows: false, dots: true, autoplay: true, autoplaySpeed: 5000 }); function setModalViewed(identifier) { this.window.localStorage[identifier] = true; } $('.home-modal').each(function () { if (!window.localStorage) { return; } var modal = $(this); var counter = $(this).find('.modal-duration-counter'); var duration = modal.data('duration'); var identifier = modal.data('identifier'); var remainingTime = duration; if (window.localStorage[identifier]) { return; } modal.modal('show'); modal.on('hide.bs.modal', function () { setModalViewed(identifier); }); if (duration === 0) { return; } var timer = window.setInterval(function () { remainingTime--; counter.html(remainingTime); if (remainingTime <= 0) { window.clearInterval(timer); modal.modal('hide'); setModalViewed(identifier); } }, 1000); }); $.get("/umbraco/api/instagram/latest", function (photos) { var html = ''; for (var i = 0; i < photos.length; i++) { var photo = photos[i]; var url = photo.permalink; var timestamp = moment.utc(moment.unix(photo.timestamp)).local(); var src = photo.url; html += '
'; } $("#instagram-feed").html(html); }); function populateTweets(tweets) { var element = document.getElementById('twitter-feed'); var html = ''; for (var i = 0, length = tweets.length; i < length ; i++) { var tweet = tweets[i]; var timestamp = moment.utc(tweet.timestamp).local(); html += '