Skip to content

Commit

Permalink
ふがー
Browse files Browse the repository at this point in the history
  • Loading branch information
YumizSui committed Jun 26, 2020
1 parent cba6ed2 commit da67604
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 26 deletions.
4 changes: 4 additions & 0 deletions counter/counter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#red_button {
color: rgb(255, 255, 0);
background: #ff0000;
}
17 changes: 17 additions & 0 deletions counter/counter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="./counter.css">
<script src="./counter.js"></script>
<title>押してはいけないボタン</title>
</head>
<body>
<h1>押してはいけないボタン</h1>
<div id="count">回数: 0</div>
<button onclick="countUp()">普通のボタン</button>
<button onclick="dontClick()" id="red_button">赤いボタン</button>
<button onclick="reset()">reset</button>
<div><a href="../index.html"> 戻るhomeに </a></div>
</body>
</html>
20 changes: 20 additions & 0 deletions counter/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let count = 0
let n = 0;
const countUp = () => {
count++
const countElement = document.querySelector('#count')
countElement.innerText = '回数: ' + count
}

const reset = () => {
count = 0
const countElement = document.querySelector('#count')
countElement.innerText = '回数: ' + count
}

const dontClick = () => {
while (n < 100) {
n++;
alert('押すなって言ったのに…(100回押せば抜けられます)');
}
}
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ <h2>はい</h2>
<li>YumizSui</li>
<a href="https://twitter.com/YumizSui">湯水🐧水</a>
<li>これは自己紹介です.</li>
<a href="work/counter.html"> 押してはいけないボタン </a>
<h2>つくられたも</h2>
<li><a href="counter/counter.html"> 押してはいけないボタン </a></li>
<li><a href="stopwatch/stopwatch.html"> 33.4challenge </a></li>
</div>
</body>
</html>
16 changes: 16 additions & 0 deletions stopwatch/stopwatch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<script src="./stopwatch.js"></script>
<title>33.4challenge</title>
</head>
<body>
<h1>33.4challenge</h1>
<div id="watch">33.4してください!</div>
<button onclick="watchStart() " id="start">Start</button>
<button onclick="watchStop()" id="stop">Stop</button>
<button onclick="watchReset()" id="reset">Reset</button>
<div><a href="../index.html"> 戻るhomeに </a></div>
</body>
</html>
44 changes: 44 additions & 0 deletions stopwatch/stopwatch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
var is_count = false;
var result;
var over_minute = 0;
var minute= 0;
var second = 0;
var milisecond = 0;
var elapsed_time =0;
const watchStart = () => {
if (!is_count) {
is_count = true;
start_time = new Date();
setInterval(countTime, 1)
const countElement = document.querySelector('#watch')
countElement.innerText ='計測中…'
}
}

const watchStop = () => {
const countElement = document.querySelector('#watch')
if (over_minute >= 1)
countElement.innerText = ':ha:'
else if (second < 33)
countElement.innerText = '記録:' + result + ' :zako:'
else if(second <= 33&&milisecond == 4)
countElement.innerText = '記録:' + result + ' :tuyoi:'
else if(second <= 33)
countElement.innerText = '記録:' + result + ' :sad_parrot:'
else if(second >= 33)
countElement.innerText = '記録:' + result + ' :zekkizekki:'
}
const watchReset = () => {
const countElement = document.querySelector('#watch')
countElement.innerText ='33.4してください!'
}

function countTime() {
now_time = new Date();
elapsed_time = now_time.getTime() - start_time.getTime();
over_minute = (elapsed_time / 1000/60);
second = Math.floor(elapsed_time / 1000) % 60;
milisecond = Math.floor((elapsed_time % 1000)/100);
result = second + "." + milisecond;
is_count = false;
}
13 changes: 0 additions & 13 deletions work/counter.html

This file was deleted.

12 changes: 0 additions & 12 deletions work/counter.js

This file was deleted.

0 comments on commit da67604

Please sign in to comment.