Skip to content

Commit

Permalink
frc game manual link will auto update
Browse files Browse the repository at this point in the history
  • Loading branch information
TFM110 committed Dec 19, 2023
1 parent 622aed2 commit 92841b1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
61 changes: 35 additions & 26 deletions header.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item text-wrap" href="https://titanroboticsbc.wixsite.com/home/" target="_blank">Booster Club</a>
<a class="dropdown-item text-wrap" href="https://www.firstinspires.org/resource-library/frc/competition-manual-qa-system" target="_blank">Season Materials</a>
<a class="dropdown-item text-wrap" href="https://firstfrc.blob.core.windows.net/frc2023/Manual/2023FRCGameManual.pdf" target="_blank">2023 FRC Game Manual</a>
<a class="dropdown-item text-wrap" id="gameManualLink" href="#" target="_blank">FRC Game Manual</a>
<a class="dropdown-item text-wrap" href="https://www.firstinspires.org/sites/default/files/uploads/frc/EventRulesManual.pdf" target="_blank">Event Rules</a>
<a class="dropdown-item text-wrap" href="https://www.firstinspires.org/robotics/frc/playing-field" target="_blank">Playing Field Assets</a>
<a class="dropdown-item text-wrap" href="https://docs.wpilib.org/en/stable/" target="_blank">WPILib Docs</a>
Expand All @@ -76,31 +76,40 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

<script>
const $dropdown = $(".dropdown");
const $dropdownToggle = $(".dropdown-toggle");
const $dropdownMenu = $(".dropdown-menu");
const showClass = "show";
$(window).on("load resize", function() {
if (this.matchMedia("(min-width: 768px)").matches) {
$dropdown.hover(
function() {
const $this = $(this);
$this.addClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "true");
$this.find($dropdownMenu).addClass(showClass);
},
function() {
const $this = $(this);
$this.removeClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "false");
$this.find($dropdownMenu).removeClass(showClass);
}
);
} else {
$dropdown.off("mouseenter mouseleave");
}
});
</script>
const $dropdown = $(".dropdown");
const $dropdownToggle = $(".dropdown-toggle");
const $dropdownMenu = $(".dropdown-menu");
const showClass = "show";
$(window).on("load resize", function() {
if (this.matchMedia("(min-width: 768px)").matches) {
$dropdown.hover(
function() {
const $this = $(this);
$this.addClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "true");
$this.find($dropdownMenu).addClass(showClass);
},
function() {
const $this = $(this);
$this.removeClass(showClass);
$this.find($dropdownToggle).attr("aria-expanded", "false");
$this.find($dropdownMenu).removeClass(showClass);
}
);
} else {
$dropdown.off("mouseenter mouseleave");
}
});

// Get the current year
var currentYear = new Date().getFullYear();
// Get the link element by its ID
var linkElement = document.getElementById('gameManualLink');
// Update the href attribute with the current year
linkElement.href = 'https://firstfrc.blob.core.windows.net/frc' + currentYear + '/Manual/' + currentYear + 'FRCGameManual.pdf';
// Set the link text with the current year
linkElement.textContent = currentYear + ' FRC Game Manual';
</script>
</body>

</html>
4 changes: 2 additions & 2 deletions ourstory.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ <h2><a class="anchor" id="anchor-2023">2023</a></h2>
<div class="carousel-inner">
<div class="game-logo carousel-item active h-100" id="game-logo-23"></div>
<div class="team carousel-item">
<img class="img-fluid d-block" src="img/about/2023/team 2022.jpg" alt="2022 photo"/>
<img class="img-fluid d-block" src="img/about/2023/team 2022.jpg" alt="2022 photo"/> <!--Needs new image-->
</div>
<div class="bot carousel-item">
<img class="img-fluid d-block w-100" src="img/about/2023/hermes cropped.jpg" alt="Hermes"/>
<img class="img-fluid d-block w-100" src="img/about/2023/hermes cropped.jpg" alt="Hermes"/> <!--Needs new image-->
<div class="carousel-caption d-block">
<h5>Brontes</h5>
</div>
Expand Down
2 changes: 1 addition & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Loads the header and footer into the proper positions. This definitely works, regardless of what the compiler says.
$(document).ready(function () {
$(function() {
var rellax = new Rellax('.rellax');
$("#navbar").load("header.html");
$("#footer").load("footer.html");
Expand Down

0 comments on commit 92841b1

Please sign in to comment.