Lucas Kent e39465ad2f Changes to be committed:
new file:   Files/flashplayer_32_sa.exe
	new file:   favicon.ico
	new file:   globe.gif
	new file:   imgs/download.png
	new file:   imgs/zuck.jpg
	new file:   index.html
	new file:   other.ico
	new file:   script.js
	new file:   site.webmanifest
	new file:   sitemap.html
	new file:   styles/backround.css
	new file:   styles/border.css
	new file:   styles/fonts/Titillium_Web/OFL.txt
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Black.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Bold.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-BoldItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-ExtraLight.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-ExtraLightItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Italic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Light.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-LightItalic.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-Regular.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-SemiBold.ttf
	new file:   styles/fonts/Titillium_Web/TitilliumWeb-SemiBoldItalic.ttf
	new file:   styles/fonts/webfontkit-20221027-163353/generator_config.txt
	new file:   styles/fonts/webfontkit-20221027-163353/specimen_files/grid_12-825-55-15.css
	new file:   styles/fonts/webfontkit-20221027-163353/specimen_files/specimen_stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-163353/stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-demo.html
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff
	new file:   styles/fonts/webfontkit-20221027-163353/titilliumweb-extralight-webfont.woff2
	new file:   styles/fonts/webfontkit-20221027-165950/generator_config.txt
	new file:   styles/fonts/webfontkit-20221027-165950/specimen_files/grid_12-825-55-15.css
	new file:   styles/fonts/webfontkit-20221027-165950/specimen_files/specimen_stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-165950/stylesheet.css
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-demo.html
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff
	new file:   styles/fonts/webfontkit-20221027-165950/titilliumweb-bold-webfont.woff2
	new file:   styles/style.css
	new file:   tools/2048/.gitignore
	new file:   tools/2048/.jshintrc
	new file:   tools/2048/CONTRIBUTING.md
	new file:   tools/2048/LICENSE.txt
	new file:   tools/2048/README.md
	new file:   tools/2048/Rakefile
	new file:   tools/2048/favicon.ico
	new file:   tools/2048/index.html
	new file:   tools/2048/js/animframe_polyfill.js
	new file:   tools/2048/js/application.js
	new file:   tools/2048/js/bind_polyfill.js
	new file:   tools/2048/js/classlist_polyfill.js
	new file:   tools/2048/js/game_manager.js
	new file:   tools/2048/js/grid.js
	new file:   tools/2048/js/html_actuator.js
	new file:   tools/2048/js/keyboard_input_manager.js
	new file:   tools/2048/js/local_storage_manager.js
	new file:   tools/2048/js/tile.js
    new file:   tools/2048/meta/apple-touch-icon.png
	new file:   tools/webretro/cores/neocd_libretro.js
	new file:   tools/webretro/cores/neocd_libretro.wasm
	new file:   tools/webretro/cores/nestopia_libretro.js
	new file:   tools/webretro/cores/nestopia_libretro.wasm
	new file:   tools/webretro/cores/o2em_libretro.js
	new file:   tools/webretro/cores/o2em_libretro.wasm
	new file:   tools/webretro/cores/opera_libretro.js
	new file:   tools/webretro/cores/opera_libretro.wasm
2022-11-02 08:40:01 -04:00

12 lines
4.6 KiB
JavaScript

