Run linter manually

This commit is contained in:
rejas 2020-02-13 08:35:09 +01:00
parent ef7720ff06
commit 5517a913d4
4 changed files with 12 additions and 12 deletions

View File

@ -24,7 +24,7 @@ var config = {
useHttps: false, // Support HTTPS or not, default "false" will use HTTP useHttps: false, // Support HTTPS or not, default "false" will use HTTP
httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true
language: "en", language: "en",
timeFormat: 24, timeFormat: 24,
units: "metric", units: "metric",

View File

@ -25,13 +25,13 @@ var Server = function(config, callback) {
var options = { var options = {
key: fs.readFileSync(config.httpsPrivateKey), key: fs.readFileSync(config.httpsPrivateKey),
cert: fs.readFileSync(config.httpsCertificate) cert: fs.readFileSync(config.httpsCertificate)
} };
server = require("https").Server(options, app); server = require("https").Server(options, app);
}else{ }else{
server = require("http").Server(app); server = require("http").Server(app);
} }
var io = require("socket.io")(server); var io = require("socket.io")(server);
console.log("Starting server on port " + port + " ... "); console.log("Starting server on port " + port + " ... ");
server.listen(port, config.address ? config.address : "localhost"); server.listen(port, config.address ? config.address : "localhost");

View File

@ -152,9 +152,9 @@ Module.register("clock",{
} }
function formatTime(config, time) { function formatTime(config, time) {
var formatString = hourSymbol + ':mm'; var formatString = hourSymbol + ":mm";
if (config.showPeriod && config.timeFormat !== 24) { if (config.showPeriod && config.timeFormat !== 24) {
formatString += config.showPeriodUpper ? 'A' : 'a'; formatString += config.showPeriodUpper ? "A" : "a";
} }
return moment(time).format(formatString); return moment(time).format(formatString);
} }
@ -167,14 +167,14 @@ Module.register("clock",{
} else if (now.isBefore(sunTimes.sunset)) { } else if (now.isBefore(sunTimes.sunset)) {
nextEvent = sunTimes.sunset; nextEvent = sunTimes.sunset;
} else { } else {
const tomorrowSunTimes = SunCalc.getTimes(now.clone().add(1, 'day'), this.config.lat, this.config.lon); const tomorrowSunTimes = SunCalc.getTimes(now.clone().add(1, "day"), this.config.lat, this.config.lon);
nextEvent = tomorrowSunTimes.sunrise; nextEvent = tomorrowSunTimes.sunrise;
} }
const untilNextEvent = moment.duration(moment(nextEvent).diff(now)); const untilNextEvent = moment.duration(moment(nextEvent).diff(now));
const untilNextEventString = untilNextEvent.hours() + 'h ' + untilNextEvent.minutes() + 'm'; const untilNextEventString = untilNextEvent.hours() + "h " + untilNextEvent.minutes() + "m";
sunWrapper.innerHTML = '<span class="' + (isVisible ? 'bright' : '') + '"><i class="fa fa-sun-o" aria-hidden="true"></i> ' + untilNextEventString + '</span>' + sunWrapper.innerHTML = "<span class=\"" + (isVisible ? "bright" : "") + "\"><i class=\"fa fa-sun-o\" aria-hidden=\"true\"></i> " + untilNextEventString + "</span>" +
'<span><i class="fa fa-arrow-up" aria-hidden="true"></i>' + formatTime(this.config, sunTimes.sunrise) + '</span>' + "<span><i class=\"fa fa-arrow-up\" aria-hidden=\"true\"></i>" + formatTime(this.config, sunTimes.sunrise) + "</span>" +
'<span><i class="fa fa-arrow-down" aria-hidden="true"></i>' + formatTime(this.config, sunTimes.sunset) + '</span>'; "<span><i class=\"fa fa-arrow-down\" aria-hidden=\"true\"></i>" + formatTime(this.config, sunTimes.sunset) + "</span>";
} }
if (this.config.showMoonTimes) { if (this.config.showMoonTimes) {
const moonIllumination = SunCalc.getMoonIllumination(now.toDate()); const moonIllumination = SunCalc.getMoonIllumination(now.toDate());
@ -184,7 +184,7 @@ Module.register("clock",{
if (moment(moonTimes.set).isAfter(moonTimes.rise)) { if (moment(moonTimes.set).isAfter(moonTimes.rise)) {
moonSet = moonTimes.set; moonSet = moonTimes.set;
} else { } else {
const nextMoonTimes = SunCalc.getMoonTimes(now.clone().add(1, 'day'), this.config.lat, this.config.lon); const nextMoonTimes = SunCalc.getMoonTimes(now.clone().add(1, "day"), this.config.lat, this.config.lon);
moonSet = nextMoonTimes.set; moonSet = nextMoonTimes.set;
} }
const isVisible = now.isBetween(moonRise, moonSet) || moonTimes.alwaysUp === true; const isVisible = now.isBetween(moonRise, moonSet) || moonTimes.alwaysUp === true;

View File

@ -13,7 +13,7 @@ function plugin (wdInstance, requests) {
this.send = function () { this.send = function () {
this.status = 200; this.status = 200;
this.readyState = 4; this.readyState = 4;
const response = this.url.includes('.njk') ? template : data; const response = this.url.includes(".njk") ? template : data;
this.response = response; this.response = response;
this.responseText = response; this.responseText = response;
this.onreadystatechange(); this.onreadystatechange();