twitterBoardからハイクへ投稿
これをハイクへの投稿フォームにしてしまいましょう。
twitterBoard.js - clickPost()
//var postText = encodeURIComponent(textStr); twitterPostMessage(textStr, username, password, true, postBM);
twitterPostMessage.js
var source = "空";
twitterPostMessage.js - twitterPostMessage()
... var hhttp = null; var haikuURL = "http://h.hatena.ne.jp/api/statuses/update.json"; var haikuUser = "(id)"; var haikuPassword = "(メール投稿の投稿用アドレスの@以前の文字列)"; // from どこそこ を変更する var m; if (m = msg.match(/^source=(.+)/)) { source = m[1]; document.getElementById("postText").value = source; return; } postFeed(msg); postHaiku(msg); // Haiku! function postHaiku(postText) { // twitterへのリプライは無視する if (postText.charAt(0) == "@" || postText.match(/@\w/)) { return; } // キーワード指定は「キーワード:本文」で // 指定していないときはidページへ var keyword = ""; if (postText.match(/:/)) { var a = postText.split(":"); keyword = a.shift(); postText = a.join(":"); } if (hhttp != null) { hhttp.abort(); hhttp = null; } hhttp = new XMLHttpRequest(); try { hhttp.onreadystatechange = function() {}; hhttp.open("POST", haikuURL, true); var b64 = 'Basic ' + base64encode(haikuUser + ':' + uPassword); hhttp.setRequestHeader("Authorization", b64); hhttp.send('source=' + encodeURIComponent(source) + '&status=' + encodeURIComponent(postText) + '&keyword=' + encodeURIComponent)); } catch (err) { } } ... function postFeed(postText) { // はてなへのidポストは無視する if (postText.match(/^id:\w|\Wid:\w/)) { document.getElementById("postText").value = ""; return; } // twitterだけに投稿 postText = postText.replace(/^@\s+/, ""); // はてなフォトライフへのリンク postText = postText.replace(/f:id:(\w+):(\d+).:image/g, "http://f.hatena.ne.jp/$1/$2");