Skip to content

Commit

Permalink
- Add IFTTT support
Browse files Browse the repository at this point in the history
  • Loading branch information
PardhavMaradani committed Sep 16, 2024
1 parent a1b1b38 commit 90a2ac3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The exported `.ics` files can be imported into Google Calendar or any other Cale
- [Usage](#usage)
- [Import ICS into Google Calendar](#import-ics-into-google-calendar)
- [Import ICS into other calendars](#import-ics-into-other-calendars)
- [IFTTT - IF This Then That](#ifttt---if-this-then-that)
- [How it works](#how-it-works)

## Installation
Expand Down Expand Up @@ -106,6 +107,14 @@ To import into Google Calendar
> ![ICS Imported into macOS Calendar - Week](images/macos-calendar-week.png)
## IFTTT - IF This Then That

If your Android phone does not have native support to mute / unmute based on Calendar events, you can use [IFTTT](https://ifttt.com/) to achieve the same.

The Applet to mute your Android phone when events start is: [VIT Timetable - Mute Android Phone At Start Of Calendar Events](https://ift.tt/E89YchI)

The Applet to unmute your Android phone when events end is: [VIT Timetable - Unmute Android Phone At End Of Calendar Events](https://ift.tt/vwT6UkS)

## How it works

All of VTOP's content is dynamically generated. There is a single URL `https://vtop.vit.ac.in/vtop/content` under which all content resides and the browser does not navigate to different pages for different sections. To export content in different tables as `.ics` files, code needs to be injected and run as [Content Scripts](https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts). Until [v1.2](https://github.com/PardhavMaradani/vit-timetable-export-plugin/tree/v1.2), the [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) API was used to observe for changes in relevant divs to detect the page and add UI elements for export. [v1.3](https://github.com/PardhavMaradani/vit-timetable-export-plugin) and above registers a more generic and extensible [Context Menu](https://developer.chrome.com/docs/extensions/reference/api/contextMenus) item `Export ICS File` (right-click option) for the main content page, which when clicked on the relevant pages carries out the export.
Expand Down
15 changes: 15 additions & 0 deletions content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ function generateAssignmentEventsAndExport(semester, courseAssignments) {
end: getICSDateOnly(nextDate)
};
events.push(event);
// Add dummy event for IFTTT to trigger on event end and unmute
const eventForIFTTT = {
summary: summary,
description: description,
start: getICSDateTime(date, '00:15'),
end: getICSDateTime(date, '00:30'),
};
events.push(eventForIFTTT);
}
}
const calName = 'VIT-Assignment-Upload-Schedule-' + semester.replace(/ /g, '-');
Expand Down Expand Up @@ -420,6 +428,13 @@ function generateTTEventsAndExport(semester, courses, tt, ac) {
end: getICSDateOnly(nextDate)
};
events.push(event);
// Add dummy event for IFTTT to trigger on event end and unmute
const eventForIFTTT = {
summary: info + ' ' + detail,
start: getICSDateTime(date, '00:15'),
end: getICSDateTime(date, '00:30'),
};
events.push(eventForIFTTT);
}
}
}
Expand Down

0 comments on commit 90a2ac3

Please sign in to comment.