-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrid.html
72 lines (69 loc) · 2.01 KB
/
grid.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Git Pattern Generator</title>
<style>
table {
border-collapse: collapse;
}
td {
width: 20px;
height: 20px;
text-align: center;
}
input[type="checkbox"] {
width: 20px;
height: 20px;
margin: 0;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const gridContainer = document.getElementById('checkboxGrid');
// Create 7 rows
for (let i = 0; i < 7; i++) {
const row = document.createElement('tr');
// Create 56 checkboxes per row
for (let j = 0; j < 56; j++) {
const cell = document.createElement('td');
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.id = `cell-${i}-${j}`;
cell.appendChild(checkbox);
row.appendChild(cell);
}
gridContainer.appendChild(row);
}
});
function generatePattern() {
const pattern = [];
for (let i = 0; i < 7; i++) {
const row = [];
for (let j = 0; j < 56; j++) {
const cell = document.getElementById(`cell-${i}-${j}`);
row.push(cell.checked ? '*' : 'X');
}
pattern.push(row.join(' '));
}
const patternText = pattern.join('\n');
const blob = new Blob([patternText], { type: 'text/plain' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'goose_pattern.txt';
link.click();
}
</script>
</head>
<body>
<h1>Git Pattern Generator</h1>
<form id="patternForm">
<table id="checkboxGrid"></table>
<button type="button" onclick="generatePattern()">Generate Pattern</button>
</form>
<script>
// JavaScript code will be inserted here
</script>
</body>
</html>