twitterの I’m reading now JSActionsバージョン
はてなグループ::ついったー部 – Twitter::Uchimata – 自分の今見ているウェブサイトを簡単にTwitterにポストするGreasemonkeyスクリプト – 「easy I’m reading now」をJSActionsに移植してみました。
GM_*を用意してあげるとGreasemonkeyのコードがそのままJSActionsでも使えるようになったりしないですかねー。
はじめJSActionsの特権をいかしてchrome特権つきのLDRize Minibufferコマンドを作るの方法でがっつりGreasemonkeyから持って来れないかと思ったけど楽じゃなかったです。
if ( typeof _jsaCScript != 'undefined' ) {
( function () {
var Twitter = {
post: function (s) {
var req = new XMLHttpRequest();
req.open("post", 'http://twitter.com/statuses/update.json', true );
req.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded');
req.send('status=' + encodeURIComponent(s) );
}
}
var safeWindow = XPCNativeWrapper(window.content);
var document = safeWindow.document;
var def = "I'm reading now:"
var m = prompt(def + ' "' + document.title + '" ','')
if (m == null) return
if (m == '') m = def
var t = document.title
var h = document.location.href
var s = [m,' "',t,'" ',h].join('')
var l = t.length || true
while (l && s.length > 140) {
t = t.slice(0, -8)
l = t.length
t += '...'
s = [m,' "',t,'" ',h].join('')
}
Twitter.post(s);
} ).apply(this);
}
About this entry
You’re currently reading “twitterの I’m reading now JSActionsバージョン,” an entry on ku
- Published:
- 2007.10.30 / 12pm
- Category:
- JSActions

No comments
Jump to comment form | comments rss [?] | trackback uri [?]