// intl_use.js // Help out cmyk_rgb.html // Send email with an internationalized date via intl_use.html var options = {year: "2-digit", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", timeZoneName: "short"}; var localdatetime = new Intl.DateTimeFormat("en-US",options).format; var lcode="en-US"; var prezhr=null; var prezform=null; var aconto=null, acontobih=''; var elsewise=false, elsewisea=[]; var goodtzs=''; function postglt() { var iois=document.getElementById('ifintl'); var fabih='', ewi=0, tzs=''; if (aconto) { //if (elsewise) { alert(1); } if (iois != null) { //if (elsewise) { alert(11); } aconto = (iois.contentWindow || iois.contentDocument); //if (elsewise) { alert(111); } if (aconto != null) { //if (elsewise) { alert(1111); } if (aconto.document) { aconto = aconto.document; } //if (elsewise) { alert(2); } acontobih=aconto.body.innerHTML; fabih=acontobih; //if (elsewise && acontobih.trim().indexOf('var options') != -1) { alert(3); } if (acontobih.trim().indexOf('var options') != -1) { eval("options" + acontobih.split('var options')[1].split('<')[0].split(';')[0]); //if (elsewise && acontobih.trim().indexOf('var options') != -1) { alert("options" + acontobih.split('var options')[1].split('<')[0].split(';')[0]); } if (elsewise) { // via div intldiv if (acontobih.trim().indexOf('') != -1) { eval("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); //alert("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); d = new Date(); timedatenow = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()); localdatetime = new Intl.DateTimeFormat(lcode, options).format; //document.title=localdatetime(timedatenow); if (aconto.getElementById('ejc1').innerHTML) { if (aconto.getElementById('ejc1').innerHTML.indexOf('timeZone:') != -1) { tzs=' (' + aconto.getElementById('ejc1').innerHTML.split('timeZone:')[eval(-1 + aconto.getElementById('ejc1').innerHTML.split('timeZone:').length)].split('"')[1].split('"')[0] + ')'; if (tzs.replace(' (UTC)','') == '') { tzs=goodtzs; } //alert('tzs=' + tzs + ' and goodtzs=' + goodtzs + ' ' + aconto.getElementById('ejc1').innerHTML); // + ' ' + acontobih.trim().substring(-100 + acontobih.trim().indexOf('"Australia/Sydney"')) + ' ' + acontobih.trim().split('timeZone:')[1]); if (window.parent) { if (document.URL.indexOf('inlineldt') == -1 && document.URL.indexOf('?') != -1 && (document.URL.indexOf('%40') != -1 || document.URL.indexOf('@') != -1)) { //location.href=document.URL.replace('?', '?inlineldt=' + encodeURIComponent(localdatetime(timedatenow) + tzs.replace(' (UTC)','')) + '&'); document.body.innerHTML+=""; return false; } } } } var theforms=document.getElementsByTagName('form'); for (var iiforms=0; iiforms'; } else { document.getElementById('inlineldt' + elsewisea[ewi]).value=localdatetime(timedatenow) + tzs.replace(' (UTC)',''); ewi++; } } //alert(document.title); } //eval('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"')); } } else { fabih=''; } if (acontobih.trim().indexOf('') != -1) { eval("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); } else { fabih=''; } acontobih=fabih; } } } } function glt(iois) { var fabih='', ewi=0, tzs=''; if (!aconto) { //if (elsewise) { alert(1); } if (iois != null) { //if (elsewise) { alert(11); } aconto = (iois.contentWindow || iois.contentDocument); //if (elsewise) { alert(111); } if (aconto != null) { //if (elsewise) { alert(1111); } if (aconto.document) { aconto = aconto.document; } //if (elsewise) { alert(2); } acontobih=aconto.body.innerHTML; fabih=acontobih; //if (elsewise && acontobih.trim().indexOf('var options') != -1) { alert(3); } if (acontobih.trim().indexOf('var options') != -1) { eval("options" + acontobih.split('var options')[1].split('<')[0].split(';')[0]); //if (elsewise && acontobih.trim().indexOf('var options') != -1) { alert("options" + acontobih.split('var options')[1].split('<')[0].split(';')[0]); } if (elsewise) { // via div intldiv if (acontobih.trim().indexOf('') != -1) { eval("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); //alert("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); d = new Date(); timedatenow = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()); localdatetime = new Intl.DateTimeFormat(lcode, options).format; //document.title=localdatetime(timedatenow); if (aconto.getElementById('ejc1').innerHTML) { if (aconto.getElementById('ejc1').innerHTML.indexOf('timeZone:') != -1) { tzs=' (' + aconto.getElementById('ejc1').innerHTML.split('timeZone:')[eval(-1 + aconto.getElementById('ejc1').innerHTML.split('timeZone:').length)].split('"')[1].split('"')[0] + ')'; goodtzs=tzs.replace(' (UTC)',''); } } var theforms=document.getElementsByTagName('form'); for (var iiforms=0; iiforms'; } else { document.getElementById('inlineldt' + elsewisea[ewi]).value=localdatetime(timedatenow) + tzs.replace(' (UTC)',''); ewi++; } } } //eval('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"')); setTimeout(postglt, 3000); //alert('pre tzs=' + tzs + ' and goodtzs=' + goodtzs + ' ' + aconto.getElementById('ejc1').innerHTML); // + ' ' + acontobih.trim().substring(-100 + acontobih.trim().indexOf('"Australia/Sydney"')) + ' ' + acontobih.trim().split('timeZone:')[1]); } } else { fabih=''; } if (acontobih.trim().indexOf('') != -1) { eval("lcode='" + acontobih.split('')[1].split('<')[0] + "';"); } else { fabih=''; } acontobih=fabih; } } } } function ifitnow() { var inputv=[], inputsv=document.getElementsByTagName('input'), iiv=0; if (document.getElementById('ifintl') && document.getElementById('intldiv')) { iiv=iiv; } else { for (iiv=0; iiv') != -1) { //alert(265); if (document.URL.indexOf('?') == -1 || document.URL.indexOf('%40') != -1 || document.URL.indexOf('@') != -1) { //alert(465); elsewise=true; } } } //} } } function ajaxDateIt() { //alert(1); var d, timedatenow, thisoptions; var tzs=''; if (prezhr != null) { if (prezhr.readyState == 4) { if (prezhr.status == 200) { //alert(11); var zhr = new XMLHttpRequest(); var zform=new FormData(); var mydate = new Date(); //if (elsewise) { // via div intldiv // //alert(document.getElementById('intldiv').innerHTML); // eval('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"')); //} else { if (document.getElementById('intljs')) { // via div intldiv if (document.getElementById('intllcode')) { // via div intldiv lcode=document.getElementById('intllcode').value; } eval(document.getElementById('intljs').value); d = new Date(); timedatenow = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()); localdatetime = new Intl.DateTimeFormat(lcode, options).format; zform.append('inline', localdatetime(timedatenow)); } else if (document.getElementById('intldiv') && ('' + document.getElementById('intldiv').innerHTML) != '') { // via div intldiv //document.getElementById('ifintl').style.display='block'; //document.getElementById('intldiv').style.display='block'; console.log(document.getElementById('intldiv').innerHTML); if (document.getElementById('intllcode')) { // via div intldiv lcode=document.getElementById('intllcode').value; if (document.getElementById('intldiv').innerHTML.indexOf('timeZone:') != -1 && document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').indexOf('options=') != -1) { console.log('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"')); eval('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"') + ';'); console.log('pretzs'); tzs=' (' + document.getElementById('intldiv').innerHTML.split('timeZone:')[eval(-1 + document.getElementById('intldiv').innerHTML.split('timeZone:').length)].split('"')[1].split('"')[0] + ')'; console.log(tzs); } } else if (document.getElementById('intldiv').innerHTML.indexOf('timeZone:') != -1 && document.getElementById('intldiv').innerHTML.indexOf('') != -1) { //alert(111); console.log('prelcode'); lcode=document.getElementById('intldiv').innerHTML.split('')[eval(-1 + document.getElementById('intldiv').innerHTML.split('').length)].split('')[0]; //alert(1111); if (document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').indexOf('options=') != -1) { console.log('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"')); eval('options=' + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=')[eval(-1 + document.getElementById('intldiv').innerHTML.replace(/\ options\ \=\ /g,'options=').replace(/\ options\ \=/g,'options=').replace(/\ options\=\ /g,'options=').split('options=').length)].split(';')[0].replace('timeZZoneName: "short"', 'timeZoneName: "long"').replace('timeZZoneName:"short"', 'timeZoneName:"long"') + ';'); console.log('pretzs'); tzs=' (' + document.getElementById('intldiv').innerHTML.split('timeZone:')[eval(-1 + document.getElementById('intldiv').innerHTML.split('timeZone:').length)].split('"')[1].split('"')[0] + ')'; //alert(tzs); console.log(tzs); } } //eval(document.getElementById('intldiv').innerHTML); d = new Date(); timedatenow = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()); localdatetime = new Intl.DateTimeFormat(lcode, options).format; zform.append('inline', localdatetime(timedatenow) + tzs.replace(' (UTC)','')); } else if (acontobih != '') { //alert(lcode); //console.log(options); d = new Date(); //timedatenow = new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds()); timedatenow = new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()); localdatetime = new Intl.DateTimeFormat(lcode, options).format; //alert(localdatetime(timedatenow)); zform.append('inline', localdatetime(timedatenow)); //} } else if (aconto) { zform.append('inline', mydate.toLocaleString()); } else { zform.append('inline', mydate.toLocaleString()); } //alert(mydate.toLocaleString()); zform.append('to', document.getElementById('to').value); if (feedback != '') { zform.append('subj', document.getElementById('subj').value + ' ... ' + feedback + ' ... '); } else if (document.getElementById('feedback').value != '') { zform.append('subj', document.getElementById('subj').value + ' ... ' + document.getElementById('feedback').value + ' ... '); } else { zform.append('subj', document.getElementById('subj').value); } zform.append('htmlis', document.getElementById('htmlis').value); zhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true); //zhr.onreadystatechange = ajaxDateIt; zhr.send(zform); if (document.getElementById('emailb')) { document.getElementById('emailb').style.backgroundColor='lightgreen'; } } } } //} } function ajaxMailOff() { prezhr = new XMLHttpRequest(); prezhr.open('get', '//www.rjmprogramming.com.au/HTMLCSS/intl_use.html', true); prezhr.onreadystatechange = ajaxDateIt; prezhr.send(null); } setTimeout(ifitnow, 1000);