Ciencia Inútil o el Alquimista

アマグラマーの日曜ハッキングメモ (跡地)

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
--.--.-- --:-- | スポンサー広告 | トラックバック(-) | コメント(-) |
FC2 managemented
TwitThisはパスワードを送らないといけないのでブックマークレットを書いた。
POSTしろとかRefererを空にしろとかうるさいけど、これで行けた。
Twit!
javascript:(function(){w=window.open('','_blank','width=520,height=300,resizable=1,scrollbars=1');f=w.document.createElement('form');f.setAttribute('action','http://twitter.com/statuses/update.xml');f.setAttribute('method','POST');i=w.document.createElement('input');i.setAttribute('type','hidden');i.setAttribute('name','status');i.setAttribute('value','Reading '+document.title+' '+location.href);f.appendChild(i);w.document.documentElement.appendChild(f);f.submit();}())
(追記参照)

今見ているページを送信します。
twitter.comとしか通信しません。2回目以降はログイン情報を保持します。(Cookieではないのでブラウザを閉じるまで)
更新後のページは生XMLで見苦しいけど。あと確認画面とかも出さないので、エロサイトとか見ている時にうっかり押さないように注意。
Firefoxで確認。escape()しなくていいのかな。"Reading "を入れたので". "はいらない?

(4/13追記)
トラバ返し。
Collection & Copy - ロケーションバーからTwitterへポストするキーワードブックマーク
なるほど。window.onunloadを使えばsubmitが完了してからウィンドウを閉じられるのね。こちらこそ勉強になりました。
修正版。
Twit!
javascript:(function(){w=window.open('','_blank','width=0,height=0');f=w.document.createElement('form');f.setAttribute('action','http://twitter.com/statuses/update.xml');f.setAttribute('method','POST');i=w.document.createElement('input');i.setAttribute('type','hidden');i.setAttribute('name','status');i.setAttribute('value','Reading '+document.title+' '+location.href);f.appendChild(i);w.document.documentElement.appendChild(f);f.submit();w.onunload=function(){w.close();}}())

IE不可が判明。Refererが空にならない。

(追記)
さらに今では接頭文言をprompt()で入力するようにしている。
Twit!
javascript:(function(){w=window.open('','_blank','width=0,height=0');f=w.document.createElement('form');f.setAttribute('action','http://twitter.com/statuses/update.xml');f.setAttribute('method','POST');i=w.document.createElement('input');i.setAttribute('type','hidden');i.setAttribute('name','status');i.setAttribute('value',(prompt('','Reading'))+' '+document.title+' '+location.href);f.appendChild(i);w.document.documentElement.appendChild(f);f.submit();w.onunload=function(){w.close();}}())


(追追記)
さらに、間違って触ってしまった時のためにキャンセルを可能に。
Twit!
javascript:(function(){if(m=prompt('','Reading')){w=window.open('','_blank','width=0,height=0');f=w.document.createElement('form');f.setAttribute('action','http://twitter.com/statuses/update.xml');f.setAttribute('method','POST');i=w.document.createElement('input');i.setAttribute('type','hidden');i.setAttribute('name','status');i.setAttribute('value',m+'%20'+document.title+'%20'+location.href);f.appendChild(i);w.document.documentElement.appendChild(f);f.submit();w.onunload=function(){w.close();}}}())


(2009/2/8追記)
Google Chrome 対策をしました。→Twit! ブックマークレットの Google Chrome 対策 - 無用の科学あるいは錬金術
2007.04.12 23:49 | 日曜ハッキング | トラックバック(2) | コメント(-) |
FC2 managemented

トラックバックURL↓
http://worris.blog61.fc2.com/tb.php/61-d1d182aa

[JavaScript]ロケーションバーからTwitterへポストするキーワードブックマーク
FirefoxのロケーションバーからTwitterへポストします。 [Ctrl]+[L]でロケーションバーにフォーカスを移動し、「tw こんにちは」という感じです。 新しいブックマークを、名前「[tw]Twitterへポストする」、キーワード「tw」などで作成し(どちらも任意)、URLに以下を貼り付

2007.04.13 16:40 | Collection & Copy

post to Twitter - ブックマークレットの作り方4
 Twit! ブックマークレットによると、新しいウィンドを作成してその中でPOSTすればFirefoxではリファラーが空になるとの事。という事はリファラーを送る設定にしているFirefoxでも・・。(ウィンドが一瞬表示されるので何か

2007.05.28 13:45 | The elephant vanishes

| ホーム |