FFixer

By Vaughan Chandler Last update Mar 9, 2011 — Installed 14,797,238 times.

iCalendar Link Gone?

in
Subscribe to iCalendar Link Gone? 5 posts, 4 voices



djace User
FirefoxWindows

Hi!

I can't find the link to the generated iCal file in the Events page.
Where should I look for it? Or is it not working at the moment?

I'm using 2.1-alpha2

 
Vaughan Chan... Script's Author
MozillaX11

Hi djace, Facebook broke this feature with the most recent updates. I haven't gotten to working on this one yet so I still have to figure out if I can do it.

 
l-g User
FirefoxMacintosh

Is it still broken?

 
Vaughan Chan... Script's Author
FirefoxX11

Yes, this is still broken, and I still have to decide if I'll be bringing it back. Since Facebook no longer provides a page with all the birthdays listed on it this is no longer something simple to do. Currently they only way to add birthdays to a calendar is using the Google Calendar link the script adds to people profiles, but that has to be done one at a time.

Facebook offers an iCal file that lists events in it, so it should be simple for them to provide similar functionality for birthdays if enough people request that they add it.

 
matzz User
FirefoxWindows

Hi!
As long as Facebook does not fix it, you could give it a try with this patch (based on version 2.3.0). It could possibly be integrated a litte nicer, and the Google export is still broken, but birthdays export works fine on my profile with this:


@@ -132,6 +132,8 @@
var hidePopupPicTimeout;
var storage;

