-
Notifications
You must be signed in to change notification settings - Fork 0
/
10borayotei.html
346 lines (299 loc) · 9.3 KB
/
10borayotei.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.min.js"></script>
<title>レポート</title>
<style>
.insta{
width: 1080px;
height:1080px;
overflow:hidden;
}
@media print {
/* ここにカラープロファイルを埋め込む */
@import url('color-profile.icc');
}
body {
margin: 2cm;
font-family: Arial, sans-serif;
}
div {
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
border-radius: 10px;
overflow: hidden;
}
table {
border: 1px solid black;
}
th, td {
padding: 15px;
text-align: center;
border-radius: 10px;
font-weight: bold;
font-size: 20px;
}
th {
background-color: #4CAF50;
color: white;
}
table {
border-collapse: collapse;
}
td, th {
border-bottom: 1px solid #000; /* 横線のみを表示するために下の境界線を設定 */
padding: 5px; /* セルの内側の余白を指定(任意) */
}
/* テーブルの最初の行のセルだけ上の境界線を持つ */
tr:first-child td, tr:first-child th {
border-top: 1px solid #000;
}
/* テーブルの最後の行のセルだけ下の境界線を持つ */
tr:last-child td, tr:last-child th {
border-bottom: 1px solid #000;
}
.kankyo {
background-color: #c1f0c3;
}
.kodomo {
background-color: #eedbd0;
}
.hukusi {
background-color: #f08bc9;
}
.saigai {
background-color: #a9d2e7;
}
.tian {
background-color: #ede09e;
}
/* プリント時に非表示にするクラス */
.no-print {
display: none;
}
/* スタイル改善 */
.label {
padding: 6px 12px;
border-radius: 5px;
font-size: 20px;
font-weight: bold;
display: inline-block;
margin-right: 5px;
margin-bottom: 5px;
width: 100px; /* Add this */
height: 30px; /* Add this */
line-height: 100px; /* Add this */
text-align: center; /* Add this */
vertical-align: middle; /* Add this */
overflow: hidden; /* Add this */
}
/* The remaining CSS classes... */
.kankyo-label {
background-color: #c1f0c3;
color: #006400;
line-height: normal; /* Add this */
width: auto; /* Add this */
height: auto; /* Add this */
text-align: center;
display: flex; /* flexboxを使って要素を中央揃えにする */
justify-content: center; /* 水平方向(横方向)の中央揃え */
align-items: center;
}
.kodomo-label {
background-color: #eedbd0;
color: #8B4513;
line-height: normal; /* Add this */
width: auto; /* Add this */
height: auto; /* Add this */
text-align: center;
display: flex; /* flexboxを使って要素を中央揃えにする */
justify-content: center; /* 水平方向(横方向)の中央揃え */
align-items: center;
}
.hukusi-label {
background-color: #f08bc9;
color: #800080;
line-height: normal; /* Add this */
width: auto; /* Add this */
height: auto; /* Add this */
text-align: center;
display: flex; /* flexboxを使って要素を中央揃えにする */
justify-content: center; /* 水平方向(横方向)の中央揃え */
align-items: center;
}
.saigai-label {
background-color: #a9d2e7;
color: #191970;
line-height: normal; /* Add this */
width: auto; /* Add this */
height: auto; /* Add this */
text-align: center;
display: flex; /* flexboxを使って要素を中央揃えにする */
justify-content: center; /* 水平方向(横方向)の中央揃え */
align-items: center;
}
.tian-label {
background-color: #ede09e;
color: #434302;
display: flex; /* Add this */
line-height: normal; /* Add this */
width: auto; /* Add this */
height: auto; /* Add this */
text-align: center;
display: flex; /* flexboxを使って要素を中央揃えにする */
justify-content: center; /* 水平方向(横方向)の中央揃え */
align-items: center;
}
p {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
}
</style>
</head>
<div class ="insta">
<body>
<div>
<img src="活動予定表.png" width="100%" height="200">
</div>
<table>
<thead>
<tr>
<th>活 動 名</th>
<th>活 動 日</th>
<th>活 動 場 所</th>
<th>活 動 時 間</th>
</tr>
</thead>
<tbody>
<tr>
<td class="kodomo">
<label class="label kodomo-label">第4回活動報告会</label> <!-- 色: #f08bc9 -->
</td>
<td>10/4(水)</td>
<td>S509</td>
<td>12:30~13:00</td>
</tr>
<tr>
<td class="tian">
<label class="label tian-label">第10回防犯パトロール</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/5(木)</td>
<td>8号館502</td>
<td>14:50~16:20</td>
</tr>
<tr >
<td class="kankyo">
<label class="label kankyo-label">第10回クリーンアップ大作戦</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/5(木)</td>
<td>本部棟下</td>
<td>16:30~17:30</td>
</tr>
<tr>
<td class="tian">
<label class="label tian-label">第11回防犯パトロール</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/16(月)</td>
<td>8号館502</td>
<td>14:50~16:20</td>
</tr>
<tr >
<td class="kankyo">
<label class="label kankyo-label">第11回クリーンアップ大作戦</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/19(木)</td>
<td>本部棟下</td>
<td>12:30~13:10</td>
</tr>
<tr >
<td class="kankyo">
<label class="label kankyo-label">エコキャップ大作戦</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/19(木)</td>
<td>8号館502</td>
<td>13:10~14:40</td>
</tr>
<tr>
<td class="tian">
<label class="label tian-label">第12回防犯パトロール</label> <!-- 色: #a9d2e7 -->
</td>
<td>10/27(金)</td>
<td>8号館502</td>
<td>14:50~16:20</td>
</tr>
<tr>
<td class="tian">
<label class="label tian-label">第9,10,11回ふれあいあいさつ運動</label> <!-- 色: #ede09e -->
</td>
<td>10/10(火),10/26(木),10/30(月)</td>
<td>8号館502</td>
<td>14:05~15:00</td>
</tr>
<tr>
<td class="kodomo">
<label class="label kodomo-label">第5回活動報告会</label> <!-- 色: #ede09e -->
</td>
<td>10/26(火)</td>
<td>S403</td>
<td>12:30~13:00</td>
</tr>
</tbody>
</table>
<p>
<label class="label kankyo-label">環境</label> <!-- 色: #c1f0c3 -->
<label class="label hukusi-label">福祉</label>
<label class="label tian-label">地域安全パトロール</label>
<label class="label saigai-label">災害</label>
<label class="label kodomo-label">総務</label>
</p>
</body>
</div>
<button id="cp">caputure</button>
</html>
<script>
document.addEventListener("DOMContentLoaded", async function() {
// 画像とテーブルの読み込みを待つ
const image = new Image();
image.src = '活動予定表.png';
await Promise.all([new Promise(resolve => image.onload = resolve), waitForTableLoad()]);
// Captureボタンの参照を取得
const captureButton = document.getElementById("cp");
// Captureボタンがクリックされたときのイベントハンドラ
captureButton.addEventListener("click", async function() {
const instaElement = document.querySelector(".insta");
const canvas = await html2canvas(instaElement, {
width: 1080,
height: 1080,
windowWidth: instaElement.scrollWidth,
windowHeight: instaElement.scrollHeight,
scrollY: 0,
useCORS: true,
backgroundColor: "#ffffff" // 背景色を白に設定
});
const imgData = canvas.toDataURL("image/jpeg");
const link = document.createElement("a");
link.href = imgData;
link.download = "screenshot.jpeg";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
});
// テーブルが完全にロードされるまで待つ関数
function waitForTableLoad() {
return new Promise(resolve => {
const checkTable = setInterval(() => {
const table = document.querySelector('.insta table');
if (table && table.querySelectorAll('tr').length > 1) {
clearInterval(checkTable);
resolve();
}
}, 100);
});
}
</script>