<!doctype html>
<html>
<head>
<title>Send email of Morse Code</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.25, maximum-scale=8, user-scalable=yes" />
<link href='//www.rjmprogramming.com.au/PHP/emboss_h1.css' rel='stylesheet' type='text/css'>
<script type='text/javascript'>
var documentURL='';
var surl;
var cnt = 1;
var startagain='';
var wasemailee = 'fill.in@email';
var mtable = [
'.-','a', //.-
'-...','b', //-...
'-.-.','c', //-.-.
'-..','d', //-..
'.','e', //.
'..-.','f', //..-.
'--.','g', //--.
'....','h', //....
'..','i', //..
'.---','j', //.---
'-.-','k', //-.-
'.-..','l', //.-..
'--','m', //--
'-.','n', //-.
'---','o', //---
'.--.','p', //.--.
'--.-','q', //--.-
'.-.','r', //.-.
'...','s', //...
'-','t', //-
'..-','u', //..-
'...-','v', //...-
'.--','w', //.--
'-..-','x', //-..-
'-.--','y', //-.--
'--..','z', //--..
'.----','1', //.----
'..---','2', //..---
'...--','3', //...--
'....-','4', //....-
'.....','5', //.....
'-....','6', //-....
'--...','7', //--...
'---..','8', //---..
'----.','9', //----.
'-----','0', //-----
' ', ' '
];
function prealetter() {
aletter("","");
}
function aletter(myv,myc) {
var i, j, k, lmc, words, letters, amsg='', thisvalue;
if (startagain != '') {
cnt = cnt + 1;
startagain='';
document.getElementById("myh1").innerHTML = "My Morse Code Message " + cnt;
document.getElementById("aemail").href="mai" + "lto:" + document.getElementById("to").value + "?subject=My%20Morse%20Code%20Message&body=" + encodeURIComponent(surl[0] + '?to=' + document.getElementById("to").value + '&mc=');
document.getElementById("mymsg").innerHTML = '';
document.getElementById("mymc").innerHTML = '';
if (1 == 2) {
thisvalue=document.getElementById("to").value;
wasemailee = 'fill.in@email';
document.getElementById("aemail").href=document.getElementById("aemail").href.replace(wasemailee,thisvalue).replace(encodeURIComponent(wasemailee),encodeURIComponent(thisvalue));
wasemailee=thisvalue;
}
}
if (myv == '') {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var shuh=document.getElementById("mymsel").innerHTML;
document.getElementById("mymsel").style.display='none';
document.body.innerHTML=document.body.innerHTML + "<div align='center'>" + shuh.replace(/\/option/g, "/input").replace(/option /g, "input type='button' ") + "</div>";
} else {
document.body.innerHTML=document.body.innerHTML.replace(">--.</option>", ">--.</option></select><select multiple size=8 style='width:100px;font-size:36px;'>");
document.body.innerHTML=document.body.innerHTML.replace(">---</option>", ">---</option></select><select multiple size=8 style='width:100px;font-size:36px;'>");
document.body.innerHTML=document.body.innerHTML.replace(">.--</option>", ">.--</option></select><select multiple size=8 style='width:100px;font-size:36px;'>");
document.body.innerHTML=document.body.innerHTML.replace(">....-</option>", ">....-</option></select><select multiple size=8 style='width:100px;font-size:36px;'>");
document.getElementById("mymsel").size=8;
}
document.getElementById("reset").href = document.URL;
surl=document.URL.split("?");
document.getElementById("aemail").href = ('mai' + 'lto:fill.in@email?subject=My%20Morse%20Code%20Message&body=' + encodeURIComponent(surl[0] + '?to=fill.in@email&mc='));
var preymc=location.search.substring(1).split("&");
var thisvalue='fill.in@email';
var thatvalue=document.getElementById("altemail").value;
if (preymc.length <= 1 && thatvalue.indexOf("@") != -1) {
thisvalue=thatvalue;
document.getElementById("aemail").href=document.getElementById("aemail").href.replace(wasemailee,thisvalue).replace(encodeURIComponent(wasemailee),encodeURIComponent(thisvalue));
wasemailee=thisvalue;
document.getElementById("to").value = thisvalue;
} else if (preymc.length > 1) {
document.getElementById("myh1").innerHTML += ' (back?)';
var aymc=preymc[0].substring(0).split("=");
thisvalue=decodeURIComponent(aymc[aymc.length - 1]);
if (thatvalue.indexOf("@") != -1) thisvalue=thatvalue;
document.getElementById("aemail").href=document.getElementById("aemail").href.replace(wasemailee,thisvalue).replace(encodeURIComponent(wasemailee),encodeURIComponent(thisvalue));
wasemailee=thisvalue;
document.getElementById("to").value = thisvalue;
var ymc=preymc[1].substring(1).split("=");
document.getElementById("ym").innerHTML = "Your Morse Code Message";
lmc = decodeURIComponent(ymc[1]);
words=lmc.split('__');
for (i=0; i<words.length; i++) {
letters=words[i].split('_');
for (j=0; j<letters.length; j++) {
for (k=0; k<mtable.length; k++) {
if (letters[j] == mtable[k]) {
amsg = amsg + mtable[k + 1];
}
}
}
amsg = amsg + '_';
}
document.getElementById("yh").innerHTML = amsg.replace(/_/g,' ');
}
if (document.URL.indexOf("?isMobile=y") != -1) {
document.getElementById("myh1").innerHTML = "My Morse Code Message";
}
} else {
document.getElementById("mymsg").innerHTML = document.getElementById("mymsg").innerHTML + myv;
document.title = document.getElementById("mymsg").innerHTML;
document.getElementById("mymc").innerHTML = (document.getElementById("mymc").innerHTML + myc + ' ').replace(/_/g,' ');
document.getElementById("aemail").href = document.getElementById("aemail").href + myc + '_';
}
}
</script>
</head>
<body onload=' documentURL=document.URL; setTimeout(prealetter, 1000);' style='background-color:yellow;'>
<div align='center' style='background-color:pink;'>
<h1 id='ym'></h1>
<h2 id='yh'></h2>
</div>
<h1 id='myh1' align='center'>My <a target=_blank title='Morse Code information ... thanks' href='http://stackoverflow.com/questions/1352587/convert-a-string-into-morse-code'>Morse Code</a> Message</h1>
<div align='center'>
<p id='mymsg'></p>
<p id='mymc' style='font-size:18px;'></p>
<span id='myspan'>To: <input id='to' size=30 type='text' value='fill.in@email' onblur=" document.getElementById('iemail').src='morsecode.php?set=' + this.value; document.getElementById('aemail').href=document.getElementById('aemail').href.replace(wasemailee,this.value).replace(encodeURIComponent(wasemailee),encodeURIComponent(this.value)); wasemailee=this.value; "></input><input type='button' onclick=" if (documentURL.indexOf('?isMobile=y') != -1) { startagain='y'; document.getElementById('iemail').src='./morsecode.php?mt=' + encodeURIComponent(document.getElementById('aemail').href); document.getElementById('myspan').innerHTML=document.getElementById('myspan').innerHTML.replace('Email' + ' Sent To: ','To: ').replace('To:','Email' + ' Sent To:').replace('fill.in@email', document.getElementById('to').value).replace(encodeURIComponent('fill.in@email'), encodeURIComponent(document.getElementById('to').value)); document.getElementById('myh1').innerHTML = document.getElementById('myh1').innerHTML + ' sent'; } else { document.getElementById('aemail').click(); }" value='Send email of Morse Code below'></input> <a id='reset' href='./morsecode.html' title='reset'>Reset</a></span><br>
<select id='mymsel' multiple size=40 style='width:100px;font-size:36px;'>
<option onclick="aletter(this.value,'_');" value=' '> </option>
<option onclick="aletter(this.value,'.-');" value=a>.-</option>
<option onclick="aletter(this.value,'-...');" value=b>-...</option>
<option onclick="aletter(this.value,'-.-.');" value=c>-.-.</option>
<option onclick="aletter(this.value,'-..');" value=d>-..</option>
<option onclick="aletter(this.value,'.');" value=e>.</option>
<option onclick="aletter(this.value,'..-.');" value=f>..-.</option>
<option onclick="aletter(this.value,'--.');" value=g>--.</option>
<option onclick="aletter(this.value,'....');" value=h>....</option>
<option onclick="aletter(this.value,'..');" value=i>..</option>
<option onclick="aletter(this.value,'.---');" value=j>.---</option>
<option onclick="aletter(this.value,'-.-');" value=k>-.-</option>
<option onclick="aletter(this.value,'.-..');" value=l>.-..</option>
<option onclick="aletter(this.value,'--');" value=m>--</option>
<option onclick="aletter(this.value,'-.');" value=n>-.</option>
<option onclick="aletter(this.value,'---');" value=o>---</option>
<option onclick="aletter(this.value,'.--.');" value=p>.--.</option>
<option onclick="aletter(this.value,'--.-');" value=q>--.-</option>
<option onclick="aletter(this.value,'.-.');" value=r>.-.</option>
<option onclick="aletter(this.value,'...');" value=s>...</option>
<option onclick="aletter(this.value,'-');" value=t>-</option>
<option onclick="aletter(this.value,'..-');" value=u>..-</option>
<option onclick="aletter(this.value,'...-');" value=v>...-</option>
<option onclick="aletter(this.value,'.--');" value=w>.--</option>
<option onclick="aletter(this.value,'-..-');" value=x>-..-</option>
<option onclick="aletter(this.value,'-.--');" value=y>-.--</option>
<option onclick="aletter(this.value,'--..');" value=z>--..</option>
<option onclick="aletter(this.value,'_');" value=' '> </option>
<option onclick="aletter(this.value,'.----');" value=1>.----</option>
<option onclick="aletter(this.value,'..---');" value=2>..---</option>
<option onclick="aletter(this.value,'...--');" value=3>...--</option>
<option onclick="aletter(this.value,'....-');" value=4>....-</option>
<option onclick="aletter(this.value,'.....');" value=5>.....</option>
<option onclick="aletter(this.value,'-....');" value=6>-....</option>
<option onclick="aletter(this.value,'--...');" value=7>--...</option>
<option onclick="aletter(this.value,'---..');" value=8>---..</option>
<option onclick="aletter(this.value,'----.');" value=9>----.</option>
<option onclick="aletter(this.value,'-----');" value=0>-----</option>
</select>
</div>
<a style='display:none;' id='aemail' href='mailto:fill.in@email?subject=My%20Morse%20Code%20Message&body='>email</a>
<iframe id='iemail' style='display:none;height:1px;width=1px;' src='morsecode.php?get=' height=1 width=1></iframe>
<input type='hidden' id='altemail' value=''></input>
</body>
</html>