Created
January 6, 2009 03:16
-
-
Save motemen/43648 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== | |
// @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