Skip to content

Instantly share code, notes, and snippets.

@ucnv
Created February 9, 2009 06:06
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 ucnv/60680 to your computer and use it in GitHub Desktop.
Save ucnv/60680 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter Carp
// @namespace http://userscripts.org/users/40991
// @include http://twitter.com/home
// ==/UserScript==
// Stolen from http://userscripts.org/scripts/show/22404
(function() {
var replacements = ['鮎', '鯵', '鮎', '鮑', '鰒', '鰯', '鰻', '鰓', '鰍', '鰹',
'鰈', '鱚', '鯨', '鯉', '鯒', '鮗', '鮭', '鯖', '鮫', '鰆',
'鯱', '鱸', '鯛', '鱈', '鰌', '鯰', '鯡', '鰊', '鯊', '鰰',
'鱧', '鮠', '鰡', '鮃', '鮒', '鰤'];
var w = (typeof unsafeWindow == 'undefined') ? window : unsafeWindow;
var form = document.getElementById('doingForm');
var submit = w.document.getElementById('update-submit');
var status = document.getElementById('status');
var convertText = function(callback) {
var replacement = replacements[Math.floor(Math.random() * replacements.length)];
var url = 'http://areare.appjet.net/convert?&q={str}&replacement=' + encodeURIComponent(replacement);
GM_xmlhttpRequest({
method : "GET",
url : url.replace(/{str}/, status.value),
overrideMimeType: "text/html; charset=utf8",
onload : function(response) {
var result = response.responseText;
status.value = result;
callback();
}
});
};
submit.addEventListener('click', function(e) {
convertText(function() {
var evt = document.createEvent('HTMLEvents');
evt.initEvent('submit', true, true);
evt.element = function (){ return evt.target; };
form.dispatchEvent(evt);
});
e.preventDefault();
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment