By ooooo
—
Last update
Nov 4, 2005
—
Installed
1,443 times.
// ==UserScript==
// @name Thai Hotmail
// @namespace urn:rotemliss:greasmonkey:scripts:hotmailthaiencoding
// @description Make hotmail encoding to Thai
// @include http://by*fd.bay*.hotmail.msn.com/cgi-bin/HoTMaiL*
// @include http://by*fd.bay*.hotmail.msn.com/cgi-bin/getmsg*
// @include http://by*fd.bay*.hotmail.msn.com/cgi-bin/compose*
// @include http://by*fd.bay*.hotmail.msn.com/cgi-bin/hmhome*
// ==/UserScript==
(function()
{
HTMLElement.prototype.fixEnglishToThai = function()
{
//Modify by ooooo - E-mail: stopeat@gmail.com
//Original code by Rotem Liss and Liron Newman, http://eesh.net
var html = this.innerHTML;
html = html.replace(/á/g,"à ¸?");
html = html.replace(/â/g,"à ¸Â");
html = html.replace(/ã/g,"à ¸Â");
html = html.replace(/ä/g,"à ¸Â");
html = html.replace(/ÃÂ¥/g,"à ¸Â
");
html = html.replace(/æ/g,"à ¸Â");
html = html.replace(/ç/g,"à ¸Â");
html = html.replace(/è/g,"à ¸Â");
html = html.replace(/é/g,"à ¸Â");
html = html.replace(/ê/g,"à ¸Â");
html = html.replace(/ë/g,"à ¸Â");
html = html.replace(/ì/g,"à ¸Â");
html = html.replace(/ÃÂ/g,"à ¸?");
html = html.replace(/î/g,"à ¸Â");
html = html.replace(/ï/g,"à ¸?");
html = html.replace(/ð/g,"à ¸?");
html = html.replace(/ñ/g,"à ¸Â");
html = html.replace(/ò/g,"à ¸Â");
html = html.replace(/ó/g,"à ¸Â");
html = html.replace(/ô/g,"à ¸Â");
html = html.replace(/õ/g,"à ¸Â");
html = html.replace(/ö/g,"à ¸Â");
html = html.replace(/÷/g,"à ¸Â");
html = html.replace(/ø/g,"à ¸Â");
html = html.replace(/ù/g,"à ¸Â");
html = html.replace(/ú/g,"à ¸Â");
html = html.replace(/û/g,"à ¸Â");
html = html.replace(/ü/g,"à ¸Â");
html = html.replace(/ý/g,"à ¸?");
html = html.replace(/þ/g,"à ¸Â");
html = html.replace(/ÿ/g,"à ¸Â");
html = html.replace(/ÃÂ/g,"à ¸ ");
html = html.replace(/�/g,"à ¸¡");
html = html.replace(/ÃÂ/g,"à ¸¢");
html = html.replace(/ÃÂ/g,"à ¸£");
html = html.replace(/ÃÂ/g,"à ¸¤");
html = html.replace(/ÃÂ
/g,"à ¸¥");
html = html.replace(/ÃÂ/g,"à ¸¦");
html = html.replace(/ÃÂ/g,"à ¸§");
html = html.replace(/ÃÂ/g,"à ¸¨");
html = html.replace(/ÃÂ/g,"à ¸©");
html = html.replace(/ÃÂ/g,"à ¸ª");
html = html.replace(/ÃÂ/g,"à ¸«");
html = html.replace(/ÃÂ/g,"à ¸¬");
html = html.replace(/Ã?/g,"à ¸Â");
html = html.replace(/ÃÂ/g,"à ¸®");
html = html.replace(/æ/g,"à ¹Â");
html = html.replace(/�/g,"à ¸¯");
html = html.replace(/ç/g,"à ¹Â");
html = html.replace(/ÃÂ/g,"à ¹?");
html = html.replace(/ÃÂ/g,"à ¸º");
html = html.replace(/�/g,"à ¸°");
html = html.replace(/ÃÂ/g,"à ¸±");
html = html.replace(/ÃÂ/g,"à ¸²");
html = html.replace(/ÃÂ/g,"à ¸³");
html = html.replace(/ÃÂ¥/g,"à ¹Â
");
html = html.replace(/ÃÂ/g,"à ¸´");
html = html.replace(/ÃÂ/g,"à ¸µ");
html = html.replace(/ÃÂ/g,"à ¸¶");
html = html.replace(/ÃÂ/g,"à ¸·");
html = html.replace(/ÃÂ/g,"à ¸¸");
html = html.replace(/ÃÂ/g,"à ¸¹");
html = html.replace(/à/g,"à ¹Â");
html = html.replace(/á/g,"à ¹?");
html = html.replace(/â/g,"à ¹Â");
html = html.replace(/ä/g,"à ¹Â");
html = html.replace(/ã/g,"à ¹Â");
html = html.replace(/è/g,"à ¹Â");
html = html.replace(/é/g,"à ¹Â");
html = html.replace(/ê/g,"à ¹Â");
html = html.replace(/ë/g,"à ¹Â");
html = html.replace(/ì/g,"à ¹Â");
html = html.replace(/ð/g,"à ¹?");
html = html.replace(/ñ/g,"à ¹Â");
html = html.replace(/ò/g,"à ¹Â");
html = html.replace(/ó/g,"à ¹Â");
html = html.replace(/ô/g,"à ¹Â");
html = html.replace(/õ/g,"à ¹Â");
html = html.replace(/ö/g,"à ¹Âà ¹Â");
html = html.replace(/÷/g,"à ¹Â");
html = html.replace(/ø/g,"à ¹Â");
html = html.replace(/ù/g,"à ¹Â");
this.innerHTML = html;
}
function fixThaiToEnglish()
{
//Modify by ooooo - E-mail: stopeat@gmail.com
//Original code by Rotem Liss and Liron Newman, http://eesh.net
var html = this.value;
html = html.replace(/à ¸?/g,"á");
html = html.replace(/à ¸Â/g,"â");
html = html.replace(/à ¸Â/g,"ã");
html = html.replace(/à ¸Â/g,"ä");
html = html.replace(/à ¸Â
/g,"ÃÂ¥");
html = html.replace(/à ¸Â/g,"æ");
html = html.replace(/à ¸Â/g,"ç");
html = html.replace(/à ¸Â/g,"è");
html = html.replace(/à ¸Â/g,"é");
html = html.replace(/à ¸Â/g,"ê");
html = html.replace(/à ¸Â/g,"ë");
html = html.replace(/à ¸Â/g,"ì");
html = html.replace(/à ¸?/g,"ÃÂ");
html = html.replace(/à ¸Â/g,"î");
html = html.replace(/à ¸?/g,"ï");
html = html.replace(/à ¸?/g,"ð");
html = html.replace(/à ¸Â/g,"ñ");
html = html.replace(/à ¸Â/g,"ò");
html = html.replace(/à ¸Â/g,"ó");
html = html.replace(/à ¸Â/g,"ô");
html = html.replace(/à ¸Â/g,"õ");
html = html.replace(/à ¸Â/g,"ö");
html = html.replace(/à ¸Â/g,"÷");
html = html.replace(/à ¸Â/g,"ø");
html = html.replace(/à ¸Â/g,"ù");
html = html.replace(/à ¸Â/g,"ú");
html = html.replace(/à ¸Â/g,"û");
html = html.replace(/à ¸Â/g,"ü");
html = html.replace(/à ¸?/g,"ý");
html = html.replace(/à ¸Â/g,"þ");
html = html.replace(/à ¸Â/g,"ÿ");
html = html.replace(/à ¸ /g,"ÃÂ");
html = html.replace(/à ¸¡/g,"�");
html = html.replace(/à ¸¢/g,"ÃÂ");
html = html.replace(/à ¸£/g,"ÃÂ");
html = html.replace(/à ¸¤/g,"ÃÂ");
html = html.replace(/à ¸¥/g,"ÃÂ
");
html = html.replace(/à ¸¦/g,"ÃÂ");
html = html.replace(/à ¸§/g,"ÃÂ");
html = html.replace(/à ¸¨/g,"ÃÂ");
html = html.replace(/à ¸©/g,"ÃÂ");
html = html.replace(/à ¸ª/g,"ÃÂ");
html = html.replace(/à ¸«/g,"ÃÂ");
html = html.replace(/à ¸¬/g,"ÃÂ");
html = html.replace(/à ¸Â/g,"Ã?");
html = html.replace(/à ¸®/g,"ÃÂ");
html = html.replace(/à ¹Â/g,"æ");
html = html.replace(/à ¸¯/g,"�");
html = html.replace(/à ¹Â/g,"ç");
html = html.replace(/à ¹?/g,"ÃÂ");
html = html.replace(/à ¸º/g,"ÃÂ");
html = html.replace(/à ¸°/g,"�");
html = html.replace(/à ¸±/g,"ÃÂ");
html = html.replace(/à ¸²/g,"ÃÂ");
html = html.replace(/à ¸³/g,"ÃÂ");
html = html.replace(/à ¹Â
/g,"ÃÂ¥");
html = html.replace(/à ¸´/g,"ÃÂ");
html = html.replace(/à ¸µ/g,"ÃÂ");
html = html.replace(/à ¸¶/g,"ÃÂ");
html = html.replace(/à ¸·/g,"ÃÂ");
html = html.replace(/à ¸¸/g,"ÃÂ");
html = html.replace(/à ¸¹/g,"ÃÂ");
html = html.replace(/à ¹Â/g,"à");
html = html.replace(/à ¹?/g,"á");
html = html.replace(/à ¹Â/g,"â");
html = html.replace(/à ¹Â/g,"ä");
html = html.replace(/à ¹Â/g,"ã");
html = html.replace(/à ¹Â/g,"è");
html = html.replace(/à ¹Â/g,"é");
html = html.replace(/à ¹Â/g,"ê");
html = html.replace(/à ¹Â/g,"ë");
html = html.replace(/à ¹Â/g,"ì");
html = html.replace(/à ¹?/g,"ð");
html = html.replace(/à ¹Â/g,"ñ");
html = html.replace(/à ¹Â/g,"ò");
html = html.replace(/à ¹Â/g,"ó");
html = html.replace(/à ¹Â/g,"ô");
html = html.replace(/à ¹Â/g,"õ");
html = html.replace(/à ¹Â/g,"Ã¶à ¹Â");
html = html.replace(/à ¹Â/g,"÷");
html = html.replace(/à ¹Â/g,"ø");
html = html.replace(/à ¹Â/g,"ù");
this.value = html;
}
HTMLInputElement.prototype.fixThaiToEnglish = fixThaiToEnglish;
HTMLTextAreaElement.prototype.fixThaiToEnglish = fixThaiToEnglish;
function submitComposeForm(e) //Created by Rotem Liss
{
document.getElementById("alternateSubject").value = document.getElementById("subject").value;
document.getElementById("alternateSubject").fixThaiToEnglish();
document.getElementById("alternateBody").value = document.getElementById("body").value;
document.getElementById("alternateBody").fixThaiToEnglish(); //Fix Body
}
if ((location.href.indexOf("compose") == -1) && (document.characterSet == "ISO-8859-1"))
{
if (document.characterSet == "ISO-8859-1")
{
if (document.getElementById("MsgTable"))
{
document.getElementById("MsgTable").fixEnglishToThai();
document.body.childNodes[14].firstChild.firstChild.firstChild.firstChild.firstChild.
fixEnglishToThai();
}
else
{
document.body.fixEnglishToThai();
}
}
}
else
{
if (document.characterSet == "ISO-8859-1")
{
document.getElementById("HMTB").firstChild.childNodes[1].firstChild.firstChild.firstChild.
firstChild.childNodes[1].addEventListener("mousedown", submitComposeForm, true);
var alternateSubject = document.getElementById("subject").cloneNode(true);
alternateSubject.type = "hidden";
alternateSubject.id = "alternateSubject";
alternateSubject.name = "subject";
document.forms["composeform"].appendChild(alternateSubject);
document.getElementById("subject").name = "";
//Find body
var textareas = document.getElementsByTagName("textarea");
var i;
for (i = 1; (i <= textareas.length); i++)
{
if (textareas[i - 1].name == "body")
{
textareas[i - 1].id = "body";
break;
}
}
var alternateBody = document.getElementById("body").cloneNode(true);
alternateBody.style.display = "none";
alternateBody.id = "alternateBody";
alternateBody.name = "body";
document.forms["composeform"].appendChild(alternateBody);
document.getElementById("body").name = "";
}
}
})();