mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-09-13 23:55:11 +00:00
ICal Parser Fix
A little hack to fix all day ICal Events. The summary Field was being overwritten, by the VALARM Summary.
This commit is contained in:
@@ -80,6 +80,7 @@ function ical_parser(feed_url, callback){
|
|||||||
|
|
||||||
//Keep track of when we are activly parsing an event
|
//Keep track of when we are activly parsing an event
|
||||||
var in_event = false;
|
var in_event = false;
|
||||||
|
var summary_set = false;
|
||||||
//Use as a holder for the current event being proccessed.
|
//Use as a holder for the current event being proccessed.
|
||||||
var cur_event = null;
|
var cur_event = null;
|
||||||
for(var i=0;i<cal_array.length;i++){
|
for(var i=0;i<cal_array.length;i++){
|
||||||
@@ -94,6 +95,7 @@ function ical_parser(feed_url, callback){
|
|||||||
in_event = false;
|
in_event = false;
|
||||||
this.events.push(cur_event);
|
this.events.push(cur_event);
|
||||||
cur_event = null;
|
cur_event = null;
|
||||||
|
summary_set = false;
|
||||||
}
|
}
|
||||||
//If we are in an event
|
//If we are in an event
|
||||||
else if(in_event){
|
else if(in_event){
|
||||||
@@ -108,6 +110,13 @@ function ical_parser(feed_url, callback){
|
|||||||
type = ln.substr(0,idx).replace(/^\s\s*/, '').replace(/\s\s*$/, '');//Trim
|
type = ln.substr(0,idx).replace(/^\s\s*/, '').replace(/\s\s*$/, '');//Trim
|
||||||
val = ln.substr(idx+1).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
val = ln.substr(idx+1).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
||||||
|
|
||||||
|
//Ensure summary is not overwritten by VAlARM Summary
|
||||||
|
if(type =='SUMMARY' && !summary_set){
|
||||||
|
summary_set = true;
|
||||||
|
}else if(type =='SUMMARY' && summary_set){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//If the type is a start date, proccess it and store details
|
//If the type is a start date, proccess it and store details
|
||||||
if(type =='DTSTART'){
|
if(type =='DTSTART'){
|
||||||
dt = this.makeDate(val);
|
dt = this.makeDate(val);
|
||||||
|
Reference in New Issue
Block a user