<html>
<head>
<title>One or Several Quiz - RJM Programming - July, 2021</title>
<meta charset="utf-8"/>
<style>
.optchosen { background-color: rgb(230,230,230); }
</style>
<script type='text/javascript'>
var qs=["Which countries comprise Indochina?|Which countries border the Gulf of Thailand?",
"Which are primary colours?|Which are secondary colours?",
"In order which are 6th, 7th and 8th longest rivers in the world?|In order which are 1st, 2nd and 3rd longest rivers in the world?",
"How many in a baker's dozen?|What is the base number of hexidecimal numbers?",
"As of 30/7/2021 how many countries use the euro as their primary currency?",
"Which of these capital cities are South American ones?|Which of these capital cities are European ones?",
"In order which are increasing atomic number gaseous element symbols of the periodic table?",
"Which three consecutive numbers form a numerical sequence?",
"That's odd?!|Feel like getting even?!",
"Which cloud types can result in drizzle?|Which cloud types result in no precipitation?",
"Of the main taxonomic ranks below which categorizes Homo?|Of the main taxonomic ranks below which categorizes Cnidaria?",
"Which set of three consecutive rock types are Metamorphic rocks?|Which set of three consecutive rock types are Sedimentary rocks?|Which set of three consecutive rock types are Igneous rocks?",
];
var os=["Cambodia, China, Japan, Laos, Myanmar, North Korea, South Korea, Thailand, Vietnam, India, Bangladesh, Malaysia",
"orange, yellow, purple, blue, red, brown, green",
"Yangtze, Mekong, Paraná, Irtysh, Lena, Mississippi, Nile, Yellow, Congo, Amazon",
"12, 14, 16, 15, 13, 24, 10",
"27, 25, 19, 21, 23, 22, 12, 17",
"Paris, Montevideo, Caracas, Pretoria, Jakarta, New Delhi, Lima, San Salvador, Georgetown, Tashkent, Copenhagen, Sucre",
"Og, F, B, C, Xe, Ne, N, Be, Li, Ca, K, Ka, Ar, H, O, He, Cl",
"2, 4, 15, 81, 9, 3, 33, 38, 42, 21, 14, 8, 56, 45, 31",
"72, 84, 15, 81, 9, 63, 33, 38, 42, 21, 14, 88, 56, 45, 31",
"Cirrus, Cirrocumulus, Cirrostratus, Altocumulus, Altostratus, Nimbostratus, Stratocumulus, Stratus, Cumulus, Cumulonimbus",
"kingdom, phylum or division, class, order, family, genus, species",
"pumice, gabbro, granite, slate, marble, schist, limestone, sandstone, shale"
];
var as=["Cambodia, Laos, Myanmar, Thailand, Vietnam|Thailand, Vietnam, Cambodia",
"yellow, blue, red|orange, purple, green",
"Yellow,Paraná,Congo|Nile,Amazon,Yangtze",
"13|16",
"19",
"Montevideo, Caracas, Lima, Georgetown, Sucre|Paris, Copenhagen",
"H,N,O,F,He,Ne,Cl,Ar,Kr,Xe,Og",
"81, 9, 3",
"15, 81, 9, 63, 33, 21, 45, 31|72, 84, 38, 42, 14, 88, 56",
"Stratocumulus, Stratus|Cirrus, Cirrocumulus, Cirrostratus",
"genus|phylum or division",
"slate, marble, schist|limestone, sandstone, shale|pumice, gabbro, granite"
];
var oneemail=1;
var twoemail=1;
var otfo='';
var dbih='';
var repeated=false;
var ck=false;
var gmlistc='';
var wasgmlistc='';
var nols=location.search.split('nols=')[1] ? (decodeURIComponent(location.search.split('nols=')[1].split('&')[0])) : "";
var fromemail=location.search.split('dividerfour=')[1] ? setans(decodeURIComponent(location.search.split('dividerfour=')[1].split('÷r')[0]).replace('&answer=','').replace(/\&answer\=/g,',')) : "";
var score=location.search.split('score=')[1] ? eval(decodeURIComponent(location.search.split('score=')[1].split('&')[0])) : 0;
var goes=location.search.split('goes=')[1] ? eval(decodeURIComponent(location.search.split('goes=')[1].split('&')[0])) : 0;
var inq=location.search.split('question=')[1] ? (decodeURIComponent(location.search.split('question=')[1].split('&')[0])) : '-1';
var emailto=location.search.split('to=')[1] ? (decodeURIComponent(location.search.split('to=')[1].split('&')[0])).replace(/\+/g,' ') : "";
var emailcc='';
var gmlist=location.search.split('answer=')[1] ? (decodeURIComponent(location.search.split('answer=')[1].split('&')[0])) : "";
var questions=location.search.split('questions=')[1] ? (decodeURIComponent(location.search.split('questions=')[1].split('&')[0])).replace(/\+/g,'') : "";
var dfive=location.search.split('dividerfive=')[1] ? (decodeURIComponent(location.search.split('dividerfive=')[1].split('&')[0])) : "";
if (window.localStorage && nols == '') {
if (('' + window.localStorage.getItem("dykscorequiz")).replace('undefined','').replace('null','') != '') {
if (dfive != '') {
window.localStorage.removeItem("dykscorequiz");
window.localStorage.setItem("dykscorequiz", "0");
otfo=' on this first collaboration';
} else {
score=decodeURIComponent(window.localStorage.getItem("dykscorequiz"));
}
} else if (dfive != '') {
window.localStorage.setItem("dykscorequiz", "0");
otfo=' on this first collaboration';
}
if (('' + window.localStorage.getItem("dykgoesquiz")).replace('undefined','').replace('null','') != '') {
if (dfive != '') {
window.localStorage.removeItem("dykgoesquiz");
window.localStorage.setItem("dykgoesquiz", "0");
otfo=' on this first collaboration';
} else {
goes=decodeURIComponent(window.localStorage.getItem("dykgoesquiz"));
}
} else if (dfive != '') {
window.localStorage.setItem("dykgoesquiz", "0");
otfo=' on this first collaboration';
}
}
//if (fromemail != '') { alert('fromemail=' + fromemail + ' and inq=' + inq); }
var lastq=-1;
var savedih=''
var validcall=true;
var inthegame=false;
var zero=0, zeroes=[0];
var snum=1;
var prevs='';
var overallq="";
var overallm="";
var overalla="";
var apick=-1;
var aclick=false;
var firstih='';
var origscore=score;
if (!String.fromCodePoint) { // thanks to http://xahlee.info/js/js_unicode_code_point.html
// ES6 Unicode Shims 0.1 , © 2012 Steven Levithan , MIT License
String.fromCodePoint = function fromCodePoint () {
var chars = [], point, offset, units, i;
for (i = 0; i < arguments.length; ++i) {
point = arguments[i];
offset = point - 0x10000;
units = point > 0xFFFF ? [0xD800 + (offset >> 10), 0xDC00 + (offset & 0x3FF)] : [point];
chars.push(String.fromCharCode.apply(null, units));
}
return chars.join("");
}
}
function setans(inans) {
if (inans != '') { gmlistc=inans; }
return inans;
}
function scoreit() {
var suffix=' ... Bad luck.';
if (inthegame && validcall) {
goes++;
document.getElementById('hgoes').value='' + goes;
if (('' + zeroes.length) == '0') {
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes + suffix;
gmlist='';
if (wasgmlistc == '') {
//alert('why');
document.getElementById('answer').size='1';
document.getElementById('answer').innerHTML=savedih;
validcall=false;
inthegame=false;
dbih='';
pickq();
//} else {
//alert('good');
}
return '';
}
var answs=gmlist.split(',');
var rw=[];
var i=-1;
for (var ijk=0; ijk<without(zeroes.length); ijk++) {
//if (ijk == 0) { alert(gmlist + ' ' + zeroes[0] + ' ' + zeroes.length + ' zero=' + zero + ' ... ' + document.getElementById('answer').getAttribute('data-title')); }
if (gmlist.toLowerCase() == document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[zero]].toLowerCase().replace(/\ /g,'') && eval(1 + ijk) == eval('' + zeroes.length)) {
score=eval('' + score);
score+=eval('' + document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[zero]].toLowerCase().replace(/\|/g,',').split(',').length);
document.getElementById('hscore').value='' + score;
suffix=' ... Well done!';
} else if (document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[zero]].toLowerCase().indexOf(' ') != -1 && eval(1 + ijk) == eval('' + zeroes.length)) {
rw=(',' + document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[zero]] + ',').replace(/\,\ /g,',');
for (i=0; i<answs.length; i++) {
//if (rw == rw.replace(',' + answs[i] + ',', '|')) { alert('was=' + rw + ' via ' + ',' + answs[i] + ',' + ' and now=' + rw.replace(',' + answs[i] + ',', '|')); }
rw=rw.replace(',' + answs[i] + ',', ',');
}
//alert(rw.replace(/\,/g, '').replace(/\ /g, ''));
if (rw.replace(/\|/g, '').replace(/\,/g, '').replace(/\ /g, '') == '' && eval(1 + ijk) == eval('' + zeroes.length)) {
score=eval('' + score);
score+=eval('' + document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[zero]].toLowerCase().replace(/\|/g,',').split(',').length);
document.getElementById('hscore').value='' + score;
suffix=' ... Well done!';
}
}
if (eval(1 + ijk) == eval('' + zeroes.length)) {
zero=zeroes[eval(1 + ijk)];
}
}
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes + suffix;
gmlist='';
if (wasgmlistc == '') {
//alert('Why');
document.getElementById('answer').size='1';
document.getElementById('answer').innerHTML=savedih;
validcall=false;
inthegame=false;
dbih='';
pickq();
}
} else if (inthegame) {
validcall=true;
document.body.style.cursor='progress';
setTimeout(scoreit, 15000);
}
}
function getask() {
qs=eval("[" + overallq + "]");
os=eval("[" + overallm + "]");
as=eval("[" + overalla + "]");
//alert(qs);
//alert(os);
//alert(as);
dbih='';
pickq();
}
function pickq() {
var yes=false;
//if (waslistc != '') { wasgmlistc=''; return ''; }
if (wasgmlistc == '' && gmlistc != '') {
wasgmlistc=gmlistc;
}
if (!ck) {
ck=true;
if (fromemail != '') { twoemail=reseih(2); }
if (emailto.indexOf(';') != -1) {
if (emailto.split(';')[1].indexOf('@') != -1) {
if (emailto.split(';')[1].indexOf('[') != -1 && emailto.split(';')[1].indexOf(']') != -1) {
document.getElementById('myh1').innerHTML+=' sent by <a target=_blank title=Email href="mailto:' + emailto.split(';')[1].split(']')[0].split('[')[1] + '?subject=Quiz">' + emailto.split(';')[1].replace('[' + emailto.split(';')[1].split(']')[0].split('[')[1] + ']', '') + '</a>';
}
} else {
document.getElementById('myh1').innerHTML+=' sent by <a target=_blank title=Email href="mailto:' + emailto.split(';')[1] + '?subject=Quiz">' + emailto.split(';')[1] + '</a>';
}
}
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes;
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('answer').onchange=function() { twoanswer(); };
document.getElementById('maybenoway').innerText='Please select answer(s) below ...';
}
//if (emailto.indexOf('@') != -1) { emailwho(); }
document.getElementById('resa').href=document.URL.split('#')[0].split('?')[0];
document.getElementById('iform').action=document.URL.split('#')[0].split('?')[0];
if (window.localStorage) {
if (('' + window.localStorage.getItem("dykquiz")).replace('undefined','').replace('null','') != '') {
var bigqa=decodeURIComponent(window.localStorage.getItem("dykquiz"));
var bqs=bigqa.split('"^"');
if (bqs.length >= 3) {
overallq=bqs[0] + '"';
overallm='"' + bqs[1] + '"';
overalla='"' + bqs[2];
document.getElementById('smode').innerHTML="<select id=sdyk onchange=' if (this.value.length != 0) { twoemail=reseih(2); eval(this.value); } else { twoemail=reseih(1); } prevs=this.value; ' style=display:inline-block;><option value=''>" + '"' + "Did You Know" + '"' + "</option><option onclick=getask(); value='getask();'>Recall Saved Quiz Questions and Answers</option><option onclick=ask(); value='ask();'>Reask or Remove Above</option></select>";
}
}
}
if (gmlist != '') { yes=true; }
}
if (savedih == '') { savedih=document.getElementById('answer').innerHTML; }
if (eval('' + inq) >= 0) {
apick=eval('' + inq);
//alert('apick=' + apick);
inq=-1;
} else {
//if (apick < 0 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
//apick=2;
//} else {
apick=Math.floor(Math.random() * qs.length);
//}
}
while (apick == lastq) {
apick=Math.floor(Math.random() * qs.length);
}
if (eval('' + qs.length) > 1) { lastq=apick; }
var spick=Math.floor(Math.random() * 2);
var selih=savedih;
var seli="";
var xeli="";
var answs=os[apick].split(',');
document.body.style.cursor='pointer';
if (qs[apick].replace('Of the ',' consecutive ').indexOf(' consecutive ') != -1) { spick=1; }
//alert('gmlistc=' + gmlistc);
for (var i=0; i<answs.length; i++) {
seli="";
xeli="";
if ((',' + gmlistc + ',').indexOf(',' + answs[i].trim() + ',') != -1) { seli=' class=optchosen selected'; }
if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if ((',' + gmlistc + ',').indexOf(',' + answs[i].trim() + ',') != -1) { xeli=' ' + String.fromCodePoint(10004); }
}
if (spick == 1 ) {
selih+="<option onclick='oneanswer(this);' value='" + answs[i].trim() + "'" + seli + ">" + answs[i].trim() + xeli + "</option>";
} else {
selih=selih.replace(savedih, savedih + "<option onclick='oneanswer(this);' value='" + answs[i].trim() + "'" + seli + ">" + answs[i].trim() + xeli + "</option>");
}
spick=Math.floor(Math.random() * 2);
if (qs[apick].replace('Of the ',' consecutive ').indexOf(' consecutive ') != -1) { spick=1; }
}
//alert('selih=' + selih);
document.getElementById('answer').innerHTML=selih;
document.getElementById('answer').size='' + eval(1 + answs.length);
//document.getElementById('answer').setAttribute('data-title', wor(as[apick]));
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) && as[apick].indexOf(', ') == -1) {
document.getElementById('answer').setAttribute('data-title', as[apick].replace(/\,/g,', '));
} else {
document.getElementById('answer').setAttribute('data-title', as[apick]);
}
document.getElementById('answer').value='';
document.getElementById('theq').innerHTML=maybesel(qs[apick]);
if (emailto.indexOf('@') != -1 && !document.getElementById('selt') && fromemail == '') { preemailwho(); }
if (gmlistc != '') { gmlist=gmlistc; }
if (gmlist != '') {
//alert('gmlist set=' + gmlist + ' and gmlistc=' + gmlistc);
if (gmlistc == '' && fromemail != '') { gmlistc=' '; wasgmlistc=gmlistc; }
inthegame=true;
validcall=true;
zero=0;
zeroes=[];
zeroes.push(zero);
if (document.getElementById('selt')) { oureval(document.getElementById('selt')); }
scoreit();
if (window.localStorage && nols == '') {
if (('' + window.localStorage.getItem("dykscorequiz")).replace('undefined','').replace('null','') != '') {
window.localStorage.removeItem("dykscorequiz");
window.localStorage.setItem("dykscorequiz", '' + score);
}
if (('' + window.localStorage.getItem("dykgoesquiz")).replace('undefined','').replace('null','') != '') {
window.localStorage.removeItem("dykgoesquiz");
window.localStorage.setItem("dykgoesquiz", '' + goes);
}
}
document.getElementById('resa').target='_blank';
document.getElementById('resa').title='Continue on with this score on your own in new tab, separate to emails you get from your collaborator';
document.getElementById('resa').href+='?score=' + score + '&goes=' + goes + '&nols=y';
//alert(document.getElementById('resa').href);
if (gmlistc != '') {
setTimeout(okagain, 2000);
}
}
gmlistc='';
//if (fromemail == '' && dbih != '' && emailto.indexOf('@') != -1) { emailit(); }
}
function okagain() {
var px=null;
if (origscore == score) {
px=prompt('Thanks' + otfo + ' for your answer even though it was incorrect. Continue on with this score on your own in new tab, separate to emails you get from your collaborator?', 'no');
} else {
px=prompt('Thanks' + otfo + ' for your excellent answer! Continue on with this score on your own in new tab, separate to emails you get from your collaborator?', 'no');
}
if (px == null) { px=''; }
if ((px + ' ').toLowerCase().substring(0,1).replace('1','y') == 'y') { document.getElementById('resa').click(); }
}
function wor(ap) {
var thingos=ap.replace(/\ /g,'').replace(/\|/g,',').split(',');
var sofara=',' + thingos[0] + ',';
repeated=false;
for (var iij=1; iij<thingos.length; iij++) {
if (sofara.indexOf(',' + thingos[iij] + ',') != -1) { repeated=true; }
sofara+=thingos[iij] + ',';
}
return ap;
}
function maybesel(inq) {
zero=0;
zeroes=[0];
if (inq.indexOf('In order ') == 0 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
var winq=inq
inq=winq.replace('In order ','').substring(0,1).toUpperCase() + winq.replace('In order ','').substring(1);
}
if (inq.indexOf('|') == -1) {
document.getElementById('hquestion').value='' + apick;
return inq;
} else {
document.getElementById('hquestion').value='' + apick;
var seltd=' selected';
var selopts=inq.split('|');
var seloh='<select id=selt onchange="zero=oureval(this);" size=' + selopts.length + ' multiple></select>';
var seli="";
for (var isel=0; isel<selopts.length; isel++) {
seli="";
if (questions != '') { if ((',' + questions + ',').indexOf(',' + isel + ',') != -1) { seli=' class=optchosen'; if (seltd == '') { seli+=' selected'; } } }
seloh=seloh.replace('</select>', '<option value=' + isel + seltd + seli + '>' + selopts[isel] + '</option></select>');
seltd='';
}
if (firstih == '') { firstih=seloh.split('</select>')[0].split(' multiple>')[1]; }
setTimeout(seltit, 1000);
//alert(seloh);
return seloh;
}
}
function seltit() {
document.getElementById('answer').focus();
setTimeout(afterseltit, 2000); //document.getElementById('selt').focus();
}
function afterseltit() {
//document.getElementById('answer').focus();
document.getElementById('selt').focus();
if (!aclick) {
aclick=true;
if (firstih.trim() != '') { document.getElementById('selt').innerHTML=firstih; firstih=' '; }
document.getElementById('selt').click();
}
}
function oureval(sin) {
var hq='', hqdelim='';
var origih=sin.innerHTML, newih=origih;
zero=-1;
zeroes=[];
for (var i=0; i<sin.options.length; i++) {
if (sin.options[i].selected) {
//sin.options[i].selected='selected';
newih=newih.replace(' value="' + sin.options[i].value + '">', ' value="' + sin.options[i].value + '" selected="selected">');
if (sin.options[i].value != '') { hq+=hqdelim + sin.options[i].value; hqdelim=','; }
if (zero < 0) {
zero=eval('' + sin.options[i].value);
zeroes.push(zero);
zero=0;
} else {
zeroes.push(eval('' + sin.options[i].value));
}
}
}
if (zero < 0) { zero=zero; }
//alert('zeroes.length=' + zeroes.length);
if (eval(''+ zeroes.length) > 1) {
document.getElementById('answer').setAttribute('data-title', wor(document.getElementById('answer').getAttribute('data-title')));
}
//alert('hq=' + hq);
document.getElementById('hquestions').value=hq;
if (newih != origih) { newih=newih.replace(/\=\"\"/g, '="selected"'); sin.innerHTML=newih; }
if (emailto.indexOf('@') != -1) { setTimeout(preemailwho, 70); }
return zero;
}
function preemailwho() {
dbih=document.body.innerHTML;
if (fromemail == '' && emailto.indexOf('@') != -1) { emailit(); }
}
function without(zl) {
if (document.getElementById('selt')) {
if (('' + zeroes.length) == ('' + document.getElementById('selt').size)) {
//alert('before: ' + document.getElementById('answer').getAttribute('data-title'));
if (document.getElementById('answer').getAttribute('data-title').indexOf(',') == -1) {
document.getElementById('answer').setAttribute('data-title',wor(document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ', ')));
} else if (document.getElementById('answer').getAttribute('data-title').indexOf(' ') != -1) {
document.getElementById('answer').setAttribute('data-title',wor(document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ', ')));
} else {
document.getElementById('answer').setAttribute('data-title',wor(document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ',')));
}
//alert('afeter: ' + document.getElementById('answer').getAttribute('data-title'));
zl=1;
zero=0;
zeroes=[zero];
} else if (eval('' + zeroes.length) > 1) {
var dgis='', dgdelim=',';
//alert('Before: ' + document.getElementById('answer').getAttribute('data-title'));
if (document.getElementById('answer').getAttribute('data-title').indexOf(',') == -1) {
dgdelim=', '; //document.getElementById('answer').setAttribute('data-title',document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ', '));
} else if (document.getElementById('answer').getAttribute('data-title').indexOf(' ') != -1) {
dgdelim=', '; //document.getElementById('answer').setAttribute('data-title',document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ', '));
} else {
dgdelim=','; //document.getElementById('answer').setAttribute('data-title',document.getElementById('answer').getAttribute('data-title').replace(/\|/g, ','));
}
for (var jj=0; jj<zeroes.length; jj++) {
if (jj == 0) {
dgis=document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[jj]];
} else {
dgis+=dgdelim + document.getElementById('answer').getAttribute('data-title').split('|')[zeroes[jj]];
}
}
document.getElementById('answer').setAttribute('data-title',wor(dgis));
//alert('After: ' + document.getElementById('answer').getAttribute('data-title'));
zl=1;
zero=0;
zeroes=[zero];
//} else {
//alert('why? ' + zeroes.length + ' vs ' + document.getElementById('selt').size);
}
}
return zl;
}
function twoanswer() {
if (dbih.length == 0) { dbih=document.body.innerHTML; }
oneanswer(document.getElementById('answer'));
}
function oneanswer(invlo) {
var invl=invlo.value + '|', adone=false;
//alert('invl=' + invl);
if (dbih == '') { dbih=document.body.innerHTML; }
if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (invl.replace('|','') == '' && gmlistc == '') { return ''; }
}
//alert('Invl=' + invl);
inthegame=true;
var isvalid=false;
var morethanone=0;
document.body.style.cursor='pointer';
if (('' + invl).indexOf('|') != -1) {
//alert('InvL=' + invl + ' and gmlist=' + gmlist);
if ((',' + gmlist.replace(/\ /g,'') + ',').indexOf(',' + invl.split('|')[0].replace(/\ /g,'') + ',') == -1) {
isvalid=true;
if (gmlist == '') {
gmlist=invl.split('|')[0];
} else {
gmlist+=',' + invl.split('|')[0];
}
} else if (repeated) {
//alert('gmlist=' + gmlist);
isvalid=true;
gmlist+=',' + invl.split('|')[0];
}
//alert('gmlist=' + gmlist);
}
var sin=document.getElementById('answer');
//alert('premto=' + morethanone);
for (var ii=1; ii<sin.options.length; ii++) {
if (sin.options[ii].selected) {
morethanone++;
}
}
if (morethanone > 1) {
//alert('mto=' + morethanone);
gmlist='';
isvalid=false;
}
for (var i=1; i<sin.options.length; i++) {
if (sin.options[i].selected) {
if (sin.options[i].innerText.indexOf(String.fromCodePoint(10004)) == -1) {
sin.options[i].innerText+=' ' + String.fromCodePoint(10004);
//alert(1);
} else if (morethanone > 1) {
adone=false;
if (sin.options[i].innerText.split(String.fromCodePoint(10004)).length > 1) {
if (sin.options[i].innerText.split(String.fromCodePoint(10004))[1].trim() != '') {
adone=true;
}
}
if (!adone) { sin.options[i].innerText=sin.options[i].innerText.split(String.fromCodePoint(10004))[0] + String.fromCodePoint(10004); }
}
if ((sin.options[i].value + '|').indexOf('|') != -1) {
//if (gmlist.indexOf((sin.options[i].value + '|').split('|')[0]) == -1) {
if ((',' + gmlist.replace(/\ /g,'') + ',').indexOf(',' + (sin.options[i].value + '|').split('|')[0].replace(/\ /g,'') + ',') == -1) {
if (gmlist == '') {
gmlist=(sin.options[i].value + '|').split('|')[0];
} else {
gmlist+=',' + (sin.options[i].value + '|').split('|')[0];
}
if ((sin.options[i].innerText + ' ').indexOf(' ' + gmlist.split(',').length + ' ') == -1) {
sin.options[i].innerText+=' ' + gmlist.split(',').length;
}
//alert(3);
}
} else {
adone=false;
if (sin.options[i].innerText.split(String.fromCodePoint(10004)).length > 1) {
if (sin.options[i].innerText.split(String.fromCodePoint(10004))[1].trim() != '') {
adone=true;
}
}
//alert('adone=' + adone);
}
} else if (morethanone > 1) {
if (sin.options[i].innerText.indexOf(String.fromCodePoint(10004)) != -1) {
sin.options[i].innerText=sin.options[i].innerText.split(String.fromCodePoint(10004))[0];
//alert(2);
sin.options[i].style.backgroundColor='white';
//} else {
//alert(7);
}
} else if (invl.indexOf(sin.options[i].value) == 0) {
adone=false;
if (sin.options[i].innerText.split(String.fromCodePoint(10004)).length > 1) {
if (sin.options[i].innerText.split(String.fromCodePoint(10004))[1].trim() != '') {
adone=true;
}
}
//alert('5:' + morethanone + ':' + invl + ' adone=' + adone + ' gmlist=' + gmlist);
}
}
if (isvalid) {
invlo.style.backgroundColor='rgb(230,230,230)';
if ((invlo.innerText + ' ').indexOf(' ' + gmlist.split(',').length + ' ') == -1) {
invlo.innerText+=' ' + gmlist.split(',').length;
}
validcall=false;
if (morethanone == 1) {
//alert(8);
document.body.style.cursor='progress';
setTimeout(scoreit, 15000);
} else {
//alert(9);
scoreit();
}
} else {
//alert(0);
document.body.style.cursor='progress';
setTimeout(scoreit, 15000);
}
}
function ask() {
var cnt=0;
var theq=" ", cdelimq="";
var them=" ", cdelimm="";
var thea=" ", cdelima="";
var removeidea='';
if (window.localStorage && nols == '') {
if (('' + window.localStorage.getItem("dykquiz")).replace('undefined','').replace('null','') != '') {
removeidea=' and know a single x means you delete previous saved set of questions.';
}
}
overallq="";
overallm="";
overalla="";
while (theq != "" && them != "" && thea != "") {
if (qs.length > cnt) {
theq=prompt("Enter question(s) (delimited by |) for set " + eval(1 + cnt) + removeidea, qs[cnt]);
} else {
theq=prompt("Enter question(s) (delimited by |) for set " + eval(1 + cnt) + removeidea, "");
}
if (!theq) { theq=""; } else if (theq.toLowerCase() == 'x' && removeidea != '') { theq=''; window.localStorage.removeItem("dykquiz"); location.href=document.URL; }
removeidea='';
if (theq != '') {
if (os.length > cnt) {
them=prompt("Enter full list of choices using comma delimitation " + eval(1 + cnt), os[cnt]);
} else {
them=prompt("Enter full list of choices using comma delimitation " + eval(1 + cnt), "");
}
if (!them) { them=""; }
}
if (theq != '' && them != '') {
if (as.length > cnt) {
thea=prompt("Enter full list of correct answer (using padded comma delimitation where order does not matter) set(s) (delimited by |) " + eval(1 + cnt), as[cnt]);
} else {
thea=prompt("Enter full list of correct answer (using padded comma delimitation where order does not matter) set(s) (delimited by |) " + eval(1 + cnt), "");
}
if (!thea) { thea=""; }
}
if (theq != "" && them != "" && thea != "") {
overallq+=cdelimq + '"' + theq + '"';
overallm+=cdelimq + '"' + them + '"';
overalla+=cdelimq + '"' + thea + '"';
cdelimq=",";
cdelimm=",";
cdelima=",";
cnt++;
}
}
if (overallq != "" && overallm != "" && overalla != "") {
//alert(1);
if (window.localStorage) {
//alert(11);
if (('' + window.localStorage.getItem("dykquiz")).replace('undefined','').replace('null','') != '') {
window.localStorage.removeItem("dykquiz");
window.localStorage.setItem("dykquiz", encodeURIComponent(overallq + '^' + overallm + '^' + overalla));
} else {
window.localStorage.setItem("dykquiz", encodeURIComponent(overallq + '^' + overallm + '^' + overalla));
}
}
location.href=document.URL.split('#')[0].split('?')[0];
}
if (document.getElementById('sdyk')) {
document.getElementById('sdyk').value=prevs;
if (prevs == '') { twoemail=reseih(1); } else { twoemail=reseih(2); }
}
}
function emailwho() {
if (emailto.indexOf('@') == -1) {
if (!document.getElementById('sdyk')) {
emailto=prompt("Share your quiz questions with which email address? Optionally semicolon separate your email address ( which can be of the form J.Smith[jsmith@emailclient.com] ) which the recipient sees as the CC recipient.", "");
} else {
if (document.getElementById('sdyk').value == '') {
emailto=prompt("Share your quiz questions with which email address? Optionally semicolon separate your email address ( which can be of the form J.Smith[jsmith@emailclient.com] ) which the recipient sees as the CC recipient.", "");
}
}
if (!emailto) { emailto=''; }
if (emailto.indexOf('@') != -1) { document.getElementById('dividerfive').value='y'; document.getElementById('hscore').value='0'; document.getElementById('hgoes').value='0'; document.getElementById('hto').value=emailto; emailit(); }
} else {
document.getElementById('hto').value=emailto;
}
}
function emailit() {
var zhr = new XMLHttpRequest();
var zform=new FormData();
var fromx='youllneverfindthis';
var tox='youwillneverfindthis';
zform.append('inline', '');
if (emailto.indexOf(';') != -1) {
zform.append('to', emailto.split(';')[0]);
if (emailto.split(';')[1].indexOf('@') != -1) {
if (emailto.split(';')[1].indexOf('[') != -1 && emailto.split(';')[1].indexOf(']') != -1) {
zform.append('cc', emailto.split(';')[1].split(']')[0].split('[')[1]);
fromx=' Quiz<';
//tox=' Quiz sent by ' + emailto.split(';')[1].replace('[' + emailto.split(';')[1].split(']')[0].split('[')[1] + ']', '') + '<';
tox=' Quiz sent by <a target=_blank title=Email href="mailto:' + emailto.split(';')[1].split(']')[0].split('[')[1] + '?subject=Quiz">' + emailto.split(';')[1].replace('[' + emailto.split(';')[1].split(']')[0].split('[')[1] + ']', '') + '</a><';
} else {
zform.append('cc', emailto.split(';')[1]);
}
} else {
fromx=' Quiz<';
//tox=' Quiz sent by ' + emailto.split(';')[1] + '<';
tox=' Quiz sent by <a target=_blank title=Email href="mailto:' + emailto.split(';')[1] + '?subject=Quiz">' + emailto.split(';')[1] + '</a><';
}
} else {
zform.append('to', emailto);
}
zform.append('subj', 'Did You Know Quiz');
var fromc=document.getElementById('score').innerHTML;
var toc='Score: ' + document.getElementById('hscore').value + '/' + document.getElementById('hgoes').value;
if (dbih != '') {
zform.append('htmlis', '<body>' + dbih.replace('display:NONE','display:BLOCK').replace(/In\ order\ w/g,'W').replace(/In\ order\ /g,'').replace(/\,/g,', ').replace(fromc, toc).replace(fromx, tox).replace('📧',',') + '</body>');
} else {
zform.append('htmlis', '<body>' + document.body.innerHTML.replace('display:NONE','display:BLOCK').replace(/In\ order\ w/g,'W').replace(/In\ order\ /g,'').replace(/\,/g,', ').replace(fromc, toc).replace(fromx, tox).replace('📧',',') + '</body>');
}
zhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true);
zhr.send(zform);
return false;
}
function reseih(invc) {
if (('' + invc) == '1') {
document.getElementById('rese').innerHTML='📧';
} else if (('' + invc) == '2') {
document.getElementById('rese').innerHTML=',';
}
return invc;
}
</script>
</head>
<body onload="pickq();">
<form onsubmit='return emailit();' id=iform action=./one_or_several_quiz.html method=GET><input type=hidden name=dividerone value=''></input>
<h1 id=myh1>One or Several <div id=smode style=display:inline-block;><a title='Asks for your question and answer data for quiz' id=dmode style='cursor:pointer;text-decoration:underline;' onclick=ask();>"Did You Know"</a></div> Quiz</h1>
<h3>RJM Programming <a id=resa href=./one_or_several_quiz.html title=Restart>-</a> July<a id=rese style='cursor:pointer;text-decoration:none;font-size=8px;' onclick=' if (oneemail == twoemail) { emailwho(); }' title=Email>📧</a> 2021</h3>
<h4 id=score>Score: 0/0</h4>
<input type=hidden name=dividertwo value=''><input type=hidden name=to id=hto value=''></input><input type=hidden name=question id=hquestion value=''></input><input type=hidden name=score id=hscore value=0></input><input type=hidden name=goes id=hgoes value=0></input><input type=hidden name=dividerthree value=''></input><input type=hidden name=questions id=hquestions value=''></input><input type=hidden name=dividerfour value=''></input>
<table cellpadding=10 cellspacing=10 border=20 style='width:90%'>
<tr><th style='text-align:center;background-color:yellow;'>Question</th></tr>
<tr><td id=theq style='text-align:center;'></td></tr>
<tr><th style='background-color:orange;'>Answer</th></tr>
<tr><td style='text-align:center;'><select name=answer style='background-color:pink;text-align:center;' id=answer data-title='' title='' size=1 multiple><option id=maybenoway data-onclick='oneanswer(this);' value=''>Please select answer(s) below, as necessary, in order you click them ...</option></select></td></tr>
</table>
<input type=hidden name=dividerfive id=dividerfive value=''></input>
<br><input style="display:NONE;" type=submit id=bsubmit value='Am I Correct?'></input>
</form>
</body>
</html>