<!doctype html>
<html>
<head>
<title>Mobile gestures - RJM Programming - November, 2019</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.s0 { background:linear-gradient(90deg,#d3cbb8,#6d6027) !important; }
.s1 { background:linear-gradient(90deg,#74ebd5,#acb6e5) !important; }
.s2 { background:linear-gradient(90deg,#f7b733,#fc4a1a) !important; }
.s3 { background:linear-gradient(90deg,#00f260,#0575e6) !important; }
.s4 { background:linear-gradient(90deg,#ffc0cb,#800080) !important; }
.s5 { background:linear-gradient(90deg,#f3f9a7,#cac531) !important; }
.s6 { background:linear-gradient(90deg,#605c3c,#3c3b3f) !important; }
.s7 { background:linear-gradient(90deg,#fdeff9,#ec38bc,#7303c0,#03001e) !important; }
.s8 { background:linear-gradient(90deg,#ada996,#f2f2f2,#dbdbdb,#eaeaea) !important; }
button { border-radius: 60px; border: 3px solid blue; padding: 8px 8px 8px 8px; background-color: #f0f0f0; }
</style>
<script type='text/javascript'>
// 🐵 then 🙈
var ideas=['#d3cbb8,#6d6027', '#74ebd5,#acb6e5', '#f7b733,#fc4a1a', '#00f260,#0575e6', '#ffc0cb,#800080', '#f3f9a7,#cac531', '#605c3c,#3c3b3f', '#fffbd5,#b20a2c', '#03001e,#7303c0,#ec38bc,#fdeff9', '#ada996,#f2f2f2,#dbdbdb,#eaeaea'];
var aname = '';
var urlprefixes = ['//www.behindthename.com/name/~', '//thenamegame-generator.com/lyrics/~.html', '//en.geneanet.org/first-name/~', '//word.tips/words-for/~/?dictionary=wwf'];
var asked = location.search.split('=')[1] ? true : false;
var oname = location.search.split('name=')[1] ? decodeURIComponent(location.search.split('name=')[1].split('&')[0]) : '';
urlprefixes[0] = location.search.split('array=')[1] ? (decodeURIComponent(location.search.split('array=')[1].split('&')[0]) + "//www.behindthename.com/name/~,//thenamegame-generator.com/lyrics/~.html,//en.geneanet.org/first-name/~,//word.tips/words-for/~/?dictionary=wwf").replace(/\[/g,'').replace(/\]/g,',').replace(/\"/g,'').replace(/\'/g,'').replace(/\ /g,'').split(',')[0].replace(/^1$/g,'//www.behindthename.com/name/~').replace(/^2$/g,'//thenamegame-generator.com/lyrics/~.html').replace(/^3$/g,'//en.geneanet.org/first-name/~').replace(/^4$/g,'//word.tips/words-for/~/?dictionary=wwf') : '//www.behindthename.com/name/~';
urlprefixes[1] = location.search.split('array=')[1] ? (decodeURIComponent(location.search.split('array=')[1].split('&')[0]) + "//www.behindthename.com/name/~,//thenamegame-generator.com/lyrics/~.html,//en.geneanet.org/first-name/~,//word.tips/words-for/~/?dictionary=wwf").replace(/\[/g,'').replace(/\]/g,',').replace(/\"/g,'').replace(/\'/g,'').replace(/\ /g,'').split(',')[1].replace(/^1$/g,'//www.behindthename.com/name/~').replace(/^2$/g,'//thenamegame-generator.com/lyrics/~.html').replace(/^3$/g,'//en.geneanet.org/first-name/~').replace(/^4$/g,'//word.tips/words-for/~/?dictionary=wwf') : '//thenamegame-generator.com/lyrics/~.html';
urlprefixes[2] = location.search.split('array=')[1] ? (decodeURIComponent(location.search.split('array=')[1].split('&')[0]) + "//www.behindthename.com/name/~,//thenamegame-generator.com/lyrics/~.html,//en.geneanet.org/first-name/~,//word.tips/words-for/~/?dictionary=wwf").replace(/\[/g,'').replace(/\]/g,',').replace(/\"/g,'').replace(/\'/g,'').replace(/\ /g,'').split(',')[2].replace(/^1$/g,'//www.behindthename.com/name/~').replace(/^2$/g,'//thenamegame-generator.com/lyrics/~.html').replace(/^3$/g,'//en.geneanet.org/first-name/~').replace(/^4$/g,'//word.tips/words-for/~/?dictionary=wwf') : '//en.geneanet.org/first-name/~';
urlprefixes[3] = location.search.split('array=')[1] ? (decodeURIComponent(location.search.split('array=')[1].split('&')[0]) + "//www.behindthename.com/name/~,//thenamegame-generator.com/lyrics/~.html,//en.geneanet.org/first-name/~,//word.tips/words-for/~/?dictionary=wwf").replace(/\[/g,'').replace(/\]/g,',').replace(/\"/g,'').replace(/\'/g,'').replace(/\ /g,'').split(',')[3].replace(/^1$/g,'//www.behindthename.com/name/~').replace(/^2$/g,'//thenamegame-generator.com/lyrics/~.html').replace(/^3$/g,'//en.geneanet.org/first-name/~').replace(/^4$/g,'//word.tips/words-for/~/?dictionary=wwf') : '//word.tips/words-for/~/?dictionary=wwf';
var xDown = null;
var yDown = null;
var wasone = -1;
var arest = "";
var wrest="(who should turn away now)";
var ifemailih = '';
var isok = true;
var numf = 1;
var lastq = -1;
var lookupw = '';
var gtrue = true;
var bonus = 3;
var myxhr = null;
var goes=0, score=0, answer='';
var cumnumf = 0;
var timeron = false;
var tableanswer = ' ... Your answer is <select ontouchstart="event.stopPropagation();" onclick="event.stopPropagation();" onchange="cumnumf=' + "''" + ' + this.value; event.stopPropagation();" id=anssel style=display:inline-block;><option value=0>0</option><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option><option value=7>7</option><option value=8>8</option><option value=9>9</option><option value=10>10</option></select> ... <span title="You can click here to check answer ahead of time" ontouchstart="event.stopPropagation();" onclick="event.stopPropagation();" onmousedown="checka(); event.stopPropagation();" id=secsleft style="background-color:orange;border:3px solid blue; padding: 3px 3px 3px 3px;"></span>';
var quiz = location.search.split('quiz=')[1] ? true : false;
var qs=["What is (67 - 1) / 11 ?", "What is (564 / 4) - 140 ?", "What is ((9 - 7) ^ (2 + 1)) + 1 ?", "What is (72 % 7) + 3 ?", "What is (9 * 8) / 12 ?", "What is (1675 % 2) + 1 ?", "What is ((789 - 687) / 3) - 26 ?", "What is (87 + 3) / 9 ?", "What is ((47 - 34) + 2) / 3 ?", "What is ((12 - 34) + 49) / 3 ?", "What is (3 ^ 2) - 5 ?"];
function ask() {
var proposed=0.0;
var qis=prompt("What is your question? Please note that any answer not an integer from 0 to 10 will only be answerable via the dropdown (rather than cumulative touch or mouse counts).", "(564 / 4) - 138");
if (qis == null) { qis=''; }
if (qis.trim() != '') {
try {
proposed=eval(qis.replace('What is ','').replace(' ?','').replace('?',''));
if (proposed != 0 && proposed != 1 && proposed != 2 && proposed != 3 && proposed != 4 && proposed != 5 && proposed != 6 && proposed != 7 && proposed != 8 && proposed != 9) {
document.getElementById('anssel').innerHTML+='<option value=' + proposed + '>' + proposed + '</option>';
}
qs.push("What is " + qis.replace('What is ','').replace(' ?','').replace('?','').trim() + " ?");
} catch (ertd) {
}
}
}
function shortenlengthenthis(doshort, msg) {
var elm=" → ";
if (lookupw == '') {
return oname;
} else if (lookupw.indexOf('<i>' + oname + '</i>') != -1) {
var obitsare=lookupw.split('<i>' + oname + '</i>');
if (doshort) {
if (lookupw.indexOf(elm + '<i>' + oname + '</i>') == -1) {
document.title=msg + ' ' + obitsare[1].split(elm)[1].split('<i>')[1].split('</i>')[0];
alert(msg + ' ' + obitsare[1].split(elm)[1].split('<i>')[1].split('</i>')[0]);
return obitsare[1].split(elm)[1].split('<i>')[1].split('</i>')[0];
} else {
document.title=msg + ' ' + oname;
alert(msg + ' ' + oname);
}
} else {
if (lookupw.indexOf('<li><i>' + oname + '</i>') == -1) {
try {
document.title=msg + ' ' + obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>')[eval(-1 + obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>').length)].split('</i>')[0];
alert(msg + ' ' + obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>')[eval(-1 + obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>').length)].split('</i>')[0]);
return obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>')[eval(-1 + obitsare[0].split(elm)[eval(-2 + obitsare[0].split(elm).length)].split('<i>').length)].split('</i>')[0];
} catch (eew) {
document.title=msg + ' ' + oname;
alert(msg + ' ' + oname);
}
} else {
document.title=msg + ' ' + oname;
alert(msg + ' ' + oname);
}
}
} else {
document.title=msg + ' ' + oname;
alert(msg + ' ' + oname);
}
return oname;
}
function setLookupwWords() {
if (myxhr.readyState == 4) {
if (myxhr.status == 200) {
if (myxhr.responseText) {
lookupw=myxhr.responseText;
shortenlengthenthis(gtrue,'');
}
}
}
}
function preifwiki(url) {
if (myxhr) {
myxhr.onreadystatechange = setLookupwWords;
myxhr.open("GET", url, true);
myxhr.send(null);
}
}
function ifwikio(ioiso) {
if (lookupw == '' && ioiso != null) {
if (('' + ioiso.src) != '') {
var aconto = (ioiso.contentWindow || ioiso.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
lookupw = aconto.body.innerHTML;
//if (lookupw.indexOf('<i>Gabriel</i>') != -1) { alert('Looks okay'); } else { alert(lookupw.length); }
if (aconto.URL.indexOf('?') == -1) { shortenlengthenthis(gtrue,''); }
}
}
} else if (lookupw != '' && ioiso != null) {
shortenlengthenthis(gtrue,'');
}
}
function drest() {
arest = " Optionally suffix (via blank delimiters) by Email To. Then optionally Email CC (which could be your email address). Then optionally Your Name (for the purposes of email wording).";
wrest = "(via email)";
}
function randgrad() {
if (wasone < 0) {
wasone=Math.floor(Math.random() * ideas.length);
document.getElementById('mydiv').className='s' + wasone;
wasone=-1;
}
setTimeout(randgrad,5000);
}
function genask(msg) {
var huhs=["1","2","3","4"];
var wans="";
var xans="";
if (isok) {
var ans=prompt(msg + " If you want to play the Name Game for your friend (who should turn away now), answer with Their First Name preceded by Swipe [Up, Down, Left, Right] URL ideas as per ['//www.behindthename.com/name/~', '//thenamegame-generator.com/lyrics/~.html', '//en.geneanet.org/first-name/~', '//word.tips/words-for/~/?dictionary=wwf'] is [1,2,3,4]".replace('(who should turn away now)', wrest) + arest, "[1,2,3,4] ");
if (ans == null) { ans=""; }
if (ans.indexOf('[') != -1 && ans.indexOf('] ') != -1) {
if (ans.indexOf('[') != 0) { wans=ans.split('[')[0]; }
xans='[' + ans.split('] ')[0].split('[')[eval(-1 + ans.split('] ')[0].split('[').length)] + "]";
var xsd=ans.split('] ')[1];
if (xsd.length > 1) {
wans+=ans.split('] ')[1];
} else {
while (wans == '') {
wans=prompt("What is your friend's first name?" + arest, "");
if (wans == null) {
location.href=document.URL.split('?')[0].split('#')[0]; wans=' ';
}
}
}
if (wans.trim().indexOf('@') != '' && arest != '') {
var blankers=wans.trim().split(' ');
var zrest='';
wans='';
for (var ibl=0; ibl<blankers.length; ibl++) {
if (blankers[ibl].indexOf('@') != -1) {
if (document.getElementById('tdto').value == '') {
document.getElementById('tdto').value=blankers[ibl];
} else if (document.getElementById('tdcc').value == '') {
document.getElementById('tdcc').value=blankers[ibl];
} else {
document.getElementById('tdbcc').value=blankers[ibl];
}
} else if (wans == '') {
wans=blankers[ibl];
} else if (document.getElementById('tdto').value == '') {
wans+=' ' + blankers[ibl];
} else if (zrest == '') {
zrest=blankers[ibl];
} else {
zrest+=' ' + blankers[ibl];
}
}
if (zrest == '') {
document.getElementById('tdhuhta').value=document.getElementById('tdhuhta').value.replace(/ourtesy\ of\ \`/g, '');
} else {
document.getElementById('tdhuhta').value=document.getElementById('tdhuhta').value.replace(/ourtesy\ of\ \`/g, 'ourtesy of ' + zrest);
}
if (wans == '') {
document.getElementById('tdhuhta').value=document.getElementById('tdhuhta').value.replace(/\~/g, wans).replace('?name=&array=', '?name=' + encodeURIComponent(wans) + '&array=' + encodeURIComponent(xans));
} else {
document.getElementById('tdhuhta').value=document.getElementById('tdhuhta').value.replace(/\~/g, wans).replace('?name=&array=', '?name=' + encodeURIComponent(wans) + '&array=' + encodeURIComponent(xans));
}
if (document.getElementById('tdto').value.indexOf('@') != -1) {
if (document.getElementById('tdcc').value != '') { document.getElementById('tdsubj').value+=' ... My Email Address is CC'; }
document.getElementById('fsubm').click();
document.getElementById('myh3').innerHTML='RJM Programming - November, 2019 ... Emailed ' + document.getElementById('tdto').value + " Name Game link button.";
isok = false;
setTimeout(atn, 5000);
}
} else {
if (wans.trim() != '') { location.href=document.URL.split('?')[0].split('#')[0] + '?name=' + encodeURIComponent(wans) + '&array=' + encodeURIComponent(xans); }
}
}
if (arest != "") { arest=""; }
}
}
function atn() {
document.getElementById('ifemail').innerHTML=ifemailih;
isok = true;
}
function dopinch(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[0].indexOf('~') != -1) {
document.title=msg;
gtrue=true;
if (lookupw == '') {
// Thanks Wikipedia
if (1 == 11) {
if (window.XMLHttpRequest) {
myxhr = new window.XMLHttpRequest;
}
else {
try {
myxhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
myxhr = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
myxhr = false;
}
}
}
preifwiki('//en.wikipedia.org/wiki/Hypocorism#English');
} else {
//alert('why?');
document.getElementById('ifnicknames').src='./mg.php'; // thanks to '//en.wikipedia.org/wiki/Hypocorism#English';
}
} else {
shortenlengthenthis(true,msg);
}
} else {
alert(msg);
}
}
function dostretch(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[0].indexOf('~') != -1) {
document.title=msg;
gtrue=false;
if (lookupw == '') {
// Thanks Wikipedia
if (1 == 11) {
if (window.XMLHttpRequest) {
myxhr = new window.XMLHttpRequest;
}
else {
try {
myxhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
myxhr = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
myxhr = false;
}
}
}
preifwiki('//en.wikipedia.org/wiki/Hypocorism#English');
} else {
//alert('Why?');
document.getElementById('ifnicknames').src='./mg.php'; // thanks to '//en.wikipedia.org/wiki/Hypocorism#English';
}
} else {
shortenlengthenthis(false,msg);
}
} else {
alert(msg);
}
}
function doup(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[0].indexOf('~') != -1) {
document.title=msg;
window.open(urlprefixes[0].replace('~', encodeURIComponent(oname)), '_blank', 'top=100,left=100,width=600,height=600');
} else {
alert(msg);
}
}
function dodown(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[1].indexOf('~') != -1) {
document.title=msg;
window.open(urlprefixes[1].replace('~', encodeURIComponent(oname)), '_blank', 'top=100,left=100,width=600,height=600');
} else {
alert(msg);
}
}
function doleft(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[2].indexOf('~') != -1) {
document.title=msg;
window.open(urlprefixes[2].replace('~', encodeURIComponent(oname)), '_blank', 'top=100,left=100,width=600,height=600');
} else {
alert(msg);
}
}
function doright(msg) {
if (!asked && oname == '') {
genask(msg);
} else if (oname != '' && urlprefixes[3].indexOf('~') != -1) {
document.title=msg;
window.open(urlprefixes[3].replace('~', encodeURIComponent(oname)), '_blank', 'top=100,left=100,width=600,height=600');
} else {
alert(msg);
}
}
function getTouches(evt) {
return evt.touches || // browser API
evt.originalEvent.touches; // jQuery
}
function checka() {
timeron=false;
goes++;
if (Math.abs(eval(('' + cumnumf)) - eval(('' + answer))) < 0.0001) {
score++;
score+=bonus;
}
bonus = 0;
document.getElementById('myh3').innerHTML='Score: ' + score + '/' + goes + tableanswer;
document.getElementById('secsleft').style.border='3px solid transparent';
document.getElementById('secsleft').style.backgroundColor='transparent';
setTimeout(pickq, 3000);
}
function eachsec() {
if (document.getElementById('secsleft').innerHTML.indexOf(' ') != -1) {
var curval=eval(document.getElementById('secsleft').innerHTML.split(' ')[0]);
curval--;
if (curval >= 0) {
if (curval >= 15) {
document.getElementById('secsleft').innerHTML='' + curval + ' second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>3⃣</span> bonus points';
} else if (curval >= 10) {
document.getElementById('secsleft').innerHTML='' + curval + ' second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>2⃣</span> bonus points';
if (curval == 14) { bonus--; }
} else if (curval >= 5) {
document.getElementById('secsleft').innerHTML='' + curval + ' second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>1⃣</span> bonus points';
if (curval == 9) { bonus--; }
} else {
document.getElementById('secsleft').innerHTML='' + curval + ' second(s) left to answer';
document.getElementById('secsleft').style.backgroundColor='3px solid orange';
if (curval == 4) { bonus--; }
}
//if (curval == 0) { document.getElementById('secsleft').style.border='3px solid transparent'; document.getElementById('secsleft').style.backgroundColor='transparent'; }
}
if (curval >= 1) {
setTimeout(eachsec, 1000);
} else if (curval == 0) {
checka();
}
}
}
function handleTouchStart(evt) {
numf = getTouches(evt).length;
cumnumf+=numf;
const firstTouch = getTouches(evt)[eval(-1 + numf)];
if (numf == 2) {
document.getElementById('twofd1').innerHTML='' + getTouches(evt)[0].clientX + ',' + getTouches(evt)[0].clientY;
document.getElementById('twofd2').innerHTML='' + firstTouch.clientX + ',' + firstTouch.clientY;
} else if (numf > 2) {
bonus+=eval(-2 + numf);
}
if (quiz) {
if (eval('' + cumnumf) > 10) {
document.getElementById('anssel').value='0';
} else {
document.getElementById('anssel').value='' + cumnumf;
}
//for (var icn=0; icn<10; icn++) {
// if (eval('' + icn + 1) <= eval('' + cumnumf)) {
// document.getElementById('ans' + icn).innerHTML='.';
// }
//}
if (!timeron) {
timeron=true;
bonus = 3;
document.getElementById('secsleft').innerHTML='18 second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>3⃣</span> bonus points';
document.getElementById('secsleft').style.border='3px solid blue';
document.getElementById('secsleft').style.backgroundColor='orange';
setTimeout(eachsec, 1000);
//setTimeout(checka, 19000);
}
evt.stopPropagation();
} else {
xDown = firstTouch.clientX;
yDown = firstTouch.clientY;
}
};
function handleMouseStart(evt) {
cumnumf++;
if (quiz) {
if (eval('' + cumnumf) > 10) {
document.getElementById('anssel').value='0';
} else {
document.getElementById('anssel').value='' + cumnumf;
}
//for (var icn=0; icn<10; icn++) {
// if (eval('' + icn + 1) <= eval('' + cumnumf)) {
// document.getElementById('ans' + icn).innerHTML='.';
// }
//}
if (!timeron) {
timeron=true;
bonus = 3;
document.getElementById('secsleft').innerHTML='18 second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>3⃣</span> bonus points';
document.getElementById('secsleft').style.border='3px solid blue';
document.getElementById('secsleft').style.backgroundColor='orange';
setTimeout(eachsec, 1000);
//setTimeout(checka, 19000);
}
evt.stopPropagation();
} else {
if ( ! xDown || ! yDown ) {
if (evt.clientX) {
xDown=evt.clientX;
yDown=evt.clientY;
} else {
xDown=evt.pageX;
yDown=evt.pageY;
}
//document.title='startx=' + xDown;
}
}
};
function handleTouchMove(evt) {
if ( ! xDown || ! yDown ) {
return;
}
var xUp = evt.touches[eval(-1 + numf)].clientX;
var yUp = evt.touches[eval(-1 + numf)].clientY;
if (numf == 2) {
document.getElementById('twofd1').innerHTML+=',' + evt.touches[0].clientX + ',' + evt.touches[0].clientY;
document.getElementById('twofd2').innerHTML+=',' + evt.touches[eval(-1 + numf)].clientX + ',' + evt.touches[eval(-1 + numf)].clientY;
}
var xDiff = xDown - xUp;
var yDiff = yDown - yUp;
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/
if (numf > 1) {
if (1 == 6) { alert('Ouch ' + xDiff + ' vs ' + yDiff); }
} else {
if ( xDiff > 0 ) {
/* left swipe */
doleft('You swiped left.'); // alert('You swiped left');
} else {
/* right swipe */
doright('You swiped right.'); // alert('You swiped right');
}
}
} else {
if (numf > 1) {
if (1 == 6) { alert('Aaaah ' + xDiff + ' vs ' + yDiff); }
} else {
if ( yDiff > 0 ) {
/* up swipe */
doup('You swiped up.'); // alert('You swiped up');
} else {
/* down swipe */
dodown('You swiped down.'); // alert('You swiped down');
}
}
}
/* reset values */
//document.title+=',';
xDown = null;
yDown = null;
};
function handleMouseMove(evt) {
if ( ! xDown || ! yDown ) {
return;
}
var xUp = 0;
var yUp = 0;
if (evt.clientX) {
xUp=evt.clientX;
yUp=evt.clientY;
} else {
xUp=evt.pageX;
yUp=evt.pageY;
}
var xDiff = xDown - xUp;
var yDiff = yDown - yUp;
if (Math.abs( xDiff ) > 15 || Math.abs( yDiff ) > 15) {
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/
if ( xDiff > 0 ) {
/* left swipe */
doleft('You moved mouse left.'); // alert('You moved mouse left');
} else {
/* right swipe */
doright('You moved mouse right.'); // alert('You moved mouse right');
}
} else {
if ( yDiff > 0 ) {
/* up swipe */
doup('You moved mouse up.'); // alert('You moved mouse up');
} else {
/* down swipe */
dodown('You moved mouse down.'); // alert('You moved mouse down');
}
}
/* reset values */
xDown = null;
yDown = null;
}
};
function pickq() {
var zero='0', nine='9', ncnt=0;
var choice=0;
if (quiz) {
document.getElementById('myh3').innerHTML='Score: ' + score + '/' + goes + tableanswer;
choice=Math.floor(Math.random() * qs.length);
while (choice == lastq) {
choice=Math.floor(Math.random() * qs.length);
}
lastq=choice;
cumnumf=0;
var leftis='', rightis='', kk=0, spareis='';
var qsc=qs[choice];
var qscs=qsc.split('^');
while (qscs.length > 1) {
if (qscs[0].trim() != qscs[0] || qscs[1].trim() != qscs[1]) {
qsc=qsc.replace(qscs[0] + '^' + qscs[1], qscs[0].trim() + '^' + qscs[1].trim());
qscs=qsc.split('^');
}
leftis='';
rightis='';
kk=1;
zero='0';
nine='9';
if (qscs[0].trim().slice(-kk).substring(0,1) == ')') {
ncnt=1;
kk++;
leftis=')';
while (ncnt > 0 || qscs[0].trim().slice(-kk).substring(0,1) != '(') {
if (qscs[0].trim().slice(-kk).substring(0,1) == ')') {
ncnt++;
} else if (qscs[0].trim().slice(-kk).substring(0,1) == '(') {
ncnt--;
}
spareis=leftis;
leftis=qscs[0].trim().slice(-kk).substring(0,1) + spareis;
kk++;
}
} else {
while (qscs[0].trim().slice(-kk).substring(0,1) >= zero && qscs[0].trim().slice(-kk).substring(0,1) <= nine) {
spareis=leftis;
leftis=qscs[0].trim().slice(-kk).substring(0,1) + spareis;
kk++;
}
if (qscs[0].trim().slice(-kk).substring(0,1) == '-' && leftis != '') {
spareis=leftis;
leftis=qscs[0].trim().slice(-kk).substring(0,1) + spareis;
}
}
zero='0';
nine='9';
kk=1;
if (qscs[1].trim().substring(0,kk).slice(-1) == '(') {
rightis='(';
kk++;
ncnt=1;
while (ncnt > 0 || qscs[1].trim().substring(0,kk).slice(-1) != ')') {
if (qscs[1].trim().substring(0,kk).slice(-1) == ')') {
ncnt--;
} else if (qscs[1].trim().substring(0,kk).slice(-1) == '(') {
ncnt++;
}
rightis=qscs[1].trim().substring(0,kk);
kk++;
}
} else {
if (qscs[1].trim().substring(0,kk).slice(-1) == '-') {
kk++;
}
while (qscs[1].trim().substring(0,kk).slice(-1) >= zero && qscs[1].trim().substring(0,kk).slice(-1) <= nine) {
rightis=qscs[1].trim().substring(0,kk);
kk++;
}
}
qsc=qsc.replace(leftis + '^' + rightis, 'Math.pow(' + leftis + ',' + rightis + ')');
qscs=qsc.split('^');
}
answer='' + eval(qsc.split('What is ')[1].split('?')[0].trim());
document.getElementById('myh1').innerHTML=qs[choice].replace(/\x/g,'✖').replace(/\*/g,'✖').replace(/\+/g,'➕').replace(/\-/g,'➖').replace(/\//g,'➗').replace(/\?/g,'<a style="text-decoration:none;cursor:pointer;" title="Enter your own question" onclick="ask(); event.stopPropagation();" ontouchstart="event.stopPropagation();" onmousedown="event.stopPropagation();">❓</a>');
if (!timeron) {
timeron=true;
bonus = 3;
document.getElementById('secsleft').innerHTML='18 second(s) left to answer ... +<span style=background-color:white;cursor:pointer;>3⃣</span> bonus points';
document.getElementById('secsleft').style.border='3px solid blue';
document.getElementById('secsleft').style.backgroundColor='orange';
setTimeout(eachsec, 1000);
//setTimeout(checka, 19000);
}
}
}
function onl() {
if (!asked && oname == '') {
if (quiz) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1 style='vertical-align:middle;text-align:center;'>Mobile Gesture 👉 Quiz</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Take the 1 to 10 answer mathematics quiz by touch with number of fingers of answer over 18 seconds (bonus for 3 or more usage).</h4><!--input onclick=\"genask('');\" type=button value=\"Two Player Game ... You Set It Up for Other Player who Turns Away Now\"></input--><button style=\"height:90px;\" onclick=\"genask('');\">Two Player Name Game 🐵 / 🙈 ... <br>You 🐵 Set It Up for Other <br>Player 🙈 who Turns Away Now</button><br><br><button style=\"height:90px;\" onclick=\"drest(); genask('');\">Two Player Name Email Game 🐵 📧 🐵 ... <br>You 🐵 Set It Up for Other <br>Player 🐵 via Email 📧</button>");
} else {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1 style='vertical-align:middle;text-align:center;'>Mobile Gesture 👉 Quiz</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Take the 1 to 10 answer mathematics quiz by touch with number of fingers of answer over 18 seconds.</h4><!--input onclick=\"genask('');\" type=button value=\"Two Player Game ... You Set It Up for Other Player who Turns Away Now\"></input--><button style=\"height:90px;\" onclick=\"genask('');\">Two Player Name Game 🐵 / 🙈 ... <br>You 🐵 Set It Up for Other <br>Player 🙈 who Turns Away Now</button><br><br><button style=\"height:90px;\" onclick=\"drest(); genask('');\">Two Player Name Email Game 🐵 📧 🐵 ... <br>You 🐵 Set It Up for Other <br>Player 🐵 via Email 📧</button>");
}
document.getElementById('mydiv').style.textAlign='center';
document.getElementById('mydiv').style.verticalAlign='middle';
setTimeout(pickq, 8000);
} else if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1>Mobile Gesture 👉 Playground</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Try mobile <select onchange=\"location.href=document.URL.split('#')[0].split('?')[0] + '?quiz=y';\"><option value=>gestures</option><option value=quiz>quiz</option></select> below, & we'll detect which type of swipe gesture.</h4><!--input onclick=\"genask('');\" type=button value=\"Two Player Game ... You Set It Up for Other Player who Turns Away Now\"></input--><button style=\"height:90px;\" onclick=\"genask('');\">Two Player Name Game 🐵 / 🙈 ... <br>You 🐵 Set It Up for Other <br>Player 🙈 who Turns Away Now</button><br><br><button style=\"height:90px;\" onclick=\"drest(); genask('');\">Two Player Name Email Game 🐵 📧 🐵 ... <br>You 🐵 Set It Up for Other <br>Player 🐵 via Email 📧</button>");
} else {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1>Mobile Gesture 👉 Playground</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Try mobile gestures below, & we'll detect which type of swipe gesture.</h4><!--input onclick=\"genask('');\" type=button value=\"Two Player Game ... You Set It Up for Other Player who Turns Away Now\"></input--><button style=\"height:90px;\" onclick=\"genask('');\">Two Player Name Game 🐵 / 🙈 ... <br>You 🐵 Set It Up for Other <br>Player 🙈 who Turns Away Now</button><br><br><button style=\"height:90px;\" onclick=\"drest(); genask('');\">Two Player Name Email Game 🐵 📧 🐵 ... <br>You 🐵 Set It Up for Other <br>Player 🐵 via Email 📧</button>");
}
document.getElementById('mydiv').style.paddingLeft='10px';
document.getElementById('mydiv').style.border='2px solid orange';
document.getElementById('tdhuhta').innerHTML=("<h1>Mobile Gesture <a target=_blank href='" + document.URL.split('?')[0].split('#')[0] + "'>👉</a> Game for ~ ... Welcome!</h1><h3>RJM Programming - November, 2019</h3><h4>~, try gestures 👉 below by clicking button courtesy of `!.</h4><br><br><a target=_blank style='text-decoration: none; border:3px solid red; padding: 15px 15px 15px 15px; background-color: yellow; height: 60px; border-radius: 40px;' id=aclick href='" + document.URL.split('?')[0].split('#')[0] + "?name=&array='>Name Game for ~ Courtesy of `</a><br><br><br>");
document.getElementById('tdsubj').value+=" - " + document.URL.split('?')[0].split('#')[0];
ifemailih = document.getElementById('ifemail').innerHTML;
} else {
if (quiz) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1 style='vertical-align:middle;text-align:center;'>Mobile Gesture 👉 Quiz</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Take the 1 to 10 answer mathematics quiz by touch with number of fingers of answer over 18 seconds (bonus for 3 or more usage).</h4>");
} else {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1 style='vertical-align:middle;text-align:center;'>Mobile Gesture 👉 Quiz</h1><h3 id=myh3>RJM Programming - November, 2019</h3><h4>Take the 1 to 10 answer mathematics quiz by touch with number of fingers of answer over 18 seconds.</h4>");
}
document.getElementById('mydiv').style.textAlign='center';
document.getElementById('mydiv').style.verticalAlign='middle';
setTimeout(pickq, 8000);
} else {
document.getElementById('mydiv').innerHTML=("<h1 id=myh1>Mobile Gesture 👉 Game for " + oname + " ... Welcome!</h1><h3>RJM Programming - November, 2019</h3><h4>" + oname + ", try gestures 👉 below to surprise yourself!</h4>");
}
document.getElementById('mydiv').className='s7'; //.style.background='linear-gradient(90deg,#03001e,#7303c0,#ec38bc,#fdeff9) !important;';
document.getElementById('mydiv').style.paddingLeft='10px';
document.getElementById('mydiv').style.border='2px solid orange';
setTimeout(randgrad,5000);
}
// Thanks to https://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('mousedown', handleMouseStart, false);
if (!quiz) {
document.addEventListener('touchmove', handleTouchMove, false);
//document.getElementById('mydiv').addEventListener('click', handleMouseStart, false);
document.addEventListener('mousemove', handleMouseMove, false);
document.addEventListener('gestureend', function(e) {
if (e.scale < 1.0 && numf == 2) {
// User moved fingers closer together
if (oname != '') {
if (lookupw == '') {
// Thanks Wikipedia
gtrue=true;
document.title='Ouch!';
document.getElementById('ifnicknames').src='./mg.php'; // Thanks to '//en.wikipedia.org/wiki/Hypocorism#English';
} else {
dopinch('Ouch!');
}
} else {
dopinch('Ouch!');
}
} else if (e.scale > 1.0 && numf == 2) {
// User moved fingers further apart
if (oname != '') {
if (lookupw == '') {
// Thanks Wikipedia
gtrue=false;
document.title='Aaaah!';
document.getElementById('ifnicknames').src='./mg.php'; // Thanks to '//en.wikipedia.org/wiki/Hypocorism#English';
} else {
dostretch('Aaaah!');
}
} else {
dostretch('Aaaah!');
}
}
}, false);
}
}
</script>
</head>
<body onload="onl();">
<div id=mydiv title='Pointing place' style='position:fixed;top:0px;left:0px;width:100%;height:100vh;background-color:yellow;'>
<!--h1>Swipe Gesture Playground</h1>
<h3>RJM Programming - November, 2019</h3>
<h4>Try swipe gestures below, and we'll detect which type of swipe gesture.</h4-->
</div>
<form id=ifemail target="iemail" style="display:none;" action="//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php" method="POST">
<input type=hidden style=display:none; name=inline value=""></input>
<input type=hidden style=display:none; name=to id=tdto value=""></input>
<input type=hidden style=display:none; name=subj id=tdsubj value="Name Game - RJM Programming"></input>
<textarea name=hcont style=display:none; value="" id=tdhuhta cols=160 rows=4></textarea>
<input type=hidden style=display:none; name=cc id=tdcc value=""></input>
<input type=hidden style=display:none; name=bcc id=tdbcc value=""></input>
<input style=display:none; type=submit id=fsubm value="Email"></input>
</form>
<iframe style=display:none; name=iemail id=iemail src=></iframe>
<script type='text/javascript'>
if (oname != '') { document.write("<iframe onload='if (1 == 1) { ifwikio(this); }' style=display:none; id=ifnicknames src='./mg.php?x=x'></iframe>"); }
</script>
<div id=twofd1></div>
<div id=twofd2></div>
</body>
</html>