Skip to content

Commit

Permalink
limit ev to 90 days, still tz bug
Browse files Browse the repository at this point in the history
  • Loading branch information
domlet committed Jul 27, 2024
1 parent 8a4a5a6 commit 589e419
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 16 deletions.
8 changes: 7 additions & 1 deletion calendars.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
</div>
</div>
</div>

<!-- list of calendars -->
<div id="calendarList0" class="calendar-list">
<div class="calendar-row"><label for="cal4checkbox0"><input type="checkbox" name="calVisibility0" id="cal4checkbox0" value="a71ff6b63e1709ae2bfbcada2b3b64ebeb1f7f5e30787b2bb059725fa17b7b2b@group.calendar.google.com" toggle-checkbox="" checked=""><span style="color: #5F6B02">Free Museums (Bay Area)</span></label></div>
<div class="calendar-row"><label for="cal5checkbox0"><input type="checkbox" name="calVisibility0" id="cal5checkbox0" value="[email protected]" toggle-checkbox="" checked=""><span style="color: #B1440E">CCPA Calendar of Events - Public</span></label></div>
<div class="calendar-row"><label for="cal6checkbox0"><input type="checkbox" name="calVisibility0" id="cal6checkbox0" value="e5c502978d4582e2e7b304e8197120672739ed245f730fc938e64c24949e000e@group.calendar.google.com" toggle-checkbox="" checked=""><span style="color: #1B887A">CCPA STEM Stuff</span></label></div>
</div>
<!-- the actual iframe -->
<iframe id="fullscreen-iframe" src="https://calendar.google.com/calendar/embed?wkst=2&ctz=America%2FLos_Angeles&bgcolor=%23ffffff&src=ZTVjNTAyOTc4ZDQ1ODJlMmU3YjMwNGU4MTk3MTIwNjcyNzM5ZWQyNDVmNzMwZmM5MzhlNjRjMjQ5NDllMDAwZUBncm91cC5jYWxlbmRhci5nb29nbGUuY29t&src=YTcxZmY2YjYzZTE3MDlhZTJiZmJjYWRhMmIzYjY0ZWJlYjFmN2Y1ZTMwNzg3YjJiYjA1OTcyNWZhMTdiN2IyYkBncm91cC5jYWxlbmRhci5nb29nbGUuY29t&src=Y2NwYWVkdS5jb21fZnR1MGxhNTRraW8wY3JoaDgzbTI2N2xyaThAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&color=%23039BE5&color=%23C0CA33&color=%23F4511E&mode=WEEK" frameborder="0" scrolling="no"></iframe>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
Expand Down
15 changes: 10 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
<script type="text/javascript" src="data/SY2324.js"></script>
<script type="text/javascript" src="data/SY2425.js"></script>
<script type="text/javascript" src="data/SY2526.js"></script>
<script type="text/javascript" src="script.js" defer></script>
<script type="module">
import { addDays } from '/script/date-fns-3.6.0.js';
// Expose date-fns to global scope
window.dateFns = { addDays };
</script>
<script type="text/javascript" src="script/jquery-3.7.1.min.js"></script>

</head>

