Skip to content

Instantly share code, notes, and snippets.

@saitamanodoruji
Created April 16, 2011 20:28
Show Gist options
  • Save saitamanodoruji/923461 to your computer and use it in GitHub Desktop.
Save saitamanodoruji/923461 to your computer and use it in GitHub Desktop.
extractor.drawr.Photo.js
// Photo - Upload from Cache して tag をつける
Tombloo.Service.extractors.register([
{
name: 'Photo - drawr',
ICON: 'http://drawr.net/favicon.ico',
check: function(ctx){
return ctx.onImage && /drawr\.net/.test(ctx.host)
},
extract: function(ctx){
var tags = ['illustration', 'drawr']
if(ctx.document.contentType.match(/^image/))
ctx.title = ctx.href.split('/').pop();
var target = ctx.target;
var itemUrl = (tagName(target)=='object')? target.data : target.src;
var uri = createURI(itemUrl);
return download(itemUrl, getTempDir()).addCallback(function(file){
return {
type : 'photo',
item : ctx.title,
itemUrl : itemUrl,
file : file,
tags : tags
}
});
},
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment