// world.js // RJM Programming // March, 2016 // Help out world.html and others like it function fixmyemail(tval, issubj) { // mailto:fill.in.email@address?subject=My%20World%20Map&body= if (tval != '') { ourbits = document.getElementById('myemail').href.split('?subject='); if (issubj == 0) { if (ourbits.length > 1) { prebits = ourbits[0].split(':'); document.getElementById('to').value = tval; document.getElementById('myemail').href = prebits[0] + ':' + encodeURIComponent(tval) + '?subject=' + ourbits[eval(-1 + ourbits.length)]; if (document.getElementById('myiemail').value.indexOf('@') != -1) { document.getElementById('mode').value = ''; document.getElementById('ismobile').value = 'y'; document.getElementById('myisubject').style.display = 'inline'; document.getElementById('myiemail').style.display = 'inline'; document.getElementById('myform').action = document.getElementById('myform').action.replace('?mode=1', ''); document.getElementById('myform').action = document.getElementById('myform').action.replace('mode=1', 'mode='); //document.getElementById('myemail').href = '#' + document.getElementById('myemail').href; } } } else { var pbits = ""; if (ourbits.length > 1) { pbits = ourbits[1].split('&'); document.getElementById('mysubject').value = tval; if (pbits.length > 1) { document.getElementById('myemail').href = ourbits[0] + '?subject=' + encodeURIComponent(tval) + '&' + pbits[1]; } else { document.getElementById('myemail').href = ourbits[0] + '?subject=' + encodeURIComponent(tval); } } } } } function dorectangle() { // new idea ... March, 2016 //context.strokeStyle=document.getElementById('mycolour').value; context.fillStyle=document.getElementById('mycolour').value; context.fillRect(Math.min(x,lastx), Math.min(y,lasty), Math.abs(x - lastx), Math.abs(y - lasty)); } function dorectangleborder() { // new idea ... March, 2016 context.strokeStyle=document.getElementById('mycolour').value; //context.fillStyle=document.getElementById('mycolour').value; context.rect(Math.min(x,lastx), Math.min(y,lasty), Math.abs(x - lastx), Math.abs(y - lasty)); context.stroke(); } function docircle() { // new idea ... March, 2016 context.strokeStyle=document.getElementById('mycolour').value; context.beginPath(); context.arc(eval((x + lastx) / 2.0),eval((y + lasty) / 2.0),eval(Math.pow(Math.abs(x - lastx) * Math.abs(x - lastx) + Math.abs(y - lasty) * Math.abs(y - lasty),0.5) / 2.0),0,2*Math.PI); context.stroke(); } function doline() { // new idea ... March, 2016 context.strokeStyle=document.getElementById('mycolour').value; context.beginPath(); context.moveTo(x,y); context.lineTo(lastx,lasty); context.stroke(); } function clearall() { // new idea ... March, 2016 context.clearRect(0, 0, elem.width, elem.height); elem.style.borderRight='1px solid black'; elem.style.borderBottom='1px solid black'; } function placeannotation(anno) { // new idea ... March, 2016 if (anno.value != '') { if (anno.id == 'jannotation') { context.clearRect(Math.min(x,lastx), Math.min(y,lasty), Math.abs(x - lastx), Math.abs(y - lasty)); context.strokeStyle = "black"; document.getElementById('iannotation').value=''; } else { context.strokeStyle = "blue"; document.getElementById('jannotation').value=''; } //context.font = cf; context.font = document.getElementById('myfont').value; context.strokeStyle=document.getElementById('mycolour').value; context.strokeText(anno.value,eval(2 + Math.min(x,lastx)),eval((Math.min(y,lasty) + Math.max(y,lasty)) / 2)); anno.value = ''; } } function tryit() { var tds=document.getElementsByTagName('td'), hstuff=''; if (tds.length > 0) { hstuff+=""; if (tds[eval(-1 + tds.length)].innerHTML.indexOf('diva' + 'nnotaxtion') == -1) tds[eval(-1 + tds.length)].innerHTML+=hstuff; var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); var hh = today.getHours(); var minm = today.getMinutes(); //January is 0! var ss = today.getSeconds(); document.getElementById('myfname').value = "world_" + yyyy + "_" + mm + "_" + hh + "_" + minm + "_" + ss + ".png"; document.getElementById('myform').action = document.getElementById('myform').action.replace('?mode=1', ''); document.getElementById('mode').value = ''; document.getElementById('ismobile').value = 'y'; document.getElementById('myisubject').style.display = 'inline'; document.getElementById('myiemail').style.display = 'inline'; document.getElementById('myform').action = document.getElementById('myform').action.replace('?mode=1', ''); document.getElementById('myform').action = document.getElementById('myform').action.replace('mode=1', 'mode='); //document.getElementById('myemail').href = '#' + document.getElementById('myemail').href; } } setTimeout(tryit, 2000);