// wajax.js // Ajax functionality for onmouseover event specifics at http://www.rjmprogramming.com.au/wordpress ... contextual advice // RJM Programming // Robert Metcalfe // November 2014 // Mobile devices use ontouchstart and ontouchend logic // Non-Mobile devices use onmouseover and onmouseout logic var zhr = null; var zok = 1; var bpost = 0; var mtimer = null; var mdownis = false; var mfunction = null; var tickcnt = 0; 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 wadvice = 'If contextual help is available for a feature (that you long touch on) of this webpage a new green bordered webpage part will open and on clicking in this and answering Y you can read and interact with a relevant Blog Posting regarding this.'; function getSVG(evt) { bpost = 10920; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 8000); } } function getCode(evt) { bpost = 10939; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function getRpnow(evt) { bpost = 10985; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function clickaid(aidis) { document.getElementById(aidis).click(); } function winit() { var allPs; zhr = null; zok = 1; if ((wisiPad || wisTouch) || 1 == 1) { var mybased = document.getElementById('site-description'); if (mybased.innerHTML.indexOf("Please note") == -1) { if ((wisiPad || wisTouch)) { mybased.innerHTML = mybased.innerHTML.replace(")", ")
Please note long touch help available."); } else { mybased.innerHTML = mybased.innerHTML.replace(")", ")
Please note long hover help available."); } } } if (1 == 1) { if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByClassName('iiconlist'); } else { allPs= document.getElementsByClassName('iiconlist'); } for (var j=0; j < allPs.length; j++) { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getRpnow; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getRpnow; // 10985 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding Recent Post images"; } allPs[j].onmouseout = yehBut; } } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('code'); } else { allPs= document.getElementsByTagName('code'); } for (var j=0; j < allPs.length; j++) { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getCode; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getCode; // 10939 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding Code Tag CSS"; } allPs[j].onmouseout = yehBut; } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('img'); } else { allPs= document.getElementsByTagName('img'); } for (var j=0; j < allPs.length; j++) { if (allPs[j].id == "mytopimage") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getSVG; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getSVG; // 10920 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding SVG Mask"; } allPs[j].onmouseout = yehBut; } } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('a'); } else { allPs= document.getElementsByTagName('a'); } for (var j=0; j < allPs.length; j++) { if (allPs[j].id == "ahomeis") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getEmboss; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getEmboss; // 10783 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding 3D Embossed Text"; } allPs[j].onmouseout = yehBut; } } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('div'); } else { allPs= document.getElementsByTagName('div'); } for (var j=0; j < allPs.length; j++) { if (allPs[j].id == "access") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getGradient; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getGradient; // 10640 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding CSS3 Gradient"; } allPs[j].onmouseout = yehBut; } } } if (navigator.userAgent.toLowerCase().indexOf("ie") != (0 - 1)) { allPs = document.getElementsByTagName('li'); } else { allPs= document.getElementsByTagName('li'); } for (var j=0; j < allPs.length; j++) { if (allPs[j].id == "text-4") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getNumwidget; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getNumwidget; // 4927 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding Number Game Text Widget"; } allPs[j].onmouseout = yehBut; } } else if (allPs[j].id == "text-5") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getBimgwidget; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getBimgwidget; // 7137 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows Blog Post regarding Background Image Text Widget"; } allPs[j].onmouseout = yehBut; } } else if (allPs[j].id == "recent-posts-2") { // Recent blog post Ajax previews 27/11/2014 var ihs = allPs[j].innerHTML.split("?p="); var myposts; var aeight=new Array("aone", "atwo", "athree", "afour", "afive", "asix", "aseven", "aeight"); var ieight = aeight.length - 1; for (var jhs=(ihs.length - 1); jhs>=1; jhs--) { myposts = ihs[jhs].split('"'); if ((wisiPad || wisTouch)) { if (allPs[j].innerHTML.indexOf('a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" t') != -1) { allPs[j].innerHTML = allPs[j].innerHTML.replace('a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" title="', 'a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" style="margin-bottom:20px;" ontouchend=" yehbut(); " id="' + aeight[ieight] + '" ontouchstart=" bpost=' + myposts[0] + '; if (mtimer) { clearInterval(mtimer); } tickcnt = 0; mtimer = setInterval(mchecker, 1000); " title="You can wait for the long hover functionality for a Blog Post preview ... '); } else { allPs[j].innerHTML = allPs[j].innerHTML.replace('" href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '"', ' ... you can wait for the long hover functionality for a Blog Post preview" href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" style="margin-bottom:20px;" ontouchend=" yehbut(); " id="' + aeight[ieight] + '" ontouchstart=" bpost=' + myposts[0] + '; if (mtimer) { clearInterval(mtimer); } tickcnt = 0; mtimer = setInterval(mchecker, 1000); " '); } } else { if (allPs[j].innerHTML.indexOf('a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" t') != -1) { allPs[j].innerHTML = allPs[j].innerHTML.replace('a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" title="', 'a href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" onmouseout=" yehbut(); " id="' + aeight[ieight] + '" style="margin-bottom:20px;" onmouseover=" bpost=' + myposts[0] + '; setTimeout(xget, 4000); " title="You can wait for the long hover functionality for a Blog Post preview ... '); } else { allPs[j].innerHTML = allPs[j].innerHTML.replace('" href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '"', ' ... you can wait for the long hover functionality for a Blog Post preview" href="http://www.rjmprogramming.com.au/wordpress/?p=' + myposts[0] + '" onmouseout=" yehbut(); " id="' + aeight[ieight] + '" style="margin-bottom:20px;" onmouseover=" bpost=' + myposts[0] + '; setTimeout(xget, 4000); " '); } } ieight = ieight - 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 (allPs[j].innerHTML == "Course") { if ((wisiPad || wisTouch)) { allPs[j].ontouchstart = getCoursedesign; allPs[j].ontouchend = yehBut; } else { allPs[j].onmouseover = getCoursedesign; // 10396 if (allPs[j].title.indexOf(" ...") == -1) { allPs[j].title = allPs[j].title + " ... welcome to the long hover functionality that shows information about the making of Courses functionality at this blog"; } allPs[j].onmouseout = yehBut; } } } } function mchecker() { tickcnt = eval(1 + tickcnt); if (tickcnt == 4) { xget(null); //bpost = 0; if (mtimer) clearInterval(mtimer); tickcnt = 0; } } function getEmboss(evt) { bpost = 10783; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function getGradient(evt) { bpost = 10640; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function getNumwidget(evt) { bpost = 4927; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function getBimgwidget(evt) { bpost = 7137; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function getCoursedesign(evt) { bpost = 10396; if ((wisiPad || wisTouch)) { if (mtimer) clearInterval(mtimer); tickcnt = 0; mtimer = setInterval(mchecker, 1000); } else { setTimeout(xget, 4000); } } function yehBut() { if ((wisiPad || wisTouch)) { if (tickcnt < 4) { if (mtimer) clearInterval(mtimer); tickcnt = 0; zok = 0; bpost = 0; } } else { zok = 0; bpost = 0; } } function hideStuff(evt) { var mybase = document.getElementById('branding'); var mymain = document.getElementById('main'); var mybased = document.getElementById('site-description'); var upto = mybase.innerHTML.indexOf(mybased.innerHTML) + mybased.innerHTML.length + 6; var cupto = mybase.innerHTML.substring(0, upto); if (mymain != null) { mymain.style.opacity = 1.0; } mybase.innerHTML = cupto + ''; winit(); } function getXMLHttpRequest() { if (window.XMLHttpRequest) { return new window.XMLHttpRequest; } else { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { return false; } } } } function xget(evt) { if (zok == 1 && bpost != 0) { zhr = getXMLHttpRequest(); } //else { //zok = 1; //} if (zhr != null) { zhr = zhr; } else { try { zhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { zhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { zhr = false; } } } if (zhr) { //alert(987); if (bpost > 0) { zhr.open("GET", "http://www.rjmprogramming.com.au/wordpress/?p=" + bpost, true); zhr.onreadystatechange = showStuff; zhr.send(null); bpost = -bpost; } } else { zok = 1; //alert("Sorry ... no XMLHttpRequest possible"); } } function prehideStuff() { var myb=0; var pisis; if ((wisiPad || wisTouch)) { pisis = prompt("Welcome to the long touch contextual help functionality. If you want Original Image back rather than a contextual informational Blog Posting, change Y to N or change to y to give advice in new window", "Y"); } else { pisis = prompt("If you want Original Image back rather than a contextual informational Blog Posting, change Y to N or change to y to give advice in new window", "Y"); } if (pisis != "Y") { if ((pisis + " ").substring(0,1) == "y") { myb = Math.abs(bpost); } hideStuff(); if ((pisis + " ").substring(0,1) == "y") { window.open("http://www.rjmprogramming.com.au/wordpress/?p=" + myb + "#content", "_blank"); } } else { var mymain = document.getElementById('main'); if (mymain != null) { mymain.style.opacity = 0.2; } var mybase = document.getElementById('branding'); mybase.onclick = winit; } } function showStuff(evt) { if (zhr != null) { var zero=0; var alen=0; var mybase = document.getElementById('branding'); var mymain = document.getElementById('main'); var mybased = document.getElementById('site-description'); var upto = mybase.innerHTML.indexOf(mybased.innerHTML) + mybased.innerHTML.length + 6; var cupto = mybase.innerHTML.substring(0, upto); if (zhr.readyState == 4) { if (zhr.status == 200) { //if (mymain != null) { // mymain.style.opacity = 0.3; //} document.body.style.backgroundColor = 'transparent'; alen = zhr.responseText.length; if (zhr.responseText.indexOf('
" + zhr.responseText.substring(zero, alen).replace('="container">','') + "
"; if ((wisiPad || wisTouch)) { mybase.onclick = prehideStuff; } else { mybase.onclick = prehideStuff; } } } } }