Created
April 16, 2011 20:28
-
-
Save saitamanodoruji/923461 to your computer and use it in GitHub Desktop.
extractor.drawr.Photo.js
This file contains hidden or 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
// 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