Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/4ever9/less.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden X <caichao.xu@gmail.com>2020-08-24 18:15:13 +0300
committerAiden X <caichao.xu@gmail.com>2020-08-24 18:15:13 +0300
commit79562851b49fcabdff8cd2db35071a9d8786ea43 (patch)
treea290caf80881c985de050f8c34055878ee304341
parent142bea5d69fa90ba9549d48e3e4623deebe80817 (diff)
feat(js): add dark cookie
-rw-r--r--assets/js/less.js44
-rw-r--r--assets/scss/_heaader.scss2
-rw-r--r--assets/scss/_single.scss22
-rw-r--r--assets/scss/less.scss2
-rw-r--r--layouts/_default/single.html20
-rw-r--r--layouts/partials/footer.html1
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/header.html2
-rw-r--r--static/images/favicon.pngbin3400 -> 17258 bytes
-rw-r--r--static/images/logo.pngbin4710 -> 18447 bytes
10 files changed, 62 insertions, 33 deletions
diff --git a/assets/js/less.js b/assets/js/less.js
index 44c0408..3221f4a 100644
--- a/assets/js/less.js
+++ b/assets/js/less.js
@@ -1,6 +1,40 @@
-console.log(99)
-
-$(document).on('click', '#btn-dark', function(e) {
+const $btnDark = document.getElementById('btn-dark')
+const $body = document.getElementsByTagName('body')
+$btnDark.addEventListener('click', e => {
e.preventDefault()
- $('body').toggleClass('dark')
-}) \ No newline at end of file
+ $body[0].classList.toggle('dark')
+ if (getCookie('dark') === "") {
+ setCookie('dark', 'true', 7 * 24 * 60 * 60)
+ } else {
+ removeCookie('dark')
+ }
+})
+
+if (getCookie('dark') === 'true') {
+ $body[0].classList.add('dark')
+}
+
+function setCookie(key, value, second) {
+ let d = new Date();
+ d.setTime(d.getTime() + (second * 1000));
+ let expires = "expires=" + d.toGMTString();
+ document.cookie = key + "=" + value + "; " + expires + "; path=/";
+}
+
+function removeCookie(key) {
+ let d = new Date();
+ d.setTime(d.getTime() - 1);
+ let expires = "expires=" + d.toGMTString();
+ document.cookie = key + "=;" + expires + "; path=/";
+}
+
+function getCookie(key) {
+ let name = key + "=";
+ let ca = document.cookie.split(';');
+ for (let i = 0; i < ca.length; i++) {
+ let c = ca[i].trim();
+ if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
+ }
+
+ return "";
+}
diff --git a/assets/scss/_heaader.scss b/assets/scss/_heaader.scss
index 89d9ffb..f18bbfe 100644
--- a/assets/scss/_heaader.scss
+++ b/assets/scss/_heaader.scss
@@ -14,7 +14,7 @@
justify-content: space-between;
.icon-moon {
- color: #999;
+ color: #e0e0e0;
}
}
diff --git a/assets/scss/_single.scss b/assets/scss/_single.scss
index b75aaa0..b577f13 100644
--- a/assets/scss/_single.scss
+++ b/assets/scss/_single.scss
@@ -5,6 +5,8 @@
font-size: 16px;
.single-title {
+ line-height: 1.2;
+ margin-bottom: 20px;
font-size: 30px;
font-weight: 500;
font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif;
@@ -21,7 +23,8 @@
border-radius: 2px;
padding: 20px;
overflow: auto;
-
+ line-height: 1.4;
+
code {
font-size: 14px;
}
@@ -29,6 +32,8 @@
code {
font-family: "menlo", serif;
+ white-space: pre-wrap;
+ word-break: break-all;
}
p {
@@ -36,7 +41,7 @@
}
h1, h2, h3, h4, h5, h6 {
- font-weight: 500;
+ font-weight: 600;
outline: none;
margin: 30px 0 30px;
font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif;
@@ -64,16 +69,9 @@
}
}
-.single-meta {
- color: #999;
-
- .single-date {
- margin-right: 10px;
- }
- a {
- color: #999;
- margin-right: 10px;
- }
+.single-date {
+ margin-right: 10px;
+ color: #a0a0a0;
}
.single-toc {
diff --git a/assets/scss/less.scss b/assets/scss/less.scss
index f908fa5..bc44603 100644
--- a/assets/scss/less.scss
+++ b/assets/scss/less.scss
@@ -87,7 +87,7 @@ a {
}
.post-title {
- //font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif;
+ font-family: 'Monda', -apple-system, BlinkMacSystemFont, PingFang SC, Hiragino Sans GB, Microsoft YaHei, "\5FAE\8F6F\96C5\9ED1", helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, Arial, sans-serif;
}
.year {
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 6b869a5..2b5b1f1 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -5,20 +5,18 @@
<div class="single-title">
{{.Title}}
</div>
- <div class="single-meta">
<div class="single-date">
{{ .Date.Format "2006-01-02" }}
</div>
- {{ if .Params.tags }}
- <div class="single-tags">
- {{ range $k, $v := .Params.tags }}
- <a class="single-tag" href="{{ "tags/" | absLangURL }}{{ . }}">
- #{{ . }}
- </a>
- {{ end }}
- </div>
- {{ end }}
- </div>
+<!-- {{ if .Params.tags }} -->
+<!-- <div class="single-tags"> -->
+<!-- {{ range $k, $v := .Params.tags }} -->
+<!-- <a class="single-tag" href="{{ "tags/" | absLangURL }}{{ . }}"> -->
+<!-- #{{ . }} -->
+<!-- </a> -->
+<!-- {{ end }} -->
+<!-- </div> -->
+<!-- {{ end }} -->
<div class="single-content">
{{.Content}}
</div>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index d9ad6cd..90a5026 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -29,7 +29,6 @@
collapseDepth: 4
});
</script>
-<script crossorigin="anonymous" integrity="sha384-LVoNJ6yst/aLxKvxwp6s2GAabqPczfWh6xzm38S/YtjUyZ+3aTKOnD/OJVGYLZDl" src="https://lib.baomitu.com/jquery/3.5.0/jquery.min.js"></script>
{{ $built := resources.Get "js/less.js" | js.Build "less.js" }}
<script type="text/javascript" src="{{ $built.RelPermalink }}"></script>
</html> \ No newline at end of file
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index caaa5a6..5db9264 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -8,6 +8,6 @@
<link href="/images/favicon.png" rel="icon" type="image/ico">
<link rel="stylesheet" href="{{ $style.Permalink }}">
<link rel="stylesheet" href="//at.alicdn.com/t/font_1995642_5r07rt5x862.css">
- <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/tocbot/4.11.1/tocbot.css">
+ <link rel="stylesheet" href="https://lib.baomitu.com/tocbot/4.11.2/tocbot.min.css">
<title>面向自由编程</title>
</head> \ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index bfee24f..80dd680 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,7 +1,7 @@
<div class="container">
<div class="nav">
<a class="logo" href="/">
- <img src="/images/logo.svg" alt="">
+ <img src="/images/logo.png" alt="">
</a>
<!-- <ul class="nav-menu"> -->
<!-- <li> -->
diff --git a/static/images/favicon.png b/static/images/favicon.png
index 32c6bfc..42a5414 100644
--- a/static/images/favicon.png
+++ b/static/images/favicon.png
Binary files differ
diff --git a/static/images/logo.png b/static/images/logo.png
index d85af5c..26966b6 100644
--- a/static/images/logo.png
+++ b/static/images/logo.png
Binary files differ