Skip to content

Commit

Permalink
Merge pull request #31 from MichMich/develop
Browse files Browse the repository at this point in the history
synch to Develop
  • Loading branch information
sdetweil authored Dec 28, 2019
2 parents d74f055 + 0e93713 commit 525c235
Show file tree
Hide file tree
Showing 11 changed files with 1,439 additions and 905 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
dist: trusty
language: node_js
node_js:
- "8"
- "10

before_install:
- npm i -g npm


before_script:
- yarn danger ci
- npm install grunt-cli -g
Expand Down
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

### Added
- move node_helper module to dedicated github repo, to prevent being erased accidentally

- new upgrade script to help users consume regular updates installers/upgrade-script.sh
- new script to help setup pm2, without install installers/fixuppm2.sh

### Updated
- updated compliments.js to handle newline in text, as textfields to not interpolate contents
- updated raspberry.sh installer script to handle new platform issues, split node/npm, pm2, and screen saver changes
- improve handling for armv6l devices, where electron support has gone away, add optional serveronly config option

---
- change electron version

❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror² core.

Expand All @@ -21,12 +23,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added
- Timestamps in log output
- Padding in dateheader mode of the calendar module

### Updated

### Fixed
- Fixed issue in weatherforecast module where predicted amount of rain was not using the decimal symbol specified in config.js.

- Module header now updates correctly, if a module need to dynamically show/hide its header based on a condition.

## [2.9.0] - 2019-10-01

ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`. If you are having issues running Electron, make sure your [Raspbian is up to date](https://www.raspberrypi.org/documentation/raspbian/updating.md).
Expand Down
17 changes: 9 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ var MM = (function() {
dom.opacity = 0;
wrapper.appendChild(dom);

if (typeof module.getHeader() !== "undefined" && module.getHeader() !== "") {
var moduleHeader = document.createElement("header");
moduleHeader.innerHTML = module.getHeader();
moduleHeader.className = "module-header";
dom.appendChild(moduleHeader);
var moduleHeader = document.createElement("header");
moduleHeader.innerHTML = module.getHeader();
moduleHeader.className = "module-header";
dom.appendChild(moduleHeader);

if (typeof module.getHeader() === "undefined" || module.getHeader() !== "") {
moduleHeader.style = "display: none;";
}

var moduleContent = document.createElement("div");
Expand Down Expand Up @@ -210,9 +212,8 @@ var MM = (function() {
contentWrapper[0].innerHTML = "";
contentWrapper[0].appendChild(newContent);

if( headerWrapper.length > 0 && newHeader) {
headerWrapper[0].innerHTML = newHeader;
}
headerWrapper[0].innerHTML = newHeader;
headerWrapper[0].style = headerWrapper.length > 0 && newHeader ? undefined : "display: none;";
};

/* hideModule(module, speed, callback)
Expand Down
2 changes: 1 addition & 1 deletion js/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var Server = function(config, callback) {

console.log("Starting server on port " + port + " ... ");

server.listen(port, config.address ? config.address : null);
server.listen(port, config.address ? config.address : "localhost");

if (config.ipWhitelist instanceof Array && config.ipWhitelist.length === 0) {
console.info(Utils.colors.warn("You're using a full whitelist configuration to allow for all IPs"));
Expand Down
1 change: 1 addition & 0 deletions modules/default/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Module.register("calendar", {

dateCell.colSpan = "3";
dateCell.innerHTML = dateAsString;
dateCell.style.paddingTop = "10px";
dateRow.appendChild(dateCell);
wrapper.appendChild(dateRow);

Expand Down
39 changes: 32 additions & 7 deletions modules/default/compliments/compliments.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ Module.register("compliments", {
morningStartTime: 3,
morningEndTime: 12,
afternoonStartTime: 12,
afternoonEndTime: 17
afternoonEndTime: 17,
random: true
},

lastIndexUsed:-1,
// Set currentweather from module
currentWeatherType: "",

Expand Down Expand Up @@ -147,19 +148,43 @@ Module.register("compliments", {
* return compliment string - A compliment.
*/
randomCompliment: function() {
// get the current time of day compliments list
var compliments = this.complimentArray();
var index = this.randomIndex(compliments);
// variable for index to next message to display
let index=0
// are we randomizing
if(this.config.random){
// yes
index = this.randomIndex(compliments);
}
else{
// no, sequetial
// if doing sequential, don't fall off the end
index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed
}

return compliments[index];
},

// Override dom generator.
// Override dom generator.
getDom: function() {
var complimentText = this.randomCompliment();

var compliment = document.createTextNode(complimentText);
var wrapper = document.createElement("div");
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
// get the compliment text
var complimentText = this.randomCompliment();
// split it into parts on newline text
var parts= complimentText.split('\n')
// create a span to hold it all
var compliment=document.createElement('span')
// process all the parts of the compliment text
for (part of parts){
// create a text element for each part
compliment.appendChild(document.createTextNode(part))
// add a break `
compliment.appendChild(document.createElement('BR'))
}
// remove the last break
compliment.lastElementChild.remove();
wrapper.appendChild(compliment);

return wrapper;
Expand Down
125 changes: 0 additions & 125 deletions modules/node_modules/node_helper/index.js

This file was deleted.

Loading

0 comments on commit 525c235

Please sign in to comment.