Merge pull request #915 from rejas/cleanups

Cleanups
This commit is contained in:
Michael Teeuw
2017-06-13 16:53:23 +02:00
committed by GitHub
8 changed files with 18 additions and 28 deletions

View File

@@ -30,7 +30,7 @@ function createWindow() {
zoomFactor: config.zoom zoomFactor: config.zoom
}, },
backgroundColor: "#000000" backgroundColor: "#000000"
} };
// DEPRECATED: "kioskmode" backwards compatibility, to be removed // DEPRECATED: "kioskmode" backwards compatibility, to be removed
// settings these options directly instead provides cleaner interface // settings these options directly instead provides cleaner interface

View File

@@ -165,8 +165,6 @@ var MM = (function() {
if( headerWrapper.length > 0 && newHeader) { if( headerWrapper.length > 0 && newHeader) {
headerWrapper[0].innerHTML = newHeader; headerWrapper[0].innerHTML = newHeader;
} }
}; };
/* hideModule(module, speed, callback) /* hideModule(module, speed, callback)
@@ -219,7 +217,7 @@ var MM = (function() {
// remove lockString if set in options. // remove lockString if set in options.
if (options.lockString) { if (options.lockString) {
var index = module.lockStrings.indexOf(options.lockString) var index = module.lockStrings.indexOf(options.lockString);
if ( index !== -1) { if ( index !== -1) {
module.lockStrings.splice(index, 1); module.lockStrings.splice(index, 1);
} }

View File

@@ -43,7 +43,7 @@ var Server = function(config, callback) {
app.use("/js", express.static(__dirname)); app.use("/js", express.static(__dirname));
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"]; var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
var directory; var directory;
for (i in directories) { for (var i in directories) {
directory = directories[i]; directory = directories[i];
app.use(directory, express.static(path.resolve(global.root_path + directory))); app.use(directory, express.static(path.resolve(global.root_path + directory)));
} }

View File

@@ -174,7 +174,6 @@ Module.register("calendar", {
var titleWrapper = document.createElement("td"), var titleWrapper = document.createElement("td"),
repeatingCountTitle = ""; repeatingCountTitle = "";
if (this.config.displayRepeatingCountTitle) { if (this.config.displayRepeatingCountTitle) {
repeatingCountTitle = this.countTitleForUrl(event.url); repeatingCountTitle = this.countTitleForUrl(event.url);
@@ -496,9 +495,9 @@ Module.register("calendar", {
*/ */
broadcastEvents: function () { broadcastEvents: function () {
var eventList = []; var eventList = [];
for (url in this.calendarData) { for (var url in this.calendarData) {
var calendar = this.calendarData[url]; var calendar = this.calendarData[url];
for (e in calendar) { for (var e in calendar) {
var event = cloneObject(calendar[e]); var event = cloneObject(calendar[e]);
delete event.url; delete event.url;
eventList.push(event); eventList.push(event);

View File

@@ -127,7 +127,6 @@ Module.register("clock",{
hour = ((now.hours() % 12) / 12) * 360 + 90 + minute / 12; hour = ((now.hours() % 12) / 12) * 360 + 90 + minute / 12;
// Create wrappers // Create wrappers
var wrapper = document.createElement("div");
var clockCircle = document.createElement("div"); var clockCircle = document.createElement("div");
clockCircle.className = "clockCircle"; clockCircle.className = "clockCircle";
clockCircle.style.width = this.config.analogSize; clockCircle.style.width = this.config.analogSize;

View File

@@ -115,7 +115,6 @@ Module.register("currentweather",{
var small = document.createElement("div"); var small = document.createElement("div");
small.className = "normal medium"; small.className = "normal medium";
var windIcon = document.createElement("span"); var windIcon = document.createElement("span");
windIcon.className = "wi wi-strong-wind dimmed"; windIcon.className = "wi wi-strong-wind dimmed";
small.appendChild(windIcon); small.appendChild(windIcon);
@@ -247,10 +246,9 @@ Module.register("currentweather",{
if (notification === "CALENDAR_EVENTS") { if (notification === "CALENDAR_EVENTS") {
var senderClasses = sender.data.classes.toLowerCase().split(" "); var senderClasses = sender.data.classes.toLowerCase().split(" ");
if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) { if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) {
var lastEvent = this.firstEvent;
this.firstEvent = false; this.firstEvent = false;
for (e in payload) { for (var e in payload) {
var event = payload[e]; var event = payload[e];
if (event.location || event.geo) { if (event.location || event.geo) {
this.firstEvent = event; this.firstEvent = event;
@@ -348,11 +346,10 @@ Module.register("currentweather",{
if (this.config.useBeaufort){ if (this.config.useBeaufort){
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed)); this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
}else { } else {
this.windSpeed = parseFloat(data.wind.speed).toFixed(0); this.windSpeed = parseFloat(data.wind.speed).toFixed(0);
} }
this.windDirection = this.deg2Cardinal(data.wind.deg); this.windDirection = this.deg2Cardinal(data.wind.deg);
this.windDeg = data.wind.deg; this.windDeg = data.wind.deg;
this.weatherType = this.config.iconTable[data.weather[0].icon]; this.weatherType = this.config.iconTable[data.weather[0].icon];
@@ -385,7 +382,6 @@ Module.register("currentweather",{
this.sunriseSunsetTime = timeString; this.sunriseSunsetTime = timeString;
this.sunriseSunsetIcon = (sunrise < now && sunset > now) ? "wi-sunset" : "wi-sunrise"; this.sunriseSunsetIcon = (sunrise < now && sunset > now) ? "wi-sunset" : "wi-sunrise";
this.show(this.config.animationSpeed, {lockString:this.identifier}); this.show(this.config.animationSpeed, {lockString:this.identifier});
this.loaded = true; this.loaded = true;
this.updateDom(this.config.animationSpeed); this.updateDom(this.config.animationSpeed);

View File

@@ -63,7 +63,7 @@ Module.register("weatherforecast",{
firstEvent: false, firstEvent: false,
// create a variable to hold the location name based on the API result. // create a variable to hold the location name based on the API result.
fetchedLocatioName: "", fetchedLocationName: "",
// Define required scripts. // Define required scripts.
getScripts: function() { getScripts: function() {
@@ -175,7 +175,6 @@ Module.register("weatherforecast",{
row.style.opacity = 1 - (1 / steps * currentStep); row.style.opacity = 1 - (1 / steps * currentStep);
} }
} }
} }
return table; return table;
@@ -184,7 +183,7 @@ Module.register("weatherforecast",{
// Override getHeader method. // Override getHeader method.
getHeader: function() { getHeader: function() {
if (this.config.appendLocationNameToHeader) { if (this.config.appendLocationNameToHeader) {
return this.data.header + " " + this.fetchedLocatioName; return this.data.header + " " + this.fetchedLocationName;
} }
return this.data.header; return this.data.header;
@@ -200,10 +199,9 @@ Module.register("weatherforecast",{
if (notification === "CALENDAR_EVENTS") { if (notification === "CALENDAR_EVENTS") {
var senderClasses = sender.data.classes.toLowerCase().split(" "); var senderClasses = sender.data.classes.toLowerCase().split(" ");
if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) { if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) {
var lastEvent = this.firstEvent;
this.firstEvent = false; this.firstEvent = false;
for (e in payload) { for (var e in payload) {
var event = payload[e]; var event = payload[e];
if (event.location || event.geo) { if (event.location || event.geo) {
this.firstEvent = event; this.firstEvent = event;
@@ -291,7 +289,7 @@ Module.register("weatherforecast",{
* argument data object - Weather information received form openweather.org. * argument data object - Weather information received form openweather.org.
*/ */
processWeather: function(data) { processWeather: function(data) {
this.fetchedLocatioName = data.city.name + ", " + data.city.country; this.fetchedLocationName = data.city.name + ", " + data.city.country;
this.forecast = []; this.forecast = [];
for (var i = 0, count = data.list.length; i < count; i++) { for (var i = 0, count = data.list.length; i < count; i++) {

View File

@@ -38,31 +38,31 @@
"grunt": "latest", "grunt": "latest",
"grunt-eslint": "latest", "grunt-eslint": "latest",
"grunt-jsonlint": "latest", "grunt-jsonlint": "latest",
"grunt-markdownlint": "^1.0.37", "grunt-markdownlint": "^1.0.39",
"grunt-stylelint": "latest", "grunt-stylelint": "latest",
"grunt-yamllint": "latest", "grunt-yamllint": "latest",
"http-auth": "^3.1.3", "http-auth": "^3.1.3",
"jshint": "^2.9.4", "jshint": "^2.9.4",
"mocha": "^3.4.1", "mocha": "^3.4.2",
"spectron": "^3.6.4", "spectron": "^3.6.4",
"stylelint": "^7.10.1", "stylelint": "^7.11.0",
"stylelint-config-standard": "latest", "stylelint-config-standard": "latest",
"time-grunt": "latest" "time-grunt": "latest"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.17.2", "body-parser": "^1.17.2",
"colors": "^1.1.2", "colors": "^1.1.2",
"electron": "^1.6.8", "electron": "^1.6.10",
"express": "^4.15.3", "express": "^4.15.3",
"express-ipfilter": "latest", "express-ipfilter": "latest",
"feedme": "latest", "feedme": "latest",
"helmet": "^3.6.0", "helmet": "^3.6.1",
"iconv-lite": "latest", "iconv-lite": "latest",
"moment": "latest", "moment": "latest",
"request": "^2.81.0", "request": "^2.81.0",
"rrule-alt": "^2.2.5", "rrule-alt": "^2.2.5",
"simple-git": "^1.73.0", "simple-git": "^1.73.0",
"socket.io": "^2.0.1", "socket.io": "^2.0.2",
"valid-url": "latest", "valid-url": "latest",
"walk": "latest" "walk": "latest"
} }