Skip to content

Commit 13ba0ca

Browse files
committed
Remove astro page-load
1 parent 390d858 commit 13ba0ca

File tree

12 files changed

+11
-29
lines changed

12 files changed

+11
-29
lines changed

src/components/Header.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import links from "@data/links.json";
5353
}
5454
</style>
5555
<script>
56-
document.addEventListener("astro:page-load", () => {
56+
document.addEventListener("DOMContentLoaded", () => {
5757
let prevScrollPos = window.pageYOffset;
5858
const navbar = document.getElementById("navbar") as HTMLElement;
5959

src/components/Modal.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const { id = 'modal', open = false, closeOnOutsideClick = false } = Astro.props;
2727
</div>
2828
</div>
2929
<script >
30-
document.addEventListener('astro:page-load', () => {
30+
document.addEventListener('DOMContentLoaded', () => {
3131
// Function to toggle body scroll
3232
const toggleBodyScroll = (disable: any) => {
3333
if (disable) {

src/components/NavItems.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const { items, inverted = false, level = 1 } = Astro.props;
100100

101101
<script>
102102
// Add keyboard navigation support
103-
document.addEventListener('astro:page-load', () => {
103+
document.addEventListener('DOMContentLoaded', () => {
104104
const navButtons = document.querySelectorAll('[role="menuitem"][aria-haspopup="true"]');
105105

106106
navButtons.forEach(button => {

src/components/Search.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Modal from "@components/Modal.astro";
2424

2525

2626
<script>
27-
document.addEventListener("astro:page-load", function () {
27+
document.addEventListener("DOMContentLoaded", function () {
2828
const searchContainer = document.querySelector(".pagefind-ui") as HTMLElement | null;
2929
const searchInput = searchContainer?.querySelector("input") as HTMLInputElement | null;
3030
const searchButton = document.getElementById("searchButton") as HTMLElement | null;

src/components/schedule/day.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ const dateText = format(date, "eeee - do MMMM");
635635
</style>
636636

637637
<script>
638-
document.addEventListener("astro:page-load", function () {
638+
document.addEventListener("DOMContentLoaded", function () {
639639
const containers = document.querySelectorAll(".schedule-container");
640640

641641
function syncScroll(event: any) {

src/components/sections/speakers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const sectionSubtitle = "Meet some of our amazing speakers";
7070
</Section>
7171

7272
<script>
73-
document.addEventListener('astro:page-load', () => {
73+
document.addEventListener('DOMContentLoaded', () => {
7474
const track = document.querySelector('.speakers-track') as HTMLElement;
7575
const slides = document.querySelectorAll('.speaker-slide');
7676
const totalOriginalSlides = slides.length / 2;

src/components/sessions/filter.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import Select from "@ui/Select.astro";
8080
search: string;
8181
}
8282

83-
document.addEventListener("astro:page-load", () => {
83+
document.addEventListener("DOMContentLoaded", () => {
8484
const forms = document.querySelectorAll<HTMLFormElement>("form.filter-sessions");
8585
const resultsInfo = document.getElementById("results-info");
8686

src/components/ui/Accordion.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const { title, id } = Astro.props;
2929
}
3030
</style>
3131
<script>
32-
document.addEventListener("astro:page-load", () => {
32+
document.addEventListener("DOMContentLoaded", () => {
3333
const hash = window.location.hash.substring(1); // Remove #
3434
if (hash) {
3535
const details = document.getElementById(

src/layouts/Layout.astro

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,7 @@ document.addEventListener('DOMContentLoaded', () => {
151151
} else {
152152
alert(message);
153153
}
154-
155-
console.log('Blocked external link:', href);
156-
157154
}, { passive: false });
158155
}
159156
});
160-
161-
function addVisualFeedback() {
162-
if (window.matchMedia('(display-mode: standalone)').matches) {
163-
const style = document.createElement('style');
164-
style.textContent = `
165-
a[href^="http"]:not([href^="${window.location.origin}"]):hover::after,
166-
a[href^="//"]:hover::after {
167-
content: " 🚫";
168-
}
169-
`;
170-
document.head.appendChild(style);
171-
}
172-
}
173-
174-
document.addEventListener('DOMContentLoaded', addVisualFeedback);
175157
</script>

src/layouts/MarkdownLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const { title, description, toc=false } = Astro.props;
3434
</Layout>
3535

3636
<script is:inline>
37-
document.addEventListener("astro:page-load", () => {
37+
document.addEventListener("DOMContentLoaded", () => {
3838
const tocContainer = document.getElementById("toc");
3939
if (!tocContainer) return;
4040

0 commit comments

Comments
 (0)