// email.js // Email functionality for H1 onclick event specifics for Google Chart work // RJM Programming // Robert Metcalfe // January 2015 var wua = navigator.userAgent; var wisiPad = /iPad/i.test(wua) || /iPhone OS 3_1_2/i.test(wua) || /Android/i.test(wua) || /iPhone OS 3_2_2/i.test(wua); var wisTouch = /touch/i.test(wua) || /Touch/i.test(wua); var gcadvice = ' ... To email a snapshot of this Google Chart click me.'; var wisMobile = false; var wisWebView = false; function depends(ins) { if (ins == "") return wisWebView; return ins; } function getH1s(evt) { var rest = '', rests, restss, brest='?justmenu=justmenu'; if (document.URL.indexOf('?') != -1) { rests = document.URL.split('?'); restss = rests[1].split('&'); if (restss[0].indexOf('title=') == -1) rest = '?' + restss[0]; if (restss[0].indexOf('title=') == -1) brest = '?justmenu=justmenu&' + restss[0]; } if (wisWebView || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { wisWebView = wisWebView; } else { wisMobile = false; wisWebView = false; } if (wisWebView || (wisMobile && document.URL.indexOf("title=") != -1)) { if (document.body.innerHTML.indexOf("jkl" + "email") == -1) { document.body.innerHTML = document.body.innerHTML + "Email snapshot to:    
"; } } else { if (document.body.innerHTML.indexOf("mail" + "to:") == -1 && document.body.innerHTML.indexOf(">E" + "mail") == -1) { document.body.innerHTML = document.body.innerHTML + "  
"; document.getElementById('email').click(); } } } function gcinit() { var rest = '', rests, restss, brest='?justmenu=justmenu'; document.body.style.background='-webkit-linear-gradient(top, #FFFF00, #00FFFF)'; document.body.style.background='-moz-linear-gradient(top, #FFFF00, #00FFFF)'; if (document.URL.indexOf('?') != -1) { rests = document.URL.split('?'); restss = rests[1].split('&'); if (restss[0].indexOf('title=') == -1) rest = '?' + restss[0]; if (restss[0].indexOf('title=') == -1) brest = '?justmenu=justmenu&' + restss[0]; } if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { wisMobile = true; wisWebView = wisWebView; } else { wisMobile = false; wisWebView = false; } if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { // is mobile wisMobile = true; wisWebView = true; if (depends("") && (document.URL.replace(/justmenu/g,"").indexOf("=WebView") != -1 || document.URL.replace(/justmenu/g,"").indexOf("WebView=") != -1 || document.URL.replace(/justmenu/g,"").indexOf("=UIWebView") != -1)) { // called this way by iOS or Android WebView wisWebView = true; wisWebView = depends(""); if (wisWebView || (wisMobile && document.URL.indexOf("&") != -1)) { if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { aallPs = document.getElementsByTagName('a'); } else { aallPs= document.getElementsByTagName('a'); } for (var jj=0; jj < aallPs.length; jj++) { if (("*" + aallPs[jj].innerHTML).indexOf("*Another ") != -1) { if (wisWebView) { if ((aallPs[jj].href + "*").indexOf(".php*") != -1) { if (document.URL.indexOf("&") != -1) { var huha=document.URL.split("&"); aallPs[jj].href = huha[0]; } else { aallPs[jj].href = document.URL; } } } } else if ((aallPs[jj].href.indexOf("http") != -1 || aallPs[jj].href.indexOf("//") != -1) && aallPs[jj].href.indexOf("rjmprogramming.com.au") == -1) { aallPs[jj].onclick = " alert('" + aallPs[jj].href + "'); "; aallPs[jj].href = "#"; } } } } else { wisWebView = false; } } if (1 == 1) { if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('h1'); } else { allPs= document.getElementsByTagName('h1'); } for (var j=0; j < allPs.length; j++) { if ((depends("") && wisWebView) || (wisMobile && document.URL.indexOf("&") != -1)) { if (document.body.innerHTML.indexOf("ijk" + "email") == -1) { document.body.innerHTML = document.body.innerHTML + "  Menu  Email snapshot of Google Chart to:    
"; } } else { if (document.body.innerHTML.indexOf("MAIL" + "TO:") == -1 && document.body.innerHTML.indexOf(">E" + "mail") == -1) { document.body.innerHTML = document.body.innerHTML + "  Menu  Email snapshot of Google Chart ...  
"; } } if ((wisiPad || wisTouch)) { allPs[j].onclick = getH1s; if (allPs[j].title.indexOf(gcadvice) == -1) allPs[j].title += gcadvice; } else { allPs[j].onclick = getH1s; if (allPs[j].title.indexOf(gcadvice) == -1) allPs[j].title += gcadvice; } } } if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { // is mobile if (document.body.innerHTML.indexOf("but" + "sel." + "php") == -1) { document.body.innerHTML = document.body.innerHTML + "  Menu"; } } } setTimeout(gcinit, 2000);