// ==UserScript== // @name Twitter follow message // @namespace http://web.zgo.jp/ // @include http://twitter.com/* // @include https://twitter.com/* // @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);