diff --git a/README.md b/README.md index 9206347..f179c61 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/content-script.js b/content-script.js index a104aab..5e4242d 100644 --- a/content-script.js +++ b/content-script.js @@ -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, '-'); @@ -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); } } }