Fix parser degli eventi per ai1ec 2.5.39
This commit is contained in:
parent
3e2279da06
commit
cb16f5d79a
2 changed files with 42 additions and 39 deletions
|
@ -17,52 +17,52 @@ var ai1ec = (function(){
|
||||||
//Parser di un evento dell'array tornato da getXmlData
|
//Parser di un evento dell'array tornato da getXmlData
|
||||||
API.event = {
|
API.event = {
|
||||||
getId : function(event) {
|
getId : function(event) {
|
||||||
return event.uid ? getCleanId(event.uid) : null;
|
return event.properties.uid ? getCleanId(event.properties.uid.text) : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTitle : function(event) {
|
getTitle : function(event) {
|
||||||
return event.summary || null;
|
return event.properties.summary.text || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getDescription : function(event) {
|
getDescription : function(event) {
|
||||||
return event.description || "";
|
return event.properties.description.text || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitDate : function(event) {
|
getInitDate : function(event) {
|
||||||
return event.dtstart && event.dtstart._ ? event.dtstart._ : "";
|
return event.properties.dtstart && event.properties.dtstart["date-time"] ? event.properties.dtstart["date-time"] : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getEndDate : function(event) {
|
getEndDate : function(event) {
|
||||||
return event.dtend && event.dtend._ ? event.dtend._ : "";
|
return event.properties.dtend && event.properties.dtend["date-time"] ? event.properties.dtend["date-time"] : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getCats : function(event) {
|
getCats : function(event) {
|
||||||
return event.categories || "";
|
return event.properties.categories.text || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getTags : function(event) {
|
getTags : function(event) {
|
||||||
return event["x-tags"] && event["x-tags"]._ ? event["x-tags"]._ : "";
|
return event.properties["x-tags"] && event.properties["x-tags"]._ ? event.properties["x-tags"]._ : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getUrl : function(event) {
|
getUrl : function(event) {
|
||||||
return event.url && event.url.$ && event.url.$.uri ? event.url.$.uri : "";
|
return event.properties.url && event.properties.url.uri && event.properties.url.uri ? event.properties.url.uri : "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getContact : function(event) {
|
getContact : function(event) {
|
||||||
return event.contact || "";
|
return event.properties.contact || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getGeo : function(event) {
|
getGeo : function(event) {
|
||||||
return event.geo || "";
|
return event.properties.location.text || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
//Regole per gli eventi ripetitivi
|
//Regole per gli eventi ripetitivi
|
||||||
getRule : function(event) {
|
getRule : function(event) {
|
||||||
return event.rrule || "";
|
return event.properties.rrule || "";
|
||||||
},
|
},
|
||||||
|
|
||||||
getImage : function(event){
|
getImage : function(event){
|
||||||
return event['x-wp-images-url'] || "";
|
return event.properties['x-wp-images-url'] && event.properties['x-wp-images-url'].unknown ? event.properties['x-wp-images-url'].unknown : "";
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ var ai1ec = (function(){
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
json[catId] = $.xml2json(res);
|
json[catId] = $.xml2json(res);
|
||||||
events[catId] = json[catId]["#document"].vcalendar.vevent;
|
events[catId] = json[catId]["#document"].icalendar.vcalendar.components.vevent;
|
||||||
console.log(events[catId]);
|
console.log(events[catId]);
|
||||||
return callback(events[catId]);
|
return callback(events[catId]);
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@ var ai1ec = (function(){
|
||||||
catId = catId || API.cats.single;
|
catId = catId || API.cats.single;
|
||||||
|
|
||||||
return API.remote.site + API.remote.q + "&" + API.remote.catq + catId + "&" + API.remote.xmlq;
|
return API.remote.site + API.remote.q + "&" + API.remote.catq + catId + "&" + API.remote.xmlq;
|
||||||
}
|
};
|
||||||
|
|
||||||
//Oggetto che gestisce attività remote
|
//Oggetto che gestisce attività remote
|
||||||
API.remote = {
|
API.remote = {
|
||||||
|
|
3
www/js/vendor/xml2json.js
vendored
3
www/js/vendor/xml2json.js
vendored
|
@ -63,6 +63,9 @@
|
||||||
|
|
||||||
for (i = 0; i < xml.childNodes.length; i++) {
|
for (i = 0; i < xml.childNodes.length; i++) {
|
||||||
node = xml.childNodes[i];
|
node = xml.childNodes[i];
|
||||||
|
if (node.nodeName === "#comment")
|
||||||
|
continue;
|
||||||
|
|
||||||
if (node.nodeType === 1) {
|
if (node.nodeType === 1) {
|
||||||
|
|
||||||
if (node.attributes.length === 0 && node.childElementCount === 0){
|
if (node.attributes.length === 0 && node.childElementCount === 0){
|
||||||
|
|
Loading…
Reference in a new issue