User:小躍/MathChallenge/MathChallenge.js:修订间差异
外观
< User:小躍 | MathChallenge
删除的内容 添加的内容
小 Fix |
小 Fix |
||
(未显示同一用户的25个中间版本) | |||
第3行: | 第3行: | ||
開發者:小躍 |
開發者:小躍 |
||
*/ |
*/ |
||
if (mw.config.get('wgAction') == 'view' && mw.config.get('wgPageName') =='User:小躍/MathChallenge'){ |
|||
if (wgAction == 'view' && wgPageName =='User:小躍/MathChallenge'){ |
|||
document.getElementById('MathPlayingScreen').innerHTML = '您已成功載入腳本。'+'<input id="wpMathPlayingSureUser" value="確認身分" title="開始確認您的身分" type="button"/>'; |
document.getElementById('MathPlayingScreen').innerHTML = '您已成功載入腳本。'+'<input id="wpMathPlayingSureUser" value="確認身分" title="開始確認您的身分" type="button"/>'; |
||
document.getElementById('MathPlayingScreen2').innerHTML ='咱們一起突破重重的關卡吧!'; |
document.getElementById('MathPlayingScreen2').innerHTML ='咱們一起突破重重的關卡吧!'; |
||
第17行: | 第16行: | ||
'您好,歡迎進入挑戰數學的遊戲畫面。<br/><img src="http:/upwiki/wikipedia/commons/8/85/MathChallengePlayingStart.png" /><br/>'; |
'您好,歡迎進入挑戰數學的遊戲畫面。<br/><img src="http:/upwiki/wikipedia/commons/8/85/MathChallengePlayingStart.png" /><br/>'; |
||
document.getElementById('MathPlayingScreen2').innerHTML =MathPlayingItems; |
document.getElementById('MathPlayingScreen2').innerHTML =MathPlayingItems; |
||
if (wgAction == 'view' && wgPageName =='User:小躍/MathChallenge'){ |
if (wgAction == 'view' && mw.config.get('wgPageName') =='User:小躍/MathChallenge'){ |
||
window.onbeforeunload = function(){ |
window.onbeforeunload = function(){ |
||
window.event.returnValue =''; |
window.event.returnValue =''; |
||
第37行: | 第36行: | ||
Determine_ctime=0; |
Determine_ctime=0; |
||
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout); |
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout); |
||
$('#wpMathPlayingDetermineL4').click(function(){ |
|||
Determine_q=0; |
|||
Determine_score=0; |
|||
Determine_ctime=0; |
|||
}).click(MathPlayingDetermineL4).click(MathPlayingDetermineTimeout); |
|||
$('#wpMathPlayingDetermineL5').click(function(){ |
|||
Determine_q=0; |
|||
Determine_score=0; |
|||
Determine_ctime=0; |
|||
}).click(MathPlayingDetermineL5).click(MathPlayingDetermineTimeout); |
|||
break; |
break; |
||
} |
} |
||
第55行: | 第64行: | ||
'<li><input id="wpMathPlayingDetermineL2" value="第二階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
'<li><input id="wpMathPlayingDetermineL2" value="第二階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
||
'<li><input id="wpMathPlayingDetermineL3" value="第三階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
'<li><input id="wpMathPlayingDetermineL3" value="第三階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
||
'<li><input id="wpMathPlayingDetermineL4" value="第四階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
|||
'<li><input id="wpMathPlayingDetermineL5" value="第五階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+ |
|||
'</ul>'; |
'</ul>'; |
||
function MathPlayingDetermineTimeout(){ |
function MathPlayingDetermineTimeout(){ |
||
第61行: | 第72行: | ||
Determine_T=setTimeout("MathPlayingDetermineTimeout()",10); |
Determine_T=setTimeout("MathPlayingDetermineTimeout()",10); |
||
}); |
}); |
||
} |
|||
function PlayAutoEditPage( tracePage,destinationPage,SetSection,edittext,editsummary) { |
|||
var api = new mw.Api(); |
|||
api.get( { |
|||
'action' : 'query', |
|||
'titles' : tracePage, |
|||
'prop' : 'revisions|info', |
|||
'intoken' : 'edit', |
|||
'rvprop' : 'content', |
|||
'indexpageids' : 1 |
|||
} ).done( function (result) { |
|||
result = result.query; |
|||
var page = result.pages[result.pageids[0]]; |
|||
var pagecontent= page.revisions[0]["*"].toString(); |
|||
var pagecontentL=pagecontent.length; |
|||
var pagecontent2=pagecontent.substring(0,(pagecontentL-3))+edittext+'\n|}'; |
|||
api.post( { |
|||
'action' : 'edit', |
|||
'title' : destinationPage, |
|||
'section':SetSection, |
|||
'text' :pagecontent2, |
|||
'summary' :editsummary, |
|||
'token' : page.edittoken |
|||
} ).done( function () { |
|||
} ); |
|||
} ); |
|||
} |
} |
||
function MathPlayingDetermineL1(event){ |
function MathPlayingDetermineL1(event){ |
||
第96行: | 第80行: | ||
case 10:{ |
case 10:{ |
||
clearTimeout(Determine_T); |
clearTimeout(Determine_T); |
||
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack" value="返回 |
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack" value="返回" type="button"/></center>'; |
||
$('#wpMathPlayingBack').click(MathPlayingItem); |
$('#wpMathPlayingBack').click(MathPlayingItem); |
||
$('#wpMathPlayingSave').click(MathPlayingSave); |
|||
break; |
break; |
||
} |
} |
||
第182行: | 第165行: | ||
(Determine1*Determine2==Determine3*Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
(Determine1*Determine2==Determine3*Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
||
}).click(MathPlayingDetermineL3); |
}).click(MathPlayingDetermineL3); |
||
break; |
|||
} |
|||
}//switch end |
|||
} |
|||
function MathPlayingDetermineL4(event){ |
|||
event.preventDefault(); |
|||
Determine_time=Math.floor(Determine_ctime *100)/100; |
|||
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score; |
|||
switch(Determine_q){ |
|||
case 10:{ |
|||
clearTimeout(Determine_T); |
|||
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack4" value="返回" type="button"/></center>'; |
|||
$('#wpMathPlayingBack4').click(MathPlayingItem); |
|||
break; |
|||
} |
|||
default:{ |
|||
++Determine_q; |
|||
Determine1=1+Math.floor(Math.random() *9); |
|||
Determine2=1+Math.floor(Math.random() *9); |
|||
Determine3=1+Math.floor(Math.random() *9); |
|||
Determine4=1+Math.floor(Math.random() *9); |
|||
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">log '+Determine1.toString()+'+ log '+Determine2.toString()+'<img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" /> log '+Determine3.toString()+'+log '+Determine4.toString()+'</font><br/>'+ |
|||
'<input id="wpMathPlayingDetermineBigger4" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller4" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual4" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>'; |
|||
$('#wpMathPlayingDetermineBigger4').click(function(){ |
|||
(Math.log10(Determine1)+Math.log10(Determine2)>Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL4); |
|||
$('#wpMathPlayingDetermineSmaller4').click(function(){ |
|||
(Math.log10(Determine1)+Math.log10(Determine2)<Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL4); |
|||
$('#wpMathPlayingDetermineEqual4').click(function(){ |
|||
(Math.log10(Determine1)+Math.log10(Determine2)==Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL4); |
|||
break; |
|||
} |
|||
}//switch end |
|||
} |
|||
function MathPlayingDetermineL5(event){ |
|||
event.preventDefault(); |
|||
Determine_time=Math.floor(Determine_ctime *100)/100; |
|||
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score; |
|||
switch(Determine_q){ |
|||
case 10:{ |
|||
clearTimeout(Determine_T); |
|||
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack5" value="返回" type="button"/></center>'; |
|||
$('#wpMathPlayingBack5').click(MathPlayingItem); |
|||
break; |
|||
} |
|||
default:{ |
|||
++Determine_q; |
|||
Determine1=2+Math.floor(Math.random() *9); |
|||
Determine2=2+Math.floor(Math.random() *9); |
|||
Determine3=2+Math.floor(Math.random() *9); |
|||
Determine4=2+Math.floor(Math.random() *9); |
|||
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">'+Determine1.toString()+'<sup>2</sup>+'+Determine2.toString()+'<sup>2</sup><img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" />'+Determine3.toString()+'<sup>2</sup>+'+Determine4.toString()+'<sup>2</sup></font><br/>'+ |
|||
'<input id="wpMathPlayingDetermineBigger5" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller5" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual5" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>'; |
|||
$('#wpMathPlayingDetermineBigger5').click(function(){ |
|||
(Math.pow(Determine1,2)+Math.pow(Determine2,2)>Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL5); |
|||
$('#wpMathPlayingDetermineSmaller5').click(function(){ |
|||
(Math.pow(Determine1,2)+Math.pow(Determine2,2)<Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL5); |
|||
$('#wpMathPlayingDetermineEqual5').click(function(){ |
|||
(Math.pow(Determine1,2)+Math.pow(Determine2,2)==Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0; |
|||
}).click(MathPlayingDetermineL5); |
|||
break; |
break; |
||
} |
} |
||
第205行: | 第254行: | ||
Determine_ctime=0; |
Determine_ctime=0; |
||
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout); |
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout); |
||
$('#wpMathPlayingDetermineL4').click(function(){ |
|||
Determine_q=0; |
|||
Determine_score=0; |
|||
Determine_ctime=0; |
|||
}).click(MathPlayingDetermineL4).click(MathPlayingDetermineTimeout); |
|||
$('#wpMathPlayingDetermineL5').click(function(){ |
|||
Determine_q=0; |
|||
Determine_score=0; |
|||
Determine_ctime=0; |
|||
}).click(MathPlayingDetermineL5).click(MathPlayingDetermineTimeout); |
|||
} |
} |
||
mw.loader.using(['jquery.ui.dialog', 'jquery.ui.progressbar'], function() { |
|||
function MathPlayingSave(event){ |
|||
event.preventDefault(); |
|||
PlayAutoEditPage( 'User:小躍/MathChallenge/Leaderboard','User:小躍/MathChallenge/Leaderboard',1,'{{User:小躍/MathChallenge/LeaderboardTemplate|username='+wpUserName+'|score='+Determine_score+'|time='+Determine_time+'}}','玩家點擊後自動儲存記錄') |
|||
} |
|||
}); |
2022年2月3日 (四) 05:45的最新版本
/*
版本:0.0.0 繁體中文版
開發者:小躍
*/
if (mw.config.get('wgAction') == 'view' && mw.config.get('wgPageName') =='User:小躍/MathChallenge'){
document.getElementById('MathPlayingScreen').innerHTML = '您已成功載入腳本。'+'<input id="wpMathPlayingSureUser" value="確認身分" title="開始確認您的身分" type="button"/>';
document.getElementById('MathPlayingScreen2').innerHTML ='咱們一起突破重重的關卡吧!';
$('#wpMathPlayingSureUser').click(MathPlayingSureUser);
}
function MathPlayingSureUser(event) {
event.preventDefault();
var confirm_a=confirm('您的身分是'+wgUserName+'嗎?');
switch(confirm_a){
case true:{
document.getElementById('MathPlayingScreen').innerHTML ='<img src="http:/upwiki/wikipedia/commons/4/42/Loading.gif" />'+wgUserName+
'您好,歡迎進入挑戰數學的遊戲畫面。<br/><img src="http:/upwiki/wikipedia/commons/8/85/MathChallengePlayingStart.png" /><br/>';
document.getElementById('MathPlayingScreen2').innerHTML =MathPlayingItems;
if (wgAction == 'view' && mw.config.get('wgPageName') =='User:小躍/MathChallenge'){
window.onbeforeunload = function(){
window.event.returnValue ='';
};
}
$('#wpMathPlayingDetermineL1').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL1).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL2').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL2).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL3').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL4').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL4).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL5').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL5).click(MathPlayingDetermineTimeout);
break;
}
case false:{
document.getElementById('MathPlayingScreen').innerHTML ='<img src="https:/upwiki/wikipedia/commons/c/ca/Crystal_error.png" />您已取消確認身分的程序。';
break;
}
}
}
var Determine_q;
var Determine_score;
var Determine_time;
var Determine_ctime;
var Determine_T;
var Determine1,Determine2,Determine3,Determine4;
var MathPlayingItems;
MathPlayingItems='選擇遊戲項目:<ul><li><input id="wpMathPlayingDetermineL1" value="第一階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+
'<li><input id="wpMathPlayingDetermineL2" value="第二階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+
'<li><input id="wpMathPlayingDetermineL3" value="第三階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+
'<li><input id="wpMathPlayingDetermineL4" value="第四階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+
'<li><input id="wpMathPlayingDetermineL5" value="第五階判斷" title="判斷大於、小於還是等於" type="button"/></li>'+
'</ul>';
function MathPlayingDetermineTimeout(){
$(document).ready(function() {
Determine_ctime=Determine_ctime+(0.01);
Determine_T=setTimeout("MathPlayingDetermineTimeout()",10);
});
}
function MathPlayingDetermineL1(event){
event.preventDefault();
Determine_time=Math.floor(Determine_ctime *100)/100;
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score;
switch(Determine_q){
case 10:{
clearTimeout(Determine_T);
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack" value="返回" type="button"/></center>';
$('#wpMathPlayingBack').click(MathPlayingItem);
break;
}
default:{
++Determine_q;
Determine1=Math.floor(Math.random() *10);
Determine2=Math.floor(Math.random() *10);
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">'+Determine1.toString()+'<img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" />'+Determine2.toString()+'</font><br/>'+
'<input id="wpMathPlayingDetermineBigger" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>';
$('#wpMathPlayingDetermineBigger').click(function(){
(Determine1>Determine2)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL1);
$('#wpMathPlayingDetermineSmaller').click(function(){
(Determine1<Determine2)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL1);
$('#wpMathPlayingDetermineEqual').click(function(){
(Determine1==Determine2)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL1);
break;
}
}//switch end
}
function MathPlayingDetermineL2(event){
event.preventDefault();
Determine_time=Math.floor(Determine_ctime *100)/100;
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score;
switch(Determine_q){
case 10:{
clearTimeout(Determine_T);
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack2" value="返回" type="button"/></center>';
$('#wpMathPlayingBack2').click(MathPlayingItem);
break;
}
default:{
++Determine_q;
Determine1=1+Math.floor(Math.random() *9);
Determine2=1+Math.floor(Math.random() *9);
Determine3=1+Math.floor(Math.random() *9);
Determine4=1+Math.floor(Math.random() *9);
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">'+Determine1.toString()+'+'+Determine2.toString()+'<img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" />'+Determine3.toString()+'+'+Determine4.toString()+'</font><br/>'+
'<input id="wpMathPlayingDetermineBigger2" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller2" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual2" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>';
$('#wpMathPlayingDetermineBigger2').click(function(){
(Determine1+Determine2>Determine3+Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL2);
$('#wpMathPlayingDetermineSmaller2').click(function(){
(Determine1+Determine2<Determine3+Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL2);
$('#wpMathPlayingDetermineEqual2').click(function(){
(Determine1+Determine2==Determine3+Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL2);
break;
}
}//switch end
}
function MathPlayingDetermineL3(event){
event.preventDefault();
Determine_time=Math.floor(Determine_ctime *100)/100;
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score;
switch(Determine_q){
case 10:{
clearTimeout(Determine_T);
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack3" value="返回" type="button"/></center>';
$('#wpMathPlayingBack3').click(MathPlayingItem);
break;
}
default:{
++Determine_q;
Determine1=1+Math.floor(Math.random() *9);
Determine2=1+Math.floor(Math.random() *9);
Determine3=1+Math.floor(Math.random() *9);
Determine4=1+Math.floor(Math.random() *9);
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">'+Determine1.toString()+'×'+Determine2.toString()+'<img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" />'+Determine3.toString()+'×'+Determine4.toString()+'</font><br/>'+
'<input id="wpMathPlayingDetermineBigger3" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller3" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual3" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>';
$('#wpMathPlayingDetermineBigger3').click(function(){
(Determine1*Determine2>Determine3*Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL3);
$('#wpMathPlayingDetermineSmaller3').click(function(){
(Determine1*Determine2<Determine3*Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL3);
$('#wpMathPlayingDetermineEqual3').click(function(){
(Determine1*Determine2==Determine3*Determine4)?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL3);
break;
}
}//switch end
}
function MathPlayingDetermineL4(event){
event.preventDefault();
Determine_time=Math.floor(Determine_ctime *100)/100;
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score;
switch(Determine_q){
case 10:{
clearTimeout(Determine_T);
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack4" value="返回" type="button"/></center>';
$('#wpMathPlayingBack4').click(MathPlayingItem);
break;
}
default:{
++Determine_q;
Determine1=1+Math.floor(Math.random() *9);
Determine2=1+Math.floor(Math.random() *9);
Determine3=1+Math.floor(Math.random() *9);
Determine4=1+Math.floor(Math.random() *9);
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">log '+Determine1.toString()+'+ log '+Determine2.toString()+'<img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" /> log '+Determine3.toString()+'+log '+Determine4.toString()+'</font><br/>'+
'<input id="wpMathPlayingDetermineBigger4" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller4" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual4" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>';
$('#wpMathPlayingDetermineBigger4').click(function(){
(Math.log10(Determine1)+Math.log10(Determine2)>Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL4);
$('#wpMathPlayingDetermineSmaller4').click(function(){
(Math.log10(Determine1)+Math.log10(Determine2)<Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL4);
$('#wpMathPlayingDetermineEqual4').click(function(){
(Math.log10(Determine1)+Math.log10(Determine2)==Math.log10(Determine3)+Math.log10(Determine4))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL4);
break;
}
}//switch end
}
function MathPlayingDetermineL5(event){
event.preventDefault();
Determine_time=Math.floor(Determine_ctime *100)/100;
document.getElementById('MathPlayingScreenShow').innerHTML ='使用時間:'+Determine_time+'秒,累計答對題數:'+Determine_score;
switch(Determine_q){
case 10:{
clearTimeout(Determine_T);
document.getElementById('MathPlayingScreen2').innerHTML ='<center><font size="45">題數已用完。</font><br/><input id="wpMathPlayingBack5" value="返回" type="button"/></center>';
$('#wpMathPlayingBack5').click(MathPlayingItem);
break;
}
default:{
++Determine_q;
Determine1=2+Math.floor(Math.random() *9);
Determine2=2+Math.floor(Math.random() *9);
Determine3=2+Math.floor(Math.random() *9);
Determine4=2+Math.floor(Math.random() *9);
document.getElementById('MathPlayingScreen2').innerHTML ='<center>第'+Determine_q+'題<br/><font size="45">'+Determine1.toString()+'<sup>2</sup>+'+Determine2.toString()+'<sup>2</sup><img src="http:/upwiki/wikipedia/commons/c/cd/Chess_l45.svg" />'+Determine3.toString()+'<sup>2</sup>+'+Determine4.toString()+'<sup>2</sup></font><br/>'+
'<input id="wpMathPlayingDetermineBigger5" value="大於" type="button"/><input id="wpMathPlayingDetermineSmaller5" value="小於" type="button"/><input id="wpMathPlayingDetermineEqual5" value="等於" type="button"/><br/><img src="http://3.bp.blogspot.com/_BxnVmGrZndM/THuqMI4dRaI/AAAAAAAABj0/iqjuTE10eE8/s1600/%C3%A5%E2%80%B9%E2%80%A2%C3%A7%E2%80%A2%C2%AB.gif" width="300"/></center>';
$('#wpMathPlayingDetermineBigger5').click(function(){
(Math.pow(Determine1,2)+Math.pow(Determine2,2)>Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL5);
$('#wpMathPlayingDetermineSmaller5').click(function(){
(Math.pow(Determine1,2)+Math.pow(Determine2,2)<Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL5);
$('#wpMathPlayingDetermineEqual5').click(function(){
(Math.pow(Determine1,2)+Math.pow(Determine2,2)==Math.pow(Determine3,2)+Math.pow(Determine4,2))?Determine_score=Determine_score+1:Determine_score=Determine_score+0;
}).click(MathPlayingDetermineL5);
break;
}
}//switch end
}
function MathPlayingItem(event){
event.preventDefault();
document.getElementById('MathPlayingScreen2').innerHTML =MathPlayingItems;
$('#wpMathPlayingDetermineL1').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL1).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL2').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL2).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL3').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL3).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL4').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL4).click(MathPlayingDetermineTimeout);
$('#wpMathPlayingDetermineL5').click(function(){
Determine_q=0;
Determine_score=0;
Determine_ctime=0;
}).click(MathPlayingDetermineL5).click(MathPlayingDetermineTimeout);
}