Skip to content

Instantly share code, notes, and snippets.

@imaz
Created July 20, 2011 02:11
Show Gist options
  • Save imaz/1094192 to your computer and use it in GitHub Desktop.
Save imaz/1094192 to your computer and use it in GitHub Desktop.
pomotimer作ってみた
body {
background-color:#ccffdd;
color:#000000;
}
<html>
<head>
<meta http-equiv="Content-Type: text/html" charset="Shift_JIS">
<title>pomodoro timer</title>
<link type="text/css" rel="stylesheet" href="./pomodoro.css"></script>
<script type="text/javascript" src="./pomodoro.js"></script>
<script language="JavaScript">
<!---->
</script>
</head>
<body>
<span id="pomodoroStatus">停止中</span><br />
<input type="button" value="StartTimer" onClick="startTimer()"><br /><br />
(<span id="counter">0</span>+)&nbsp;<span id="resultCount">0</span><span id="message">ポモ</span>
<input type="button" value="PlusCount" onClick="plusCount()"><br /><br />
<input type="button" value="MinusCount" onClick="minusCount()"><br /><br />
</body>
</html>
function showText(id,str){
document.getElementById(id).innerHTML = str;
}
function getText(id){
return(window.document.getElementById(id).innerHTML);
}
function textColoring(str,color);
var retText = "\<font style=\"color:"+color+"\"\>"+str+"\</font\>";
return(retText);
}
function startTimer(){
setTimeout("pomodoro()",1000*60*25);
showText("pomodoroStatus",textColoring("ポモ","red")+"なう");
}
function pomodoro(){
var cnt = getText("resultCount");
cnt++;
showText("resultCount",cnt);
showText("message","ポモ完遂しました!");
showText("pomodoroStatus","停止中");
window.alert('25分経過しました。');
}
function plusCount(){
var cnt = getText("counter");
cnt++;
showText("counter",cnt);
}
function minusCount(){
var cnt = getText("counter");
cnt--;
showText("counter",cnt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment