Skip to content

Instantly share code, notes, and snippets.

@Constellation
Created June 20, 2010 16:30
Show Gist options
  • Save Constellation/445934 to your computer and use it in GitHub Desktop.
Save Constellation/445934 to your computer and use it in GitHub Desktop.
models.register({
name : 'ReadItLater',
ICON : 'http://readitlaterlist.com/favicon.ico',
LINK : 'http://readitlaterlist.com/',
LOGIN_URL : 'http://readitlaterlist.com/l',
check : function(ps){
return /quote|link/.test(ps.type);
},
post : function(ps){
var that = this;
return request('http://readitlaterlist.com/edit').addCallback(function(res) {
var doc = convertToHTMLDocument(res.responseText);
var form = $x('id("content")/form', doc);
if (form) {
return request('http://readitlaterlist.com/edit_process.php', {
queryString: {
BL: 1
},
sendContent: update(formContents(form), {
tags : ps.tags? ps.tags.join(',') : '',
title: ps.item,
url : ps.itemUrl
})
});
} else {
throw new Error(getMessage('error.notLoggedin'));
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment