Skip to content

Commit a57ff37

Browse files
author
Layton Chen
committed
notification support
1 parent c8513d0 commit a57ff37

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Under construction
2+
3+
Features:
4+
1. Notification
5+
16
# May 28, 2020 v1.1.0
27

38
New features are imported to erblog:

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ There are some basic configuration options you may want to use:
6464
| Params.google_search | Enable Google Intra-Site Search Engine | false |
6565
| Params.badge | The color for badge ('red', 'cyan', 'orange', 'green', 'blue', 'black' and 'gray' are available) | 'red' |
6666
| Params.quote | The color for quota ('red', 'cyan', 'orange', 'green', 'blue', 'black' and 'gray' are available) | 'green' |
67+
| Params.notice | Contents of notification | none |
68+
| Params.notice_color | The color for notification background ('red', 'cyan', 'orange', 'green', 'blue', 'black' and 'gray' are available) | 'red' |
6769

6870
Add your own custom menus in the `config.toml` like this:
6971

exampleSite/config.toml

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ footnoteReturnLinkContents = "^"
1111
author = "Steve Francia"
1212
badge = "orange"
1313
quote = "red"
14+
notice = "Hello, world. This is a notification."
15+
notice_color = "red"
1416
index_posts_num = 5
1517
google_search = true
1618
# logo = "//blog.ertuil.top/avater.png"

layouts/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{{ define "main" }}
22

33
<main>
4+
5+
{{ partial "notice.html" .}}
6+
47
<div class="layui-container">
58
<div class="layui-row about">
69
<div class="layui-col-xs12 layui-col-sm4 layui-col-md4 about_left">

layouts/partials/notice.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{if isset .Site.Params "notice"}}
2+
<div id="erblog-notice" onclick="notice_close();"
3+
class="layui-container-fluid {{with $.Site.Params.notice_color}}layui-bg-{{.}}{{else}}layui-bg-red{{end}}">
4+
<div class="layui-row self-notice">
5+
<div class="layui-col-xs12 layui-col-sm12 layui-col-md12 self-notice-text">
6+
<span style="margin-left: 20px">
7+
{{.Site.Params.notice | safeHTML}}
8+
<i class="layui-icon layui-icon-close" style="vertical-align: -1px;margin-left: 20px"></i>
9+
</span>
10+
</div>
11+
</div>
12+
</div>
13+
14+
<script>
15+
function notice_close() {
16+
document.getElementById('erblog-notice').classList.add("layui-anim");
17+
document.getElementById('erblog-notice').classList.add("layui-anim-fadeout");
18+
//document.getElementById('erblog-notice').style.display='none';
19+
}
20+
</script>
21+
{{end}}

static/self/css/default.css

+13
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,19 @@ footer {
269269
text-decoration: underline;
270270
}
271271

272+
.self-notice {
273+
/* height: 40px; */
274+
}
275+
276+
.self-notice-text {
277+
/* top: 50%;
278+
transform: translate(0, -50%); */
279+
margin-top: 10px;
280+
margin-bottom: 10px;
281+
/* margin-left:30px;
282+
margin-right: 30px; */
283+
}
284+
272285
.self-elem-quote {
273286
margin-bottom:10px;
274287
padding:15px;

0 commit comments

Comments
 (0)