// dotdotdot.js // RJM Programming // March, 2016 // DotDotDot web application helper + Override prompt window function along with input type=button method of asking //Canvas HTML Element Suffix Ology Board Game Tutorial ... RJM Programming ... March 2016 ... thanks to http://stackoverflow.com/questions/9880279/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element //prompt("Enter first of your Suffix Ology parts (adjust accordingly)", "ology"); var nextexpected = "you'llneverfindthis"; var hint="Click on a button and then the next button that completes a true sentence part (or phrase or set of words), which adds a point to your score and waits for you to click again all the way through to just this Hint button remaining."; var bcnt = 0, ccnt = 0; var yourone = " "; var yourtwo = " "; var yourthree = " "; var ourd = ""; var nourd = -5000; var aclick = true; var mainview = "mainview"; var minorview = ""; var altview = "altview"; var shorttitle=document.title.split(" Tutorial")[0].split(" Game")[0] .split(" Board")[0].replace("Canvas HTML Element ",""); //"Suffix Ology"; var defs = ["ology", "is", "the study of "]; var hones=document.head.innerHTML.split('prom' + 'pt("'), prehones, posthones, jk=0; for (var ixy=1; ixy"); function bitlater() { document.getElementById('modesel').value = 'Button'; gameshowmode(document.getElementById('modesel').value); } function puth() { if (("" + elem.height).indexOf("700") == -1) { elem.height=700; if (document.head.innerHTML.indexOf('.createLine' + 'Gradient(') != -1) { ling(); } } } function ling() { var grdt=context.createLinearGradient(0, 0,elem.width, elem.height); // Create gradient grdt.addColorStop(0,"white"); grdt.addColorStop(1,colhuh); // Fill with gradient context.fillStyle = grdt; context.fillRect(0, 0, elem.width, elem.height); placetext(); } function addsome() { puth(); aclick=true; addxsome(); } function atstartsel() { prehones=document.URL.split('?'); hones=document.getElementsByTagName('a'); for (var iy=0; iy").split(""); if (sbits.length == 3) hones[0].innerHTML=sbits[0] + sbits[2]; hones[0].innerHTML=hones[0].innerHTML.replace(" Game", " Game"); //if (sbits.length == 3) alert(hones[0].innerHTML); if (document.URL.toLowerCase().indexOf('useoldprompt=') == -1) { nourd=Math.abs(nourd); // use this to differentiate the modes of prompt() meaning ... positive is jQuery, negative is Javascript prompt() hones[0].innerHTML=hones[0].innerHTML.replace("Dot", "Dot"); //if (sbits.length == 3) alert(hones[0].innerHTML); } else { hones[0].innerHTML=hones[0].innerHTML.replace("Dot ", "Dot "); hones[0].innerHTML=hones[0].innerHTML.replace("Dot"; divh+=""; } else { //divh+=""; divh+=""; } threepick = 1; sentencepick = -1; while (sofar.indexOf(";" + sentencepick + "," + threepick + ";") != -1) { threepick = 1; while (threepick == 1) { threepick = Math.floor((Math.random()*3)+0); } sentencepick = Math.floor((Math.random()*(sentenceparts.length / 3))+0); } sofar+=sentencepick + "," + threepick + ";"; bcnt++; if (threepick == 0) { //divh+=""; divh+=""; } else { //divh+=""; divh+=""; } } ccnt=bcnt; bcnt=0; var bsuffix=""; if (eval(sentenceparts.length) < 582) { for (var ib=1; ib" + was + ""; ourccnt++; ourccnt++; } } else if (ourone == '') { ourone=pinputval; } else { ourtwo=pinputval; } //alert(0); } function ourgameshowmode(tval) { if (tval == '') { location.href=document.URL; //'./ology_chalkboard.html'; } else { //document.getElementById('mainview').style.display='none'; var ip=document.getElementById(mainview).innerHTML.indexOf('
' + "
"; } function addxsome() { //alert('OnE=@' + one + '@ and ourd=@' + ourd + '@ and yourone=@' + yourone + '@ and ourone=@' + ourone + '@'); addzsome(); } function addzsome() { var two=" ", three=" ", one=" "; //if (aclick) { // aclick=false; //alert(6700); // one=prompt("Enter first of your " + shorttitle + " parts (adjust accordingly)", defs[0]); //"ology"); //if (eval(nourd) < 0) { // yourone=one; //} //} else if (yourone == "" && ourd != "") { one=prompt("Enter first of your " + shorttitle + " parts (adjust accordingly)", ourd); //ourd=''; //alert(12); //ourone=one; if (eval(nourd) > 0) { //alert(67); setTimeout(addxsome,nourd); return; } else { //alert(56); yourone=one; //alert(yourone); //alert('One=@' + one + '@ and ourd=@' + ourd + '@ and yourone=@' + yourone + '@ and ourone=@' + ourone + '@'); } } else if (yourone != " ") { one=yourone; } else { preinput=" "; within=false; if (ourd != "") { //alert(670); one=prompt("Enter first of your " + shorttitle + " parts (adjust accordingly)", ourd); } else if (aclick) { aclick=false; //alert(6700); one=prompt("Enter first of your " + shorttitle + " parts (adjust accordingly)", defs[0]); //"ology"); if (eval(nourd) < 0) { yourone=one; } } else { return; } //ourd=''; //alert('*' + ourone + ')'); ourone=one; if (eval(nourd) > 0) return; } if (one != " ") { //alert(nourd + ' one=@' + one + '@ and ourd=@' + ourd + '@ and yourone=@' + yourone + '@ and ourone=@' + ourone + '@'); //alert(97); if (yourtwo == "" && ourd != "") { two=prompt("Enter second of your " + shorttitle + " parts (adjust accordingly) that started with " + one, ourd); //ourd=''; //alert(120); //ourtwo=two; if (eval(nourd) > 0) { setTimeout(addxsome,nourd); return; } else { yourtwo=two; } } else if (yourtwo != " ") { two=yourtwo; //alert('two=' + two + ' ourd=' + ourd); } else { //alert('TWO=' + two + ' ourd=' + ourd); preinput=" "; within=false; if (ourd != "") { two=prompt("Enter second of your " + shorttitle + " parts (adjust accordingly) that started with " + one, ourd); } else { two=prompt("Enter second of your " + shorttitle + " parts (adjust accordingly) that started with " + one, defs[1]); //"is"); if (eval(nourd) < 0) { yourtwo=two; } } //ourd=''; ourtwo=two; //alert('Two=' + two + ' ourd=' + ourd); if (eval(nourd) > 0) return; } if (two != " ") { //alert('two=@' + two + '@ and ourd=@' + ourd + '@ and yourtwo=@' + yourtwo + '@ and ourtwo=@' + ourtwo + '@'); if (yourthree == "" && ourd != "") { three=prompt("Enter third of your " + shorttitle + " parts (adjust accordingly) that started with " + one + " " + two, ourd); //ourd=''; //alert(1200); //ourthree=three; if (eval(nourd) > 0) { setTimeout(addxsome,nourd); return; } else { yourthree=three; } } else if (yourthree != " ") { three=yourthree; } else { preinput=" "; within=false; if (ourd != "") { three=prompt("Enter third of your " + shorttitle + " parts (adjust accordingly) that started with " + one + " " + two, ourd); } else { three=prompt("Enter third of your " + shorttitle + " parts (adjust accordingly) that started with " + one + " " + two, defs[2]); //"the study of "); if (eval(nourd) < 0) { yourthree=three; } } //ourd=''; ourthree=three; if (eval(nourd) > 0) return; } if (three != " ") { //alert('*' + ourthree + '*'); //alert(ourtwo); //alert(ourone); sentenceparts[sentenceparts.length] = yourone; sentenceparts[sentenceparts.length] = yourtwo; sentenceparts[sentenceparts.length] = yourthree; if (document.getElementById('modesel').value != '') { var was=document.getElementById('altview').innerHTML; document.getElementById('altview').innerHTML="" + was + ""; ccnt++; ccnt++; } else { onloading(); } ourone=" "; ourtwo=" "; ourthree=" "; if (ourd == '') { yourone=" "; yourtwo=" "; yourthree=" "; window.scrollTo(0,0); //return; // new idea } else { ourd=''; //yourone=" "; //yourtwo=" "; //yourthree=" "; //alert(12000); window.scrollTo(0,0); return; } } } } } function dohuh(ob) { if (eval(bcnt % 2) == 0) { nextexpected = ob.alt.replace(ob.value, ''); //alert(' next expected is ' + nextexpected); document.getElementById(ob.id).style.display='none'; hint=ob.alt; bcnt++; //if (nextexpected.indexOf("ology ") != -1 && nextexpected.indexOf(" is ") != -1) { //if (nextexpected.indexOf(defs[0] + " ") != -1 && nextexpected.indexOf(" " + defs[2] + " ") != -1) { if (ob.style.backgroundColor != 'yellow') { document.title="? " + ob.value; } else { document.title=ob.value + " ?"; } //alert(document.title); } else if (ob.value == nextexpected) { bcnt++; document.getElementById(ob.id).style.display='none'; score++; goes++; updatescore(); document.getElementById('myadot').href='http://www.thefreedictionary.com/' + ob.alt.replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+').replace(' ','+'); } else { goes++; updatescore(); } } $(document).ready(function() { $("#myeg").dialog({ autoOpen: false, modal: true, position: [0,0], draggable: true, show: "blind", hide: "explode", height: "auto", width: "auto", resizable: true, overlay: { opacity: 0.9, background: "black" }, buttons: { "Will Append More in 30": function(event, ui) { unfixpar30(); $(this).dialog('close'); }, "Will Append More in 5": function(event, ui) { unfixpar5(); $(this).dialog('close'); }, "Cancel": function(event, ui) { unfixpar(); $(this).dialog('close'); }, "OK": function(event, ui) { fixpar(); $(this).dialog('close'); } } }); $('#abutton').click(function(event) { fixthings(); event.preventDefault(); $('#myeg').dialog('open'); return false; }); }); setTimeout(atstartsel, 1000);