mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-27 08:22:05 +00:00
Standardize: TO JSCS!
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user