mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Added proper User-Agent string to Facebook calendar call, and various fixed spelling of 'exist'.
This commit is contained in:
parent
8d1ef5291f
commit
486956b762
@ -152,7 +152,7 @@ var Module = Class.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* socket()
|
/* socket()
|
||||||
* Returns a socket object. If it doesn"t exsist, it"s created.
|
* Returns a socket object. If it doesn"t exist, it"s created.
|
||||||
* It also registers the notification callback.
|
* It also registers the notification callback.
|
||||||
*/
|
*/
|
||||||
socket: function() {
|
socket: function() {
|
||||||
|
@ -298,7 +298,7 @@ If no translation is found, a fallback will be used. The fallback sequence is as
|
|||||||
- 4. Translation as defined in core translation file of the fallback language (the first defined core translation file).
|
- 4. Translation as defined in core translation file of the fallback language (the first defined core translation file).
|
||||||
- 5. The key (identifier) of the translation.
|
- 5. The key (identifier) of the translation.
|
||||||
|
|
||||||
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the exsisting translations.
|
When adding translations to your module, it's a good idea to see if an apropriate translation is already available in the [core translation files](https://github.com/MichMich/MagicMirror/tree/master/translations). This way, your module can benefit from the existing translations.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
````javascript
|
````javascript
|
||||||
|
@ -49,7 +49,7 @@ Module.register("calendar",{
|
|||||||
getTranslations: function() {
|
getTranslations: function() {
|
||||||
// The translations for the defaut modules are defined in the core translation files.
|
// The translations for the defaut modules are defined in the core translation files.
|
||||||
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
|
||||||
// If you're trying to build yiur own module including translations, check out the documentation.
|
// If you're trying to build your own module including translations, check out the documentation.
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -25,7 +25,12 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
|||||||
clearTimeout(reloadTimer);
|
clearTimeout(reloadTimer);
|
||||||
reloadTimer = null;
|
reloadTimer = null;
|
||||||
|
|
||||||
ical.fromURL(url, {}, function(err, data) {
|
var opts = {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Node.js 6.0.0) MagicMirror/v2 (https://github.com/MichMich/MagicMirror/)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ical.fromURL(url, opts, function(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fetchFailedCallback(self, err);
|
fetchFailedCallback(self, err);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
@ -188,7 +193,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* broadcastItems()
|
/* broadcastItems()
|
||||||
* Broadcast the exsisting events.
|
* Broadcast the existing events.
|
||||||
*/
|
*/
|
||||||
this.broadcastEvents = function() {
|
this.broadcastEvents = function() {
|
||||||
//console.log('Broadcasting ' + events.length + ' events.');
|
//console.log('Broadcasting ' + events.length + ' events.');
|
||||||
|
@ -30,8 +30,8 @@ module.exports = NodeHelper.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* createFetcher(url, reloadInterval)
|
/* createFetcher(url, reloadInterval)
|
||||||
* Creates a fetcher for a new url if it doesn't exsist yet.
|
* Creates a fetcher for a new url if it doesn't exist yet.
|
||||||
* Otherwise it reuses the exsisting one.
|
* Otherwise it reuses the existing one.
|
||||||
*
|
*
|
||||||
* attribute url string - URL of the news feed.
|
* attribute url string - URL of the news feed.
|
||||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||||
@ -69,7 +69,7 @@ module.exports = NodeHelper.create({
|
|||||||
|
|
||||||
self.fetchers[url] = fetcher;
|
self.fetchers[url] = fetcher;
|
||||||
} else {
|
} else {
|
||||||
//console.log('Use exsisting news fetcher for url: ' + url);
|
//console.log('Use existing news fetcher for url: ' + url);
|
||||||
fetcher = self.fetchers[url];
|
fetcher = self.fetchers[url];
|
||||||
fetcher.broadcastEvents();
|
fetcher.broadcastEvents();
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* broadcastItems()
|
/* broadcastItems()
|
||||||
* Broadcast the exsisting items.
|
* Broadcast the existing items.
|
||||||
*/
|
*/
|
||||||
this.broadcastItems = function() {
|
this.broadcastItems = function() {
|
||||||
if (items.length <= 0) {
|
if (items.length <= 0) {
|
||||||
|
@ -25,8 +25,8 @@ module.exports = NodeHelper.create({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* createFetcher(url, reloadInterval)
|
/* createFetcher(url, reloadInterval)
|
||||||
* Creates a fetcher for a new url if it doesn't exsist yet.
|
* Creates a fetcher for a new url if it doesn't exist yet.
|
||||||
* Otherwise it reoses the exsisting one.
|
* Otherwise it reoses the existing one.
|
||||||
*
|
*
|
||||||
* attribute url string - URL of the news feed.
|
* attribute url string - URL of the news feed.
|
||||||
* attribute reloadInterval number - Reload interval in milliseconds.
|
* attribute reloadInterval number - Reload interval in milliseconds.
|
||||||
@ -62,7 +62,7 @@ module.exports = NodeHelper.create({
|
|||||||
|
|
||||||
self.fetchers[url] = fetcher;
|
self.fetchers[url] = fetcher;
|
||||||
} else {
|
} else {
|
||||||
console.log("Use exsisting news fetcher for url: " + url);
|
console.log("Use existing news fetcher for url: " + url);
|
||||||
fetcher = self.fetchers[url];
|
fetcher = self.fetchers[url];
|
||||||
fetcher.setReloadInterval(reloadInterval);
|
fetcher.setReloadInterval(reloadInterval);
|
||||||
fetcher.broadcastItems();
|
fetcher.broadcastItems();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user