Skip to content

Instantly share code, notes, and snippets.

@motemen
Created January 6, 2009 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motemen/43648 to your computer and use it in GitHub Desktop.
Save motemen/43648 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Kore Yoyaku Shita
// @namespace http://twitter.com/motemen
// @include http://www.amazon.co.jp/*-22*
// ==/UserScript==
var ID_MAPPING = {
nifuba: 'fuba',
harsch: 'harsch',
tokyoenvious: 'motemen'
};
if (location.href.match(/(\w+)-22/) && RegExp.$1 in ID_MAPPING) {
var twitter_id = ID_MAPPING[RegExp.$1];
var button = document.getElementById('addToCartSpan').getElementsByTagName('input')[0];
if (button.alt == 'この商品を今日予約注文する') {
button.addEventListener('click', function (e) {
GM_xmlhttpRequest({
method: 'POST',
url: 'http://twitter.com/statuses/update.json',
headers: { 'Content-type': 'application/x-www-form-urlencoded' },
data: 'status=' + encodeURIComponent('@' + twitter_id + ' これ予約した http://www.amazon.co.jp/exec/obidos/ASIN/' + unsafeWindow.asin + '/tokyoenvious-22')
});
}, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment