Created
August 31, 2009 09:59
-
-
Save whym/178378 to your computer and use it in GitHub Desktop.
Post to Google Docs. Right-click on a link -> Choose Share - Link - Target -> Choose GoogleDocs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
models.register({ | |
name : 'GoogleDocs', | |
ICON : 'http://docs.google.com/favicon.ico', | |
check : function(ps){ | |
return ps.type == 'link' && !ps.file; | |
}, | |
getAuthCookie : function(){ | |
return getCookieString('www.google.com', 'secid').split('=').pop(); | |
}, | |
post : function(ps){ | |
var endpoint = 'http://docs.google.com/DocAction?action=updoc'; | |
if (!this.getAuthCookie()) | |
throw new Error(getMessage('error.notLoggedin')); | |
return request(endpoint).addCallback(function(res){ | |
var doc = convertToHTMLDocument(res.responseText); | |
return request(endpoint, { | |
redirectionLimit : 0, | |
sendContent : update(formContents(doc), { | |
uploadURL: ps.itemUrl, | |
DocName: ps.item | |
}) | |
}); | |
}); | |
} | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tombloo.Service.extractors.register([{ | |
name : 'Link - Target', | |
ICON : 'chrome://tombloo/skin/link.png', | |
check : function(ctx){ | |
return ctx.onLink; | |
}, | |
extract : function(ctx){ | |
return { | |
type : 'link', | |
item : ctx.link.textContent, | |
itemUrl : ctx.link.href | |
}; | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment