gitpush
This commit is contained in:
parent
f406f63713
commit
254742a794
171
sensehat.html
Normal file
171
sensehat.html
Normal file
@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="data:" type="image/x-icon">
|
||||
<title>Sense Hat</title>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#matrix {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
width: 94px;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.led {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid gray;
|
||||
background-color: whitesmoke;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.led.on {
|
||||
background-color: blue;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 94px;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="matrix">
|
||||
<div class="row">
|
||||
<div class="led" data-y="0" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="0" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="1" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="1" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="2" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="2" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="3" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="3" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="4" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="4" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="5" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="5" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="6" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="6" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="led" data-y="7" data-x="0" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="1" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="2" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="3" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="4" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="5" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="6" onclick="turnon(this)"></div>
|
||||
<div class="led" data-y="7" data-x="7" onclick="turnon(this)"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button onclick="client.emit('action', {action:'clear'})">clear all</button>
|
||||
<br>
|
||||
<button onclick="client.emit('action', {action:'hello'})">hello</button>
|
||||
<br>
|
||||
<button onclick="client.emit('action', {action:'flash'})">flash</button>
|
||||
<br>
|
||||
<button onclick="client.emit('action', {action:'temp'})">temp</button>
|
||||
<div id="rpis"></div>
|
||||
|
||||
<script src="http://pi/sensehat/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
const client = io.connect('ws://pi', { path: '/sensehat/socket.io', })
|
||||
client.on("message", (message) => console.log(message))
|
||||
// function turnon(led) {
|
||||
// const { x, y } = led.dataset
|
||||
// const action = led.classList.toggle('on') ? 'on' : 'off'
|
||||
// client.emit('action', { action, x, y })
|
||||
// }
|
||||
// client.on('leds', (array) => {
|
||||
// const leds = document.querySelectorAll('.led')
|
||||
// for (let y = 0; y < 8; y++) {
|
||||
// for (let x = 0; x < 8; x++) {
|
||||
// const n = y * 8 + x
|
||||
// if (array[y][x] == 1) leds[n].classList.add('on')
|
||||
// else leds[n].classList.remove('on')
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// client.on('data', (data) => {
|
||||
// rpis.innerHTML = ''
|
||||
// data.forEach(rpi => {
|
||||
// const p = document.createElement('p')
|
||||
// p.innerHTML = `hostname: ${rpi.hostname}<br>cpu load: ${rpi.cpu.load}<br>cpu temperature: ${rpi.cpu.temperature}<br>memory total: ${rpi.memory.total}<br>memory available: ${rpi.memory.available}`
|
||||
// rpis.appendChild(p)
|
||||
// })
|
||||
// })
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
10
课程表.html
10
课程表.html
@ -107,7 +107,7 @@
|
||||
</section>
|
||||
<section class="课程表">
|
||||
<header>
|
||||
<span class="date">今天是周<span id="weekday2"></span>。</span>
|
||||
<span class="date">明天是周<span id="weekday2"></span>。</span>
|
||||
<img src="images/little_cat.png" height="80px">
|
||||
</header>
|
||||
<table>
|
||||
@ -183,13 +183,13 @@
|
||||
</section>
|
||||
<script>
|
||||
const now = new Date()
|
||||
const weekday = now.getDay()
|
||||
const day = "日一二三四五六"[weekday]
|
||||
const tomorrow = now.getDay() + 1
|
||||
const day = "日一二三四五六"[tomorrow]
|
||||
const date = `${now.getFullYear()}年${now.getMonth() + 1}月${now.getDate()}日`
|
||||
document.getElementById("weekday1").innerText = date
|
||||
document.getElementById("weekday2").innerText = day
|
||||
if (weekday > 0 && weekday < 6)
|
||||
document.querySelectorAll(`tr td:nth-child(${weekday + 1})`).forEach(cell => {
|
||||
if (tomorrow > 0 && tomorrow < 6)
|
||||
document.querySelectorAll(`tr td:nth-child(${tomorrow + 1})`).forEach(cell => {
|
||||
cell.style.color = "#ff7"
|
||||
cell.style.background = "#66d"
|
||||
cell.style.fontWeight = 900
|
||||
|
Loading…
Reference in New Issue
Block a user