Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==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
You can’t perform that action at this time.