Huge cleanup of white space

This commit is contained in:
Domi-G
2016-04-01 22:52:32 +02:00
committed by Michael Teeuw
parent e448e87252
commit 576c668d84
41 changed files with 127 additions and 175 deletions

View File

@@ -1,6 +1,6 @@
# Module: Calendar
The `calendar` module is one of the default modules of the MagicMirror.
This module displays events from a public .ical calendar. It can combine multiple calendars.
This module displays events from a public .ical calendar. It can combine multiple calendars.
## Using the module
@@ -13,7 +13,7 @@ modules: [
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
}
}
]
@@ -100,7 +100,7 @@ The following properties can be configured:
<td><code>titleReplace</code></td>
<td>An object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title.<br>
<br><b>Example:</b> <br>
<code>
titleReplace: {'Birthday of ' : '', 'foo':'bar'}
</code>
@@ -149,4 +149,4 @@ config: {
</td>
</tr>
</tbody>
</table>
</table>

View File

@@ -20,4 +20,4 @@
.calendar .time {
padding-left: 30px;
text-align: right;
}
}

View File

@@ -14,10 +14,10 @@ Module.register('calendar',{
maximumEntries: 10, // Total Maximum Entries
displaySymbol: true,
defaultSymbol: 'calendar', // Fontawsome Symbol see http://fontawesome.io/cheatsheet/
maxTitleLength: 25,
maxTitleLength: 25,
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
animationSpeed: 2000,
fade: true,
fade: true,
fadePoint: 0.25, // Start on 1/4th of the list.
calendars: [
{
@@ -58,7 +58,7 @@ Module.register('calendar',{
// Override socket notification handler.
socketNotificationReceived: function(notification, payload) {
if (notification === 'CALENDAR_EVENTS') {
if (notification === 'CALENDAR_EVENTS') {
if (this.hasCalendarURL(payload.url)) {
this.calendarData[payload.url] = payload.events;
}
@@ -237,4 +237,4 @@ Module.register('calendar',{
title = this.shorten(title, this.config.maxTitleLength);
return title;
}
});
});

View File

@@ -42,7 +42,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries) {
for (var e in data) {
var event = data[e];
if (event.type === 'VEVENT') {
var startDate = (event.start.length === 8) ? moment(event.start, 'YYYYMMDD') : moment(new Date(event.start));
@@ -62,7 +62,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries) {
rule.timeset[0].minute = startDate.format('m');
rule.timeset[0].second = startDate.format('s');
}
var oneYear = new Date();
oneYear.setFullYear(oneYear.getFullYear() + 1);
@@ -92,7 +92,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries) {
newEvents.sort(function(a,b) {
return a.startDate - b.startDate;
});
events = newEvents.slice(0, maximumEntries);
self.broadcastEvents();
@@ -180,7 +180,7 @@ module.exports = NodeHelper.create({
console.log('Starting node helper for: ' + this.name);
},
// Override socketNotificationReceived method.
@@ -211,7 +211,7 @@ module.exports = NodeHelper.create({
if (typeof self.fetchers[url] === 'undefined') {
console.log('Create new calendar fetcher for url: ' + url + ' - Interval: ' + fetchInterval);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries);
fetcher.onReceive(function(fetcher) {
//console.log('Broadcast events.');
//console.log(fetcher.events());
@@ -239,4 +239,3 @@ module.exports = NodeHelper.create({
fetcher.startFetch();
}
});

View File

@@ -12,7 +12,7 @@ modules: [
position: 'top_left', // This can be any of the regions.
config: {
// The config property is optional.
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
}
}
]

View File

@@ -33,7 +33,7 @@ Module.register('clock',{
// Set locale.
moment.locale(config.language);
},
// Override dom generator.
getDom: function() {
@@ -52,16 +52,15 @@ Module.register('clock',{
dateWrapper.innerHTML = moment().format('dddd, LL');
timeWrapper.innerHTML = moment().format((this.config.timeFormat === 24) ? 'HH:mm' : ('hh:mm'));
secondsWrapper.innerHTML = moment().format('ss');
// Combine wrappers.
wrapper.appendChild(dateWrapper);
wrapper.appendChild(timeWrapper);
if (this.config.displaySeconds) {
timeWrapper.appendChild(secondsWrapper);
}
// Return the wrapper to the dom.
return wrapper;
}
});

View File

@@ -1,6 +1,6 @@
# Module: Compliments
The `compliments` module is one of the default modules of the MagicMirror.
This module displays a random compliment.
This module displays a random compliment.
## Using the module
@@ -14,7 +14,7 @@ modules: [
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
}
}
]
@@ -84,4 +84,4 @@ config: {
]
}
}
````
````

View File

@@ -40,7 +40,7 @@ Module.register('compliments',{
// Define start sequence.
start: function() {
Log.info('Starting module: ' + this.name);
this.lastComplimentIndex = -1;
// Schedule update timer.
@@ -105,19 +105,18 @@ Module.register('compliments',{
var index = this.randomIndex(compliments);
return compliments[index];
},
},
// Override dom generator.
getDom: function() {
var complimentText = this.randomCompliment();
var compliment = document.createTextNode(complimentText);
var compliment = document.createTextNode(complimentText);
var wrapper = document.createElement("div");
wrapper.className = 'thin xlarge bright';
wrapper.appendChild(compliment);
return wrapper;
return wrapper;
}
});
});

View File

@@ -12,7 +12,7 @@ modules: [
position: 'top_right', // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
}
@@ -140,6 +140,6 @@ The following properties can be configured:
}</code>
</td>
</tr>
</tbody>
</table>
</table>

View File

@@ -6,4 +6,4 @@
-ms-transform: translate(0px,-3px); /* IE 9 */
-webkit-transform: translate(0px,-3px); /* Safari */
transform: translate(0px,-3px);
}
}

View File

@@ -65,7 +65,7 @@ Module.register('currentweather',{
// Set locale.
moment.locale(config.language);
this.windSpeed = null;
this.sunriseSunsetTime = null;
this.sunriseSunsetIcon = null;
@@ -76,7 +76,7 @@ Module.register('currentweather',{
this.scheduleUpdate(this.config.initialLoadDelay);
this.updateTimer = null;
},
// Override dom generator.
@@ -110,7 +110,7 @@ Module.register('currentweather',{
small.appendChild(windIcon);
var windSpeed = document.createElement("span");
windSpeed.innerHTML = " " + this.windSpeed;
windSpeed.innerHTML = " " + this.windSpeed;
small.appendChild(windSpeed);
var spacer = document.createElement("span");
@@ -122,7 +122,7 @@ Module.register('currentweather',{
small.appendChild(sunriseSunsetIcon);
var sunriseSunsetTime = document.createElement("span");
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
small.appendChild(sunriseSunsetTime);
var large = document.createElement("div");
@@ -134,7 +134,7 @@ Module.register('currentweather',{
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + '&deg;';
temperature.innerHTML = " " + this.temperature + '&deg;';
large.appendChild(temperature);
wrapper.appendChild(small);
@@ -206,7 +206,7 @@ Module.register('currentweather',{
var now = moment().format('x');
var sunrise = moment(data.sys.sunrise*1000).format('x');
var sunset = moment(data.sys.sunset*1000).format('x');
if (sunrise < now && sunset > now) {
this.sunriseSunsetTime = moment(data.sys.sunset*1000).format((this.config.timeFormat === 24) ? 'HH:mm' : 'hh:mm a');
@@ -230,7 +230,7 @@ Module.register('currentweather',{
var nextLoad = this.config.updateInterval;
if (typeof delay !== 'undefined' && delay >= 0) {
nextLoad = delay;
}
}
var self = this;
setTimeout(function() {
@@ -268,4 +268,3 @@ Module.register('currentweather',{
return parseFloat(temperature).toFixed(1);
}
});

View File

@@ -19,4 +19,4 @@ var defaultModules = [
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = defaultModules;}
if (typeof module !== 'undefined') {module.exports = defaultModules;}

View File

@@ -9,7 +9,7 @@ modules: [
module: 'helloworld',
position: 'bottom_bar', // This can be any of the regions.
config: {
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
text: 'Hello world!',
}
}
@@ -46,6 +46,6 @@ The following properties can be configured:
</td>
</tr>
</tbody>
</table>
</table>

View File

@@ -19,9 +19,8 @@ Module.register('helloworld',{
getDom: function() {
var wrapper = document.createElement("div");
wrapper.className = this.config.classes;
wrapper.innerHTML = this.config.text;
wrapper.innerHTML = this.config.text;
return wrapper;
}
});

View File

@@ -13,7 +13,7 @@ modules: [
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
}
}
]
@@ -40,7 +40,7 @@ The following properties can be configured:
<br><b>Default value:</b> <code>'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'</code>
</td>
</tr>
<tr>
<td><code>showPublishDate</code></td>
<td>Display the publish date of an headline.<br>
@@ -48,7 +48,7 @@ The following properties can be configured:
<br><b>Default value:</b> <code>true</code> or <code>false</code>
</td>
</tr>
<tr>
<td><code>reloadInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>
@@ -70,7 +70,6 @@ The following properties can be configured:
<br><b>Default value:</b> <code>2000</code> (2.5 seconds)
</td>
</tr>
</tbody>
</table>

View File

@@ -5,7 +5,7 @@
* MIT Licensed.
*/
var NewsFetcher = require('./newsfetcher.js');
var NewsFetcher = require('./newsfetcher.js');
/* Fetcher
* Responsible for requesting an update on the set interval and broadcasting the data.
@@ -20,7 +20,7 @@ var Fetcher = function(url, reloadInterval) {
if (reloadInterval < 1000) {
reloadInterval = 1000;
}
var reloadTimer = null;
var items = [];

View File

@@ -14,8 +14,8 @@ Module.register('newsfeed',{
feedUrl: 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml',
showPublishDate: true,
reloadInterval: 5 * 60 * 1000, // every 5 minutes
updateInterval: 7.5 * 1000,
animationSpeed: 2.5 * 1000,
updateInterval: 7.5 * 1000,
animationSpeed: 2.5 * 1000,
},
// Define required scripts.
@@ -29,7 +29,7 @@ Module.register('newsfeed',{
// Set locale.
moment.locale(config.language);
this.newsItems = [];
this.loaded = false;
this.activeItem = 0;
@@ -61,7 +61,7 @@ Module.register('newsfeed',{
}
if (this.newsItems.length > 0) {
if (this.config.showPublishDate) {
var timestamp = document.createElement("div");
timestamp.className = "light small dimmed";
@@ -119,5 +119,3 @@ Module.register('newsfeed',{
return string.charAt(0).toUpperCase() + string.slice(1);
}
});

View File

@@ -6,7 +6,7 @@
*/
var FeedMe = require('feedme');
var request = require('request');
var request = require('request');
var NewsFetcher = function() {
var self = this;
@@ -40,8 +40,8 @@ var NewsFetcher = function() {
* Fetch the new news items.
*
* attribute url string - The url to fetch.
* attribute success function(items) - Callback on succes.
* attribute error function(error) - Callback on error.
* attribute success function(items) - Callback on succes.
* attribute error function(error) - Callback on error.
*/
self.fetchNews = function(url, success, error) {
self.successCallback = success;
@@ -50,4 +50,4 @@ var NewsFetcher = function() {
};
};
module.exports = NewsFetcher;
module.exports = NewsFetcher;

View File

@@ -7,7 +7,7 @@
var NodeHelper = require('node_helper');
var validUrl = require('valid-url');
var Fetcher = require('./fetcher.js');
var Fetcher = require('./fetcher.js');
module.exports = NodeHelper.create({
// Subclass start method.
@@ -44,7 +44,7 @@ module.exports = NodeHelper.create({
if (typeof self.fetchers[url] === 'undefined') {
console.log('Create new news fetcher for url: ' + url + ' - Interval: ' + reloadInterval);
fetcher = new Fetcher(url, reloadInterval);
fetcher.onReceive(function(fetcher) {
self.sendSocketNotification('NEWS_ITEMS', {
url: fetcher.url(),
@@ -70,7 +70,3 @@ module.exports = NodeHelper.create({
fetcher.startFetch();
}
});

View File

@@ -12,7 +12,7 @@ modules: [
position: 'top_right', // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
}
@@ -148,6 +148,6 @@ The following properties can be configured:
}</code>
</td>
</tr>
</tbody>
</table>
</table>

View File

@@ -11,4 +11,4 @@
.weatherforecast .min-temp {
padding-left: 20px;
padding-right: 0px;
}
}

View File

@@ -18,7 +18,7 @@ Module.register('weatherforecast',{
animationSpeed: 1000,
timeFormat: config.timeFormat,
lang: config.language,
fade: true,
fade: true,
fadePoint: 0.25, // Start on 1/4th of the list.
initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy.
@@ -67,7 +67,7 @@ Module.register('weatherforecast',{
// Set locale.
moment.locale(config.language);
this.forecast = [];
this.loaded = false;
this.scheduleUpdate(this.config.initialLoadDelay);
@@ -144,10 +144,10 @@ Module.register('weatherforecast',{
}
}
}
return table;
@@ -238,7 +238,7 @@ Module.register('weatherforecast',{
var nextLoad = this.config.updateInterval;
if (typeof delay !== 'undefined' && delay >= 0) {
nextLoad = delay;
}
}
var self = this;
clearTimeout(this.updateTimer);
@@ -277,4 +277,3 @@ Module.register('weatherforecast',{
return parseFloat(temperature).toFixed(1);
}
});