Created
January 17, 2009 05:51
-
-
Save azu/48274 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Twitter follow message | |
// @namespace http://web.zgo.jp/ | |
// @include http://twitter.com/* | |
// @include https://twitter.com/* | |
// @exclude http://twitter.com/home | |
// @exclude https://twitter.com/home | |
// @description フォローボタンを押したらフォローしたことを発言する | |
// ==/UserScript== | |
var prefix = "."; //接頭辞 | |
var postfix = " をフォローした";//接尾辞 | |
function post(status) { | |
GM_xmlhttpRequest({ | |
method : 'post', | |
url : 'http://twitter.com/statuses/update.json', | |
headers: { | |
'Content-type': 'application/x-www-form-urlencoded', | |
}, | |
data : 'status=' + encodeURIComponent(status), | |
onload : function(res) { | |
//if (useAlert) alert('twittered!') | |
debug('Loaded - ' + status + ' - ' + res.status + ': ' + res.statusText) | |
}, | |
onerror: function(res) { | |
if (useAlert) alert('post failed!') | |
error('Failed - ' + status + ' - ' + res.status + ': ' + res.statusText) | |
}, | |
}) | |
} | |
function init() { | |
var m = document.getElementsByName("page-user-screen_name")[0].content; | |
if (m == null) return | |
var s = prefix + "@" + m + postfix; | |
post(s); | |
} | |
var fl_button = document.getElementById("follow_button"); | |
fl_button.addEventListener('click', init, false); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment