Standardize: TO JSCS!

This commit is contained in:
Nicholas Hubbard
2016-04-05 14:35:11 -04:00
parent 18390503b5
commit 426728058c
28 changed files with 623 additions and 653 deletions

View File

@@ -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);
}
});