Created
January 10, 2009 00:07
-
-
Save nobuhito/45323 to your computer and use it in GitHub Desktop.
This file contains 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== | |
// @author SATO Nobuhito | |
// @version 1.0 | |
// @name Gwitter | |
// @namespace nobuhito.sato@gmail.com | |
// @description google search with post to twitter | |
// @include http://google.*/search* | |
// @include http://www.google.*/search* | |
// ==/UserScript== | |
(function() { | |
var username = ''; | |
var password = ''; | |
var url = 'twitter.com/statuses/update.json'; | |
var gwitter_q = document.forms.namedItem("gs").elements.namedItem("q").value; | |
var gwitter_last = GM_getValue('last', ''); | |
if (gwitter_q == gwitter_last) return; | |
GM_xmlhttpRequest({ | |
method: 'POST', | |
url: 'http://' + username + ':' + password + '@' + url, | |
data: 'status=' + encodeURIComponent(gwitter_q), | |
headers: { | |
'Content-Type' : 'application/x-www-form-urlencoded' | |
}, | |
onload: function() { | |
GM_setValue('last', gwitter_q); | |
var body = document.getElementsByTagName('body')[0]; | |
var twitter = document.createElement('img'); | |
twitter.src = 'http://twitter-development-talk.googlegroups.com/web/girl_square.gif?gda=snrts0AAAABDeqJz6jMttqtU34ao5wnwyG13cBE5UKrr59RL3SWO1WG1qiJ7UbTIup-M2XPURDSnjdvvYeUIgBOinLjkdSfG'; | |
twitter.style.position = 'absolute'; | |
twitter.style.top = '8px'; | |
twitter.style.left = '35px'; | |
body.appendChild(twitter); | |
}, | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment