// country_quiz.js // Help out backgrounds of country_flag/currency/capital_quiz.php suite // RJM Programming // November, 2016 var oneoftwo=0, xinxy=[], yinxy=[], opis='1.0', ovnum=1, defzoom=2, canvcont='', zzaconto=null; var zpos3=-999, zpos4=-999; var trjm=null; var zaconto=null; var xsprefix=''; var xuprefix="//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Countries&onclick=y&width=298&height=194&country=Country&popularity=Intensity&guess=&data="; function xselchangeit(osel) { uprefix+=sprefix + '%20[~' + encodeURIComponent(osel.options[osel.selectedIndex].text) + '~,66]%20'; sprefix=','; iframeit(); } function xsetup(ins) { uprefix+=sprefix + '%20[~' + encodeURIComponent(ins.replace(/_/g,' ')) + '~,66]%20'; sprefix=','; iframeit(); } function xiframeit() { document.getElementById('dgeochart').innerHTML=''; } function xcheckforpost(insg, oiframe, owhere) { var outs=insg, fbits=''; if (oiframe == null) { fbits='
'; } else { if (oiframe.name != '') { fbits='
'; } else { fbits='
'; } } if (insg.length > 950) { var outarr=insg.split('#')[0].split('?'); if (outarr.length > 1) { var outarrtwo=outarr[1].split('&'), oath; for (var im=0; im',''); } } if (owhere == null) { owhere=document.getElementById('mydpost'); if (owhere == null) { if (document.getElementById('mydpost')) { document.getElementById('mydpost').innerHTML=fbits; setTimeout(andlater,1500); outs="#"; } else { document.body.innerHTML+='
' + fbits + '
'; setTimeout(andlater,1500); outs="#"; } } else { owhere.innerHTML=fbits; setTimeout(andlater,1500); outs="#"; } } else { owhere.innerHTML=fbits; setTimeout(andlater,1500); outs="#"; } } return outs; } function xandlater() { document.getElementById('myspost').click(); } function flagcheck(inv) { var suffix=''; goes++; if (document.getElementById('tdflag').innerHTML.indexOf(inv.value) != -1) { score++; } else if (document.getElementById(countryids[choice]).outerHTML.indexOf('
you needed for your answer was ' + document.getElementById(countryids[choice]).title; } else { suffix=' The country
represented by
you needed for your answer was ' + document.getElementById(countryids[choice]).title; } if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; document.getElementById('country').value=''; choose(); if (suffix != '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { //document.body.style.zoom='1'; //window.scrollTo(0,0); if (document.getElementById('container')) { document.getElementById('country').scrollIntoView(); if (document.getElementById('ssuffix')) { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the capital city ', 'has the capital city
'); } else { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the capital city ', 'has the capital city
'); } if (document.getElementById('thleft')) { document.getElementById('thleft').scrollIntoView(); } else { document.getElementById('container').scrollIntoView(); } setTimeout(nocontainer, 20000); } else { document.getElementById('myh1').scrollIntoView(); } } } function capitalcheck(inv) { if (inv.value != '') { var suffix=''; goes++; if (ourcomp(inv.value,document.getElementById('country').value)) { score++; } else if (document.getElementById(countryids[choice]).outerHTML.indexOf('represented by ' + document.getElementById(countryids[choice]).innerHTML + '
has the capital city ' + document.getElementById(countryids[choice]).title; } else { suffix=' The country ' + document.getElementById(countryids[choice]).id.replace(/_/g,' ') + '
represented by
has the capital city ' + document.getElementById(countryids[choice]).title; } var wass=suffix; if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; choose(); if (wass != '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { //document.body.style.zoom='1'; //window.scrollTo(0,0); if (document.getElementById('container')) { document.getElementById('country').scrollIntoView(); if (document.getElementById('ssuffix')) { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the capital city ', 'has the capital city
'); } else { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the capital city ', 'has the capital city
'); } if (document.getElementById('thleft')) { document.getElementById('thleft').scrollIntoView(); } else { document.getElementById('container').scrollIntoView(); } setTimeout(nocontainer, 20000); } else { document.getElementById('myh1').scrollIntoView(); } } } } function nocontainer() { document.getElementById('container').innerHTML=''; } function currencycheck(inv) { if (inv.value != '') { var suffix=''; goes++; if (ourcomp(inv.value,document.getElementById('country').value)) { score++; } else if (document.getElementById(countryids[choice]).outerHTML.indexOf('represented by ' + document.getElementById(countryids[choice]).innerHTML + '
has the currency ' + document.getElementById(countryids[choice]).title; } else { suffix=' The country ' + document.getElementById(countryids[choice]).id.replace(/_/g,' ') + ' (' + countrycodes[choice] + ')
represented by
has the currency ' + document.getElementById(countryids[choice]).title; } if (document.getElementById('ssuffix')) { document.gteElementById('ssuffix').innerHTML=suffix; suffix=''; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; choose(); if (suffix != '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { //document.body.style.zoom='1'; //window.scrollTo(0,0); if (document.getElementById('container')) { document.getElementById('country').scrollIntoView(); if (document.getElementById('ssuffix')) { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the currency ', 'has the currency
'); } else { document.getElementById('container').innerHTML=(document.getElementById('score').innerHTML + '  ').replace('The country ', '
The country ').replace('has the currency ', 'has the currency
'); } if (document.getElementById('thleft')) { document.getElementById('thleft').scrollIntoView(); } else { document.getElementById('container').scrollIntoView(); } setTimeout(nocontainer, 20000); } else { document.getElementById('myh1').scrollIntoView(); } } } } function ifon() { if (trjm != null) { document.getElementById('iback').style.display='block'; } else { document.getElementById('iback').style.display='none'; } } function youralert(ev) { //},yblurb1,yblurb2,yblurb3,yblurb4,yblurb5) { if (ev.touches) { if (ev.touches[0].pageX) { zpos3 = ev.touches[0].pageX; zpos4 = ev.touches[0].pageY; } else { zpos3 = ev.touches[0].clientX; zpos4 = ev.touches[0].clientY; } } else if (ev.clientX || ev.clientY) { zpos3 = ev.clientX; zpos4 = ev.clientY; } else { zpos3 = ev.pageX; zpos4 = ev.pageY; } //alert('x=' + zpos3 + ' and y=' + zpos4); //if (zpos3 >= 0) { //zaconto.ouralert(yblurb1,yblurb2,yblurb3,yblurb4,yblurb5); //} //zaconto.ouralert(yblurb1,yblurb2,yblurb3,yblurb4,yblurb5); if (oneoftwo == 0) { return true; } else if (Math.abs(oneoftwo) == 1) { xinxy.push(zpos3); yinxy.push(zpos4); if (oneoftwo < 0) { oneoftwo--; } else { oneoftwo++; } if (1 == 5) { alert('first of two ' + 'x=' + zpos3 + ' and y=' + zpos4); } return false; } else if (Math.abs(oneoftwo) == 2) { xinxy.push(zpos3); yinxy.push(zpos4); if (1 == 5) { alert('second of two ' + 'x=' + zpos3 + ' and y=' + zpos4); } overlayit(0); return false; } return true; } function setdefzoom(towhat) { defzoom=eval('' + towhat); } function dotwor() { if (oneoftwo == 1) { defzoom++; } else { defzoom=2; } oneoftwo=1; } function dotwoc() { if (oneoftwo == -1) { defzoom++; } else { defzoom=2; } oneoftwo=-1; } function alternatevisibility() { var igh=1; while (zaconto.getElementById('iciov' + igh)) { if (igh == 1 && zaconto.getElementById('iciov' + igh).outerHTML.indexOf('visibility:') == -1) { nextv='hidden'; } else if (igh == 1 && zaconto.getElementById('iciov' + igh).outerHTML.split('visibility:')[1].split(';')[0].split('>')[0].toLowerCase().indexOf('visible') != -1) { nextv='hidden'; } else if (igh == 1) { nextv='visible'; } zaconto.getElementById('iciov' + igh).style.visibility='' + nextv; igh++; } } function overlayit(ootis) { var prerest='', zb='', wascc=''; if (ootis == 0) { if (eval('' + xinxy.length) == 2) { if (ovnum == 1) { // thanks to https://stackoverflow.com/questions/69491728/how-to-zoom-an-image-on-mouse-hover-using-css prerest=' .zoom-img { width: ' + zaconto.getElementById('myimg').width + 'px; height: ' + zaconto.getElementById('myimg').height + 'px; overflow: hidden; } .zoom-img:hover { transform: scale(2.0); } '; } if (defzoom != 2) { zb=' #iciov' + ovnum + ':hover { transform: scale(' + defzoom + '.0); } '; } if (oneoftwo < 0) { // circle wascc=canvcont; //zzaconto.onl(); if (canvcont == '') { canvcont=zaconto.getElementById('mycanvas').toDataURL('image/jpeg',0.1); } canvcont='/HTMLCSS/HYP_50M_SR_W.jpg'; zaconto.getElementById('myimg').style.opacity='1.0'; //alert(zaconto.getElementById('myimg').outerHTML.replace('myimg','iciov' + ovnum).replace('myimg','iciov' + ovnum).replace('56;','1899;background-color:transparent;').replace(/\\\"\\ on/g, '\" data-on').replace(' ' + prerest + zb + ' #iciov' + ovnum + ' { -webkit-filter: brightness(150%); filter: brightness(150%); transform-origin: ' + xinxy[0] + 'px ' + yinxy[0] + 'px; clip-path: circle(' + Math.sqrt(eval(xinxy[0] - xinxy[1]) * eval(xinxy[0] - xinxy[1]) + eval(yinxy[0] - yinxy[1]) * eval(yinxy[0] - yinxy[1])) + 'px at ' + xinxy[0] + 'px ' + yinxy[0] + 'px); } '); zaconto.getElementById('dvstyle').innerHTML+=''; } else { // rectangle wascc=canvcont; //zzaconto.onl(); if (canvcont == '') { canvcont=zaconto.getElementById('mycanvas').toDataURL('image/jpeg',0.1); } canvcont='/HTMLCSS/HYP_50M_SR_W.jpg'; zaconto.getElementById('myimg').style.opacity='1.0'; zaconto.getElementById('imgmore').innerHTML+=zaconto.getElementById('myimg').outerHTML.replace('myimg','iciov' + ovnum).replace('myimg','iciov' + ovnum).replace('56;','1899;').replace(/\\\"\\ on/g, '\" data-on').replace(''; } if (ovnum == 1) { setInterval(alternatevisibility, 15000); } ovnum++; } oneoftwo=ootis; defzoom=2; xinxy=[]; yinxy=[]; } } function putcc(inccis) { canvcont=inccis; } function ctyifcheck(ziois) { var kkfound=false, iars=0, iiars=0; zaconto = (ziois.contentWindow || ziois.contentDocument); zzaconto=zaconto; if (zaconto != null) { try { if (zaconto.document) { zaconto = zaconto.document; } if (zaconto.body.innerHTML.indexOf('>') != -1 && ziois.src.indexOf('highlight=') != -1) { //canvcont=zaconto.getElementById('mycanvas').toDataURL('image/jpeg',0.1); document.getElementById('iback').style.width='110%'; document.getElementById('iback').style.height='900px'; document.getElementById('iback').style.marginLeft='-20px'; document.getElementById('iback').frameborder='0'; var arstart=zaconto.getElementsByTagName('area'); var ars=zaconto.getElementsByTagName('div'); for (iiars=0; iiars