Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/schedule/session.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import Speakers from "./speakers.astro";
import { slugify } from "@utils/content";
import Headline from "@ui/Headline.astro";

export interface props {
style: any;
Expand Down Expand Up @@ -69,7 +70,7 @@ const hasFooter = true;
</div>
-->

<h2>{session.title}</h2>
<h2 id=`session-${session.slug}`>{session.title}</h2>

{
hasFooter && (
Expand Down
61 changes: 61 additions & 0 deletions src/pages/schedule.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,64 @@ const days = await getCollection("days");
))
}
</Layout>
<script>
window.addEventListener('load', function() {
function checkForAnchorAndHighlight() {
const currentAnchor = window.location.hash.substring(1);

if (!currentAnchor) return;

const allMatching = document.querySelectorAll(`h2#${currentAnchor}`);
const targetH2 = allMatching[allMatching.length - 1];

if (targetH2) {
const parentElement: any = targetH2.parentElement;

if (parentElement) {
const originalBorder = parentElement.style.border;
const originalBackground = parentElement.style.background;

let blinkCount = 0;
const maxBlinks = 5;
const blinkDuration = 500; // milliseconds

function toggleBorder() {
if (blinkCount >= maxBlinks * 2) {
parentElement.style.border = originalBorder;
parentElement.style.background = originalBackground;
return;
}

if (blinkCount % 2 === 0) {
parentElement.style.border = '1px solid #ff9900';
parentElement.style.background = 'white';
} else {
parentElement.style.border = originalBorder;
parentElement.style.background = originalBackground;
}

blinkCount++;
setTimeout(toggleBorder, blinkDuration);
}

toggleBorder();

setTimeout(function() {
const scrollOffset = 200;
const elementPosition = parentElement.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - scrollOffset;

window.scrollTo({
top: offsetPosition,
behavior: 'smooth'
});
}, 500);
}
}
}

checkForAnchorAndHighlight();

window.addEventListener('hashchange', checkForAnchorAndHighlight);
});
</script>
3 changes: 3 additions & 0 deletions src/pages/session/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { YouTube } from "@astro-community/astro-embed-youtube";
import { Picture } from "astro:assets";
import Markdown from "@ui/Markdown.astro";
import Section from "@ui/Section.astro";
import Button from "@ui/Button.astro";

export async function getStaticPaths() {
const sessions = await getCollection("sessions");
Expand Down Expand Up @@ -100,6 +101,8 @@ const nextSessionsOrdered = sameRoomNextSession
<dt class="font-bold">Duration:</dt>
<dd>{entry.data.duration} minutes</dd>
</dl>
<Button class="mb-10" url=`/schedule/#session-${entry.id}`>View on the schedule</Button>


<Prose full>
<h2>Abstract</h2>
Expand Down