7d6
< 'use strict';
11a11
> var staro=[];
13a14
> var hone=null;
17,178d17
< var starone=null, brickone=null, superbugone=null, hone=null;
<
< // Arrays of objects (either DOM or DOM accompanied by Class) below
< var staro=[], bricko=[], superbugo=[];
< var starfireo=[];
<
< // Class code below does not work everywhere
< var Star=null, Brick=null, Superbug=null;
< var Starfire=null;
<
< try {
< eval(" "
< + "Star = class Star {"
< + " constructor(id, domo) {"
< + " this.id = id;"
< + " this.domo = domo;"
< + " }"
< + ""
< + " style_border(onsb) {"
< + " this.domo.style.border=onsb;"
< + " }"
< + "}; "
< );
< } catch(estar) {
< }
<
< try {
< eval(" "
< + "Brick = class Brick {"
< + " constructor(id, domo) {"
< + " this.id = id;"
< + " this.domo = domo;"
< + " this.opacity = 1.0;"
< + " }"
< + ""
< + " getid() {"
< + " return this.id;"
< + " }"
< + ""
< + " getopacity() {"
< + " return this.opacity;"
< + " }"
< + ""
< + " setopacity(thisop) {"
< + " this.opacity=thisop;"
< + " this.domo.style.opacity=thisop;"
< + " this.domo.style.border=eval(10 - eval(thisop * 10)) + 'px solid red';"
< + " }"
< + ""
< + " style_width(sw) {"
< + " if (sw == '1px') { if (brickone) { bricko[eval(-1 + eval(brickone.getid().replace('b','')))].style_width('01px'); } brickone=this; setTimeout(fadeout,1000); } else { this.domo.style.border=''; this.domo.style.width=sw; }"
< + " }"
< + "}; "
< );
< } catch(ebrick) {
< }
<
< try {
< eval(" "
< + "Superbug = class Superbug {"
< + " constructor(id, domo) {"
< + " this.id = id;"
< + " this.domo = domo;"
< + " this.opacity = 1.0;"
< + " }"
< + ""
< + " getid() {"
< + " return this.id;"
< + " }"
< + ""
< + " getopacity() {"
< + " return this.opacity;"
< + " }"
< + ""
< + " setopacity(thisop) {"
< + " this.opacity=thisop;"
< + " this.domo.style.opacity=thisop;"
< + " this.domo.style.border=eval(10 - eval(thisop * 10)) + 'px solid red;';"
< + " }"
< + ""
< + " style_width(sw) {"
< + " if (sw == '1px') { if (superbugone) { superbugo[eval(-1 + eval(superbugone.getid().replace('sb','')))].style_width('01px'); } superbugone=this; setTimeout(fadeout,1000); } else { this.domo.style.border=''; this.domo.style.width=sw; }"
< + " }"
< + "}; "
< );
< } catch(esuperbug) {
< }
<
< try {
< eval(" "
< + "Starfire = class Starfire {"
< + " constructor(id, domo) {"
< + " this.id = id;"
< + " this.domo = domo;"
< + " }"
< + ""
< + " style_display(sd) {"
< + " this.domo.style.display=sd;"
< + " }"
< + "}; "
< );
< } catch(estarfire) {
< }
<
< function createStars(numtodo) {
< var isiPad = navigator.userAgent.match(/iPad/i) != null;
< var isiPhone = navigator.userAgent.match(/iPhone/i) != null;
< //if ((isiPad || isiPhone) && document.URL.indexOf('.html') == -1 && document.URL.indexOf('.htm') != -1) location.href=document.URL.replace('.htm','.html');
< var i, sih='';
< var starlist=["onestar.jpg","twostar.jpg","threestar.jpg","fourstar.jpg","fivestar.jpg","sixstar.jpg","sevenstar.jpg"];
< if (numtodo == 0) {
< numStars=numtodo;
< document.getElementById('stars').innerHTML='';
< } else if (numtodo > 0) {
< numStars=numtodo;
< document.getElementById('stars').innerHTML='';
< }
< if (Brick) document.getElementById('myh4').innerHTML+=' ... Please note that Sound Effects could occur with this game.';
< for (i=1; i<=numStars; i++) {
< if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
< sih+="] + ")
";
< } else {
< sih+="] + ")
";
< if (Math.floor(Math.random() * 2) == 0) sih+='
';
< }
< }
< document.getElementById('stars').innerHTML=sih;
< for (i=1; i<=numStars; i++) {
< if (!Star) {
< staro.push(document.getElementById('s' + i));
< } else {
< staro.push(new Star('s' + i, document.getElementById('s' + i)));
< starfireo.push(new Starfire('h' + i, document.getElementById('h' + i)));
< }
< }
< }
<
< function createBricks(numtodo) {
< var i, bih='';
< if (numtodo == 0) {
< numBricks=numtodo;
< document.getElementById('bricks').innerHTML='';
< } else if (numtodo > 0) {
< numBricks=numtodo;
< document.getElementById('bricks').innerHTML='';
< }
< for (i=1; i<=numBricks; i++) {
< bih+="
";
< if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
< if (eval(i % 3) == 0) bih+=" ";
< } else {
< if (eval(i % 2) == 0) bih+=" ";
< }
< }
< document.getElementById('bricks').innerHTML=bih;
< for (i=1; i<=numBricks; i++) {
< if (Brick) {
< bricko.push(new Brick('b' + i, document.getElementById('b' + i)));
< }
< }
< }
<
195a35
> //alert('' + sih.replace(/
/g,'').replace(/\/img>/g, '/img>').replace(/![]()
') + '
');
197,199c37,39
< document.getElementById('superbugs').style.width='35%';
< document.getElementById('bricks').style.width='45%'; //'50%';
< document.getElementById('superbugs').innerHTML=sih;
---
> document.getElementById('superbugs').style.width='35%';
> document.getElementById('bricks').style.width='45%'; //'50%';
> document.getElementById('superbugs').innerHTML=sih;
201,203c41,43
< document.getElementById('superbugs').style.width='35%';
< document.getElementById('bricks').style.width='35%';
< document.getElementById('superbugs').innerHTML=sih;
---
> document.getElementById('superbugs').style.width='35%';
> document.getElementById('bricks').style.width='35%';
> document.getElementById('superbugs').innerHTML=sih;
205,210c45
< document.getElementById('superbugs').innerHTML='' + sih.replace(/
/g,'').replace(/\/img>/g, '/img>').replace(/![]()
![]()
';
< }
< for (i=1; i<=numSuperbugs; i++) {
< if (Superbug) {
< superbugo.push(new Superbug('sb' + i, document.getElementById('sb' + i)));
< }
---
> document.getElementById('superbugs').innerHTML='' + sih.replace(/
/g,'').replace(/\/img>/g, '/img>').replace(/![]()
![]()
';
214,226c49,57
< function fadeout() { // can only happen if Class functionality works on this web browser
< var opis=1.0, newopis;
< if (brickone) {
< opis=bricko[eval(-1 + eval(brickone.getid().replace('b','')))].getopacity();
< newopis=eval(-0.1 + opis);
< bricko[eval(-1 + eval(brickone.getid().replace('b','')))].setopacity(newopis);
< if (eval(newopis) <= 0.0) {
< bricko[eval(-1 + eval(brickone.getid().replace('b','')))].style_width('01px');
< brickone=null;
< } else {
< var snd=new Audio('http://www.rjmprogramming.com.au/Games/Battleshipsandcruisers/sounds/Wind-SoundBible.com-950807958.wav');
< snd.play();
< }
---
> function createStars(numtodo) {
> var i, sih='';
> var starlist=["onestar.jpg","twostar.jpg","threestar.jpg","fourstar.jpg","fivestar.jpg","sixstar.jpg","sevenstar.jpg"];
> if (numtodo == 0) {
> numStars=numtodo;
> document.getElementById('stars').innerHTML='';
> } else if (numtodo > 0) {
> numStars=numtodo;
> document.getElementById('stars').innerHTML='';
228,238c59,70
< if (superbugone) {
< opis=superbugo[eval(-1 + eval(superbugone.getid().replace('sb','')))].getopacity();
< newopis=eval(-0.1 + opis);
< superbugo[eval(-1 + eval(superbugone.getid().replace('sb','')))].setopacity(newopis);
< if (eval(newopis) <= 0.0) {
< superbugo[eval(-1 + eval(superbugone.getid().replace('sb','')))].style_width('01px');
< superbugone=null;
< } else {
< var snd=new Audio('http://www.rjmprogramming.com.au/Games/Battleshipsandcruisers/sounds/Thunder-Mike_Koenig-315681025.wav');
< snd.play();
< }
---
> for (i=1; i<=numStars; i++) {
> if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
> sih+="] + ")
";
> } else {
> sih+="] + ")
";
> if (Math.floor(Math.random() * 2) == 0) sih+='
';
> }
> }
> //alert('sih=' + sih);
> document.getElementById('stars').innerHTML=sih;
> for (i=1; i<=numStars; i++) {
> staro.push(document.getElementById('s' + i));
240d71
< if (brickone || superbugone) setTimeout(fadeout, 1000);
243a75
> //document.title=pubu
251c83
< pubu='./star_proteins_vs_superbugs.htm?numbricks=' + xnb;
---
> pubu='./star_proteins_vs_superbugs.html?numbricks=' + xnb;
253c85
< pubu='./star_proteins_vs_superbugs.htm';
---
> pubu='./star_proteins_vs_superbugs.html';
254a87
> //alert(pubu);
262,266c95
< if (Brick) {
< bricko[eval(-1 + nextBrickToGo)].style_width('1px');
< } else {
< document.getElementById('b' + nextBrickToGo).style.width='1px';
< }
---
> document.getElementById('b' + nextBrickToGo).style.width='1px';
268,280c97
< if (Superbug) {
< superbugo[eval(-1 + nextBrickToGo - numBricks)].style_width('1px');
< } else {
< document.getElementById('sb' + eval(nextBrickToGo - numBricks)).style.width='1px';
< }
< }
< if (Starfire) {
< //alert(tone);
< hone=starfireo[eval(tone)];
< hone.style_display('block');
< } else {
< hone=document.getElementById('h' + eval(1 + tone));
< hone.style.display='block';
---
> document.getElementById('sb' + eval(nextBrickToGo - numBricks)).style.width='1px';
281a99,100
> hone=document.getElementById('h' + eval(1 + tone));
> hone.style.display='block';
285c104,112
< ask('Congratulations! That took you ' + seconds + ' seconds (ie. ' + eval((0.0 + seconds) / eval(eval(numBricks) + eval(numSuperbugs))) + ' seconds per brick and superbug). Another game with number of bricks in wall, below?');
---
> //var nb=prompt('Congratulations! That took you ' + seconds + ' seconds (ie. ' + eval((0.0 + seconds) / numBricks) + ' seconds per brick). Another game with number of bricks in wall, below?',numBricks);
> ask('Congratulations! That took you ' + seconds + ' seconds (ie. ' + eval((0.0 + seconds) / numBricks) + ' seconds per brick). Another game with number of bricks in wall, below?');
> //if (nb) {
> // if (nb != '') {
> // location.href='./star_proteins_vs_superbugs.html?numbricks=' + nb;
> // } else {
> // location.href='./star_proteins_vs_superbugs.html';
> // }
> //}
289a117,137
> function createBricks(numtodo) {
> var i, bih='';
> if (numtodo == 0) {
> numBricks=numtodo;
> document.getElementById('bricks').innerHTML='';
> } else if (numtodo > 0) {
> numBricks=numtodo;
> document.getElementById('bricks').innerHTML='';
> }
> for (i=1; i<=numBricks; i++) {
> bih+="
";
> if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
> if (eval(i % 3) == 0) bih+=" ";
> } else {
> if (eval(i % 2) == 0) bih+=" ";
> }
> }
> //alert('bih=' + bih);
> document.getElementById('bricks').innerHTML=bih;
> }
>
292,296c140
< if (Starfire) {
< hone.style_display('none');
< } else {
< hone.style.display='none';
< }
---
> hone.style.display='none';
304,308c148
< if (!Star) {
< staro[i].style.border='';
< } else {
< staro[i].style_border('');
< }
---
> staro[i].style.border='';
311a152,153
> //hone.style.display='none';
> //hone=null;
314,318c156
< if (!Star) {
< staro[thisone].style.border='15px solid yellow';
< } else {
< staro[thisone].style_border('15px solid yellow');
< }
---
> staro[thisone].style.border='15px solid yellow';
320c158
< setTimeout(startBorderizing, 800);
---
> setTimeout(startBorderizing, 800);
322c160
< setTimeout(startBorderizing, 1200);
---
> setTimeout(startBorderizing, 1500);
338c176
< As Star Proteins Go Yellow Click to Break Down Wall and Superbug Protection
---
> As Star Proteins Go Yellow Click to Break Down Wall and Superbug Protection