function meanuserMain(){this.version='0.91';w=480;h=380;var s="";s+='<div style="position:relative; width:'+w+'px; height:'+h+'px; border-radius: 10px; margin:auto; display:block; background-color: #ddeeff; ">';s+='<div id="title" style="font: bold 22px Arial; text-align: left; color: darkblue; ">';s+='</div>';s+='<div id="pic" style="position: absolute; right: 0; top: 0;">';s+='</div>';s+='<div id="userAnswer" style="margin: 20px 0 0 0; text-align: center;">';s+='</div>';s+='<div id="answer" style="color: blue; text-align: center;">';s+='</div>';s+='<div id="success" style="font: bold 40px Arial; text-align: center; color: gold; ">';s+='</div>';s+='<input id="playBtn" onclick="restart()" type="button" style="z-index:2; position:absolute; right:3px; bottom:3px;" value="Another" class="togglebtn" />';s+='<div id="copyrt" style="font: 7pt arial; font-weight: bold; color: #6600cc; position:absolute; left:5px; bottom:3px;">&copy; 2015 MathsIsFun.com v'+this.version+'</div>';s+='</div>';document.write(s);games=[];games.push(["Average age of a basketball team","Player","is","year","s old","18","32","basket-photo1.gif"]);games.push(["Average weight of a group of chimpanzees","Chimp","weighs","kg","","40","70","yinyan-chimp.gif"]);games.push(["Average time for rats to finish a maze","Rat","took","second","s","30","60","fatty-rat.gif"]);games.push(["Average temperature","Day","is","degree","s","-30","30","thermometer1.gif"]);gameNo=0;vals=[];init();go();}
function init(){gameNo=(++gameNo)%games.length;game=games[gameNo];var div=document.getElementById('title');div.innerHTML=game[0];div=document.getElementById('userAnswer');div.innerHTML=getQHTML();div=document.getElementById('pic');div.innerHTML='<img src="../numbers/images/'+game[7]+'" style="height: 150px;">';}
function getQHTML(){var s='';itemCount=3+(Math.random()*2)>>0;var min=game[5];var max=game[6];console.log("getQHTML",itemCount,min,max);vals=[];s+='<ul style="margin: 20px 0 30px 0; text-align: left; font: 16px Arial; line-height: 28px;">';for(var i=0;i<itemCount;i++){var val=+min+(Math.random()*(max-min))>>0;vals.push(val);var qStr=game[1]+' '+(i+1).toString()+' '+game[2]+' '+val+' '+game[3]+game[4];console.log("getQHTML",val,qStr);s+='<li>';s+=qStr;s+='</li>';}
s+='</ul>';s+='<div style="width:80px; display: inline-block; font: 22px Arial;">';s+='<div>';s+='Sum';s+='</div>';s+='<div style="border-top: 2px solid black;">';s+='Count';s+='</div>';s+='</div>';s+='<div style="display: inline-block; font: 26px Arial; vertical-align: top; margin: 12px 5px 0 5px;">';s+='&nbsp; = &nbsp;';s+='</div>';s+='<div style="width:'+(itemCount*60)+'px; display: inline-block;">';s+='<div>';console.log("vals",vals);for(i=0;i<itemCount;i++){if(i>0)s+=' + ';s+='<input type="text" id="val'+i+'" style="color: #0000ff; background-color: #eeffee; text-align:center; font: 20px Arial; width:35px; border-radius: 10px; " value="" onKeyUp="go()" />';}
s+='</div>';s+='<div style="border-top: 2px solid black; font: 20px Arial;">';s+=itemCount;s+='</div>';s+='</div>';return s;}
function getAHTML(OKQ){var s='';s+='<div style="font: 18px Arial; ">';s+='<div style="line-height: 14px;">';s+='&nbsp;';s+='</div>';s+='<div style="display: inline-block; font: 26px Arial; vertical-align: top; margin: 12px 5px 0 5px;">';s+='&nbsp; = &nbsp;';s+='</div>';s+='<div style="width:'+(itemCount*40)+'px; display: inline-block;">';s+='<div>';var sumUser=0;for(var i=0;i<itemCount;i++){if(i>0)s+=' + ';var valUser=document.getElementById('val'+i).value<<0;s+=valUser.toString();sumUser+=valUser;}
s+='</div>';s+='<div style="border-top: 2px solid black;">';s+=itemCount;s+='</div>';s+='</div>';s+='<div style="display: inline-block; font: 26px Arial; vertical-align: top; margin: 12px 5px 0 5px;">';s+='&nbsp; = &nbsp;';s+='</div>';s+='<div style="width:40px; display: inline-block;">';s+='<div>';s+=sumUser.toString();s+='</div>';s+='<div style="border-top: 2px solid black;">';s+=itemCount.toString();s+='</div>';s+='</div>';if(OKQ){var mean=(((sumUser/itemCount)*100)>>0)/100;s+='<div style="display: inline-block; font: 26px Arial; vertical-align: top; margin: 12px 5px 0 5px;">';s+='&nbsp; = &nbsp;';s+=mean.toString();s+='</div>';}
s+='</div>';return s;}
function go(){var failCount=0;for(var i=0,len=vals.length;i<len;i++){var val=vals[i];var valUser=document.getElementById('val'+i).value<<0;console.log("go",val,valUser);if(valUser==val){}else{failCount++;}}
if(failCount==0){document.getElementById('success').innerHTML='Well Done !';}else{document.getElementById('success').innerHTML='';}
document.getElementById('answer').innerHTML=getAHTML(failCount==0);}
function restart(){this.aCount=2;this.bCount=5;init();go();}