Skip to content

Commit

Permalink
[V4.0]
Browse files Browse the repository at this point in the history
  • Loading branch information
phungorquan committed Sep 4, 2021
1 parent b6cef65 commit d34fe42
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
12 changes: 6 additions & 6 deletions MMM-VietNamEventsCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Module.register("MMM-VietNamEventsCalendar", {
tableClass: "xsmall",
displayPageIndicator: true, // Page indicator text not follow array[] rule
displaySwitchBtn: true, // Display button to switch between calendars
displayCalendarAfterInterval: true, // Allow switch to page 'calendarAfterInterval' after 'fetchInterval'
calendarAfterInterval: 0, // Follow array rule, 0(All - first page), 1(first google calendar),...(last page - VietNam events)
moveToPageAfterInterval: true, // Allow switch to page 'pageAfterInterval' after 'fetchInterval'
pageAfterInterval: 0, // Follow array rule, 0(All - first page), 1(first google calendar),...(last page - VietNam events)
displayEndTime: true, // Display end time of event
dateEndFormat: "LT(DD/MM)", // end time format
colored: true, // Allow color google calendars from 'calendar.color'
Expand Down Expand Up @@ -140,9 +140,9 @@ Module.register("MMM-VietNamEventsCalendar", {
// Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar
// fetcher running on the server side.
}
if (self.config.displayCalendarAfterInterval) {
if (self.config.calendarAfterInterval <= ns_VNCal.numOfUrls) {
ns_VNCal.currentPage = self.config.calendarAfterInterval;
if (self.config.moveToPageAfterInterval) {
if (self.config.pageAfterInterval <= ns_VNCal.numOfUrls) {
ns_VNCal.currentPage = self.config.pageAfterInterval;
} else {
ns_VNCal.currentPage = 0;
console.log("Please input correctly calendar page, Remember minus 1 because it's not follow Array[] rule");
Expand Down Expand Up @@ -320,7 +320,7 @@ Module.register("MMM-VietNamEventsCalendar", {
var wrapper = document.createElement("tr");
// Handle play sound and alert when events are coming
if (ns_VNCal.titleArr.length != 0 && ns_VNCal.alertOnce) {
console.log("ALERT EVENT IS COMMING");
console.log("ALERT EVENT IS COMING");
// Disable re-invoked too much time
ns_VNCal.alertOnce = false;
// Stop currently audio
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ cd ~/MagicMirror/modules
git clone https://github.com/phungorquan/MMM-VietNamEventsCalendar.git
```

## UPDATE
**YOU NEED TO SAVE YOUR ALL CHANGES BEFORE UPDATE**
- Use 'gitk' to show what you changed with UI git
- You have to download gitk with command: `sudo apt install gitk` before use gitk


**UPDATE COMMANDS**
```
git reset --hard HEAD
git pull
```

Now you can copy your change into new version :D


## DEFAULT CONFIG
To use this module, add below config into the modules array in the `config/config.js` file.

Expand All @@ -19,7 +34,6 @@ To use this module, add below config into the modules array in the `config/confi
module: "MMM-VietNamEventsCalendar",
position: "top_left",
config: {
maximumEntries: 10,
lunarColor: "LightGreen",
calendars: [
{
Expand All @@ -29,7 +43,7 @@ To use this module, add below config into the modules array in the `config/confi
},
{
url: "https://calendar.google.com/calendar/ical/quan.ng0anhin98%40gmail.com/public/basic.ics",
color: "PowderBlue",
color: "Yellow",
name: "Google lịch của quan.ng0anhin98 nè"
}],
personalDateEvent:[
Expand All @@ -49,20 +63,22 @@ To use this module, add below config into the modules array in the `config/confi
| `maximumNumberOfDays` | `int` | `365`, `366` | `365` | The maximum number of days in the future. |
| `maxTitleLength` | `int` | `10` - `50` | `20` | The maximum title length. |
| `maxTitleLines` | `int` | `0` - `10` | `3` | The maximum number of lines a title will wrap vertically before being cut (Only enabled if `wrapEvents` is also enabled). |
| `wrapEvents` | `bool` | `true`, `false` | `true` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`. |
| `wrapEvents` | `bool` | `true`, `false` | `true` | Wrap event titles to multiple lines. Breaks lines at the length defined by `maxTitleLength`. |
| `fetchInterval` | `int` | `1000` - `86400000` | `60000` (1') | How often does the content needs to be fetched? (Milliseconds). |
| `animationSpeed` | `int` | `0` - `5000` | `500` (0.5s) | Speed of the update animation. (Milliseconds). |
| `tableClass` | `String` | `xsmall`, `small`, `medium`, `large`, `xlarge` | `xsmall` | Name of the classes from `main.css`. |
| `displayPageIndicator` | `bool` | `true`, `false` | `true` | Display page indicator to inform user which page they are standing (current page / last page). |
| `displaySwitchBtn` | `bool` | `true`, `false` | `true` | Display button to switch calendars (pre/next). |
| `displayCalendarAfterInterval` | `bool` | `true`, `false` | `true` | Allow display to a page after `fetchInterval`. |
| `calendarAfterInterval` | `int` | `0` - (google calendar quantity + 2) | `0` (All calendars) | Display at page after `fetchInterval`. |
| `displayPageIndicator` | `bool` | `true`, `false` | `true` | Display page indicator to inform user which page they are standing (current page / last page). |
| `displaySwitchBtn` | `bool` | `true`, `false` | `true` | Display button to switch calendars (pre/next). |
| `moveToPageAfterInterval`| `bool` | `true`, `false` | `true` | Allow display to a page after `fetchInterval`. |
| `pageAfterInterval` | `int` | `0` - (google calendar quantity + 1) | `0` (All - first page) | Display at page after `fetchInterval`. This number follow Array[] rule, start at index 0 |
| `displayEndTime` | `bool` | `true`, `false` | `true` | Allow display end time of google calender events. |
| `dateEndFormat` | `String` |See [Moment.js](https://momentjs.com/docs/#/parsing/string-format/) | `"LT(DD/MM)"` | Format to use for the date of events when using absolute dates. (version <= 2.16.0) From version 2.16.0, this option will be used to format absolute and relative dates. (e.g. DD/MM/YY to change from the default MM/DD/YYYY). |
| `colored` | `bool` | `true`, `false` | `true` | Allow color google calendar events. |
| `defaultColor` | `String` | HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)) | `"White"` | Default color of Google Calendar events. |
| `showLocation` | `bool` | `true`, `false` | `true` | Allow show location of google calendar events. |
| `lunarColor` | `String` | HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)) | `"LightGreen"` | Color of VietNam, Personal events. |
| `alertSoundFile` | `String` | See in `resources` folder | `ClearAnnouce.wav` | Sound alert files will be played when event is coming. See files in `resources` folder or download [here](https://mixkit.co/free-sound-effects/notification/) |
| `alertSoundTimer` | `int` | `1000` - `86400000` | `5000` (5s) | Timer to play alert sound and show notification |
| `displayLocation` | `bool` | `true`, `false` | `true` | Allow show location of google calendar events. |
| `lunarColor` | `String` | HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)) | `"LightGreen"` | Color of VietNam, Personal events. |
| `displayLunarEvents` | `bool` | `true`, `false` | `true` | Display VietNam, Personal events. |
| `displayLunarDate` | `bool` | `true`, `false` | `true` | Display VietNam, Personal lunar time. |
| `displayPersonalEvents` | `bool` | `true`, `false` | `true` | Display Personal events. |
Expand Down Expand Up @@ -98,7 +114,7 @@ The following is the list of notifications that MMM-pages will handle:
| Files and folders | Description |
| --- | --- |
|`include/VietNamEvents.js`| Edit VietNam events |
|`resources`| Contain resource file (.mp3, .png) |
|`resources`| Contain resource file (.wav, .png) |
|`src/calendarfetcher.js`| Fetch google calendar (I copied from module `calendar`) |
|`src/UtilsChecking.js`| Contain functions to check calendars (personal calendar, google calendar) |
|`src/VietNamCal.js`| Contain functions to process DL,AL,... |
Expand Down

0 comments on commit d34fe42

Please sign in to comment.