<body>
Expand Down Expand Up @@ -168,15 +173,15 @@ <h2>Career & College</h2>
<a href="https://www.opencccapply.net/gateway/apply?cccMisCode=345&__hstc=228223362.9dc2bb36d2b88e85d1b0876b4e49961a.1576604154238.1689178418965.1689181615099.1784&__hssc=228223362.5.1689181615099&__hsfp=2123489275&hsCtaTracking=c6331421-8d45-426d-8cd4-3e2ba1b5fc38%7C314532d2-a763-4a9b-98df-c4ec431254c0" target="_blank" class="item-link">
Dual Enrollment (BCC)</a>
</p>
<p class="list-item-desc">
<a href="https://app.informedk12.com/link_campaigns/ousd-work-permit-application-current?token=He3Bpiaf3pYMQA8NthwixgN8" target="_blank" class="item-link">
Student Work Permit</a>
</p>
<p class="list-item-desc">
Summer Programs
<a href="https://bit.ly/CCPASUMMER" target="_blank" class="item-link"><span class="item-bubble">Sheet</span></a>
<a href="https://bit.ly/CCPASUMMERSLIDES" target="_blank" class="item-link"><span class="item-bubble">Slides</span></a>
</p>
<p class="list-item-desc">
<a href="https://app.informedk12.com/link_campaigns/ousd-work-permit-application-current?token=He3Bpiaf3pYMQA8NthwixgN8" target="_blank" class="item-link">
Student Work Permit</a>
</p>
<p class="list-item-desc">
<a href="https://ccpa-ousd.github.io/alumni-map/" target="_blank" class="item-link">
Alumni Map</a>
Expand Down
8 changes: 8 additions & 0 deletions script/date-fns-3.6.0.js

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions script/scriptEventLists.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
/*
- get all events from Google Calendars
- get all events from hard-coded events
- combine them into one array
Scripts specific to events, ie not dots
*/

const calendarIds = [
"[email protected]", // CCPA
"a71ff6b63e1709ae2bfbcada2b3b64ebeb1f7f5e30787b2bb059725fa17b7b2b@group.calendar.google.com", // Opportunities HS - https://github.com/ccpa-ousd/opps-cal-hs
"e5c502978d4582e2e7b304e8197120672739ed245f730fc938e64c24949e000e@group.calendar.google.com", // CCPA Robotics
"a71ff6b63e1709ae2bfbcada2b3b64ebeb1f7f5e30787b2bb059725fa17b7b2b@group.calendar.google.com", // Free museums - https://github.com/ccpa-ousd/opps-cal-hs
"e5c502978d4582e2e7b304e8197120672739ed245f730fc938e64c24949e000e@group.calendar.google.com", // CCPA STEM Interested
];
let combinedGCalEvents = [];
let combinedAllEvents = [];

// Fetch events from Google Calendar
$(document).ready(function () {
document.addEventListener("DOMContentLoaded", () => {
async function fetchGoogleCalendarEvents(calendarIdsList) {
// Set parameters for Google Calendar API
const timeMin = "2024-08-01T00:00:00-0700"; // set for SY2425; -0700 is Pacific Daylight Time
const timeMax = "2025-08-01T00:00:00-0700"; // set for SY2425; -0700 is Pacific Daylight Time
const now = new Date();
const timeMin = now.toISOString();
let timeMax = "";
// date-fns stuff
if (window.dateFns && window.dateFns.addDays) {
const { addDays } = window.dateFns;
timeMax = addDays(now, 90);
timeMax = timeMax.toISOString();
} else {
console.error("dateFns or addDays is not available.");
}

const timezone = "America/Los_Angeles";
const gCalkey = "AIzaSyDdvMUXW8jaNxCfVZQv3vKbaL4nTzhygMI"; // https://console.cloud.google.com/apis/credentials/

Expand Down Expand Up @@ -139,7 +147,6 @@ $(document).ready(function () {
}
}
showEvents(combinedAllEvents);
console.log(combinedAllEvents[15]); //
return combinedAllEvents;
})
.catch((error) => {
Expand Down
12 changes: 11 additions & 1 deletion style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ iframe {
#events-student-non-holiday .list-item:nth-child(-n + 5) {
display: list-item;
}
#events-student-opps .list-item:nth-child(-n + 4) {
#events-student-opps .list-item:nth-child(-n + 3) {
display: list-item;
}
.list-item-desc {
Expand Down Expand Up @@ -196,3 +196,13 @@ div[title]:hover::after {
height: 90vh; /* 90% of the viewport height */
margin: 0 auto; /* Center the iframe */
}
#calendarList0 {
background-color: #fff;
padding: 0.5em;
}
#calendarList0 div {
line-height: 0.5;
}
#calendarList0 div input {
margin-right: 0.5em;
}

0 comments on commit 589e419

Please sign in to comment.