diff --git a/CHANGELOG.md b/CHANGELOG.md index f757b0bf..673b5669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added option `remoteFile` to compliments module to load compliment array from filesystem. - Added option `zoom` to scale the whole mirror display with a given factor. - Added option `roundTemp` for currentweather and weatherforecast modules to display temperatures rounded to nearest integer. +- Added abilty set the classes option to compliments module for style and text size of compliments. ### Updated - Modified translations for Frysk. diff --git a/Gruntfile.js b/Gruntfile.js index c47f55b9..ec3128ef 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,7 +6,10 @@ module.exports = function(grunt) { options: { configFile: ".eslintrc.json" }, - target: ["js/*.js", "modules/default/*.js", "serveronly/*.js", "*.js"] + target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js", + "serveronly/*.js", "*.js", "!modules/default/alert/notificationFx.js", + "!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js" + ] }, stylelint: { simple: { @@ -63,4 +66,4 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-yamllint"); grunt.loadNpmTasks("grunt-markdownlint"); grunt.registerTask("default", ["eslint", "stylelint", "jsonlint", "markdownlint", "yamllint"]); -}; \ No newline at end of file +}; diff --git a/modules/default/calendar/debug.js b/modules/default/calendar/debug.js index bc0adae6..d52cdc9f 100644 --- a/modules/default/calendar/debug.js +++ b/modules/default/calendar/debug.js @@ -8,18 +8,18 @@ var CalendarFetcher = require("./calendarfetcher.js"); -var url = 'https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics'; +var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; var fetchInterval = 60 * 60 * 1000; var maximumEntries = 10; var maximumNumberOfDays = 365; -console.log('Create fetcher ...'); +console.log("Create fetcher ..."); fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays); fetcher.onReceive(function(fetcher) { - console.log(fetcher.events()); - console.log('------------------------------------------------------------'); + console.log(fetcher.events()); + console.log("------------------------------------------------------------"); }); fetcher.onError(function(fetcher, error) { @@ -29,5 +29,5 @@ fetcher.onError(function(fetcher, error) { fetcher.startFetch(); -console.log('Create fetcher done! '); +console.log("Create fetcher done! "); diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index cfd8f524..4455b15a 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -8,7 +8,7 @@ Module.register("clock",{ // Module config defaults. defaults: { - displayType: 'digital', // options: digital, analog, both + displayType: "digital", // options: digital, analog, both timeFormat: config.timeFormat, displaySeconds: true, @@ -18,11 +18,11 @@ Module.register("clock",{ showDate: true, /* specific to the analog clock */ - analogSize: '200px', - analogFace: 'simple', // options: 'none', 'simple', 'face-###' (where ### is 001 to 012 inclusive) - analogPlacement: 'bottom', // options: 'top', 'bottom', 'left', 'right' - analogShowDate: 'top', // options: false, 'top', or 'bottom' - secondsColor: '#888888', + analogSize: "200px", + analogFace: "simple", // options: 'none', 'simple', 'face-###' (where ### is 001 to 012 inclusive) + analogPlacement: "bottom", // options: 'top', 'bottom', 'left', 'right' + analogShowDate: "top", // options: false, 'top', or 'bottom' + secondsColor: "#888888", timezone: null, }, // Define required scripts. @@ -92,7 +92,7 @@ Module.register("clock",{ } } if(this.config.showDate){ - dateWrapper.innerHTML = now.format("dddd, LL"); + dateWrapper.innerHTML = now.format("dddd, LL"); } timeWrapper.innerHTML = timeString; secondsWrapper.innerHTML = now.format("ss"); @@ -112,7 +112,7 @@ Module.register("clock",{ * Create wrappers for ANALOG clock, only if specified in config */ - if (this.config.displayType !== 'digital') { + if (this.config.displayType !== "digital") { // If it isn't 'digital', then an 'analog' clock was also requested // Calculate the degree offset for each hand of the clock @@ -131,10 +131,10 @@ Module.register("clock",{ clockCircle.style.width = this.config.analogSize; clockCircle.style.height = this.config.analogSize; - if (this.config.analogFace != '' && this.config.analogFace != 'simple' && this.config.analogFace != 'none') { + if (this.config.analogFace != "" && this.config.analogFace != "simple" && this.config.analogFace != "none") { clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)"; clockCircle.style.backgroundSize = "100%"; - } else if (this.config.analogFace != 'none') { + } else if (this.config.analogFace != "none") { clockCircle.style.border = "2px solid white"; } var clockFace = document.createElement("div"); @@ -168,18 +168,18 @@ Module.register("clock",{ * Combine wrappers, check for .displayType */ - if (this.config.displayType === 'digital') { + if (this.config.displayType === "digital") { // Display only a digital clock wrapper.appendChild(dateWrapper); wrapper.appendChild(timeWrapper); - } else if (this.config.displayType === 'analog') { + } else if (this.config.displayType === "analog") { // Display only an analog clock dateWrapper.style.textAlign = "center"; dateWrapper.style.paddingBottom = "15px"; - if (this.config.analogShowDate === 'top') { + if (this.config.analogShowDate === "top") { wrapper.appendChild(dateWrapper); wrapper.appendChild(clockCircle); - } else if (this.config.analogShowDate === 'bottom') { + } else if (this.config.analogShowDate === "bottom") { wrapper.appendChild(clockCircle); wrapper.appendChild(dateWrapper); } else { @@ -199,11 +199,11 @@ Module.register("clock",{ digitalWrapper.appendChild(dateWrapper); digitalWrapper.appendChild(timeWrapper); - if (placement === 'left' || placement === 'right') { + if (placement === "left" || placement === "right") { digitalWrapper.style.display = "inline-block"; digitalWrapper.style.verticalAlign = "top"; analogWrapper.style.display = "inline-block"; - if (placement === 'left') { + if (placement === "left") { analogWrapper.style.padding = "0 20px 0 0"; wrapper.appendChild(analogWrapper); wrapper.appendChild(digitalWrapper); @@ -214,7 +214,7 @@ Module.register("clock",{ } } else { digitalWrapper.style.textAlign = "center"; - if (placement === 'top') { + if (placement === "top") { analogWrapper.style.padding = "0 0 20px 0"; wrapper.appendChild(analogWrapper); wrapper.appendChild(digitalWrapper); diff --git a/modules/default/compliments/README.md b/modules/default/compliments/README.md index 1dab242a..ac410d30 100644 --- a/modules/default/compliments/README.md +++ b/modules/default/compliments/README.md @@ -57,14 +57,14 @@ The following properties can be configured:
remoteFile
compliments.json
- null
(Do not load from file)
- remoteFile
compliments.json
+ null
(Do not load from file)
+ night_rain
* night_thunderstorm
* night_snow
-* night_alt_cloudy_windy
+* night_alt_cloudy_windy
#### Example use with currentweather module
````javascript
diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js
index 3bfdc8be..9f514ff1 100644
--- a/modules/default/compliments/compliments.js
+++ b/modules/default/compliments/compliments.js
@@ -29,7 +29,7 @@ Module.register("compliments",{
]
},
updateInterval: 30000,
- remoteFile: null,
+ remoteFile: null,
fadeSpeed: 4000
},
@@ -47,11 +47,11 @@ Module.register("compliments",{
this.lastComplimentIndex = -1;
- if (this.config.remoteFile != null) {
- this.complimentFile((response) => {
- this.config.compliments = JSON.parse(response);
- });
- }
+ if (this.config.remoteFile != null) {
+ this.complimentFile((response) => {
+ this.config.compliments = JSON.parse(response);
+ });
+ }
// Schedule update timer.
var self = this;
@@ -114,17 +114,17 @@ Module.register("compliments",{
/* complimentFile(callback)
* Retrieve a file from the local filesystem
*/
- complimentFile: function(callback) {
- var xobj = new XMLHttpRequest();
- xobj.overrideMimeType("application/json");
- xobj.open('GET', this.file(this.config.remoteFile), true);
- xobj.onreadystatechange = function () {
- if (xobj.readyState == 4 && xobj.status == "200") {
- callback(xobj.responseText);
- }
- };
- xobj.send(null);
- },
+ complimentFile: function(callback) {
+ var xobj = new XMLHttpRequest();
+ xobj.overrideMimeType("application/json");
+ xobj.open("GET", this.file(this.config.remoteFile), true);
+ xobj.onreadystatechange = function () {
+ if (xobj.readyState == 4 && xobj.status == "200") {
+ callback(xobj.responseText);
+ }
+ };
+ xobj.send(null);
+ },
/* complimentArray()
* Retrieve a random compliment.
@@ -144,7 +144,7 @@ Module.register("compliments",{
var compliment = document.createTextNode(complimentText);
var wrapper = document.createElement("div");
- wrapper.className = "thin xlarge bright";
+ wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright";
wrapper.appendChild(compliment);
return wrapper;
diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js
index ab48b911..b42ef12a 100644
--- a/modules/default/currentweather/currentweather.js
+++ b/modules/default/currentweather/currentweather.js
@@ -166,7 +166,7 @@ Module.register("currentweather",{
}
if (!this.loaded) {
- wrapper.innerHTML = this.translate('LOADING');
+ wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "dimmed light small";
return wrapper;
}
@@ -323,20 +323,20 @@ Module.register("currentweather",{
// So we need to generate the timestring manually.
// See issue: https://github.com/MichMich/MagicMirror/issues/181
var sunriseSunsetDateObject = (sunrise < now && sunset > now) ? sunset : sunrise;
- var timeString = moment(sunriseSunsetDateObject).format('HH:mm');
+ var timeString = moment(sunriseSunsetDateObject).format("HH:mm");
if (this.config.timeFormat !== 24) {
//var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
if (this.config.showPeriod) {
if (this.config.showPeriodUpper) {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
- timeString = moment(sunriseSunsetDateObject).format('h:mm A');
+ timeString = moment(sunriseSunsetDateObject).format("h:mm A");
} else {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
- timeString = moment(sunriseSunsetDateObject).format('h:mm a');
+ timeString = moment(sunriseSunsetDateObject).format("h:mm a");
}
} else {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
- timeString = moment(sunriseSunsetDateObject).format('h:mm');
+ timeString = moment(sunriseSunsetDateObject).format("h:mm");
}
}
@@ -387,39 +387,39 @@ Module.register("currentweather",{
},
deg2Cardinal: function(deg) {
- if (deg>11.25 && deg<=33.75){
- return "NNE";
- } else if (deg > 33.75 && deg <= 56.25) {
- return "NE";
- } else if (deg > 56.25 && deg <= 78.75) {
- return "ENE";
- } else if (deg > 78.75 && deg <= 101.25) {
- return "E";
- } else if (deg > 101.25 && deg <= 123.75) {
- return "ESE";
- } else if (deg > 123.75 && deg <= 146.25) {
- return "SE";
- } else if (deg > 146.25 && deg <= 168.75) {
- return "SSE";
- } else if (deg > 168.75 && deg <= 191.25) {
- return "S";
- } else if (deg > 191.25 && deg <= 213.75) {
- return "SSW";
- } else if (deg > 213.75 && deg <= 236.25) {
- return "SW";
- } else if (deg > 236.25 && deg <= 258.75) {
- return "WSW";
- } else if (deg > 258.75 && deg <= 281.25) {
- return "W";
- } else if (deg > 281.25 && deg <= 303.75) {
- return "WNW";
- } else if (deg > 303.75 && deg <= 326.25) {
- return "NW";
- } else if (deg > 326.25 && deg <= 348.75) {
- return "NNW";
- } else {
- return "N";
- }
+ if (deg>11.25 && deg<=33.75){
+ return "NNE";
+ } else if (deg > 33.75 && deg <= 56.25) {
+ return "NE";
+ } else if (deg > 56.25 && deg <= 78.75) {
+ return "ENE";
+ } else if (deg > 78.75 && deg <= 101.25) {
+ return "E";
+ } else if (deg > 101.25 && deg <= 123.75) {
+ return "ESE";
+ } else if (deg > 123.75 && deg <= 146.25) {
+ return "SE";
+ } else if (deg > 146.25 && deg <= 168.75) {
+ return "SSE";
+ } else if (deg > 168.75 && deg <= 191.25) {
+ return "S";
+ } else if (deg > 191.25 && deg <= 213.75) {
+ return "SSW";
+ } else if (deg > 213.75 && deg <= 236.25) {
+ return "SW";
+ } else if (deg > 236.25 && deg <= 258.75) {
+ return "WSW";
+ } else if (deg > 258.75 && deg <= 281.25) {
+ return "W";
+ } else if (deg > 281.25 && deg <= 303.75) {
+ return "WNW";
+ } else if (deg > 303.75 && deg <= 326.25) {
+ return "NW";
+ } else if (deg > 326.25 && deg <= 348.75) {
+ return "NNW";
+ } else {
+ return "N";
+ }
},
/* function(temperature)
diff --git a/modules/default/newsfeed/fetcher.js b/modules/default/newsfeed/fetcher.js
index 3b45a3b5..80e58deb 100644
--- a/modules/default/newsfeed/fetcher.js
+++ b/modules/default/newsfeed/fetcher.js
@@ -44,9 +44,9 @@ var Fetcher = function(url, reloadInterval, encoding) {
parser.on("item", function(item) {
var title = item.title;
- var description = item.description || item.summary || item.content || '';
+ var description = item.description || item.summary || item.content || "";
var pubdate = item.pubdate || item.published || item.updated;
- var url = item.url || item.link || '';
+ var url = item.url || item.link || "";
if (title && pubdate) {
diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js
index 7d8d08c7..32fdabdf 100644
--- a/modules/default/newsfeed/newsfeed.js
+++ b/modules/default/newsfeed/newsfeed.js
@@ -25,8 +25,8 @@ Module.register("newsfeed",{
updateInterval: 10 * 1000,
animationSpeed: 2.5 * 1000,
maxNewsItems: 0, // 0 for unlimited
- removeStartTags: '',
- removeEndTags: '',
+ removeStartTags: "",
+ removeEndTags: "",
startTags: [],
endTags: []
@@ -93,33 +93,41 @@ Module.register("newsfeed",{
var sourceAndTimestamp = document.createElement("div");
sourceAndTimestamp.className = "light small dimmed";
- if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '') sourceAndTimestamp.innerHTML = this.newsItems[this.activeItem].sourceTitle;
- if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '' && this.config.showPublishDate) sourceAndTimestamp.innerHTML += ', ';
- if (this.config.showPublishDate) sourceAndTimestamp.innerHTML += moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow();
- if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== '' || this.config.showPublishDate) sourceAndTimestamp.innerHTML += ':';
+ if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "") {
+ sourceAndTimestamp.innerHTML = this.newsItems[this.activeItem].sourceTitle;
+ }
+ if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "" && this.config.showPublishDate) {
+ sourceAndTimestamp.innerHTML += ", ";
+ }
+ if (this.config.showPublishDate) {
+ sourceAndTimestamp.innerHTML += moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow();
+ }
+ if (this.config.showSourceTitle && this.newsItems[this.activeItem].sourceTitle !== "" || this.config.showPublishDate) {
+ sourceAndTimestamp.innerHTML += ":";
+ }
wrapper.appendChild(sourceAndTimestamp);
}
//Remove selected tags from the beginning of rss feed items (title or description)
- if (this.config.removeStartTags == 'title' || 'both') {
+ if (this.config.removeStartTags == "title" || "both") {
for (f=0; f 1 || scale_y > 1)
{
if (scale_x > scale_y)