+var icalTmp;
+
var lang = {
// English - By Vaughan Chandler
en : {
@@ -4186,6 +4188,72 @@
}

//
+// Get day events from page
+//
+function getDayEvents(pageDoc) {
+ var ical = '';
+ var divItems = $("//ul[@class='uiList fbxevents_eventlist'][1]/li", pageDoc, false);
+ var divBlock;
+ var name;
+ var date1;
+ var date2;
+ var info;
+ var dateString1;
+ var dateString2;
+ for (i=0; i<divItems.snapshotLength; i++) {
+ divBlock = $("./div[@class='UIImageBlock clearfix UIImageBlock_Entity'][1]/div[@class='UIImageBlock_Content UIImageBlock_ENT_Content'][1]",divItems.snapshotItem(i),true);
+ name = $("./div[@class='uiTextTitle'][1]/a[1]",divBlock,true).text;
+ info = $("./div[@class='uiTextSubtitle'][1]/div[1]",divBlock,true).innerHTML.split(' ยท ');
+ date1 = $d(info[0]);
+ date2 = date1.getNextDay();
+ dateString1 = date1.toISOString(false);
+ dateString2 = date2.toISOString(false);
+ ical = ical + 'BEGIN:VEVENT%0D%0ASUMMARY:' + $l('Birthday',prefs['CalendarFullName'] ? name : name.split(' ')[0]) + '%0D%0ADESCRIPTION:' + $l('Birthday',name) + '%0D%0ADTSTART;VALUE=DATE:' + dateString1 + '%0D%0ADTEND;VALUE=DATE:' + dateString2 + '%0D%0ARRULE:FREQ=YEARLY%0D%0AEND:VEVENT%0D%0A';
+ var s=i+'';
+ }
+ return ical;
+}
+
+//
+// Process birthday page navigation
+//
+function processBDResponse(response) {
+ var newdiv = document.createElement('div');
+ newdiv.innerHTML = response.responseText;
+ processBirthdayPage(newdiv);
+ newdiv = null;
+}
+
+//
+// Iterate through birthday pages and read
+//
+function processBirthdayPage(currentDoc) {
+ var elm = $("//div[contains(@class,'pageScan')][1]/div[@class='rfloat'][1]", currentDoc, true);
+ var status = document.getElementById('fbfical');
+ var nextLink = $("./a[@class='next'][1]", elm, true).href;
+ if (nextLink != "") {
+ status.innerHTML = status.innerHTML + '.';
+ icalTmp = icalTmp + getDayEvents(currentDoc);
+ xmlhttpRequest({
+ method:"GET",
+ url:nextLink,
+ headers:{
+ "User-Agent":"Mozilla/5.0",
+ "Accept":"text/xml",
+ "Cookie":"noscript=1" // This is to make sure we get parseable HTML
+ }
+ },processBDResponse);
+ } else {
+ status.href = 'data:text/calendar;charset=US-ASCII,' + icalTmp + 'END:VCALENDAR';
+ icalTmp = '';
+ status.onclick='';
+ location.replace(status.href);
+ document.getElementById('fbfcalwarning').style.display = 'none';
+ status.innerHTML = $l('ExportICalendarFile');
+ }
+}
+
+//
// Process the page at regular intervals
//
processing = setInterval(processPage, prefs['ProcessInterval']);
@@ -4392,10 +4460,10 @@
//
// Add calendar features to Events pages
//
- if ((prefs['GoogleCalendar'] || prefs['iCalendar']) && page.indexOf('events.php')==0) {
- if (prefs['iCalendar'] && page.indexOf('events.php?bday=1')==0) {
+ if ((prefs['GoogleCalendar'] || prefs['iCalendar']) && page.indexOf('?sk=bd')!=-1) {
+ if (prefs['iCalendar'] && page.indexOf('?sk=bd')!=-1 && !page.match(/&s=[1-9]+/)) { // Only display on first page
try {
- var elm = document.evaluate("//div[contains(@class,'summary_bar')][1]/div[@class='summary'][1]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE ,null).singleNodeValue;
+ var elm = $("//div[contains(@class,'pageScan')][1]/div[@class='prm lfloat'][1]/div[@class='uiTextSubtitle'][1]", document, true);
if (elm!=null) {
if (elm.className.indexOf('fbfcal')!=-1) { return; }
elm.className = elm.className + ' fbfcal';
@@ -4406,37 +4474,8 @@
e.preventDefault();
document.getElementById('fbfical').innerHTML = $l('CreatingFile');
setTimeout(function(){
- var now = new Date();
- var day = now.getDate();
- var month = now.getMonth()+1;
- var year = now.getFullYear();
- var divs = document.evaluate("//div[@class='bdaycal_month_section']",document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE ,null);
- var ical = 'BEGIN:VCALENDAR%0D%0AVERSION:2.0%0D%0APRODID:FFixer%0D%0A';
- var eventMonth;
- var date;
- var days;
- var bdays;
- for (i=0; i<divs.snapshotLength; i++) {
- eventMonth = $m(divs.snapshotItem(i).id)+1+'';
- if (eventMonth<10) { eventMonth = '0' + eventMonth; }
- days = divs.snapshotItem(i).innerHTML.replace(/.*<\/table>/,'').split(/<br[^>]*>/g);
- for (j=0; j<days.length; j++) {
- if (m = days[j].match(/^(\d+)/)) {
- bdays = days[j].split(',');
- for (k=0; k<bdays.length; k++) {
- if (n = bdays[k].match(/[^>]+>([^<]+)/)) {
- date = ((eventMonth < month || (eventMonth == month && m[1] < day)) ? year-0+1 : year) + eventMonth + m[1];
- ical = ical + 'BEGIN:VEVENT%0D%0ASUMMARY:' + $l('Birthday',prefs['CalendarFullName'] ? n[1] : n[1].split(' ')[0]) + '%0D%0ADESCRIPTION:' + $l('Birthday',n[1]) + '%0D%0ADTSTART:' + date + '%0D%0ADTEND:' + date + '%0D%0ARRULE:FREQ=YEARLY%0D%0AEND:VEVENT%0D%0A';
- }
- }
- }
- }
- }
- e.target.href = 'data:text/calendar;charset=US-ASCII,' + ical + 'END:VCALENDAR';
- e.target.onclick='';
- location.replace(e.target.href);
- document.getElementById('fbfcalwarning').style.display = 'none';
- document.getElementById('fbfical').innerHTML = $l('ExportICalendarFile');
+ icalTmp = 'BEGIN:VCALENDAR%0D%0AVERSION:2.0%0D%0APRODID:FFixer%0D%0A';
+ processBirthdayPage(document);
},0);
}
}, false);

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel