mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-07 16:11:14 +00:00
Merge pull request #1425 from Ybbet/addClassCellCalendar
Add class cell calendar
This commit is contained in:
commit
600e0ec7e3
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
*This release is scheduled to be released on 2018-10-01.*
|
*This release is scheduled to be released on 2018-10-01.*
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- Possibility to add classes to the cell of symbol, title and time of the events of calendar.
|
||||||
- Font-awesome 5, still has 4 for backwards compatibility.
|
- Font-awesome 5, still has 4 for backwards compatibility.
|
||||||
- Missing `showEnd` in calendar documentation
|
- Missing `showEnd` in calendar documentation
|
||||||
- Screenshot for the new feed module
|
- Screenshot for the new feed module
|
||||||
|
@ -87,6 +87,9 @@ config: {
|
|||||||
| `maximumEntries` | The maximum number of events shown. Overrides global setting. **Possible values:** `0` - `100`
|
| `maximumEntries` | The maximum number of events shown. Overrides global setting. **Possible values:** `0` - `100`
|
||||||
| `maximumNumberOfDays` | The maximum number of days in the future. Overrides global setting
|
| `maximumNumberOfDays` | The maximum number of days in the future. Overrides global setting
|
||||||
| `auth` | The object containing options for authentication against the calendar.
|
| `auth` | The object containing options for authentication against the calendar.
|
||||||
|
| `symbolClass` | Add a class to the cell of symbol.
|
||||||
|
| `titleClass` | Add a class to the title's cell.
|
||||||
|
| `timeClass` | Add a class to the time's cell.
|
||||||
|
|
||||||
|
|
||||||
#### Calendar authentication options:
|
#### Calendar authentication options:
|
||||||
|
@ -82,6 +82,15 @@ Module.register("calendar", {
|
|||||||
maximumEntries: calendar.maximumEntries,
|
maximumEntries: calendar.maximumEntries,
|
||||||
maximumNumberOfDays: calendar.maximumNumberOfDays
|
maximumNumberOfDays: calendar.maximumNumberOfDays
|
||||||
};
|
};
|
||||||
|
if (calendar.symbolClass === "undefined" || calendar.symbolClass === null) {
|
||||||
|
calendarConfig.symbolClass = "";
|
||||||
|
}
|
||||||
|
if (calendar.titleClass === "undefined" || calendar.titleClass === null) {
|
||||||
|
calendarConfig.titleClass = "";
|
||||||
|
}
|
||||||
|
if (calendar.timeClass === "undefined" || calendar.timeClass === null) {
|
||||||
|
calendarConfig.timeClass = "";
|
||||||
|
}
|
||||||
|
|
||||||
// we check user and password here for backwards compatibility with old configs
|
// we check user and password here for backwards compatibility with old configs
|
||||||
if(calendar.user && calendar.pass) {
|
if(calendar.user && calendar.pass) {
|
||||||
@ -143,7 +152,7 @@ Module.register("calendar", {
|
|||||||
if(this.config.timeFormat === "dateheaders"){
|
if(this.config.timeFormat === "dateheaders"){
|
||||||
if(lastSeenDate !== dateAsString){
|
if(lastSeenDate !== dateAsString){
|
||||||
var dateRow = document.createElement("tr");
|
var dateRow = document.createElement("tr");
|
||||||
dateRow.className = "normal"
|
dateRow.className = "normal";
|
||||||
var dateCell = document.createElement("td");
|
var dateCell = document.createElement("td");
|
||||||
|
|
||||||
dateCell.colSpan = "3";
|
dateCell.colSpan = "3";
|
||||||
@ -172,7 +181,9 @@ Module.register("calendar", {
|
|||||||
symbolWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
|
symbolWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
symbolWrapper.className = "symbol align-right";
|
var symbolClass = this.symbolClassForUrl(event.url);
|
||||||
|
symbolWrapper.className = "symbol align-right " + symbolClass;
|
||||||
|
|
||||||
var symbols = this.symbolsForUrl(event.url);
|
var symbols = this.symbolsForUrl(event.url);
|
||||||
if(typeof symbols === "string") {
|
if(typeof symbols === "string") {
|
||||||
symbols = [symbols];
|
symbols = [symbols];
|
||||||
@ -189,7 +200,7 @@ Module.register("calendar", {
|
|||||||
eventWrapper.appendChild(symbolWrapper);
|
eventWrapper.appendChild(symbolWrapper);
|
||||||
}else if(this.config.timeFormat === "dateheaders"){
|
}else if(this.config.timeFormat === "dateheaders"){
|
||||||
var blankCell = document.createElement("td");
|
var blankCell = document.createElement("td");
|
||||||
blankCell.innerHTML = " "
|
blankCell.innerHTML = " ";
|
||||||
eventWrapper.appendChild(blankCell);
|
eventWrapper.appendChild(blankCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,10 +221,12 @@ Module.register("calendar", {
|
|||||||
|
|
||||||
titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle;
|
titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle;
|
||||||
|
|
||||||
|
var titleClass = this.titleClassForUrl(event.url);
|
||||||
|
|
||||||
if (!this.config.colored) {
|
if (!this.config.colored) {
|
||||||
titleWrapper.className = "title bright";
|
titleWrapper.className = "title bright " + titleClass;
|
||||||
} else {
|
} else {
|
||||||
titleWrapper.className = "title";
|
titleWrapper.className = "title " + titleClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.config.timeFormat === "dateheaders"){
|
if(this.config.timeFormat === "dateheaders"){
|
||||||
@ -223,8 +236,10 @@ Module.register("calendar", {
|
|||||||
titleWrapper.align = "left";
|
titleWrapper.align = "left";
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
var timeClass = this.timeClassForUrl(event.url);
|
||||||
var timeWrapper = document.createElement("td");
|
var timeWrapper = document.createElement("td");
|
||||||
timeWrapper.className = "time light";
|
timeWrapper.className = "time light " + timeClass;
|
||||||
timeWrapper.align = "left";
|
timeWrapper.align = "left";
|
||||||
timeWrapper.style.paddingLeft = "2px";
|
timeWrapper.style.paddingLeft = "2px";
|
||||||
var timeFormatString = "";
|
var timeFormatString = "";
|
||||||
@ -343,7 +358,8 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
|
||||||
//console.log(event);
|
//console.log(event);
|
||||||
timeWrapper.className = "time light";
|
var timeClass = this.timeClassForUrl(event.url);
|
||||||
|
timeWrapper.className = "time light " + timeClass;
|
||||||
eventWrapper.appendChild(timeWrapper);
|
eventWrapper.appendChild(timeWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,11 +488,15 @@ Module.register("calendar", {
|
|||||||
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
|
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
|
||||||
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
|
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
|
||||||
fetchInterval: this.config.fetchInterval,
|
fetchInterval: this.config.fetchInterval,
|
||||||
|
symbolClass: calendarConfig.symbolClass,
|
||||||
|
titleClass: calendarConfig.titleClass,
|
||||||
|
timeClass: calendarConfig.timeClass,
|
||||||
auth: auth
|
auth: auth
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/* symbolsForUrl(url)
|
/**
|
||||||
|
* symbolsForUrl(url)
|
||||||
* Retrieves the symbols for a specific url.
|
* Retrieves the symbols for a specific url.
|
||||||
*
|
*
|
||||||
* argument url string - Url to look for.
|
* argument url string - Url to look for.
|
||||||
@ -487,6 +507,42 @@ Module.register("calendar", {
|
|||||||
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol);
|
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* symbolClassForUrl(url)
|
||||||
|
* Retrieves the symbolClass for a specific url.
|
||||||
|
*
|
||||||
|
* @param url string - Url to look for.
|
||||||
|
*
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
symbolClassForUrl: function (url) {
|
||||||
|
return this.getCalendarProperty(url, "symbolClass", "");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* titleClassForUrl(url)
|
||||||
|
* Retrieves the titleClass for a specific url.
|
||||||
|
*
|
||||||
|
* @param url string - Url to look for.
|
||||||
|
*
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
titleClassForUrl: function (url) {
|
||||||
|
return this.getCalendarProperty(url, "titleClass", "");
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* timeClassForUrl(url)
|
||||||
|
* Retrieves the timeClass for a specific url.
|
||||||
|
*
|
||||||
|
* @param url string - Url to look for.
|
||||||
|
*
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
timeClassForUrl: function (url) {
|
||||||
|
return this.getCalendarProperty(url, "timeClass", "");
|
||||||
|
},
|
||||||
|
|
||||||
/* colorForUrl(url)
|
/* colorForUrl(url)
|
||||||
* Retrieves the color for a specific url.
|
* Retrieves the color for a specific url.
|
||||||
*
|
*
|
||||||
|
2208
package-lock.json
generated
2208
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -49,7 +49,7 @@
|
|||||||
"jshint": "^2.9.5",
|
"jshint": "^2.9.5",
|
||||||
"mocha": "^4.1.0",
|
"mocha": "^4.1.0",
|
||||||
"mocha-each": "^1.1.0",
|
"mocha-each": "^1.1.0",
|
||||||
"spectron": "3.7.x",
|
"spectron": "^3.8.0",
|
||||||
"stylelint": "^8.4.0",
|
"stylelint": "^8.4.0",
|
||||||
"stylelint-config-standard": "latest",
|
"stylelint-config-standard": "latest",
|
||||||
"time-grunt": "latest"
|
"time-grunt": "latest"
|
||||||
@ -57,18 +57,18 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"body-parser": "^1.18.2",
|
"body-parser": "^1.18.2",
|
||||||
"colors": "^1.1.2",
|
"colors": "^1.1.2",
|
||||||
"electron": "^2.0.0",
|
"electron": "^2.0.4",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
"express-ipfilter": "0.3.1",
|
"express-ipfilter": "0.3.1",
|
||||||
"feedme": "latest",
|
"feedme": "latest",
|
||||||
"helmet": "^3.9.0",
|
"helmet": "^3.9.0",
|
||||||
"iconv-lite": "latest",
|
"iconv-lite": "latest",
|
||||||
"mocha-logger": "^1.0.5",
|
"mocha-logger": "^1.0.6",
|
||||||
"moment": "latest",
|
"moment": "latest",
|
||||||
"request": "^2.83.0",
|
"request": "^2.87.0",
|
||||||
"rrule-alt": "^2.2.7",
|
"rrule-alt": "^2.2.7",
|
||||||
"simple-git": "^1.85.0",
|
"simple-git": "^1.85.0",
|
||||||
"socket.io": "^2.0.4",
|
"socket.io": "^2.1.1",
|
||||||
"valid-url": "latest",
|
"valid-url": "latest",
|
||||||
"walk": "latest"
|
"walk": "latest"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user