diff --git a/index.js b/index.js index 50e72339b..603de0253 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,8 @@ import './sass/main.scss' import '@fortawesome/fontawesome-free/css/all.css' -// slick-carousel configuration -import $ from 'jquery' -import 'slick-carousel' - +// Hiring message const hiringMessage = `Hey, you. You’re finally awake. You were trying to see the code, right? @@ -14,11 +11,32 @@ If you’d like to work on this website and other cool projects with hackathons, console.log(hiringMessage); -// comment generated via js instead of directly in HTML so the hiring message text is only in one place +// Comment generated via js instead of directly in HTML so the hiring message text is only in one place const comment = document.createComment("\n"+hiringMessage.toString()+"\n"); document.insertBefore(comment, document.firstChild); +// Random hero SVG on each page load +import desk1 from './assets/desk1.svg' +import desk2 from './assets/desk2.svg' +import desk3 from './assets/desk3.svg' + +$(document).ready(function() { + var deskIndex = parseInt(localStorage.getItem('deskIndex')); + if (!deskIndex) { + deskIndex = 0; + localStorage.setItem('deskIndex', 0); + } + var desks = [desk1, desk2, desk3] + $('#desk').css('background-image', 'url(' + desks[deskIndex % desks.length] + ')'); + localStorage.setItem('deskIndex', deskIndex + 1); +}); + + +// Slick-carousel +import $ from 'jquery' +import 'slick-carousel' + $(document).ready(function() { $('.carousel').slick({ infinite: true, @@ -67,6 +85,7 @@ $(document).on('keydown', function(event) { }); +// FAQ Cards hide/show let card = document.getElementsByClassName("card"); for (let i = 0; i < card.length; i++) { let accordion = card[i].getElementsByClassName("accordion-header")[0]; @@ -90,6 +109,7 @@ for (let i = 0; i < card.length; i++) { }); } + // Schedule toggle code $('.day-second-events').hide(); $('.day-first').click(function() { diff --git a/sass/main.scss b/sass/main.scss index 1a55dc894..79638c841 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -78,7 +78,7 @@ $event-count: 6; // Transition all elements on the screen // (except FAQ panel, which already has a transition, // and the section days, which need no transition.) - &:not(.panel):not(#days):not(.number) { + &:not(.panel):not(#days):not(.number):not(#desk) { transition: all 1s ease; }