diff options
author | Y4er <45418382@qq.com> | 2019-10-05 10:20:53 +0300 |
---|---|---|
committer | Y4er <45418382@qq.com> | 2019-10-05 10:20:53 +0300 |
commit | 22d6a19d34ff6bfdb9f7d6ac69bfb2a386dbd9b7 (patch) | |
tree | d85004f984c970fb3a62707228acd0c64e20a28e |
first commit
-rw-r--r-- | LICENSE | 20 | ||||
-rw-r--r-- | archetypes/default.md | 10 | ||||
-rw-r--r-- | layouts/404.html | 18 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 38 | ||||
-rw-r--r-- | layouts/_default/list.html | 15 | ||||
-rw-r--r-- | layouts/_default/single.html | 20 | ||||
-rw-r--r-- | layouts/index.html | 30 | ||||
-rw-r--r-- | layouts/partials/comments.html | 138 | ||||
-rw-r--r-- | layouts/partials/footer.html | 3 | ||||
-rw-r--r-- | layouts/partials/head.html | 55 | ||||
-rw-r--r-- | layouts/partials/header.html | 11 | ||||
-rw-r--r-- | layouts/partials/script.html | 51 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 27 | ||||
-rw-r--r-- | static/css/main.css | 887 | ||||
-rw-r--r-- | static/images/lazy.gif | bin | 0 -> 673 bytes | |||
-rw-r--r-- | static/js/easybook.js | 242 | ||||
-rw-r--r-- | static/js/figure.js | 55 | ||||
-rw-r--r-- | static/js/lazysizes.min.js | 2 | ||||
-rw-r--r-- | theme.toml | 21 |
19 files changed, 1643 insertions, 0 deletions
@@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2019 YOUR_NAME_HERE + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..8d462de --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,10 @@ +--- +title: "{{ replace .TranslationBaseName "-" " " | title }}" +date: {{ .Date }} +lastmod: {{ .Date }} +draft: false +tags: [] +categories: [] +--- + +<!--more--> diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..171fe09 --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,18 @@ +{{- define "title" }}404 page not found - {{ .Site.Title }}{{ end -}} + +{{- define "content" -}} +<div class="not-found"> + <h1 class="error-emoji"></h1> + <p class="error-text">/* 404 page not found. */</p> + <p class="error-link"><a href="{{ "/" | relLangURL }}">↑ Back Home ↑</a></p> +</div> +<script> + var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; + var emojiArray = [ + '\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)', + '(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/', + ]; + var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)]; + errorEmojiContainer.appendChild(document.createTextNode(errorEmoji)); +</script> +{{- end -}} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..603ca39 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html lang="{{ .Site.Language }}"> + +<head> + {{ partial "head.html" . }} +</head> + +<body> + <div class="header-placeholder"></div> + {{/* header */}} + {{ if not .Params.hideHeaderAndFooter -}} + <header class="header"> + {{ partial "header.html" . }} + </header> + {{- end }} + + {{/* body */}} + <div class="page-content"> + <div class="wrapper"> + {{/* posts */}} + <div class="col-main"> + {{ block "content" . }}{{ end }} + </div> + {{/* sidebar */}} + <div class="col-second"> + {{ partial "sidebar.html" . }} + </div> + </div> + </div> + {{/* footer */}} + <footer class="footer"> + {{ partial "footer.html" . }} + </footer> + {{/* script */}} + {{ partial "script.html" . }} +</body> + +</html>
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..66930f7 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,15 @@ +{{- define "content" }} +<div class="home"> + <h1 class="page-heading">Category</h1> + <ul class="post-list"> + {{ range $key,$value := .Site.Taxonomies.tags }} + <h2 class="category" id="{{ $key }}">{{ $key }}</h2> + <ul> + {{ range $value }} + <li><span>{{.Date.Format "Jan 2, 2006"}}</span> » <a href="{{ .URL }}">{{ .Title}}</a></li> + {{ end }} + </ul> + {{ end }} + </ul> +</div> +{{- end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..c786090 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,20 @@ +{{ define "content" -}} +<div class="post"> + <header class="post-header"> + <h1 class="post-title">{{ .Title}}</h1> + <p class="post-meta">{{.Date.Format "Jan 2, 2006"}}</p> + </header> + <article class="post-content"> + {{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }} + {{ $reAltOut := "<figure><img src=\"/images/lazy.gif\" data-sizes=\"auto\" data-src=\"$1\" alt=\"$2\" class=\"lazyload\"></figure>" }} + {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} + {{ $reAltTitleIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" title=\"([^\"]+)?\" />" }} + {{ $reAltTitleOut := "<figure><img src=\"/images/lazy.gif\" data-src=\"$1\" data-sizes=\"auto\" alt=\"$2\" title=\"$3\" class=\"lazyload\"></figure>" }} + {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }} + {{ $finalContent }} + </article> + <div class="post-comments"> + {{ partial "comments" . }} + </div> +</div> +{{- end }}
\ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..1ee5713 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,30 @@ +{{- define "content" -}} +<div class="home"> + <a class="rss-link" href="/feed.xml">RSS Feed</a> + <h1 class="page-heading">Articles</h1> + {{/* content */}} + <ul class="post-list"> + {{ $paginator := .Paginate (where .Data.Pages "Section" "post") }} + <!--读取分页内容--> + {{ range $paginator.Pages }} + <li> + <h2><a href="{{ .URL }}">{{ title .Title | safeHTML }}</a></h2> + <div class="post-meta">{{.Date.Format "Jan 2, 2006"}}</div> + <div class="post-excerpt"> + {{ .Summary | safeHTML }} + </div> + </li> + {{ end }} + </ul> + <!-- pagination --> + <div class="pagination"> + {{ with $paginator.Prev -}} + <a href="{{ .URL }}" class="next">PREV</a> + {{- end }} + <span class="page_number ">{{ $paginator }} of {{ $paginator.TotalPages }}</span> + {{ with $paginator.Next -}} + <a href="{{ .URL }}" class="next">NEXT</a> + {{- end }} + </div> +</div> +{{- end -}}
\ No newline at end of file diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..0d3e8cf --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,138 @@ +{{ if and .IsPage (ne .Params.comment false) -}} + <!-- Disqus --> + {{- if .Site.DisqusShortname -}} + <div id="disqus_thread"></div> + <script type="text/javascript"> + (function() { + // Don't ever inject Disqus on localhost--it creates unwanted + // discussions from 'localhost:1313' on your Disqus account... + if (window.location.hostname === 'localhost') return; + + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + var disqus_shortname = '{{ .Site.DisqusShortname }}'; + dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + </script> + <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> + {{- end -}} + + <!-- changyan --> + {{- if and .Site.Params.changyanAppid .Site.Params.changyanAppkey -}} + <div id="SOHUCS" sid="{{ .URL }}"></div> + <script type="text/javascript"> + (function(){ + if (window.location.hostname === 'localhost') return; + + var appid = '{{ .Site.Params.changyanAppid }}'; + var conf = '{{ .Site.Params.changyanAppkey }}'; + var width = window.innerWidth || document.documentElement.clientWidth; + if (width < 960) {window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } + })(); + </script> + {{- end -}} + + <!-- LiveRe --> + {{- if .Site.Params.livereUID -}} + <div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livereUID }}"> + <script type="text/javascript"> + (function(d, s) { + var j, e = d.getElementsByTagName(s)[0]; + + if (typeof LivereTower === 'function') { return; } + + j = d.createElement(s); + j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; + j.async = true; + + e.parentNode.insertBefore(j, e); + })(document, 'script'); + </script> + <noscript>Please enable JavaScript to view the comments powered by <a href="https://livere.com/">LiveRe.</a></noscript> + </div> + {{- end -}} + + <!-- gitment --> + {{- if .Site.Params.gitment.owner -}} + <div id="comments-gitment"></div> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.min.css" crossorigin="anonymous"> + <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.min.js" crossorigin="anonymous"></script> + <script type="text/javascript"> + var gitment = new Gitment({ + id: '{{ .Date }}', + title: '{{ .Title }}', + link: decodeURI(location.href), + desc: '{{ .Summary }}', + owner: '{{ .Site.Params.gitment.owner }}', + repo: '{{ .Site.Params.gitment.repo }}', + oauth: { + client_id: '{{ .Site.Params.gitment.clientId }}', + client_secret: '{{ .Site.Params.gitment.clientSecret }}' + } + }); + gitment.render('comments-gitment'); + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript> + {{- end -}} + + <!-- gitalk --> + {{- if .Site.Params.gitalk.owner -}} + <div id="gitalk-container"></div> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" crossorigin="anonymous"> + <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js" crossorigin="anonymous"></script> + <script type="text/javascript"> + var gitalk = new Gitalk({ + id: '{{ .Date }}', + title: '{{ .Title }}', + clientID: '{{ .Site.Params.gitalk.clientId }}', + clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', + repo: '{{ .Site.Params.gitalk.repo }}', + owner: '{{ .Site.Params.gitalk.owner }}', + admin: ['{{ .Site.Params.gitalk.owner }}'], + body: decodeURI(location.href) + }); + gitalk.render('gitalk-container'); + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript> + {{- end }} + + <!-- valine --> + {{- if .Site.Params.valine.enable -}} + <!-- id 将作为查询条件 --> + {{- if .Site.Params.valine.visitor -}} + <span id="{{ .URL | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}"> + <span class="post-meta-item-text">文章阅读量 </span> + <span class="leancloud-visitors-count">0</span> + <p></p> + </span> + {{- end }} + <div id="vcomments"></div> + <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> + <script src='//unpkg.com/valine/dist/Valine.min.js'></script> + <script type="text/javascript"> + new Valine({ + el: '#vcomments' , + appId: '{{ .Site.Params.valine.appId }}', + appKey: '{{ .Site.Params.valine.appKey }}', + notify: {{ .Site.Params.valine.notify }}, + verify: {{ .Site.Params.valine.verify }}, + avatar:'{{ .Site.Params.valine.avatar }}', + placeholder: '{{ .Site.Params.valine.placeholder }}', + visitor: {{ .Site.Params.valine.visitor }} + }); + </script> + {{- end }} + + <!-- utterances --> + {{- if .Site.Params.utterances.owner}} + <script src="https://utteranc.es/client.js" + repo="{{ .Site.Params.utterances.owner }}/{{ .Site.Params.utterances.repo }}" + issue-term="pathname" + theme="github-light" + crossorigin="anonymous" + async> + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/utterance">comments powered by utterances.</a></noscript> + {{- end }} + +{{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..8a9eaa8 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,3 @@ +<div class="wrapper"> + © {{.Date.Format "2006"}} {{ .Site.Params.author }} +</div>
\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..c79f1e0 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,55 @@ +{{/* 编码 */}} +<meta charset="utf-8"> +{{/* 浏览器兼容 */}} +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1"> + +{{/* title */}} +<title> + {{- block "title" . -}} + {{ if .IsPage }}{{ .Title }} - {{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ end }} + {{- end -}} +</title> + +{{/* description */}} +{{- if .Description -}} +<meta name="description" content="{{ .Description | safeHTML }}" /> +{{- else if .IsPage -}} +<meta name="description" content="{{ .Summary | plainify }}" /> +{{- else if .Site.Params.description -}} +<meta name="description" content="{{ .Site.Params.description | safeHTML }}" /> +{{- end -}} + +{{/* keywords */}} +{{- if .Keywords -}} +{{ $length := len .Keywords | add -1 -}} +<meta name="keywords" + content="{{ range $index, $element := .Keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> +{{- else if .Site.Params.keywords -}} +{{ $length := len .Site.Params.keywords | add -1 -}} +<meta name="keywords" + content="{{ range $index, $element := .Site.Params.keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> +{{- end }} + +{{/* theme css */}} +<link rel="stylesheet" href="/css/main.css"> +<!-- lightgallery css --> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@1.6.12/src/css/lightgallery.css"> + +{{/* js */}} + +{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} +{{- template "_internal/opengraph.html" . -}} +{{- template "_internal/google_news.html" . -}} +{{- template "_internal/schema.html" . -}} +{{- template "_internal/twitter_cards.html" . -}} + +<!-- Polyfill for old browsers --> +{{ `<!--[if lte IE 9]> + <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script> +<![endif]-->` | safeHTML }} + +{{ `<!--[if lt IE 9]> + <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> +<![endif]-->` | safeHTML }}
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..8818f6b --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,11 @@ +<div class="wrapper"> + <div id="sidebar-toggle">TOC</div> + {{/* 首页左上角作者名 */}} + <a class="site-title" href="/">{{ .Site.Params.author }}</a> + {{/* 右上角导航 */}} + <nav class="site-nav"> + {{ range .Site.Menus.main -}} + <a class="page-link" href="{{ .URL | safeURL }}">{{ .Name }}</a> + {{- end }} + </nav> +</div>
\ No newline at end of file diff --git a/layouts/partials/script.html b/layouts/partials/script.html new file mode 100644 index 0000000..ba0b08b --- /dev/null +++ b/layouts/partials/script.html @@ -0,0 +1,51 @@ +<!-- JQ --> +<script src="https://cdn.jsdelivr.net/npm/jquery@1.11.0/dist/jquery.min.js"></script> +<!-- CORE JS --> +<script src="{{ "js/easybook.js" | relURL }}"></script> +<!-- image lazyload js --> +<script src="{{ "js/lazysizes.min.js" | relURL }}"></script> +<!-- image box lightgallery --> +<script src="https://cdn.jsdelivr.net/npm/lightgallery@1.6.12/dist/js/lightgallery-all.min.js"></script> +<script src="{{ "js/figure.js" | relURL }}"></script> + +<!-- Analytics --> +{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}} +{{ template "_internal/google_analytics_async.html" . }} +{{- end -}} + +{{- with .Site.Params.baiduAnalytics -}} +<script id="baidu_analytics"> + var _hmt = _hmt || []; + (function () { + if (window.location.hostname === 'localhost') return; + var hm = document.createElement("script"); hm.async = true; + hm.src = "https://hm.baidu.com/hm.js?{{.}}"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); +</script> +{{- end }} + +<!-- baidu push --> +{{- if .Site.Params.baiduPush -}} +<script id="baidu_push"> + (function () { + if (window.location.hostname === 'localhost') return; + var bp = document.createElement('script'); bp.async = true; + var curProtocol = window.location.protocol.split(':')[0]; + if (curProtocol === 'https') { + bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; + } + else { + bp.src = 'http://push.zhanzhang.baidu.com/push.js'; + } + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(bp, s); + })(); +</script> +{{- end }} + +<!-- custom js --> +{{ range .Site.Params.customJS -}} +<script src="{{ "/js/" | relURL }}{{ . }}"></script> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html new file mode 100644 index 0000000..40f5108 --- /dev/null +++ b/layouts/partials/sidebar.html @@ -0,0 +1,27 @@ +<div class="col-box col-box-author"> + <img class="avatar" src="{{ .Site.Params.avatar }}" alt="{{ .Site.Params.author }}"> + <div class="col-box-title name">{{ .Site.Params.author }}</div> + <p>{{ .Site.Params.whoami }}</p> + <p class="contact"> + {{- range $name, $path := .Site.Params.social }} + {{- if $path }} + <a href="{{ $path | safeURL }}">{{ title $name }}</a> + {{- end }} + {{- end }} + </p> +</div> + +<div class="col-box"> + <div class="col-box-title">Newest Posts</div> + <ul class="post-list"> + {{ range first 10 $.Site.RegularPages }} + <li> + <a href="{{ .URL }}" class="post-link">{{ title .Title }}</a> + </li> + {{ end }} + </ul> +</div> + +<div class="col-box post-toc hide"> + <div class="col-box-title">TOC</div> +</div>
\ No newline at end of file diff --git a/static/css/main.css b/static/css/main.css new file mode 100644 index 0000000..04da36d --- /dev/null +++ b/static/css/main.css @@ -0,0 +1,887 @@ +body { + margin: 0; + font-family: "Open Sans", "Helvetica Neue", "DejaVu Sans", Arial, "PingFang SC", "Noto Sans CJK SC", "Hiragino Sans GB", "微软雅黑", Helvetica, sans-serif; + font-size: 16px; + line-height: 1.5 +} + +a { + text-decoration: none; + color: #036 +} + +a:hover, +a:focus { + text-decoration: underline; + color: #069 +} + +blockquote { + background: #FFF; + margin: 0; + padding: 5px 20px; + border-left: 10px solid #CCC +} + +code, +pre { + font-family: Menlo, Monaco, Consolas, "DejaVu Sans Mono", "Liberation Mono", "文泉驿等宽微米黑", "Courier New", Courier, SimSun, monospace; + font-size: 15px +} + +code { + color: white; + background-color: #100005; + padding: 2px 5px; + border-radius: 5px +} + +pre { + overflow-x: auto; + padding: 20px 50px +} + +pre, +pre code { + color: #fafafa; + background-color: #223 +} + +pre code { + padding: 0 +} + +.hide { + display: none +} + +.center { + text-align: center +} + +table { + border-collapse: collapse; + border-spacing: 0; + margin: 10pt auto; + background: #FFF +} + +table td, +table th { + border: 1px solid #CCC; + padding: 5px 15px; + margin: 0 +} + +table th { + border-color: #555; + background: #555; + color: #eee; + font-weight: normal +} + +table tr:hover { + background: rgba(255, 255, 0, 0.2) +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: normal +} + +.MathJax_SVG_Display, +.MathJax_Display, +.MJXc-display, +.MathJax_PHTML_Display { + overflow-x: auto +} + +video { + margin: 20px +} + +@keyframes ebani-fadein { + 0% { + opacity: 0 + } + 100% { + opacity: 1 + } +} + +@keyframes ebani-descend { + 0% { + transform: translateY(-10px); + opacity: 0.7 + } +} + +@keyframes ebani-ascend { + 0% { + transform: translateY(10px) + } +} + +body { + background-color: #e0e0e3 +} + +.wrapper { + margin: 0 auto; + max-width: 1100px +} + +@media (max-width: 1120px) { + .wrapper { + max-width: 800px + } +} + +.header { + line-height: 32px; + background-color: rgba(165, 19, 15, 0.75); + padding: 10px; + margin: 0 +} + +.header:after { + clear: both; + content: ' '; + display: block +} + +.header #sidebar-toggle { + display: none +} + +.header .site-title { + float: left; + color: #FFF; + text-decoration: none; + font-size: 16px; + line-height: 32px +} + +.header .site-nav { + text-align: right +} + +.header .site-nav a { + text-decoration: none; + color: #fff; + padding: 10px 20px; + white-space: nowrap +} + +.header .site-nav a:hover, +.header .site-nav a:focus { + background: #9c3f43 +} + +.header-placeholder { + position: absolute +} + +@media (max-width: 1120px) { + .header-placeholder { + position: static + } + .header { + position: fixed; + left: 0; + top: 0; + right: 0; + z-index: 20 + } + .header #sidebar-toggle { + float: right; + display: block; + cursor: pointer; + margin: -10px; + margin-left: 0; + padding: 10px; + background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48bGluZSB4MT0iMyIgeDI9IjIxIiB5MT0iMTIiIHkyPSIxMiIvPjxsaW5lIHgxPSIzIiB4Mj0iMjEiIHkxPSI2IiB5Mj0iNiIvPjxsaW5lIHgxPSIzIiB4Mj0iMjEiIHkxPSIxOCIgeTI9IjE4Ii8+PC9zdmc+); + background-repeat: no-repeat; + background-position: center center; + color: transparent + } + .header .site-nav { + display: none + } + .header.expand-sidebar .site-nav { + display: block; + animation: ebani-fadein ease .5s 1 + } +} + +.page-content { + padding: 30px 0 +} + +.page-content .wrapper { + position: relative; + background: #FAFAFA; + box-shadow: 0 1px 4px #999; + outline: 1px solid #CCC +} + +.page-content .wrapper:after { + clear: both; + content: ''; + display: block +} + +.page-content .wrapper:before { + content: ''; + display: block; + position: absolute; + width: 300px; + height: 100%; + right: 0; + top: 0; + background: #EEE +} + +.page-content img { + max-width: 100% +} + +.col-main { + position: relative; + box-sizing: border-box; + padding: 30px; + width: 800px; + float: left; + animation: ebani-descend ease .5s 1 +} + +.col-main h1, +.col-main h2, +.col-main h3, +.col-main h4, +.col-main .post-meta, +.col-main .rss-link { + animation: ebani-ascend ease .5s 1 +} + +.col-main article table, +.col-main article pre, +.col-main article img, +.col-main .post-excerpt table, +.col-main .post-excerpt pre, +.col-main .post-excerpt img { + animation: ebani-ascend ease .3s 1 +} + +.col-second { + position: relative; + box-sizing: border-box; + float: right; + width: 300px; + padding: 20px; + background: #EEE; + z-index: 10 +} + +.col-box { + color: #666; + font-size: 14px; + padding-bottom: 20px +} + +.col-box p { + margin: 0 +} + +.col-box ul { + padding-left: 20px; + margin: 0 +} + +.col-box:not(:first-child) { + border-top: 1px solid #ccc; + padding-top: 20px +} + +.col-box .col-box-title { + color: #333; + margin-bottom: 10px; + font-size: 15.4px +} + +@media (max-width: 1120px) { + .page-content .wrapper { + overflow: hidden + } + .page-content .wrapper .col-second, + .page-content .wrapper:before { + z-index: 10; + transition: transform .4s; + transform: translateX(300px) + } + .page-content .wrapper.expand-sidebar:before { + box-shadow: 0 0 4px #999 + } + .page-content .wrapper.expand-sidebar .col-second, + .page-content .wrapper.expand-sidebar:before { + transform: translateX(0) + } + .col-main { + width: 100% + } + .col-second { + margin-left: -300px + } +} + +.col-box-author { + text-align: center +} + +.col-box-author .avatar { + width: 135px; + height: 135px; + border-radius: 100%; + margin: 20px auto; + display: block +} + +.col-box-author .name { + font-size: 16px +} + +.col-box-author .contact { + margin-top: 10px +} + +.col-box-author .contact a { + background: #999; + color: #eee; + padding: 5px 10px; + text-decoration: none; + border-radius: 5px; + white-space: nowrap +} + +.col-box-author .contact a:hover { + transition: background 0.3s ease; + background: #666 +} + +.footer { + padding: 60px 0; + text-align: center; + color: #666; + font-size: 14px +} + +.post .post-header { + margin: 0 100px; + margin-bottom: 40px; + padding: 20px +} + +.post .post-header .post-title { + font-size: 40px; + font-weight: normal; + margin: 0 -100px; + color: #b5402e +} + +@media screen and (max-width: 600px) { + .post .post-header .post-title { + font-size: 34px + } +} + +.post .post-header .post-meta { + color: #999; + font-size: 14px; + margin: 0 -100px +} + +@media screen and (max-width: 600px) { + .post .post-header { + text-align: center; + margin-bottom: 10px; + padding: 10px + } +} + +.post .post-content { + color: #333 +} + +.post .post-content h2, +.post .post-content h3, +.post .post-content h4, +.post .post-content h5, +.post .post-content h6 { + color: #b5402e; + margin-top: 30px +} + +.post .post-content h1, +.post .post-content h2 { + margin-bottom: 10px +} + +.post .post-content h1, +.post .post-content h2, +.post .post-content h3 { + border-bottom: 1px solid #CCC +} + +.post .post-content pre { + margin: 0 -30px +} + +@media screen and (max-width: 600px) { + .post .post-content pre { + margin: 0 -10px + } +} + +.post .post-content .middle-image { + display: block; + margin-left: auto; + margin-right: auto +} + +.post .post-comments { + padding-top: 30px +} + +.home .page-heading { + font-size: 40px; + font-weight: normal; + margin: 20px +} + +@media screen and (max-width: 600px) { + .home .page-heading { + margin: 10px; + font-size: 34px + } +} + +.home .rss-link { + float: right; + text-decoration: none; + border: 1px solid; + color: #999; + background: #fff; + font-size: 11.2px; + padding: 1px 8px +} + +.home .rss-link:hover, +.home .rss-link:focus { + color: #666 +} + +.home .post-list { + margin: 0; + padding: 20px 40px; + list-style: none +} + +.home .post-list>li { + padding-bottom: 30px; + border-bottom: 1px solid #CCC; + margin-bottom: 30px +} + +.home .post-list .post-title { + font-size: 28px; + font-weight: normal; + margin: 0 +} + +.home .post-list .post-meta { + font-size: 14px; + color: #666; + margin: 0 20px; + margin-bottom: .5em +} + +.home .post-list .post-excerpt { + margin: 0 20px +} + +.home .post-list .post-excerpt, +.home .post-list .post-excerpt * { + font-size: 14px; + padding-top: 0; + padding-bottom: 0; + color: #333 +} + +.home .post-list .post-excerpt code, +.home .post-list .post-excerpt pre, +.home .post-list .post-excerpt pre * { + color: #666; + background-color: #eee +} + +.home .post-list .post-excerpt th { + border-color: #ccc; + background-color: #ccc +} + +.home .post-list .post-excerpt a { + color: rgba(165, 19, 15, 0.75) +} + +.home .post-list .post-excerpt img { + display: block; + margin: 1em auto; + max-height: 16em; + opacity: .7; + transition: opacity .3s +} + +.home .post-list .post-excerpt img:hover { + opacity: 1 +} + +@media screen and (max-width: 600px) { + .home .post-list { + padding: 10px + } +} + +.home .pagination { + text-align: center; + text-decoration: none; + color: #666; + margin: 30px 0 +} + +.home .pagination .page_number { + margin: 0 30px +} + +.home .pagination .previous, +.home .pagination .next { + padding: 10px 20px; + white-space: nowrap +} + +.home .pagination a.previous, +.home .pagination a.next { + color: #333; + border-radius: 20px; + border: 1px solid #CCC +} + +.home .pagination a.previous:hover, +.home .pagination a.next:hover { + background: #fefefe; + color: #000; + text-decoration: none +} + +@media screen and (max-width: 800px) { + .page-content { + padding: 0 + } + .footer { + padding: 15px 0 + } +} + +@media screen and (max-width: 600px) { + .header, + .header .site-nav { + text-align: center + } + .header .site-title { + float: none + } + .col-main { + padding: 10px + } + .col-box { + width: 100%; + float: none; + margin-bottom: 20px + } + pre { + padding: 10px + } +} + +.highlight .hll { + background-color: #49483e +} + +.highlight .c { + color: #75715e +} + +.highlight .err { + color: #960050; + background-color: #1e0010 +} + +.highlight .k { + color: #66d9ef +} + +.highlight .l { + color: #ae81ff +} + +.highlight .n { + color: #f8f8f2 +} + +.highlight .o { + color: #f92672 +} + +.highlight .p { + color: #f8f8f2 +} + +.highlight .cm { + color: #75715e +} + +.highlight .cp { + color: #75715e +} + +.highlight .c1 { + color: #75715e +} + +.highlight .cs { + color: #75715e +} + +.highlight .ge { + font-style: italic +} + +.highlight .gs { + font-weight: bold +} + +.highlight .kc { + color: #66d9ef +} + +.highlight .kd { + color: #66d9ef +} + +.highlight .kn { + color: #f92672 +} + +.highlight .kp { + color: #66d9ef +} + +.highlight .kr { + color: #66d9ef +} + +.highlight .kt { + color: #66d9ef +} + +.highlight .ld { + color: #e6db74 +} + +.highlight .m { + color: #ae81ff +} + +.highlight .s { + color: #e6db74 +} + +.highlight .na { + color: #a6e22e +} + +.highlight .nb { + color: #f8f8f2 +} + +.highlight .nc { + color: #a6e22e +} + +.highlight .no { + color: #66d9ef +} + +.highlight .nd { + color: #a6e22e +} + +.highlight .ni { + color: #f8f8f2 +} + +.highlight .ne { + color: #a6e22e +} + +.highlight .nf { + color: #a6e22e +} + +.highlight .nl { + color: #f8f8f2 +} + +.highlight .nn { + color: #f8f8f2 +} + +.highlight .nx { + color: #a6e22e +} + +.highlight .py { + color: #f8f8f2 +} + +.highlight .nt { + color: #f92672 +} + +.highlight .nv { + color: #f8f8f2 +} + +.highlight .ow { + color: #f92672 +} + +.highlight .w { + color: #f8f8f2 +} + +.highlight .mf { + color: #ae81ff +} + +.highlight .mh { + color: #ae81ff +} + +.highlight .mi { + color: #ae81ff +} + +.highlight .mo { + color: #ae81ff +} + +.highlight .sb { + color: #e6db74 +} + +.highlight .sc { + color: #e6db74 +} + +.highlight .sd { + color: #e6db74 +} + +.highlight .s2 { + color: #e6db74 +} + +.highlight .se { + color: #ae81ff +} + +.highlight .sh { + color: #e6db74 +} + +.highlight .si { + color: #e6db74 +} + +.highlight .sx { + color: #e6db74 +} + +.highlight .sr { + color: #e6db74 +} + +.highlight .s1 { + color: #e6db74 +} + +.highlight .ss { + color: #e6db74 +} + +.highlight .bp { + color: #f8f8f2 +} + +.highlight .vc { + color: #f8f8f2 +} + +.highlight .vg { + color: #f8f8f2 +} + +.highlight .vi { + color: #f8f8f2 +} + +.highlight .il { + color: #ae81ff +} + +.highlight .gu { + color: #75715e +} + +.highlight .gd { + color: #f92672 +} + +.highlight .gi { + color: #a6e22e +} + +.page-content .wrapper .post-toc>ul { + overflow: auto +} + +.util-notify1 { + position: absolute; + z-index: 100; + background: rgba(0, 0, 0, 0.7); + color: #FFF; + padding: 5px 10px; + font-size: 14px; + pointer-events: none; + opacity: 1; + transition: .2s ease +} + +.util-notify1.hidden { + opacity: 0; + display: none +}
\ No newline at end of file diff --git a/static/images/lazy.gif b/static/images/lazy.gif Binary files differnew file mode 100644 index 0000000..f2a1bc0 --- /dev/null +++ b/static/images/lazy.gif diff --git a/static/js/easybook.js b/static/js/easybook.js new file mode 100644 index 0000000..5edefb2 --- /dev/null +++ b/static/js/easybook.js @@ -0,0 +1,242 @@ +/*! + * EasyBook Jekyll Theme Javascript + * + * http://laobubu.github.io/jekyll-theme-EasyBook + * https://github.com/laobubu/jekyll-theme-EasyBook + * + * This is just a extension for my theme. + */ + +function TOCize(toc, content, matchHeightTo) { + if (!(toc && content && matchHeightTo)) return false + + var cnt = 0; + + var make = function (tag) { + return document.createElement(tag) + } + + var aniscroll = { + to: function (top) { + aniscroll.target = top; + if (aniscroll.running) return; + aniscroll.running = setInterval(aniscroll.tick, 20); + }, + target: 0, + running: 0, + getTop: function () { + return window.scrollY || window.pageYOffset || document.documentElement.scrollTop; + }, + setTop: function (value) { + (window['scrollTo'] && window.scrollTo(window.scrollX, value)) + }, + tick: function () { + var oldST = aniscroll.getTop(), newST = ~~((oldST + aniscroll.target) / 2); + aniscroll.setTop(newST); + if (aniscroll.getTop() < newST || Math.abs(newST - aniscroll.target) < 10) { + aniscroll.setTop(aniscroll.target); + clearInterval(aniscroll.running) + aniscroll.running = 0 + } + } + } + + function scrollToHeader(header, hash, ev) { + var y = header.getBoundingClientRect().top + aniscroll.getTop(); + if (window.history['pushState']) { + window.history.pushState({}, header.textContent, "#" + hash); + aniscroll.to(y); + ev.preventDefault(); + } else { + var y2 = aniscroll.getTop(); + setTimeout(function () { + aniscroll.setTop(y2); + aniscroll.to(y); + }, 0); + } + } + + var generateLink = function (h) { + var q = make('a'); + cnt++; + var hash = h.getAttribute('id'); + if (!hash) { + hash = ('generated-hash-' + cnt); + h.setAttribute('id', hash); + } + q.textContent = h.textContent; + q.setAttribute('href', '#' + hash); + q.addEventListener('click', scrollToHeader.bind(this, h, hash), false); + return q; + }; + + var hs = content.querySelectorAll('h1, h2, h3, h4, h5, h6'); + var cul = null, plevel = 1; + var uls = [make('ul')]; + for (var i = 0; i < hs.length; i++) { + var level = +hs[i].tagName.substr(1); + var hi = hs[i]; + var ti = make('li'); + ti.appendChild(generateLink(hi)); + if (plevel < level) { + do { + uls.push(make('ul')); + uls[uls.length - 2].appendChild(uls[uls.length - 1]); + } while (++plevel < level); + } else if (plevel > level) { + do { + cul = uls.pop(); + } while (--plevel > level); + } + cul = uls[uls.length - 1]; + cul.appendChild(ti); + } + while (true) { + var chs = uls[0].children; + if (chs.length == 1 && chs[0].tagName == 'UL') + uls.shift(); + else + break; + } + + if (!cnt) return false; + + var scrolldummy = make('div'); + toc.appendChild(scrolldummy); + toc.appendChild(uls[0]); + toc.style.display = 'block'; + + var maxHeightTOC = ''; + var ppc = document.querySelector('.col-main'); + var header_placeholder = document.querySelector('.header-placeholder'); + var s1 = function () { + var scrollTop = aniscroll.getTop(), dummyClientTop = scrolldummy.getBoundingClientRect().top - header_placeholder.offsetHeight, + margin = 10, c, d; // c = dummyHeight, d = TOC.maxHeight (+'px') + if ((c = -dummyClientTop + margin) < 0) c = 0; + if (c) { + var wh = window.innerHeight + || document.documentElement.clientHeight + || document.body.clientHeight, + cbox = matchHeightTo.getBoundingClientRect(), + vq = cbox.bottom - dummyClientTop - uls[0].offsetHeight; + if (c > vq) c = vq; + d = (wh - (margin << 1)) + 'px'; + } else { + d = ""; + } + if (d != maxHeightTOC) { //status lock. + maxHeightTOC = d; + if (d) { + uls[0].setAttribute('style', 'max-height:' + d + '; width:' + (toc.offsetWidth - 20) + "px"); + } else { + uls[0].setAttribute("style", ""); + } + } + scrolldummy.style.height = (c + 'px'); + }; + window.addEventListener('scroll', s1, false); + window.addEventListener('resize', s1, false); +} + +function PalmSidebar() { + var ww = 0; //window width + var pcw = document.querySelector('.page-content .wrapper'); + var header = document.querySelector('.header'); + var header_placeholder = document.querySelector('.header-placeholder'); + + var is_palm_mode = false; + + // do not support old browsers! + if (typeof window['getComputedStyle'] !== 'function') return; + + function s1() { + ww = window.innerWidth + || document.documentElement.clientWidth + || document.body.clientWidth; + var h = header.getBoundingClientRect(); + is_palm_mode = getComputedStyle(header).position !== 'static'; + header_placeholder.style.height = is_palm_mode ? (h.bottom - h.top + 'px') : '0px' + } + function toggleSidebar(e) { + if (/expand-sidebar/.test(pcw.className)) { + pcw.className = pcw.className.replace(/\s*expand-sidebar\s*/, ' '); + header.className = header.className.replace(/\s*expand-sidebar\s*/, ' '); + } else { + pcw.className += " expand-sidebar"; + header.className += " expand-sidebar"; + } + setTimeout(s1, 200); + } + s1(); + document.getElementById('sidebar-toggle').addEventListener('click', toggleSidebar, false); + window.addEventListener('resize', s1, false); +} + +function SelectAllize(selector, tips) { + if (!window.getSelection) return null; + + var obj = document.querySelectorAll(selector); + var selection = window.getSelection(); + var z = document.createElement("div"); + z.className = "util-notify1"; + z.textContent = tips; + document.body.appendChild(z) + + function hide() { + z.classList.add('hidden') + z.style.top = '-200px' + } + + hide(); + z.addEventListener('mouseover', hide, false); + + function clickHandler(e) { + if (!selection.isCollapsed) return; + + var tt = e.pageY - z.offsetHeight - 15; + z.setAttribute('style', 'left:' + (e.pageX - z.offsetWidth / 2) + 'px;top:' + (tt + 10) + 'px'); + z.classList.remove('hidden'); + setTimeout(hide, 1000); + } + + function dblClickHandler(e) { + selection.selectAllChildren(this); + hide(); + } + + for (var i = obj.length; i--;) { + var oi = obj[i]; + oi.addEventListener('click', clickHandler, false); + oi.addEventListener('dblclick', dblClickHandler, false); + } + + return true; +} + +function RealLoad() { + TOCize( + document.querySelector('.post-toc'), + document.querySelector('.post-content'), + document.querySelector('.col-main') + ); + + PalmSidebar(); + SelectAllize("pre", "Dblclick to select all"); + + var imgs = document.querySelectorAll('.post-content > p > img'); + for (var i = imgs.length; i--;) { + if (imgs[i].parentElement.childNodes.length === 1) { + imgs[i].classList.add('middle-image'); + } + } + + if (document.querySelector('script[type*="math/tex"]')) { + var sc = document.createElement('script'); + sc.setAttribute('type', 'text/javascript'); + sc.setAttribute('async', 'true'); + sc.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML'); + document.body.appendChild(sc); + } +} + +RealLoad();
\ No newline at end of file diff --git a/static/js/figure.js b/static/js/figure.js new file mode 100644 index 0000000..5e22618 --- /dev/null +++ b/static/js/figure.js @@ -0,0 +1,55 @@ +$(document).ready(function () { + let items = []; + $('.post-content figure').each(function () { + if ($(this).attr('class') == 'gallery-ignore') return true; // ignore any figures where class="pswp-ignore" + // get properties from child a/img/figcaption elements, + let $figure = $(this), + $img = $figure.find('img'), + $src = $img.attr('data-src'), + $title = $figure.find('figcaption').html(); + + if ($img.data('size')) { + let $size = $a.data('size').split('x'); + var item = { + 'src': $src, + 'thumb': $src, + 'subHtml': $title, + 'width': $size[0], + 'height': $size[1] + } + } else { + var item = { + 'src': $src, + 'thumb': $src, + 'subHtml': $title + } + var img = new Image(); + img.src = $src; + var wait = setInterval(function () { + var w = img.naturalWidth, + h = img.naturalHeight; + if (w && h) { + clearInterval(wait); + item.width = w; + item.height = h; + } + }, 30); + } + + var index = items.length; + items.push(item); + // console.log(item) + + $figure.on('click', function (event) { + event.preventDefault(); + $(this).lightGallery({ + dynamic: true, + download: false, + showThumbByDefault: true, + dynamicEl: items, + index: index, + thumbnail: true, + }) + }); + }); +});
\ No newline at end of file diff --git a/static/js/lazysizes.min.js b/static/js/lazysizes.min.js new file mode 100644 index 0000000..e4fce20 --- /dev/null +++ b/static/js/lazysizes.min.js @@ -0,0 +1,2 @@ +/*! lazysizes - v5.1.1 */ +!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b){"use strict";var c,d;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:d,noSupport:!0};var e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=/^img|iframe$/i,p=["load","error","lazyincluded","_lazyloaded"],q={},r=Array.prototype.forEach,s=function(a,b){return q[b]||(q[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),q[b].test(a[i]("class")||"")&&q[b]},t=function(a,b){s(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},u=function(a,b){var c;(c=s(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},v=function(a,b,c){var d=c?h:"removeEventListener";c&&v(a,b),p.forEach(function(c){a[d](c,b)})},w=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},x=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},y=function(a,b){return(getComputedStyle(a,null)||{})[b]},z=function(a,b,c){for(c=c||a.offsetWidth;c<d.minSize&&b&&!a._lazysizesWidth;)c=b.offsetWidth,b=b.parentNode;return c},A=function(){var a,c,d=[],e=[],f=d,g=function(){var b=f;for(f=d.length?e:d,a=!0,c=!1;b.length;)b.shift()();a=!1},h=function(d,e){a&&!e?d.apply(this,arguments):(f.push(d),c||(c=!0,(b.hidden?k:l)(g)))};return h._lsFlush=g,h}(),B=function(a,b){return b?function(){A(a)}:function(){var b=this,c=arguments;A(function(){a.apply(b,c)})}},C=function(a){var b,c=0,e=d.throttleDelay,g=d.ricTimeout,h=function(){b=!1,c=f.now(),a()},i=m&&g>49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:B(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},D=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a<d?k(g,d-a):(m||e)(e)};return function(){c=f.now(),b||(b=k(g,d))}},E=function(){var g,l,m,p,q,z,E,G,H,I,J,K,L=/^img$/i,M=/^iframe$/i,N="onscroll"in a&&!/(gle|ing)bot/.test(navigator.userAgent),O=0,P=0,Q=0,R=-1,S=function(a){Q--,(!a||Q<0||!a.target)&&(Q=0)},T=function(a){return null==K&&(K="hidden"==y(b.body,"visibility")),K||"hidden"!=y(a.parentNode,"visibility")&&"hidden"!=y(a,"visibility")},U=function(a,c){var d,f=a,g=T(a);for(G-=c,J+=c,H-=c,I+=c;g&&(f=f.offsetParent)&&f!=b.body&&f!=e;)(g=(y(f,"opacity")||1)>0)&&"visible"!=y(f,"overflow")&&(d=f.getBoundingClientRect(),g=I>d.left&&H<d.right&&J>d.top-1&&G<d.bottom+1);return g},V=function(){var a,f,h,j,k,m,n,o,q,r,s,t,u=c.elements;if((p=d.loadMode)&&Q<8&&(a=u.length)){for(f=0,R++;f<a;f++)if(u[f]&&!u[f]._lazyRace)if(!N||c.prematureUnveil&&c.prematureUnveil(u[f]))ba(u[f]);else if((o=u[f][i]("data-expand"))&&(m=1*o)||(m=P),r||(r=!d.expand||d.expand<1?e.clientHeight>500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,K=null,P<s&&Q<1&&R>2&&p>2&&!b.hidden?(P=s,R=0):P=p>1&&R>1&&Q<6?r:O),q!==m&&(z=innerWidth+m*t,E=innerHeight+m,n=-1*m,q=m),h=u[f].getBoundingClientRect(),(J=h.bottom)>=n&&(G=h.top)<=E&&(I=h.right)>=n*t&&(H=h.left)<=z&&(J||I||H||G)&&(d.loadHidden||T(u[f]))&&(l&&Q<3&&!o&&(p<3||R<4)||U(u[f],m))){if(ba(u[f]),k=!0,Q>9)break}else!k&&l&&!j&&Q<4&&R<4&&p>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!o&&(J||I||H||G||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);j&&!k&&ba(j)}},W=C(V),X=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;S(a),t(b,d.loadedClass),u(b,d.loadingClass),v(b,Z),w(b,"lazyloaded")},Y=B(X),Z=function(a){Y({target:a.target})},$=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},_=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},aa=B(function(a,b,c,e,f){var g,h,j,l,p,q;(p=w(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?t(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),q=b.firesLoad||!!("src"in a&&o.test(a.nodeName)&&(h||g||l)),p={target:a},t(a,d.loadingClass),q&&(clearTimeout(m),m=k(S,2500),v(a,Z,!0)),l&&r.call(j.getElementsByTagName("source"),_),h?a.setAttribute("srcset",h):g&&!l&&(M.test(a.nodeName)?$(a,g):a.src=g),f&&(h||l)&&x(a,{src:g})),a._lazyRace&&delete a._lazyRace,u(a,d.lazyClass),A(function(){var b=a.complete&&a.naturalWidth>1;q&&!b||(b&&t(a,"ls-is-cached"),X(p),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&Q--},!0)}),ba=function(a){if(!a._lazyRace){var b,c=L.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||s(a,d.errorClass)||!s(a,d.lazyClass))&&(b=w(a,"lazyunveilread").detail,f&&F.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,Q++,aa(a,b,f,e,c))}},ca=D(function(){d.loadMode=3,W()}),da=function(){3==d.loadMode&&(d.loadMode=2),ca()},ea=function(){if(!l){if(f.now()-q<999)return void k(ea,999);l=!0,d.loadMode=3,W(),j("scroll",da,!0)}};return{_:function(){q=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",W,!0),j("resize",W,!0),a.MutationObserver?new MutationObserver(W).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",W,!0),e[h]("DOMAttrModified",W,!0),setInterval(W,999)),j("hashchange",W,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,W,!0)}),/d$|^c/.test(b.readyState)?ea():(j("load",ea),b[h]("DOMContentLoaded",W),k(ea,2e4)),c.elements.length?(V(),A._lsFlush()):W()},checkElems:W,unveil:ba,_aLSL:da}}(),F=function(){var a,c=B(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f<g;f++)e[f].setAttribute("sizes",d);c.detail.dataAttr||x(a,c.detail)}),e=function(a,b,d){var e,f=a.parentNode;f&&(d=z(a,f,d),e=w(a,"lazybeforesizes",{width:d,dataAttr:!!b}),e.defaultPrevented||(d=e.detail.width)&&d!==a._lazysizesWidth&&c(a,f,e,d))},f=function(){var b,c=a.length;if(c)for(b=0;b<c;b++)e(a[b])},g=D(f);return{_:function(){a=b.getElementsByClassName(d.autosizesClass),j("resize",g)},checkElems:g,updateElem:e}}(),G=function(){!G.i&&b.getElementsByClassName&&(G.i=!0,F._(),E._())};return k(function(){d.init&&G()}),c={cfg:d,autoSizer:F,loader:E,init:G,uP:x,aC:t,rC:u,hC:s,fire:w,gW:z,rAF:A}});
\ No newline at end of file diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..638ade1 --- /dev/null +++ b/theme.toml @@ -0,0 +1,21 @@ +# theme.toml template for a Hugo theme +# See https://github.com/gohugoio/hugoThemes#themetoml for an example + +name = "Easybook" +license = "MIT" +licenselink = "https://github.com/Y4er/easybook/blob/master/LICENSE" +description = "Easybook is a simple hugo theme." +homepage = "http://Y4er.com/" +tags = ['hugo','simple'] +features = ['simple'] +min_version = "0.41" + +[author] + name = "Y4er" + homepage = "http://Y4er.com" + +# If porting an existing theme +[original] + name = "" + homepage = "" + repo = "" |