Skip to content

Commit a66afb2

Browse files
committed
styling
1 parent 13d1e6f commit a66afb2

File tree

6 files changed

+69
-24
lines changed

6 files changed

+69
-24
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 片語 - Snippets Site for wenyan-lang
1+
# 文言片語 - Snippets Site for wenyan-lang
22

33
http://snippets.wy-lang.org/
44

static/callback.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<body>
3+
<pre id='out'></pre>
4+
<script>
5+
const query = new URLSearchParams(location.search)
6+
7+
document.getElementById('out').innerText = JSON.stringify(query.getAll(), null, 2)
8+
</script>
9+
</body>
10+

static/client.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ function newPreview(div, snip) {
6060
hdr.classList.add("code-header");
6161
div.appendChild(hdr);
6262

63-
// var cm = CodeMirror(div, {
64-
// value: snip.code,
65-
// mode: "wenyan",
66-
// lineNumbers: true,
67-
// theme: "wenyan-light",
68-
// readOnly: true,
69-
// });
70-
// cm.setSize(300,128);
7163
var cm = document.createElement("pre");
7264
cm.classList.add("cm-s-wenyan-light");
7365
cm.classList.add("code-cell-inner");
@@ -76,7 +68,6 @@ function newPreview(div, snip) {
7668

7769
var ftr = document.createElement("div");
7870
ftr.innerHTML = `
79-
8071
<i class="material-icons icon-icon">star</i>
8172
${snip.votes || 0}
8273
<b class="icon-btn" id="btn-upvote" onclick="onVote(${
@@ -360,14 +351,14 @@ document.getElementById("btn-new").onclick = function () {
360351
openEditor();
361352
};
362353

363-
document.getElementById("inp-search").onkeypress = function (k) {
354+
document.getElementById("search").onkeypress = function (k) {
364355
if (k.key == "Enter") {
365356
document.getElementById("btn-search").click();
366357
}
367358
};
368359

369360
document.getElementById("btn-search").onclick = function () {
370-
var term = document.getElementById("inp-search").value;
361+
var term = document.getElementById("search").value;
371362
document.getElementById("content").innerHTML = "";
372363
if (term[0] == "#") {
373364
fetch(`${baseUrl}/one`, {

static/editor.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
border: 1px solid #ddd;
55
}
66
</style>
7-
<iframe id="editor" src='https://wenyan-ide.netlify.com/embed?autorun&title=%E5%95%8F%E5%A4%A9%E5%9C%B0%E5%A5%BD%E5%9C%A8&code=%E5%90%BE%E6%9C%89%E4%B8%80%E8%A8%80%E3%80%82%E6%9B%B0%E3%80%8C%E3%80%8C%E5%95%8F%E5%A4%A9%E5%9C%B0%E5%A5%BD%E5%9C%A8%E3%80%82%E3%80%8D%E3%80%8D%E3%80%82%E6%9B%B8%E4%B9%8B%E3%80%82' height="400" width="600"></iframe>
7+
<iframe id="editor" src='http://localhost:13331/embed?autorun&title=%E5%95%8F%E5%A4%A9%E5%9C%B0%E5%A5%BD%E5%9C%A8&code=%E5%90%BE%E6%9C%89%E4%B8%80%E8%A8%80%E3%80%82%E6%9B%B0%E3%80%8C%E3%80%8C%E5%95%8F%E5%A4%A9%E5%9C%B0%E5%A5%BD%E5%9C%A8%E3%80%82%E3%80%8D%E3%80%8D%E3%80%82%E6%9B%B8%E4%B9%8B%E3%80%82' height="400" width="600"></iframe>
88

99
<br>
1010
<br>

static/index.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!DOCTYPE html>
55
<html lang="en">
66
<head>
7-
<title>wenyan-snippets</title>
7+
<title>文言片語 - Snippets for wenyan-lang</title>
88

99
<meta charset="utf-8">
1010
<meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -31,10 +31,11 @@
3131
<script src="/client.js" defer></script>
3232
</head>
3333
<body>
34-
<div style="padding:5px;">
35-
<input placeholder="Find 文言/wenyan Snippets" style="font-size: 20px" size="28" id="inp-search"/>
36-
<i class="material-icons icon-btn" style="font-size:30px; transform:translate(0,8px)" id="btn-search">search</i>
37-
<i class="material-icons icon-btn" style="font-size:32px; transform:translate(0,7px)" id="btn-new">add</i>
34+
<div class="nav">
35+
<label class="title">文言片語</label>
36+
<input id="search" placeholder="Search snippets..." style="font-size: 20px" size="16" />
37+
<span id="btn-search" class="iconify" data-icon="mdi:search" data-inline="false"></span>
38+
<span id="btn-new" class="iconify" data-icon="mdi:plus" data-inline="false"></span>
3839
</div>
3940
<div id="content">
4041
</div>

static/style.css

+49-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,50 @@
11

2-
body{
2+
body, html {
33
font-family: sans-serif;
4-
/* filter: invert(1);background:black; */
4+
margin: 0;
55
}
6+
7+
.nav {
8+
padding: 5px;
9+
background: #f1f1f1;
10+
border-bottom: 1px solid gainsboro;
11+
position: fixed;
12+
top: 0;
13+
left: 0;
14+
right: 0;
15+
z-index: 100;
16+
white-space: nowrap;
17+
}
18+
19+
.nav * {
20+
vertical-align: middle;
21+
}
22+
23+
.nav .iconify {
24+
font-size: 1.5em;
25+
margin: 0.3rem;
26+
color: #444;
27+
cursor: pointer;
28+
}
29+
30+
.nav input {
31+
margin: 0.5rem;
32+
padding: 0.1rem 0.5rem;
33+
}
34+
35+
.nav .title {
36+
color: #777;
37+
margin: 0.5rem 1rem;
38+
font-size: 1.1em;
39+
}
40+
41+
#content {
42+
margin-top: 3.6rem;
43+
padding: 1rem;
44+
display: grid;
45+
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
46+
}
47+
648
.code-cell{
749
margin: 5px;
850
border-radius: 4px;
@@ -11,6 +53,7 @@ body{
1153
overflow: hidden;
1254
display: inline-block;
1355
}
56+
1457
.code-header{
1558
color:grey;
1659
font-size: 12px;
@@ -83,9 +126,9 @@ body{
83126
margin: 5px;
84127
}
85128
.code-cell-inner{
86-
width: 300px !important;
129+
width: 100%;
87130
height: 128px !important;
88-
overflow: scroll;
89-
padding: 0px;
90-
margin:0px;
131+
overflow: hidden;
132+
padding: 5px;
133+
margin: 0px;
91134
}

0 commit comments

Comments
 (0)