mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 13:24:06 +00:00
Standardize: TO JSCS!
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('alert',{
|
||||
Module.register("alert",{
|
||||
defaults: {
|
||||
// scale|slide|genie|jelly|flip|bouncyflip|exploader
|
||||
effect: "slide",
|
||||
// scale|slide|genie|jelly|flip|bouncyflip|exploader
|
||||
alert_effect:"jelly",
|
||||
alert_effect: "jelly",
|
||||
//time a notification is displayed in seconds
|
||||
display_time: 3500,
|
||||
//Position
|
||||
@@ -21,100 +21,97 @@ Module.register('alert',{
|
||||
welcome_message: "Welcome, start was successfull!"
|
||||
},
|
||||
getScripts: function() {
|
||||
return ["classie.js", "modernizr.custom.js", 'notificationFx.js'];
|
||||
return ["classie.js", "modernizr.custom.js", "notificationFx.js"];
|
||||
},
|
||||
getStyles: function() {
|
||||
return ['ns-default.css'];
|
||||
return ["ns-default.css"];
|
||||
},
|
||||
show_notification: function (message) {
|
||||
if (this.config.effect == "slide"){this.config.effect=this.config.effect + "-" + this.config.position}
|
||||
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>"
|
||||
show_notification: function(message) {
|
||||
if (this.config.effect == "slide") {this.config.effect = this.config.effect + "-" + this.config.position;}
|
||||
message = "<span class='thin' style='line-height: 35px; font-size:24px' color='#4A4A4A'>" + message.title + "</span><br /><span class='light' style='font-size:28px;line-height: 30px;'>" + message.message + "</span>";
|
||||
new NotificationFx({
|
||||
message : message,
|
||||
layout : "growl",
|
||||
effect : this.config.effect,
|
||||
message: message,
|
||||
layout: "growl",
|
||||
effect: this.config.effect,
|
||||
ttl: this.config.display_time
|
||||
}).show();
|
||||
},
|
||||
show_alert: function (params, sender) {
|
||||
var self = this
|
||||
show_alert: function(params, sender) {
|
||||
var self = this;
|
||||
//Set standard params if not provided by module
|
||||
if (typeof params.timer === 'undefined') { params.timer = null; }
|
||||
if (typeof params.imageHeight === 'undefined') { params.imageHeight = "80px"; }
|
||||
if (typeof params.imageUrl === 'undefined') {
|
||||
if (typeof params.timer === "undefined") { params.timer = null; }
|
||||
if (typeof params.imageHeight === "undefined") { params.imageHeight = "80px"; }
|
||||
if (typeof params.imageUrl === "undefined") {
|
||||
params.imageUrl = null;
|
||||
image = ""
|
||||
}
|
||||
else {
|
||||
image = "<img src='" + params["imageUrl"] + "' height=" + params.imageHeight + " style='margin-bottom: 10px;'/><br />"
|
||||
image = "";
|
||||
} else {
|
||||
image = "<img src='" + (params.imageUrl).toString() + "' height=" + (params.imageHeight).toString() + " style='margin-bottom: 10px;'/><br />";
|
||||
}
|
||||
//Create overlay
|
||||
var overlay = document.createElement("div");
|
||||
overlay.id = "overlay"
|
||||
overlay.innerHTML += '<div class="black_overlay"></div>';
|
||||
overlay.id = "overlay";
|
||||
overlay.innerHTML += "<div class=\"black_overlay\"></div>";
|
||||
document.body.insertBefore(overlay, document.body.firstChild);
|
||||
|
||||
|
||||
//If module already has an open alert close it
|
||||
if (this.alerts[sender.name]){
|
||||
this.hide_alert(sender)
|
||||
if (this.alerts[sender.name]) {
|
||||
this.hide_alert(sender);
|
||||
}
|
||||
|
||||
message = "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span><br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>"
|
||||
|
||||
message = "<span class='light' style='line-height: 35px; font-size:30px' color='#4A4A4A'>" + params.title + "</span><br /><span class='thin' style='font-size:22px;line-height: 30px;'>" + params.message + "</span>";
|
||||
//Store alert in this.alerts
|
||||
this.alerts[sender.name] = new NotificationFx({
|
||||
message : image + message,
|
||||
effect : this.config.alert_effect,
|
||||
message: image + message,
|
||||
effect: this.config.alert_effect,
|
||||
ttl: params.timer,
|
||||
al_no: "ns-alert"
|
||||
});
|
||||
//Show alert
|
||||
this.alerts[sender.name].show()
|
||||
this.alerts[sender.name].show();
|
||||
//Add timer to dismiss alert and overlay
|
||||
if (params.timer) {
|
||||
setTimeout( function() {
|
||||
self.hide_alert(sender)
|
||||
}, params.timer );
|
||||
setTimeout(function() {
|
||||
self.hide_alert(sender);
|
||||
}, params.timer);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
hide_alert: function (sender) {
|
||||
hide_alert: function(sender) {
|
||||
//Dismiss alert and remove from this.alerts
|
||||
this.alerts[sender.name].dismiss()
|
||||
this.alerts[sender.name] = null
|
||||
this.alerts[sender.name].dismiss();
|
||||
this.alerts[sender.name] = null;
|
||||
//Remove overlay
|
||||
var overlay = document.getElementById("overlay");
|
||||
overlay.parentNode.removeChild(overlay);
|
||||
},
|
||||
setPosition: function (pos) {
|
||||
setPosition: function(pos) {
|
||||
//Add css to body depending on the set position for notifications
|
||||
var sheet = document.createElement('style')
|
||||
if (pos == "center"){sheet.innerHTML = ".ns-box {margin-left: auto; margin-right: auto;text-align: center;}";}
|
||||
if (pos == "right"){sheet.innerHTML = ".ns-box {margin-left: auto;text-align: right;}";}
|
||||
if (pos == "left"){sheet.innerHTML = ".ns-box {margin-right: auto;text-align: left;}";}
|
||||
var sheet = document.createElement("style");
|
||||
if (pos == "center") {sheet.innerHTML = ".ns-box {margin-left: auto; margin-right: auto;text-align: center;}";}
|
||||
if (pos == "right") {sheet.innerHTML = ".ns-box {margin-left: auto;text-align: right;}";}
|
||||
if (pos == "left") {sheet.innerHTML = ".ns-box {margin-right: auto;text-align: left;}";}
|
||||
document.body.appendChild(sheet);
|
||||
|
||||
|
||||
},
|
||||
notificationReceived: function(notification, payload, sender) {
|
||||
if (notification === 'SHOW_ALERT') {
|
||||
if (typeof payload.type === 'undefined') { payload.type = "alert"; }
|
||||
if (payload.type == "alert"){
|
||||
this.show_alert(payload, sender)
|
||||
if (notification === "SHOW_ALERT") {
|
||||
if (typeof payload.type === "undefined") { payload.type = "alert"; }
|
||||
if (payload.type == "alert") {
|
||||
this.show_alert(payload, sender);
|
||||
} else if (payload.type = "notification") {
|
||||
this.show_notification(payload);
|
||||
}
|
||||
else if (payload.type = "notification"){
|
||||
this.show_notification(payload)
|
||||
}
|
||||
}
|
||||
else if (notification === 'HIDE_ALERT') {
|
||||
this.hide_alert(sender)
|
||||
} else if (notification === "HIDE_ALERT") {
|
||||
this.hide_alert(sender);
|
||||
}
|
||||
},
|
||||
start: function() {
|
||||
this.alerts = {}
|
||||
this.setPosition(this.config.position)
|
||||
if (this.config.welcome_message){
|
||||
this.show_notification({title: "MagicMirror Notification", message: this.config.welcome_message})
|
||||
this.alerts = {};
|
||||
this.setPosition(this.config.position);
|
||||
if (this.config.welcome_message) {
|
||||
this.show_notification({title: "MagicMirror Notification", message: this.config.welcome_message});
|
||||
}
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
@@ -1,80 +1,79 @@
|
||||
/*!
|
||||
* classie - class helper functions
|
||||
* from bonzo https://github.com/ded/bonzo
|
||||
*
|
||||
*
|
||||
* classie.has( elem, 'my-class' ) -> true/false
|
||||
* classie.add( elem, 'my-new-class' )
|
||||
* classie.remove( elem, 'my-unwanted-class' )
|
||||
* classie.toggle( elem, 'my-class' )
|
||||
*/
|
||||
|
||||
// jscs:disable
|
||||
/*jshint browser: true, strict: true, undef: true */
|
||||
/*global define: false */
|
||||
|
||||
( function( window ) {
|
||||
(function(window) {
|
||||
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
// class helper functions from bonzo https://github.com/ded/bonzo
|
||||
|
||||
function classReg( className ) {
|
||||
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
|
||||
function classReg(className) {
|
||||
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
|
||||
}
|
||||
|
||||
// classList support for class management
|
||||
// altho to be fair, the api sucks because it won't accept multiple classes at once
|
||||
var hasClass, addClass, removeClass;
|
||||
|
||||
if ( 'classList' in document.documentElement ) {
|
||||
hasClass = function( elem, c ) {
|
||||
return elem.classList.contains( c );
|
||||
};
|
||||
addClass = function( elem, c ) {
|
||||
elem.classList.add( c );
|
||||
};
|
||||
removeClass = function( elem, c ) {
|
||||
elem.classList.remove( c );
|
||||
};
|
||||
}
|
||||
else {
|
||||
hasClass = function( elem, c ) {
|
||||
return classReg( c ).test( elem.className );
|
||||
};
|
||||
addClass = function( elem, c ) {
|
||||
if ( !hasClass( elem, c ) ) {
|
||||
elem.className = elem.className + ' ' + c;
|
||||
}
|
||||
};
|
||||
removeClass = function( elem, c ) {
|
||||
elem.className = elem.className.replace( classReg( c ), ' ' );
|
||||
};
|
||||
if ("classList" in document.documentElement) {
|
||||
hasClass = function(elem, c) {
|
||||
return elem.classList.contains(c);
|
||||
};
|
||||
addClass = function(elem, c) {
|
||||
elem.classList.add(c);
|
||||
};
|
||||
removeClass = function(elem, c) {
|
||||
elem.classList.remove(c);
|
||||
};
|
||||
} else {
|
||||
hasClass = function(elem, c) {
|
||||
return classReg(c).test(elem.className);
|
||||
};
|
||||
addClass = function(elem, c) {
|
||||
if (!hasClass(elem, c)) {
|
||||
elem.className = elem.className + " " + c;
|
||||
}
|
||||
};
|
||||
removeClass = function(elem, c) {
|
||||
elem.className = elem.className.replace(classReg(c), " ");
|
||||
};
|
||||
}
|
||||
|
||||
function toggleClass( elem, c ) {
|
||||
var fn = hasClass( elem, c ) ? removeClass : addClass;
|
||||
fn( elem, c );
|
||||
function toggleClass(elem, c) {
|
||||
var fn = hasClass(elem, c) ? removeClass : addClass;
|
||||
fn(elem, c);
|
||||
}
|
||||
|
||||
var classie = {
|
||||
// full names
|
||||
hasClass: hasClass,
|
||||
addClass: addClass,
|
||||
removeClass: removeClass,
|
||||
toggleClass: toggleClass,
|
||||
// short names
|
||||
has: hasClass,
|
||||
add: addClass,
|
||||
remove: removeClass,
|
||||
toggle: toggleClass
|
||||
// full names
|
||||
hasClass: hasClass,
|
||||
addClass: addClass,
|
||||
removeClass: removeClass,
|
||||
toggleClass: toggleClass,
|
||||
// short names
|
||||
has: hasClass,
|
||||
add: addClass,
|
||||
remove: removeClass,
|
||||
toggle: toggleClass
|
||||
};
|
||||
|
||||
// transport
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( classie );
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// AMD
|
||||
define(classie);
|
||||
} else {
|
||||
// browser global
|
||||
window.classie = classie;
|
||||
// browser global
|
||||
window.classie = classie;
|
||||
}
|
||||
|
||||
})( window );
|
||||
})(window);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -4,31 +4,32 @@
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
*
|
||||
* Copyright 2014, Codrops
|
||||
* http://www.codrops.com
|
||||
*/
|
||||
;( function( window ) {
|
||||
|
||||
'use strict';
|
||||
// jscs:disable
|
||||
;(function(window) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var docElem = window.document.documentElement,
|
||||
support = { animations : Modernizr.cssanimations },
|
||||
support = {animations: Modernizr.cssanimations},
|
||||
animEndEventNames = {
|
||||
'WebkitAnimation' : 'webkitAnimationEnd',
|
||||
'OAnimation' : 'oAnimationEnd',
|
||||
'msAnimation' : 'MSAnimationEnd',
|
||||
'animation' : 'animationend'
|
||||
"WebkitAnimation": "webkitAnimationEnd",
|
||||
"OAnimation": "oAnimationEnd",
|
||||
"msAnimation": "MSAnimationEnd",
|
||||
"animation": "animationend"
|
||||
},
|
||||
// animation end event name
|
||||
animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ];
|
||||
|
||||
animEndEventName = animEndEventNames[ Modernizr.prefixed("animation") ];
|
||||
|
||||
/**
|
||||
* extend obj function
|
||||
*/
|
||||
function extend( a, b ) {
|
||||
for( var key in b ) {
|
||||
if( b.hasOwnProperty( key ) ) {
|
||||
function extend(a, b) {
|
||||
for (var key in b) {
|
||||
if (b.hasOwnProperty(key)) {
|
||||
a[key] = b[key];
|
||||
}
|
||||
}
|
||||
@@ -38,9 +39,9 @@
|
||||
/**
|
||||
* NotificationFx function
|
||||
*/
|
||||
function NotificationFx( options ) {
|
||||
this.options = extend( {}, this.options );
|
||||
extend( this.options, options );
|
||||
function NotificationFx(options) {
|
||||
this.options = extend({}, this.options);
|
||||
extend(this.options, options);
|
||||
this._init();
|
||||
}
|
||||
|
||||
@@ -50,28 +51,28 @@
|
||||
NotificationFx.prototype.options = {
|
||||
// element to which the notification will be appended
|
||||
// defaults to the document.body
|
||||
wrapper : document.body,
|
||||
wrapper: document.body,
|
||||
// the message
|
||||
message : 'yo!',
|
||||
message: "yo!",
|
||||
// layout type: growl|attached|bar|other
|
||||
layout : 'growl',
|
||||
layout: "growl",
|
||||
// effects for the specified layout:
|
||||
// for growl layout: scale|slide|genie|jelly
|
||||
// for attached layout: flip|bouncyflip
|
||||
// for other layout: boxspinner|cornerexpand|loadingcircle|thumbslider
|
||||
// ...
|
||||
effect : 'slide',
|
||||
effect: "slide",
|
||||
// notice, warning, error, success
|
||||
// will add class ns-type-warning, ns-type-error or ns-type-success
|
||||
type : 'notice',
|
||||
// if the user doesn´t close the notification then we remove it
|
||||
type: "notice",
|
||||
// if the user doesn´t close the notification then we remove it
|
||||
// after the following time
|
||||
ttl : 6000,
|
||||
ttl: 6000,
|
||||
al_no: "ns-box",
|
||||
// callbacks
|
||||
onClose : function() { return false; },
|
||||
onOpen : function() { return false; }
|
||||
}
|
||||
onClose: function() { return false; },
|
||||
onOpen: function() { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
* init function
|
||||
@@ -79,29 +80,29 @@
|
||||
*/
|
||||
NotificationFx.prototype._init = function() {
|
||||
// create HTML structure
|
||||
this.ntf = document.createElement( 'div' );
|
||||
this.ntf.className = this.options.al_no + ' ns-' + this.options.layout + ' ns-effect-' + this.options.effect + ' ns-type-' + this.options.type;
|
||||
var strinner = '<div class="ns-box-inner">';
|
||||
this.ntf = document.createElement("div");
|
||||
this.ntf.className = this.options.al_no + " ns-" + this.options.layout + " ns-effect-" + this.options.effect + " ns-type-" + this.options.type;
|
||||
var strinner = "<div class=\"ns-box-inner\">";
|
||||
strinner += this.options.message;
|
||||
strinner += '</div>';
|
||||
strinner += "</div>";
|
||||
this.ntf.innerHTML = strinner;
|
||||
|
||||
// append to body or the element specified in options.wrapper
|
||||
this.options.wrapper.insertBefore( this.ntf, this.options.wrapper.nextSibling );
|
||||
this.options.wrapper.insertBefore(this.ntf, this.options.wrapper.nextSibling);
|
||||
|
||||
// dismiss after [options.ttl]ms
|
||||
var self = this;
|
||||
if (this.options.ttl){
|
||||
this.dismissttl = setTimeout( function() {
|
||||
if( self.active ) {
|
||||
if (this.options.ttl) {
|
||||
this.dismissttl = setTimeout(function() {
|
||||
if (self.active) {
|
||||
self.dismiss();
|
||||
}
|
||||
}, this.options.ttl );
|
||||
}, this.options.ttl);
|
||||
}
|
||||
|
||||
// init events
|
||||
this._initEvents();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* init events
|
||||
@@ -109,18 +110,18 @@
|
||||
NotificationFx.prototype._initEvents = function() {
|
||||
var self = this;
|
||||
// dismiss notification by tapping on it if someone has a touchscreen
|
||||
this.ntf.querySelector( '.ns-box-inner' ).addEventListener( 'click', function() { self.dismiss(); } );
|
||||
}
|
||||
this.ntf.querySelector(".ns-box-inner").addEventListener("click", function() { self.dismiss(); });
|
||||
};
|
||||
|
||||
/**
|
||||
* show the notification
|
||||
*/
|
||||
NotificationFx.prototype.show = function() {
|
||||
this.active = true;
|
||||
classie.remove( this.ntf, 'ns-hide' );
|
||||
classie.add( this.ntf, 'ns-show' );
|
||||
classie.remove(this.ntf, "ns-hide");
|
||||
classie.add(this.ntf, "ns-show");
|
||||
this.options.onOpen();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* dismiss the notification
|
||||
@@ -128,35 +129,34 @@
|
||||
NotificationFx.prototype.dismiss = function() {
|
||||
var self = this;
|
||||
this.active = false;
|
||||
clearTimeout( this.dismissttl );
|
||||
classie.remove( this.ntf, 'ns-show' );
|
||||
setTimeout( function() {
|
||||
classie.add( self.ntf, 'ns-hide' );
|
||||
|
||||
clearTimeout(this.dismissttl);
|
||||
classie.remove(this.ntf, "ns-show");
|
||||
setTimeout(function() {
|
||||
classie.add(self.ntf, "ns-hide");
|
||||
|
||||
// callback
|
||||
self.options.onClose();
|
||||
}, 25 );
|
||||
}, 25);
|
||||
|
||||
// after animation ends remove ntf from the DOM
|
||||
var onEndAnimationFn = function( ev ) {
|
||||
if( support.animations ) {
|
||||
if( ev.target !== self.ntf ) return false;
|
||||
this.removeEventListener( animEndEventName, onEndAnimationFn );
|
||||
var onEndAnimationFn = function(ev) {
|
||||
if (support.animations) {
|
||||
if (ev.target !== self.ntf) return false;
|
||||
this.removeEventListener(animEndEventName, onEndAnimationFn);
|
||||
}
|
||||
self.options.wrapper.removeChild( this );
|
||||
self.options.wrapper.removeChild(this);
|
||||
};
|
||||
|
||||
if( support.animations ) {
|
||||
this.ntf.addEventListener( animEndEventName, onEndAnimationFn );
|
||||
}
|
||||
else {
|
||||
if (support.animations) {
|
||||
this.ntf.addEventListener(animEndEventName, onEndAnimationFn);
|
||||
} else {
|
||||
onEndAnimationFn();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* add to global namespace
|
||||
*/
|
||||
window.NotificationFx = NotificationFx;
|
||||
|
||||
} )( window );
|
||||
})(window);
|
||||
|
@@ -7,55 +7,55 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('calendar',{
|
||||
Module.register("calendar",{
|
||||
|
||||
// Define module defaults
|
||||
defaults: {
|
||||
maximumEntries: 10, // Total Maximum Entries
|
||||
maximumNumberOfDays: 365,
|
||||
displaySymbol: true,
|
||||
defaultSymbol: 'calendar', // Fontawsome Symbol see http://fontawesome.io/cheatsheet/
|
||||
defaultSymbol: "calendar", // Fontawsome Symbol see http://fontawesome.io/cheatsheet/
|
||||
maxTitleLength: 25,
|
||||
fetchInterval: 5 * 60 * 1000, // Update every 5 minutes.
|
||||
animationSpeed: 2000,
|
||||
fade: true,
|
||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||
calendars: [
|
||||
calendars: [
|
||||
{
|
||||
symbol: 'calendar',
|
||||
url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics',
|
||||
symbol: "calendar",
|
||||
url: "http://www.calendarlabs.com/templates/ical/US-Holidays.ics",
|
||||
},
|
||||
],
|
||||
titleReplace: {
|
||||
'De verjaardag van ' : ''
|
||||
"De verjaardag van ": ""
|
||||
},
|
||||
loadingText: 'Loading events …',
|
||||
emptyCalendarText: 'No upcoming events.',
|
||||
loadingText: "Loading events …",
|
||||
emptyCalendarText: "No upcoming events.",
|
||||
|
||||
// TODO: It would be nice if there is a way to get this from the Moment.js locale.
|
||||
todayText: 'Today'
|
||||
todayText: "Today"
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getStyles: function() {
|
||||
return ['calendar.css', 'font-awesome.css'];
|
||||
return ["calendar.css", "font-awesome.css"];
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Override start method.
|
||||
start: function() {
|
||||
Log.log('Starting module: ' + this.name);
|
||||
Log.log("Starting module: " + this.name);
|
||||
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
|
||||
for (var c in this.config.calendars) {
|
||||
var calendar = this.config.calendars[c];
|
||||
calendar.url = calendar.url.replace('webcal://', 'http://');
|
||||
calendar.url = calendar.url.replace("webcal://", "http://");
|
||||
this.addCalendar(calendar.url);
|
||||
}
|
||||
|
||||
@@ -65,17 +65,17 @@ 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;
|
||||
this.loaded = true;
|
||||
}
|
||||
} else if(notification === 'FETCH_ERROR') {
|
||||
Log.error('Calendar Error. Could not fetch calendar: ' + payload.url);
|
||||
} else if(notification === 'INCORRECT_URL') {
|
||||
Log.error('Calendar Error. Incorrect url: ' + payload.url);
|
||||
} else if (notification === "FETCH_ERROR") {
|
||||
Log.error("Calendar Error. Could not fetch calendar: " + payload.url);
|
||||
} else if (notification === "INCORRECT_URL") {
|
||||
Log.error("Calendar Error. Incorrect url: " + payload.url);
|
||||
} else {
|
||||
Log.log('Calendar received an unknown socket notification: '+notification);
|
||||
Log.log("Calendar received an unknown socket notification: " + notification);
|
||||
}
|
||||
|
||||
this.updateDom(this.config.animationSpeed);
|
||||
@@ -115,7 +115,7 @@ Module.register('calendar',{
|
||||
eventWrapper.appendChild(titleWrapper);
|
||||
|
||||
var timeWrapper = document.createElement("td");
|
||||
timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,'x').fromNow();
|
||||
timeWrapper.innerHTML = (event.today) ? this.config.todayText : moment(event.startDate,"x").fromNow();
|
||||
// timeWrapper.innerHTML = moment(event.startDate,'x').format('lll');
|
||||
timeWrapper.className = "time light";
|
||||
eventWrapper.appendChild(timeWrapper);
|
||||
@@ -164,7 +164,7 @@ Module.register('calendar',{
|
||||
*/
|
||||
createEventList: function() {
|
||||
var events = [];
|
||||
var today = moment().startOf('day');
|
||||
var today = moment().startOf("day");
|
||||
for (var c in this.calendarData) {
|
||||
var calendar = this.calendarData[c];
|
||||
for (var e in calendar) {
|
||||
@@ -175,7 +175,7 @@ Module.register('calendar',{
|
||||
}
|
||||
}
|
||||
|
||||
events.sort(function(a,b) {
|
||||
events.sort(function(a, b) {
|
||||
return a.startDate - b.startDate;
|
||||
});
|
||||
|
||||
@@ -188,7 +188,7 @@ Module.register('calendar',{
|
||||
* argument url sting - Url to add.
|
||||
*/
|
||||
addCalendar: function(url) {
|
||||
this.sendSocketNotification('ADD_CALENDAR', {
|
||||
this.sendSocketNotification("ADD_CALENDAR", {
|
||||
url: url,
|
||||
maximumEntries: this.config.maximumEntries,
|
||||
maximumNumberOfDays: this.config.maximumNumberOfDays,
|
||||
@@ -206,7 +206,7 @@ Module.register('calendar',{
|
||||
symbolForUrl: function(url) {
|
||||
for (var c in this.config.calendars) {
|
||||
var calendar = this.config.calendars[c];
|
||||
if (calendar.url === url && typeof calendar.symbol === 'string') {
|
||||
if (calendar.url === url && typeof calendar.symbol === "string") {
|
||||
return calendar.symbol;
|
||||
}
|
||||
}
|
||||
|
@@ -5,10 +5,10 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var NodeHelper = require('node_helper');
|
||||
var ical = require('ical');
|
||||
var moment = require('moment');
|
||||
var validUrl = require('valid-url');
|
||||
var NodeHelper = require("node_helper");
|
||||
var ical = require("ical");
|
||||
var moment = require("moment");
|
||||
var validUrl = require("valid-url");
|
||||
|
||||
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays) {
|
||||
var self = this;
|
||||
@@ -27,7 +27,6 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
clearTimeout(reloadTimer);
|
||||
reloadTimer = null;
|
||||
|
||||
|
||||
ical.fromURL(url, {}, function(err, data) {
|
||||
if (err) {
|
||||
fetchFailedCallback(self, err);
|
||||
@@ -38,66 +37,65 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
//console.log(data);
|
||||
newEvents = [];
|
||||
|
||||
var limitFunction = function (date, i){return i < maximumEntries;};
|
||||
var limitFunction = function(date, i) {return i < maximumEntries;};
|
||||
|
||||
for (var e in data) {
|
||||
var event = data[e];
|
||||
var now = new Date();
|
||||
var today = moment().startOf('day');
|
||||
var today = moment().startOf("day");
|
||||
|
||||
//console.log(event);
|
||||
|
||||
// FIXME:
|
||||
// FIXME:
|
||||
// Ugly fix to solve the facebook birthday issue.
|
||||
// Otherwise, the recurring events only show the birthday for next year.
|
||||
var isFacebookBirthday = false;
|
||||
if (typeof event.uid !== 'undefined') {
|
||||
if (event.uid.indexOf('@facebook.com') !== -1) {
|
||||
if (typeof event.uid !== "undefined") {
|
||||
if (event.uid.indexOf("@facebook.com") !== -1) {
|
||||
isFacebookBirthday = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.type === 'VEVENT') {
|
||||
var startDate = (event.start.length === 8) ? moment(event.start, 'YYYYMMDD') : moment(new Date(event.start));
|
||||
if (event.type === "VEVENT") {
|
||||
var startDate = (event.start.length === 8) ? moment(event.start, "YYYYMMDD") : moment(new Date(event.start));
|
||||
if (event.start.length === 8) {
|
||||
startDate = startDate.startOf('day');
|
||||
startDate = startDate.startOf("day");
|
||||
}
|
||||
|
||||
if (typeof event.rrule != 'undefined' && !isFacebookBirthday) {
|
||||
if (typeof event.rrule != "undefined" && !isFacebookBirthday) {
|
||||
var rule = event.rrule;
|
||||
|
||||
// Check if the timeset is set to this current time.
|
||||
// If so, the RRULE line does not contain any BYHOUR, BYMINUTE, BYSECOND params.
|
||||
// This causes the times of the recurring event to be incorrect.
|
||||
// By adjusting the timeset property, this issue is solved.
|
||||
|
||||
|
||||
if (rule.timeset[0].hour == now.getHours(),
|
||||
rule.timeset[0].minute == now.getMinutes(),
|
||||
rule.timeset[0].second == now.getSeconds()) {
|
||||
|
||||
rule.timeset[0].hour = startDate.format('H');
|
||||
rule.timeset[0].minute = startDate.format('m');
|
||||
rule.timeset[0].second = startDate.format('s');
|
||||
rule.timeset[0].hour = startDate.format("H");
|
||||
rule.timeset[0].minute = startDate.format("m");
|
||||
rule.timeset[0].second = startDate.format("s");
|
||||
}
|
||||
|
||||
var dates = rule.between(today, today.add(maximumNumberOfDays, 'days') , true, limitFunction);
|
||||
var dates = rule.between(today, today.add(maximumNumberOfDays, "days") , true, limitFunction);
|
||||
console.log(dates);
|
||||
for (var d in dates) {
|
||||
startDate = moment(new Date(dates[d]));
|
||||
newEvents.push({
|
||||
title: (typeof event.summary.val !== 'undefined') ? event.summary.val : event.summary,
|
||||
startDate: startDate.format('x'),
|
||||
title: (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary,
|
||||
startDate: startDate.format("x"),
|
||||
fullDayEvent: (event.start.length === 8)
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Single event.
|
||||
if (startDate >= today && startDate <= today.add(maximumNumberOfDays, 'days')) {
|
||||
if (startDate >= today && startDate <= today.add(maximumNumberOfDays, "days")) {
|
||||
newEvents.push({
|
||||
title: (typeof event.summary.val !== 'undefined') ? event.summary.val : event.summary,
|
||||
startDate: startDate.format('x'),
|
||||
title: (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary,
|
||||
startDate: startDate.format("x"),
|
||||
fullDayEvent: (event.start.length === 8)
|
||||
});
|
||||
}
|
||||
@@ -105,7 +103,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
}
|
||||
}
|
||||
|
||||
newEvents.sort(function(a,b) {
|
||||
newEvents.sort(function(a, b) {
|
||||
return a.startDate - b.startDate;
|
||||
});
|
||||
|
||||
@@ -190,14 +188,13 @@ module.exports = NodeHelper.create({
|
||||
|
||||
this.fetchers = [];
|
||||
|
||||
console.log('Starting node helper for: ' + this.name);
|
||||
|
||||
console.log("Starting node helper for: " + this.name);
|
||||
|
||||
},
|
||||
|
||||
// Override socketNotificationReceived method.
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
if (notification === 'ADD_CALENDAR') {
|
||||
if (notification === "ADD_CALENDAR") {
|
||||
//console.log('ADD_CALENDAR: ');
|
||||
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays);
|
||||
}
|
||||
@@ -214,28 +211,28 @@ module.exports = NodeHelper.create({
|
||||
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays) {
|
||||
var self = this;
|
||||
|
||||
if (!validUrl.isUri(url)){
|
||||
self.sendSocketNotification('INCORRECT_URL', {url:url});
|
||||
if (!validUrl.isUri(url)) {
|
||||
self.sendSocketNotification("INCORRECT_URL", {url: url});
|
||||
return;
|
||||
}
|
||||
|
||||
var fetcher;
|
||||
if (typeof self.fetchers[url] === 'undefined') {
|
||||
console.log('Create new calendar fetcher for url: ' + url + ' - Interval: ' + fetchInterval);
|
||||
if (typeof self.fetchers[url] === "undefined") {
|
||||
console.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
|
||||
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
|
||||
|
||||
fetcher.onReceive(function(fetcher) {
|
||||
//console.log('Broadcast events.');
|
||||
//console.log(fetcher.events());
|
||||
|
||||
self.sendSocketNotification('CALENDAR_EVENTS', {
|
||||
self.sendSocketNotification("CALENDAR_EVENTS", {
|
||||
url: fetcher.url(),
|
||||
events: fetcher.events()
|
||||
});
|
||||
});
|
||||
|
||||
fetcher.onError(function(fetcher, error) {
|
||||
self.sendSocketNotification('FETCH_ERROR', {
|
||||
self.sendSocketNotification("FETCH_ERROR", {
|
||||
url: fetcher.url(),
|
||||
error: error
|
||||
});
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('clock',{
|
||||
Module.register("clock",{
|
||||
|
||||
// Module config defaults.
|
||||
defaults: {
|
||||
@@ -17,12 +17,12 @@ Module.register('clock',{
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
// Schedule update interval.
|
||||
var self = this;
|
||||
@@ -34,7 +34,6 @@ Module.register('clock',{
|
||||
moment.locale(config.language);
|
||||
},
|
||||
|
||||
|
||||
// Override dom generator.
|
||||
getDom: function() {
|
||||
// Create wrappers.
|
||||
@@ -49,9 +48,9 @@ Module.register('clock',{
|
||||
secondsWrapper.className = "dimmed";
|
||||
|
||||
// Set content of wrappers.
|
||||
dateWrapper.innerHTML = moment().format('dddd, LL');
|
||||
timeWrapper.innerHTML = moment().format((this.config.timeFormat === 24) ? 'HH:mm' : ('hh:mm'));
|
||||
secondsWrapper.innerHTML = moment().format('ss');
|
||||
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);
|
||||
|
@@ -7,26 +7,26 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('compliments',{
|
||||
Module.register("compliments",{
|
||||
|
||||
// Module config defaults.
|
||||
defaults: {
|
||||
compliments: {
|
||||
morning: [
|
||||
'Good morning, handsome!',
|
||||
'Enjoy your day!',
|
||||
'How was your sleep?'
|
||||
],
|
||||
afternoon: [
|
||||
'Hello, beauty!',
|
||||
'You look sexy!',
|
||||
'Looking good today!'
|
||||
],
|
||||
evening: [
|
||||
'Wow, you look hot!',
|
||||
'You look nice!',
|
||||
'Hi, sexy!'
|
||||
]
|
||||
"Good morning, handsome!",
|
||||
"Enjoy your day!",
|
||||
"How was your sleep?"
|
||||
],
|
||||
afternoon: [
|
||||
"Hello, beauty!",
|
||||
"You look sexy!",
|
||||
"Looking good today!"
|
||||
],
|
||||
evening: [
|
||||
"Wow, you look hot!",
|
||||
"You look nice!",
|
||||
"Hi, sexy!"
|
||||
]
|
||||
},
|
||||
updateInterval: 30000,
|
||||
fadeSpeed: 4000
|
||||
@@ -34,12 +34,12 @@ Module.register('compliments',{
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
this.lastComplimentIndex = -1;
|
||||
|
||||
@@ -50,7 +50,6 @@ Module.register('compliments',{
|
||||
}, this.config.updateInterval);
|
||||
},
|
||||
|
||||
|
||||
/* randomIndex(compliments)
|
||||
* Generate a random index for a list of compliments.
|
||||
*
|
||||
@@ -113,7 +112,7 @@ Module.register('compliments',{
|
||||
|
||||
var compliment = document.createTextNode(complimentText);
|
||||
var wrapper = document.createElement("div");
|
||||
wrapper.className = 'thin xlarge bright';
|
||||
wrapper.className = "thin xlarge bright";
|
||||
wrapper.appendChild(compliment);
|
||||
|
||||
return wrapper;
|
||||
|
@@ -7,61 +7,60 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('currentweather',{
|
||||
Module.register("currentweather",{
|
||||
|
||||
// Default module config.
|
||||
defaults: {
|
||||
location: '',
|
||||
appid: '',
|
||||
units: 'metric',
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
location: "",
|
||||
appid: "",
|
||||
units: "metric",
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
lang: config.language,
|
||||
|
||||
initialLoadDelay: 0, // 0 seconds delay
|
||||
retryDelay: 2500,
|
||||
|
||||
apiVersion: '2.5',
|
||||
apiBase: 'http://api.openweathermap.org/data/',
|
||||
weatherEndpoint: 'weather',
|
||||
apiVersion: "2.5",
|
||||
apiBase: "http://api.openweathermap.org/data/",
|
||||
weatherEndpoint: "weather",
|
||||
|
||||
iconTable: {
|
||||
'01d':'wi-day-sunny',
|
||||
'02d':'wi-day-cloudy',
|
||||
'03d':'wi-cloudy',
|
||||
'04d':'wi-cloudy-windy',
|
||||
'09d':'wi-showers',
|
||||
'10d':'wi-rain',
|
||||
'11d':'wi-thunderstorm',
|
||||
'13d':'wi-snow',
|
||||
'50d':'wi-fog',
|
||||
'01n':'wi-night-clear',
|
||||
'02n':'wi-night-cloudy',
|
||||
'03n':'wi-night-cloudy',
|
||||
'04n':'wi-night-cloudy',
|
||||
'09n':'wi-night-showers',
|
||||
'10n':'wi-night-rain',
|
||||
'11n':'wi-night-thunderstorm',
|
||||
'13n':'wi-night-snow',
|
||||
'50n':'wi-night-alt-cloudy-windy'
|
||||
"01d": "wi-day-sunny",
|
||||
"02d": "wi-day-cloudy",
|
||||
"03d": "wi-cloudy",
|
||||
"04d": "wi-cloudy-windy",
|
||||
"09d": "wi-showers",
|
||||
"10d": "wi-rain",
|
||||
"11d": "wi-thunderstorm",
|
||||
"13d": "wi-snow",
|
||||
"50d": "wi-fog",
|
||||
"01n": "wi-night-clear",
|
||||
"02n": "wi-night-cloudy",
|
||||
"03n": "wi-night-cloudy",
|
||||
"04n": "wi-night-cloudy",
|
||||
"09n": "wi-night-showers",
|
||||
"10n": "wi-night-rain",
|
||||
"11n": "wi-night-thunderstorm",
|
||||
"13n": "wi-night-snow",
|
||||
"50n": "wi-night-alt-cloudy-windy"
|
||||
},
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getStyles: function() {
|
||||
return ['weather-icons.css', 'currentweather.css'];
|
||||
return ["weather-icons.css", "currentweather.css"];
|
||||
},
|
||||
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
@@ -83,13 +82,13 @@ Module.register('currentweather',{
|
||||
getDom: function() {
|
||||
var wrapper = document.createElement("div");
|
||||
|
||||
if (this.config.appid === '') {
|
||||
if (this.config.appid === "") {
|
||||
wrapper.innerHTML = "Please set the correct openweather <i>appid</i> in the config for module: " + this.name + ".";
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
if (this.config.location === '') {
|
||||
if (this.config.location === "") {
|
||||
wrapper.innerHTML = "Please set the openweather <i>location</i> in the config for module: " + this.name + ".";
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
@@ -101,7 +100,6 @@ Module.register('currentweather',{
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
var small = document.createElement("div");
|
||||
small.className = "normal medium";
|
||||
|
||||
@@ -134,7 +132,7 @@ Module.register('currentweather',{
|
||||
|
||||
var temperature = document.createElement("span");
|
||||
temperature.className = "bright";
|
||||
temperature.innerHTML = " " + this.temperature + '°';
|
||||
temperature.innerHTML = " " + this.temperature + "°";
|
||||
large.appendChild(temperature);
|
||||
|
||||
wrapper.appendChild(small);
|
||||
@@ -142,36 +140,35 @@ Module.register('currentweather',{
|
||||
return wrapper;
|
||||
},
|
||||
|
||||
|
||||
/* updateWeather(compliments)
|
||||
* Requests new data from openweather.org.
|
||||
* Calls processWeather on succesfull response.
|
||||
*/
|
||||
updateWeather: function() {
|
||||
var url = this.config.apiBase + this.config.apiVersion + '/' + this.config.weatherEndpoint + this.getParams();
|
||||
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.weatherEndpoint + this.getParams();
|
||||
var self = this;
|
||||
var retry = true;
|
||||
|
||||
var weatherRequest = new XMLHttpRequest();
|
||||
weatherRequest.open("GET", url, true);
|
||||
weatherRequest.onreadystatechange = function() {
|
||||
if(this.readyState === 4) {
|
||||
if(this.status === 200) {
|
||||
self.processWeather(JSON.parse(this.response));
|
||||
} else if (this.status === 401) {
|
||||
self.config.appid = '';
|
||||
self.updateDom(self.config.animationSpeed);
|
||||
if (this.readyState === 4) {
|
||||
if (this.status === 200) {
|
||||
self.processWeather(JSON.parse(this.response));
|
||||
} else if (this.status === 401) {
|
||||
self.config.appid = "";
|
||||
self.updateDom(self.config.animationSpeed);
|
||||
|
||||
Log.error(self.name + ": Incorrect APPID.");
|
||||
retry = false;
|
||||
} else {
|
||||
Log.error(self.name + ": Could not load weather.");
|
||||
}
|
||||
Log.error(self.name + ": Incorrect APPID.");
|
||||
retry = false;
|
||||
} else {
|
||||
Log.error(self.name + ": Could not load weather.");
|
||||
}
|
||||
|
||||
if (retry) {
|
||||
self.scheduleUpdate((self.loaded) ? -1 : self.config.retryDelay);
|
||||
if (retry) {
|
||||
self.scheduleUpdate((self.loaded) ? -1 : self.config.retryDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
weatherRequest.send();
|
||||
},
|
||||
@@ -183,10 +180,10 @@ Module.register('currentweather',{
|
||||
*/
|
||||
getParams: function() {
|
||||
var params = "?";
|
||||
params += 'q=' + this.config.location;
|
||||
params += '&units=' + this.config.units;
|
||||
params += '&lang=' + this.config.lang;
|
||||
params += '&APPID=' + this.config.appid;
|
||||
params += "q=" + this.config.location;
|
||||
params += "&units=" + this.config.units;
|
||||
params += "&lang=" + this.config.lang;
|
||||
params += "&APPID=" + this.config.appid;
|
||||
|
||||
return params;
|
||||
},
|
||||
@@ -201,19 +198,16 @@ Module.register('currentweather',{
|
||||
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
|
||||
this.weatherType = this.config.iconTable[data.weather[0].icon];
|
||||
|
||||
|
||||
|
||||
var now = moment().format('x');
|
||||
var sunrise = moment(data.sys.sunrise*1000).format('x');
|
||||
var sunset = moment(data.sys.sunset*1000).format('x');
|
||||
|
||||
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');
|
||||
this.sunriseSunsetIcon = 'wi-sunset';
|
||||
this.sunriseSunsetTime = moment(data.sys.sunset * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a");
|
||||
this.sunriseSunsetIcon = "wi-sunset";
|
||||
} else {
|
||||
this.sunriseSunsetTime = moment(data.sys.sunrise*1000).format((this.config.timeFormat === 24) ? 'HH:mm' : 'hh:mm a');
|
||||
this.sunriseSunsetIcon = 'wi-sunrise';
|
||||
this.sunriseSunsetTime = moment(data.sys.sunrise * 1000).format((this.config.timeFormat === 24) ? "HH:mm" : "hh:mm a");
|
||||
this.sunriseSunsetIcon = "wi-sunrise";
|
||||
|
||||
}
|
||||
|
||||
@@ -228,7 +222,7 @@ Module.register('currentweather',{
|
||||
*/
|
||||
scheduleUpdate: function(delay) {
|
||||
var nextLoad = this.config.updateInterval;
|
||||
if (typeof delay !== 'undefined' && delay >= 0) {
|
||||
if (typeof delay !== "undefined" && delay >= 0) {
|
||||
nextLoad = delay;
|
||||
}
|
||||
|
||||
@@ -264,7 +258,7 @@ Module.register('currentweather',{
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
roundValue: function (temperature) {
|
||||
roundValue: function(temperature) {
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
}
|
||||
});
|
||||
|
@@ -8,16 +8,15 @@
|
||||
// Modules listed below can be loaded without the 'default/' prefix. Omitting the default folder name.
|
||||
|
||||
var defaultModules = [
|
||||
'alert',
|
||||
'calendar',
|
||||
'clock',
|
||||
'compliments',
|
||||
'currentweather',
|
||||
'helloworld',
|
||||
'newsfeed',
|
||||
'weatherforecast'
|
||||
"alert",
|
||||
"calendar",
|
||||
"clock",
|
||||
"compliments",
|
||||
"currentweather",
|
||||
"helloworld",
|
||||
"newsfeed",
|
||||
"weatherforecast"
|
||||
];
|
||||
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== 'undefined') {module.exports = defaultModules;}
|
||||
if (typeof module !== "undefined") {module.exports = defaultModules;}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('helloworld',{
|
||||
Module.register("helloworld",{
|
||||
|
||||
// Default module config.
|
||||
defaults: {
|
||||
|
@@ -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.
|
||||
|
@@ -7,26 +7,26 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('newsfeed',{
|
||||
Module.register("newsfeed",{
|
||||
|
||||
// Default module config.
|
||||
defaults: {
|
||||
feedUrl: 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml',
|
||||
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,
|
||||
encoding: 'UTF-8' //ISO-8859-1
|
||||
updateInterval: 7.5 * 1000,
|
||||
animationSpeed: 2.5 * 1000,
|
||||
encoding: "UTF-8" //ISO-8859-1
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
@@ -41,7 +41,7 @@ Module.register('newsfeed',{
|
||||
|
||||
// Override socket notification handler.
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
if (notification === 'NEWS_ITEMS') {
|
||||
if (notification === "NEWS_ITEMS") {
|
||||
if (payload.url === this.config.feedUrl) {
|
||||
this.newsItems = payload.items;
|
||||
if (!this.loaded) {
|
||||
@@ -73,7 +73,7 @@ Module.register('newsfeed',{
|
||||
if (this.config.showPublishDate) {
|
||||
var timestamp = document.createElement("div");
|
||||
timestamp.className = "light small dimmed";
|
||||
timestamp.innerHTML = this.capitalizeFirstLetter(moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow() + ':');
|
||||
timestamp.innerHTML = this.capitalizeFirstLetter(moment(new Date(this.newsItems[this.activeItem].pubdate)).fromNow() + ":");
|
||||
//timestamp.innerHTML = this.config.feedUrl;
|
||||
wrapper.appendChild(timestamp);
|
||||
}
|
||||
@@ -95,8 +95,8 @@ Module.register('newsfeed',{
|
||||
* Requests new data from news proxy.
|
||||
*/
|
||||
fetchNews: function() {
|
||||
Log.log('Add news feed to fetcher: ' + this.config.feedUrl);
|
||||
this.sendSocketNotification('ADD_FEED', {
|
||||
Log.log("Add news feed to fetcher: " + this.config.feedUrl);
|
||||
this.sendSocketNotification("ADD_FEED", {
|
||||
url: this.config.feedUrl,
|
||||
reloadInterval: this.config.reloadInterval,
|
||||
encoding: this.config.encoding
|
||||
@@ -125,6 +125,6 @@ Module.register('newsfeed',{
|
||||
* return string - Capitalized output string.
|
||||
*/
|
||||
capitalizeFirstLetter: function(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
});
|
||||
|
@@ -5,15 +5,15 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var FeedMe = require('feedme');
|
||||
var request = require('request');
|
||||
var iconv = require('iconv-lite');
|
||||
var FeedMe = require("feedme");
|
||||
var request = require("request");
|
||||
var iconv = require("iconv-lite");
|
||||
|
||||
var NewsFetcher = function() {
|
||||
var self = this;
|
||||
|
||||
self.successCallback = function(){};
|
||||
self.errorCallback = function(){};
|
||||
self.successCallback = function() {};
|
||||
self.errorCallback = function() {};
|
||||
|
||||
self.items = [];
|
||||
|
||||
@@ -30,22 +30,22 @@ var NewsFetcher = function() {
|
||||
|
||||
var parser = new FeedMe();
|
||||
|
||||
parser.on('item', function(item) {
|
||||
parser.on("item", function(item) {
|
||||
self.items.push({
|
||||
title: item.title,
|
||||
pubdate: item.pubdate,
|
||||
});
|
||||
});
|
||||
|
||||
parser.on('end', function(item) {
|
||||
parser.on("end", function(item) {
|
||||
self.successCallback(self.items);
|
||||
});
|
||||
|
||||
parser.on('error', function(error) {
|
||||
parser.on("error", function(error) {
|
||||
self.errorCallback(error);
|
||||
});
|
||||
|
||||
request({uri:url, encoding:null}).pipe(iconv.decodeStream(encoding)).pipe(parser);
|
||||
request({uri: url, encoding: null}).pipe(iconv.decodeStream(encoding)).pipe(parser);
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -5,21 +5,21 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var NodeHelper = require('node_helper');
|
||||
var validUrl = require('valid-url');
|
||||
var Fetcher = require('./fetcher.js');
|
||||
var NodeHelper = require("node_helper");
|
||||
var validUrl = require("valid-url");
|
||||
var Fetcher = require("./fetcher.js");
|
||||
|
||||
module.exports = NodeHelper.create({
|
||||
// Subclass start method.
|
||||
start: function() {
|
||||
console.log('Starting module: ' + this.name);
|
||||
console.log("Starting module: " + this.name);
|
||||
|
||||
this.fetchers = [];
|
||||
},
|
||||
|
||||
// Subclass socketNotificationReceived received.
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
if(notification === 'ADD_FEED') {
|
||||
if (notification === "ADD_FEED") {
|
||||
this.createFetcher(payload.url, payload.reloadInterval, payload.encoding);
|
||||
}
|
||||
},
|
||||
@@ -35,25 +35,25 @@ module.exports = NodeHelper.create({
|
||||
createFetcher: function(url, reloadInterval, encoding) {
|
||||
var self = this;
|
||||
|
||||
if (!validUrl.isUri(url)){
|
||||
self.sendSocketNotification('INCORRECT_URL', url);
|
||||
if (!validUrl.isUri(url)) {
|
||||
self.sendSocketNotification("INCORRECT_URL", url);
|
||||
return;
|
||||
}
|
||||
|
||||
var fetcher;
|
||||
if (typeof self.fetchers[url] === 'undefined') {
|
||||
console.log('Create new news fetcher for url: ' + url + ' - Interval: ' + reloadInterval);
|
||||
if (typeof self.fetchers[url] === "undefined") {
|
||||
console.log("Create new news fetcher for url: " + url + " - Interval: " + reloadInterval);
|
||||
fetcher = new Fetcher(url, reloadInterval, encoding);
|
||||
|
||||
fetcher.onReceive(function(fetcher) {
|
||||
self.sendSocketNotification('NEWS_ITEMS', {
|
||||
self.sendSocketNotification("NEWS_ITEMS", {
|
||||
url: fetcher.url(),
|
||||
items: fetcher.items()
|
||||
});
|
||||
});
|
||||
|
||||
fetcher.onError(function(fetcher, error) {
|
||||
self.sendSocketNotification('FETCH_ERROR', {
|
||||
self.sendSocketNotification("FETCH_ERROR", {
|
||||
url: fetcher.url(),
|
||||
error: error
|
||||
});
|
||||
@@ -61,7 +61,7 @@ module.exports = NodeHelper.create({
|
||||
|
||||
self.fetchers[url] = fetcher;
|
||||
} else {
|
||||
console.log('Use exsisting news fetcher for url: ' + url);
|
||||
console.log("Use exsisting news fetcher for url: " + url);
|
||||
fetcher = self.fetchers[url];
|
||||
fetcher.setReloadInterval(reloadInterval);
|
||||
fetcher.broadcastItems();
|
||||
|
@@ -7,16 +7,16 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
Module.register('weatherforecast',{
|
||||
Module.register("weatherforecast",{
|
||||
|
||||
// Default module config.
|
||||
defaults: {
|
||||
location: '',
|
||||
appid: '',
|
||||
units: 'metric',
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
location: "",
|
||||
appid: "",
|
||||
units: "metric",
|
||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||
animationSpeed: 1000,
|
||||
timeFormat: config.timeFormat,
|
||||
lang: config.language,
|
||||
fade: true,
|
||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||
@@ -24,46 +24,45 @@ Module.register('weatherforecast',{
|
||||
initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy.
|
||||
retryDelay: 2500,
|
||||
|
||||
apiVersion: '2.5',
|
||||
apiBase: 'http://api.openweathermap.org/data/',
|
||||
forecastEndpoint: 'forecast/daily',
|
||||
apiVersion: "2.5",
|
||||
apiBase: "http://api.openweathermap.org/data/",
|
||||
forecastEndpoint: "forecast/daily",
|
||||
|
||||
iconTable: {
|
||||
'01d':'wi-day-sunny',
|
||||
'02d':'wi-day-cloudy',
|
||||
'03d':'wi-cloudy',
|
||||
'04d':'wi-cloudy-windy',
|
||||
'09d':'wi-showers',
|
||||
'10d':'wi-rain',
|
||||
'11d':'wi-thunderstorm',
|
||||
'13d':'wi-snow',
|
||||
'50d':'wi-fog',
|
||||
'01n':'wi-night-clear',
|
||||
'02n':'wi-night-cloudy',
|
||||
'03n':'wi-night-cloudy',
|
||||
'04n':'wi-night-cloudy',
|
||||
'09n':'wi-night-showers',
|
||||
'10n':'wi-night-rain',
|
||||
'11n':'wi-night-thunderstorm',
|
||||
'13n':'wi-night-snow',
|
||||
'50n':'wi-night-alt-cloudy-windy'
|
||||
"01d": "wi-day-sunny",
|
||||
"02d": "wi-day-cloudy",
|
||||
"03d": "wi-cloudy",
|
||||
"04d": "wi-cloudy-windy",
|
||||
"09d": "wi-showers",
|
||||
"10d": "wi-rain",
|
||||
"11d": "wi-thunderstorm",
|
||||
"13d": "wi-snow",
|
||||
"50d": "wi-fog",
|
||||
"01n": "wi-night-clear",
|
||||
"02n": "wi-night-cloudy",
|
||||
"03n": "wi-night-cloudy",
|
||||
"04n": "wi-night-cloudy",
|
||||
"09n": "wi-night-showers",
|
||||
"10n": "wi-night-rain",
|
||||
"11n": "wi-night-thunderstorm",
|
||||
"13n": "wi-night-snow",
|
||||
"50n": "wi-night-alt-cloudy-windy"
|
||||
},
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getScripts: function() {
|
||||
return ['moment.js'];
|
||||
return ["moment.js"];
|
||||
},
|
||||
|
||||
// Define required scripts.
|
||||
getStyles: function() {
|
||||
return ['weather-icons.css', 'weatherforecast.css'];
|
||||
return ["weather-icons.css", "weatherforecast.css"];
|
||||
},
|
||||
|
||||
|
||||
// Define start sequence.
|
||||
start: function() {
|
||||
Log.info('Starting module: ' + this.name);
|
||||
Log.info("Starting module: " + this.name);
|
||||
|
||||
// Set locale.
|
||||
moment.locale(config.language);
|
||||
@@ -80,13 +79,13 @@ Module.register('weatherforecast',{
|
||||
getDom: function() {
|
||||
var wrapper = document.createElement("div");
|
||||
|
||||
if (this.config.appid === '') {
|
||||
if (this.config.appid === "") {
|
||||
wrapper.innerHTML = "Please set the correct openweather <i>appid</i> in the config for module: " + this.name + ".";
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
if (this.config.location === '') {
|
||||
if (this.config.location === "") {
|
||||
wrapper.innerHTML = "Please set the openweather <i>location</i> in the config for module: " + this.name + ".";
|
||||
wrapper.className = "dimmed light small";
|
||||
return wrapper;
|
||||
@@ -98,7 +97,6 @@ Module.register('weatherforecast',{
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
var table = document.createElement("table");
|
||||
table.className = "small";
|
||||
|
||||
@@ -109,7 +107,7 @@ Module.register('weatherforecast',{
|
||||
table.appendChild(row);
|
||||
|
||||
var dayCell = document.createElement("td");
|
||||
dayCell.className = 'day';
|
||||
dayCell.className = "day";
|
||||
dayCell.innerHTML = forecast.day;
|
||||
row.appendChild(dayCell);
|
||||
|
||||
@@ -123,15 +121,14 @@ Module.register('weatherforecast',{
|
||||
|
||||
var maxTempCell = document.createElement("td");
|
||||
maxTempCell.innerHTML = forecast.maxTemp;
|
||||
maxTempCell.className = 'align-right bright max-temp';
|
||||
maxTempCell.className = "align-right bright max-temp";
|
||||
row.appendChild(maxTempCell);
|
||||
|
||||
var minTempCell = document.createElement("td");
|
||||
minTempCell.innerHTML = forecast.minTemp;
|
||||
minTempCell.className = 'align-right min-temp';
|
||||
minTempCell.className = "align-right min-temp";
|
||||
row.appendChild(minTempCell);
|
||||
|
||||
|
||||
if (this.config.fade && this.config.fadePoint < 1) {
|
||||
if (this.config.fadePoint < 0) {
|
||||
this.config.fadePoint = 0;
|
||||
@@ -144,45 +141,40 @@ Module.register('weatherforecast',{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return table;
|
||||
},
|
||||
|
||||
|
||||
/* updateWeather(compliments)
|
||||
* Requests new data from openweather.org.
|
||||
* Calls processWeather on succesfull response.
|
||||
*/
|
||||
updateWeather: function() {
|
||||
var url = this.config.apiBase + this.config.apiVersion + '/' + this.config.forecastEndpoint + this.getParams();
|
||||
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.forecastEndpoint + this.getParams();
|
||||
var self = this;
|
||||
var retry = true;
|
||||
|
||||
var weatherRequest = new XMLHttpRequest();
|
||||
weatherRequest.open("GET", url, true);
|
||||
weatherRequest.onreadystatechange = function() {
|
||||
if(this.readyState === 4) {
|
||||
if(this.status === 200) {
|
||||
self.processWeather(JSON.parse(this.response));
|
||||
} else if (this.status === 401) {
|
||||
self.config.appid = '';
|
||||
self.updateDom(self.config.animationSpeed);
|
||||
if (this.readyState === 4) {
|
||||
if (this.status === 200) {
|
||||
self.processWeather(JSON.parse(this.response));
|
||||
} else if (this.status === 401) {
|
||||
self.config.appid = "";
|
||||
self.updateDom(self.config.animationSpeed);
|
||||
|
||||
Log.error(self.name + ": Incorrect APPID.");
|
||||
retry = false;
|
||||
} else {
|
||||
Log.error(self.name + ": Could not load weather.");
|
||||
}
|
||||
Log.error(self.name + ": Incorrect APPID.");
|
||||
retry = false;
|
||||
} else {
|
||||
Log.error(self.name + ": Could not load weather.");
|
||||
}
|
||||
|
||||
if (retry) {
|
||||
self.scheduleUpdate((self.loaded) ? -1 : self.config.retryDelay);
|
||||
if (retry) {
|
||||
self.scheduleUpdate((self.loaded) ? -1 : self.config.retryDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
weatherRequest.send();
|
||||
},
|
||||
@@ -194,10 +186,10 @@ Module.register('weatherforecast',{
|
||||
*/
|
||||
getParams: function() {
|
||||
var params = "?";
|
||||
params += 'q=' + this.config.location;
|
||||
params += '&units=' + this.config.units;
|
||||
params += '&lang=' + this.config.lang;
|
||||
params += '&APPID=' + this.config.appid;
|
||||
params += "q=" + this.config.location;
|
||||
params += "&units=" + this.config.units;
|
||||
params += "&lang=" + this.config.lang;
|
||||
params += "&APPID=" + this.config.appid;
|
||||
|
||||
return params;
|
||||
},
|
||||
@@ -215,7 +207,7 @@ Module.register('weatherforecast',{
|
||||
var forecast = data.list[i];
|
||||
this.forecast.push({
|
||||
|
||||
day: moment(forecast.dt, 'X').format('ddd.'),
|
||||
day: moment(forecast.dt, "X").format("ddd."),
|
||||
icon: this.config.iconTable[forecast.weather[0].icon],
|
||||
maxTemp: this.roundValue(forecast.temp.max),
|
||||
minTemp: this.roundValue(forecast.temp.min)
|
||||
@@ -236,7 +228,7 @@ Module.register('weatherforecast',{
|
||||
*/
|
||||
scheduleUpdate: function(delay) {
|
||||
var nextLoad = this.config.updateInterval;
|
||||
if (typeof delay !== 'undefined' && delay >= 0) {
|
||||
if (typeof delay !== "undefined" && delay >= 0) {
|
||||
nextLoad = delay;
|
||||
}
|
||||
|
||||
@@ -273,7 +265,7 @@ Module.register('weatherforecast',{
|
||||
*
|
||||
* return number - Rounded Temperature.
|
||||
*/
|
||||
roundValue: function (temperature) {
|
||||
roundValue: function(temperature) {
|
||||
return parseFloat(temperature).toFixed(1);
|
||||
}
|
||||
});
|
||||
|
31
modules/node_modules/node_helper/index.js
generated
vendored
31
modules/node_modules/node_helper/index.js
generated
vendored
@@ -5,17 +5,17 @@
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var Class = require('../../../js/class.js');
|
||||
var express = require('express');
|
||||
var path = require('path');
|
||||
var Class = require("../../../js/class.js");
|
||||
var express = require("express");
|
||||
var path = require("path");
|
||||
|
||||
NodeHelper = Class.extend({
|
||||
init: function() {
|
||||
console.log('Initializing new module helper ...');
|
||||
console.log("Initializing new module helper ...");
|
||||
},
|
||||
|
||||
start: function() {
|
||||
console.log('Staring module helper: ' + this.name);
|
||||
console.log("Staring module helper: " + this.name);
|
||||
},
|
||||
|
||||
/* socketNotificationReceived(notification, payload)
|
||||
@@ -25,7 +25,7 @@ NodeHelper = Class.extend({
|
||||
* argument payload mixed - The payload of the notification.
|
||||
*/
|
||||
socketNotificationReceived: function(notification, payload) {
|
||||
console.log(this.name + ' received a socket notification: ' + notification + ' - Payload: ' + payload);
|
||||
console.log(this.name + " received a socket notification: " + notification + " - Payload: " + payload);
|
||||
},
|
||||
|
||||
/* setName(name)
|
||||
@@ -56,7 +56,6 @@ NodeHelper = Class.extend({
|
||||
this.io.of(this.name).emit(notification, payload);
|
||||
},
|
||||
|
||||
|
||||
/* setExpressApp(app)
|
||||
* Sets the express app object for this module.
|
||||
* This allows you to host files from the created webserver.
|
||||
@@ -66,8 +65,8 @@ NodeHelper = Class.extend({
|
||||
setExpressApp: function(app) {
|
||||
this.expressApp = app;
|
||||
|
||||
var publicPath = this.path + '/public';
|
||||
app.use('/' + this.name, express.static(publicPath));
|
||||
var publicPath = this.path + "/public";
|
||||
app.use("/" + this.name, express.static(publicPath));
|
||||
},
|
||||
|
||||
/* setSocketIO(io)
|
||||
@@ -80,21 +79,21 @@ NodeHelper = Class.extend({
|
||||
var self = this;
|
||||
self.io = io;
|
||||
|
||||
console.log('Connecting socket for: ' + this.name);
|
||||
console.log("Connecting socket for: " + this.name);
|
||||
var namespace = this.name;
|
||||
io.of(namespace).on('connection', function (socket) {
|
||||
io.of(namespace).on("connection", function(socket) {
|
||||
// add a catch all event.
|
||||
var onevent = socket.onevent;
|
||||
socket.onevent = function (packet) {
|
||||
socket.onevent = function(packet) {
|
||||
var args = packet.data || [];
|
||||
onevent.call (this, packet); // original call
|
||||
onevent.call(this, packet); // original call
|
||||
packet.data = ["*"].concat(args);
|
||||
onevent.call(this, packet); // additional call to catch-all
|
||||
};
|
||||
|
||||
// register catch all.
|
||||
socket.on('*', function (notification, payload) {
|
||||
if (notification !== '*')
|
||||
socket.on("*", function(notification, payload) {
|
||||
if (notification !== "*")
|
||||
//console.log('received message in namespace: ' + namespace);
|
||||
self.socketNotificationReceived(notification, payload);
|
||||
});
|
||||
@@ -107,4 +106,4 @@ NodeHelper.create = function(moduleDefinition) {
|
||||
return NodeHelper.extend(moduleDefinition);
|
||||
};
|
||||
|
||||
module.exports = NodeHelper;
|
||||
module.exports = NodeHelper;
|
||||
|
Reference in New Issue
Block a user