Skip to content

Commit

Permalink
first working version
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulx29 committed Mar 18, 2017
1 parent 79067d5 commit 0bff5c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 11 additions & 10 deletions MMM-nasaastropic.js
Expand Up @@ -11,11 +11,11 @@ Module.register('MMM-nasaastropic', {
updateInterval: 6 * 60 * 60 * 1000,
animationSpeed: 0,
header: 'NASA Astronomy Picture',
maxlongedge: 600
maxlongedge: 300
},

getStyles: function () {
return ["MMM-nasaastropic.css"];
return ["nasaastropic.css"];
},

// Define start sequence
Expand All @@ -42,17 +42,18 @@ Module.register('MMM-nasaastropic', {
header.appendChild(name);
wrapper.appendChild(header);

var imgContainer = document.createElement('div');
imgContainer.style.width = 500;
imgContainer.style.height = 500;
imgContainer.style.background = gray;
wrapper.appendChild(imgContainer);
/*var imgContainer = document.createElement('div');
imgContainer.style.width = "500px";
imgContainer.style.height = "500px";
imgContainer.style.background = "gray";
//imgContainer.innerHTML = this.img_src;
wrapper.appendChild(imgContainer);*/

var img = document.createElement('img');
img.style.maxwidth = '100%';
img.style.height = 'auto';
img.style = "max-width: " + this.config.maxlongedge + "px; max-height: " + this.config.maxlongedge + "px";
img.src = this.img_src;
imgContainer.appendChild(img);
img.alt = this.img_src;
wrapper.appendChild(img);

return wrapper;
},
Expand Down
3 changes: 3 additions & 0 deletions node_helper.js 100755 → 100644
Expand Up @@ -6,6 +6,7 @@
*/

const NodeHelper = require('node_helper');
var async = require('async');
const request = require('request');
const cheerio = require("cheerio");

Expand All @@ -22,10 +23,12 @@ module.exports = NodeHelper.create({
// Subclass socketNotificationReceived received.
socketNotificationReceived: function(notification, payload) {
if (notification === 'CONFIG') {
console.log('astro helper: config received');
var self = this;
this.config = payload;
self.retrieveAndUpdate();
setInterval(function() {
console.log("astro helper retrieveAndUpdate()");
self.retrieveAndUpdate();
}, this.config.updateInterval);
}
Expand Down

0 comments on commit 0bff5c5

Please sign in to comment.