Skip to content

Commit

Permalink
🎉 Feat: add Watermark support (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Jan 8, 2022
1 parent 80d63f6 commit dcd1909
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 131 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "assets/lib/watermark"]
path = assets/lib/watermark
url = [email protected]:Lruihao/watermark.git
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v0.2.12

- :tada: Feat: add PWA support
- :tada: Feat: add Watermark support ([#16](https://github.com/Lruihao/FixIt/issues/16))
- :bug: Fix: add scroll-margin to headerlink
- :bug: Fix: Check if content is empty beforing passing
- :bug: Fix: toc-auto display error ([#21](https://github.com/Lruihao/FixIt/issues/21))
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Thanks to the authors of following resources included in the theme:
* [Gitalk](https://github.com/gitalk/gitalk)
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)
* [Watermark](https://github.com/Lruihao/watermark)

## Author

Expand Down
3 changes: 2 additions & 1 deletion assets/lib/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ [email protected] https://github.com/ellisonleao/sharer.js
[email protected] https://github.com/simple-icons/simple-icons
[email protected] https://github.com/twitter/twemoji
[email protected] https://github.com/alexmacarthur/typeit
[email protected] https://github.com/xCss/Valine
[email protected] https://github.com/xCss/Valine
[email protected] https://github.com/Lruihao/watermark.git
1 change: 1 addition & 0 deletions assets/lib/watermark
Submodule watermark added at fb1059
38 changes: 36 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ enableEmoji = true
# website images for Open Graph and Twitter Cards
# 网站图片, 用于 Open Graph 和 Twitter Cards
images = ["/logo.png"]
# enable PWA
# 开启 PWA 支持
# enable PWA since v0.2.12
# 开启 PWA 支持(>v0.2.12 版本)
enablePWA = true

# Header config
Expand Down Expand Up @@ -973,6 +973,40 @@ enableEmoji = true
# 打字结束之后光标的持续时间 (单位是毫秒, "-1" 代表无限大)
duration = -1

# Watermark config since v0.2.12
# Detail config see https://github.com/Lruihao/watermark#readme
# 水印配置
# 详细参数见 https://github.com/Lruihao/watermark#readme
[params.watermark]
enable = true
# watermark's text
# 水印内容
content = 'Theme FixIt'
# watermark's transparency
# 水印透明度
opacity = 0.02
# parent of watermark's container
# 水印父节点
appendTo = '.wrapper>.main'
# watermark's width. unit: px
# 单水印宽度 单位:px
width = 150
# watermark's height. unit: px
# 单水印高度 单位:px
height = 20
# row spacing of watermarks. unit: px
# 水印行间距 单位:px
rowSpacing = 60
# col spacing of watermarks. unit: px
# 水印列间距 单位:px
colSpacing = 30
# watermark's tangent angle. unit: deg
# 水印旋转角度 单位:deg
rotate = 15
# watermark's fontSize. unit: rem
# 水印字体大小,单位:rem
fontSize = 0.85

# Site verification code for Google/Bing/Yandex/Pinterest/Baidu
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
Expand Down
21 changes: 0 additions & 21 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@
</a>
</div>

{{- /* PWA */ -}}
{{- if eq .Site.Params.enablePWA true -}}
{{- if eq hugo.Environment "production" -}}
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/service-worker.min.js', { scope: '/' })
.then(function (registration) {
// console.log('Service Worker Registered');
})
.catch(function (error) {
console.error('error: ', error);
});
navigator.serviceWorker.ready.then(function (registration) {
// console.log('Service Worker Ready');
});
}
</script>
{{- end -}}
{{- end -}}

{{- /* Load JavaScript scripts and CSS */ -}}
{{- partial "assets.html" . -}}
</body>
Expand Down
257 changes: 150 additions & 107 deletions layouts/partials/assets.html

Large diffs are not rendered by default.

0 comments on commit dcd1909

Please sign in to comment.