I've writen a cool application to tinyfy urls and post them to social website. The result is http://a.pwal.fr.
there is a Firefox plugin for newbies but I'm not. I'm using the great Firefox plugin Vimperator as a 100% pur geek.
So I've tried to add a command ti Vimperator to quickly post links on Twitter.
It's a bit easy since I'm now familiar with XUL. Here the result. Just add it to your ~/.vimperatorrc:
" add :twit <alias> command
js << EOF
apwalfr = {
addScript: function(path) {
var doc = window.content.document;
var s = doc.createElement('script');
s.setAttribute('src', 'http://a.pwal.fr'+path);
s.setAttribute('type', 'text/javascript');
doc.body.appendChild(s);
},
quickTwit: function(alias) {
var doc = window.content.document;
var url = "http://twitter.com/home/?status=$t+$u";
var path = '/json/?callback=apwal.quickPost&alias='+alias+'&arg='+encodeURIComponent(url)+'&url='+encodeURIComponent(doc.location.href)
this.addScript('/_static/api.js')
this.addScript(path)
}
}
EOF
command! twit -nargs=? :js apwalfr.quickTwit('<args>')
This post is a simple note for myself and can help people to extend Vimperator since the docs is hard to find for now.