jparise / evite-gcal (http://userscripts.org/scripts/show/39460)

A Greasemonkey script that replaces the Outlook Calendar link in Evite invitations with a Google Calendar link.

Clone this repository (size: 7.6 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/jparise/evite-gcal/
commit 3: ff80716c784a
parent 2: e87bdbb6bf84
branch: default
The details text may be wrapped in a <div> element. Also, reducing the maximum length of the details string.
Jon Parise / jparise
12 months ago

Changed (Δ323 bytes):

raw changeset »

evite-gcal.user.js (13 lines added, 4 lines removed)

Up to file-list evite-gcal.user.js:

3
3
// @namespace      http://www.indelible.org/
4
4
// @description    Replaces the default calendar link in Evite invitations with a Google Calendar link instead.
5
5
// @author         Jon Parise
6
// @version        1.2
6
// @version        1.3
7
7
// @include        http://www.evite.com/pages/invite/*
8
8
// ==/UserScript==
9
9
@@ -131,12 +131,21 @@ function makeGoogleCalendarLink()
131
131
132
132
    var details = '';
133
133
    if (detailsIndex != -1) {
134
        details += tds[detailsIndex].innerHTML;
134
        // The details text may be wrapped in a <div> element.
135
        var divs = tds[detailsIndex].getElementsByTagName('div');
136
        if (divs.length > 0) {
137
            details = divs[0].innerHTML;
138
        } else {
139
            details = tds[detailsIndex].innerHTML;
140
        }
141
142
        // Trim off any leading whitespace.
143
        details = details.replace(/^\s*/, '');
135
144
136
145
        // We need to limit the length of the details string to avoid
137
146
        // exceeding the maximum accepted length of the GET request.
138
        if (details.length > 1200) {
139
            details = details.substr(0, 1200);
147
        if (details.length > 1000) {
148
            details = details.substr(0, 1000);
140
149
            details += '...';
141
150
        }
142
151