Skip to content

Commit

Permalink
feat: IT WORK
Browse files Browse the repository at this point in the history
  • Loading branch information
skifli authored Jul 12, 2023
1 parent 958bdde commit e2fcbde
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion about-us/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>Our Achievements</h2>
<p>From winning entry class, to also getting fastest car and best engineered, our team has never dissapointed,
with a plethora of awards to show for our hard and dedicated work. We hope to carry this momentum into Dev
class, where we are planning to continue into the UK Nationals, and if all goes to plan, even Worlds. <a
href="../our-journey/" target="_blank">Read More...</a></p>
href="../our-journey/?id=our-journey" target="_blank">Read More...</a></p>
</div>

<div id="our-members" class="middle">
Expand Down
40 changes: 31 additions & 9 deletions assets/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ let cookieConsentBanner = document.getElementById('cookie-consent-banner');
let acceptAllCookies = document.getElementById('accept-all-cookies');
let onlyFunctionalCookies = document.getElementById('only-functional-cookies');

let navbar = document.getElementById("navbar");

function setCookie(cname, cvalue, exdays) {
const d = new Date();

d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));

let expires = "expires=" + d.toUTCString();

document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}

Expand All @@ -31,15 +32,24 @@ function getCookie(cname) {
return "";
}

acceptAllCookies.addEventListener('click', function () {
setCookie('cookieConsent', true, 365);
location.reload();
});
function getWidth() {
return Math.max(
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth,
document.documentElement.clientWidth
);
}

onlyFunctionalCookies.addEventListener('click', function () {
setCookie('cookieConsent', false, 365);
location.reload();
});
function scrollToElement() {
const params = new URLSearchParams(window.location.search);

const elementID = params.get("id");
const elementY = window.scrollY + document.getElementById(elementID).getBoundingClientRect().top;

window.scrollTo(0, getWidth() < 1000 ? elementY : elementY - navbar.offsetHeight);
}

window.addEventListener("load", function () {
let cookieConsent = getCookie('cookieConsent');
Expand Down Expand Up @@ -68,4 +78,16 @@ window.addEventListener("load", function () {
} else if (cookieConsent == "") {
cookieConsentBanner.style.display = 'block';
}

scrollToElement();
});

acceptAllCookies.addEventListener('click', function () {
setCookie('cookieConsent', true, 365);
location.reload();
});

onlyFunctionalCookies.addEventListener('click', function () {
setCookie('cookieConsent', false, 365);
location.reload();
});
13 changes: 7 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ <h2>About Us</h2>
<p>WΔRP is a team of five 13-14 year-old boys from Saint Olave's Grammar School, who are competing in the F1 in
Schools competition as a dev class team. We are a team of leaders, innovators, and designers who are
ready to compete in this year's competition. We love STEM based activities, since we believe they provide
valuable, real-life experience through hands-on-learning. <a href="about-us" target="_blank">Read
valuable, real-life experience through hands-on-learning. <a href="about-us/?id=we-are-warp"
target="_blank">Read
More...</a></p>
</div>

Expand All @@ -77,39 +78,39 @@ <h2>Meet the Team</h2>
<h3>Abhinav Malladi</h3>

<p>Joined: 2021 - 22 Season (Team didn't compete).<br>Roles: Team Manager / Engineer.<br><a
href="about-us/#abhinav-malladi" target="_blank">Find
href="about-us/?id=abhinav-malladi" target="_blank">Find
out more...</a></p>
</div>

<div id="member">
<h3>Aneeq Weerasinghe</h3>

<p>Joined: 2021 - 22 Season (Team didn't compete).<br>Roles: Portfolio Manager / Verbal
Presentation / Sponsors.<br><a href="about-us/#aneeq-weerasinghe" target="_blank">Find
Presentation / Sponsors.<br><a href="about-us/?id=aneeq-weerasinghe" target="_blank">Find
out more...</a></p>
</div>

<div id="member">
<h3>Michael Qu</h3>

<p>Joined: After end of 2022 - 23 Season.<br>Roles: Portfolio / Verbal Presentation.<br><a
href="about-us/#michael-qu" target="_blank">Find
href="about-us/?id=michael-qu" target="_blank">Find
out more...</a></p>
</div>

<div id="member">
<h3>Neal Ye</h3>

<p>Joined: 2021 - 22 Season (Team didn't compete).<br>Roles: Engineer / Graphics.<br><a
href="about-us/#neal-ye" target="_blank">Find
href="about-us/?id=neal-ye" target="_blank">Find
out more...</a></p>
</div>

<div id="member">
<h3>Thomas Howcroft</h3>

<p>Joined: After end of 2022 - 23 Season.<br>Roles: Finance / Portfolio.<br><a
href="about-us/#thomas-howcroft" target="_blank">Find
href="about-us/?id=thomas-howcroft" target="_blank">Find
out more...</a></p>
</div>
</div>
Expand Down

0 comments on commit e2fcbde

Please sign in to comment.