-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
227 lines (203 loc) · 6.37 KB
/
index.html
File metadata and controls
227 lines (203 loc) · 6.37 KB
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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate, max-age=0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>sql-formatter</title>
<style>
:root {
--bg: #f6f4f8;
--surface: #ffffff;
--text: #1c1b1f;
--muted: #5f5a6b;
--primary: #2f7c6a;
--primary-strong: #236353;
--on-primary: #ffffff;
--secondary-bg: #f0edf5;
--secondary-text: #3f3b46;
--outline: #ddd6ea;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: "BIZ UDPGothic", "Noto Sans JP", "Hiragino Sans", "Segoe UI", sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px;
}
.card {
width: min(760px, 100%);
background: var(--surface);
border: 1px solid var(--outline);
border-radius: 18px;
padding: 28px;
box-shadow: 0 8px 24px rgba(20, 14, 35, 0.08);
}
h1 {
margin: 0 0 12px;
font-size: 1.9rem;
line-height: 1.2;
}
h2 {
margin: 0 0 10px;
font-size: 1.25rem;
line-height: 1.25;
}
p {
margin: 0 0 14px;
color: var(--muted);
line-height: 1.7;
}
ul {
margin: 0 0 16px;
padding-left: 1.2rem;
color: var(--muted);
line-height: 1.6;
}
.link-row {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 4px;
}
.link-btn,
.link-btn-secondary {
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
padding: 0.68rem 1.2rem;
border-radius: 999px;
font-weight: 700;
line-height: 1.2;
}
.link-btn {
background: var(--primary);
color: var(--on-primary);
}
.link-btn:hover {
background: var(--primary-strong);
}
.link-btn-secondary {
background: var(--secondary-bg);
color: var(--secondary-text);
border: 1px solid #d2cadf;
}
.divider {
border: 0;
border-top: 1px solid var(--outline);
margin: 20px 0;
}
.lang-block:last-child p:last-child {
margin-bottom: 0;
}
.sub {
margin-top: 12px;
font-size: 0.9rem;
color: var(--muted);
}
.shots {
margin: 0;
}
.shots h2 {
margin-bottom: 12px;
}
.shots img {
display: block;
width: 100%;
height: auto;
border-radius: 12px;
border: 1px solid var(--outline);
background: #fff;
}
</style>
</head>
<body>
<main class="card">
<h1>sql-formatter</h1>
<section class="lang-block" aria-label="English">
<h2>English</h2>
<p>
sql-formatter is a browser-based SQL formatter and AST viewer.
It runs as a single-file web app and works offline in the browser.
</p>
<ul>
<li>Format SQL immediately in the browser.</li>
<li>Useful for syntax inspection, debug, and query review.</li>
<li>No installation required.</li>
</ul>
<p><strong>Target SQL:</strong> DML / DQL such as SELECT, INSERT, UPDATE, DELETE, and DDL such as CREATE TABLE and ALTER TABLE.</p>
<div class="link-row">
<a class="link-btn" href="./sql-formatter.html?v=202603071300">Open sql-formatter</a>
<a class="link-btn-secondary" href="./sql-formatter-online.html?v=202603071300">Open online version</a>
<a class="link-btn-secondary" href="https://github.com/igapyon/sql-formatter" target="_blank" rel="noopener noreferrer">GitHub</a>
</div>
<p class="sub">The app re-runs automatically when you edit SQL or switch AST mode.</p>
</section>
<hr class="divider" />
<section class="shots" aria-label="Screenshot">
<h2>Screenshot / スクリーンショット</h2>
<img src="./screenshot.png" alt="sql-formatter screenshot" />
</section>
<hr class="divider" />
<section class="lang-block" aria-label="日本語">
<h2>日本語</h2>
<p>
sql-formatter は、ブラウザ上で動作する SQL 整形・AST 確認ツールです。
単一 HTML 配布で、ブラウザだけでオフライン動作します。
</p>
<ul>
<li>ブラウザ上ですぐに SQL を整形できます。</li>
<li>構文確認、デバッグ、レビュー用途に使えます。</li>
<li>インストール不要です。</li>
</ul>
<p><strong>対象SQL:</strong> SELECT / INSERT / UPDATE / DELETE などの DML / DQL、および CREATE TABLE / ALTER TABLE などの DDL。</p>
<div class="link-row">
<a class="link-btn" href="./sql-formatter.html?v=202603071300">sql-formatter を開く</a>
<a class="link-btn-secondary" href="./sql-formatter-online.html?v=202603071300">online 版を開く</a>
<a class="link-btn-secondary" href="https://github.com/igapyon/sql-formatter" target="_blank" rel="noopener noreferrer">GitHub</a>
</div>
<p class="sub">SQL の入力変更時、および AST スイッチ切替時に自動で再実行されます。</p>
</section>
</main>
<script>
(() => {
const selector = 'a[href^="./sql-formatter.html"], a[href^="./sql-formatter-online.html"]';
const buildVersionStamp = () => {
const d = new Date();
return (
d.getFullYear().toString() +
String(d.getMonth() + 1).padStart(2, "0") +
String(d.getDate()).padStart(2, "0") +
String(d.getHours()).padStart(2, "0") +
String(d.getMinutes()).padStart(2, "0")
);
};
const stampAndGo = (anchor) => {
const u = new URL(anchor.getAttribute("href"), location.href);
u.searchParams.set("v", buildVersionStamp());
anchor.setAttribute("href", u.pathname + u.search);
};
document.addEventListener("click", (ev) => {
const a = ev.target.closest(selector);
if (!a) return;
stampAndGo(a);
}, true);
document.addEventListener("auxclick", (ev) => {
if (ev.button !== 1) return;
const a = ev.target.closest(selector);
if (!a) return;
stampAndGo(a);
}, true);
})();
</script>
</body>
</html>