Skip to content

Commit

Permalink
feat: 添加【在线工具】菜单项
Browse files Browse the repository at this point in the history
  • Loading branch information
knightyun committed Nov 2, 2023
1 parent 3c8f17d commit 0bb13e7
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ exclude:
- README.md
- COPYING
- vendor
- minify.cmd
sass:
style: compressed
lang: zh_CN
Expand Down
1 change: 1 addition & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
</li>
<li><a class="waves-effect" href="/"><i class="material-icons">home</i>Home - 主页</a></li>
<li><a class="waves-effect" href="/projects"><i class="material-icons">description</i>Github - 项目</a></li>
<li><a class="waves-effect" href="/tools"><i class="material-icons">build</i>Tools - 在线工具</a></li>
<li><a class="waves-effect" href="/categories"><i class="material-icons">sort</i>Categories - 目录</a></li>
<li><a class="waves-effect" href="/tags"><i class="material-icons">label</i>Tags - 标签</a></li>
<li><a class="waves-effect" href="/feed.xml" target="_blank"><i class="material-icons">rss_feed</i>RSS - 订阅</a></li>
Expand Down
27 changes: 27 additions & 0 deletions _includes/tools.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% if site.github.public_repositories %}
{% assign sorted_repos = (site.github.public_repositories | sort: 'pushed_at') | reverse %}

{% for repo in sorted_repos %}
{% if repo.homepage != nil and repo.homepage != '' and repo.fork == false %}
<div class="col s12">
<div class="card hoverable">
<div class="card-image waves-effect waves-block waves-light geopattern activator"
data-pattern-id="{{repo.name}}">
<a href="{{repo.html_url}}" class="card-image-icon" target="_blank">
<i class="material-icons waves-effect waves-block waves-light tooltipped" data-position="right"
data-tooltip="Github:&lt;br&gt;{{repo.html_url}}">code</i>
</a>
<a class="card-title center-align valign-wrapper tooltipped" href="{{repo.homepage}}" data-position="right"
data-tooltip="{{repo.homepage}}" target="_blank">
{{repo.name}}
</a>
</div>
<div class="card-content valign-wrapper center-align activator">
<span class="activator grey-text text-darken-1">{{repo.description}}</span>
</div>
</div>
</div>
{% endif %}
{% endfor %}

{% endif %}
45 changes: 45 additions & 0 deletions assets/css/tools.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
---
.card
display: flex
flex-wrap: wrap
margin-bottom: 2em
overflow: auto

.card-image
overflow-x: hidden
flex: 3
min-width: 300px

.card-image-icon
position: absolute
top: 0
right: 0
i
padding: 10px
color: #fff
font-size: 20px
&:hover
color: #2196F3
border-radius: 50%
border: 1px outset #26a69a
a.card-title
position: unset
font-weight: bold
color: #fff
width: 100%
height: 100%
line-height: 100%
justify-content: center
word-break: break-all
z-index: -1

.card-content
flex: 2
min-width: 200px
overflow: hidden
font-size: 14px
line-height: 110%

span
width: 100%
1 change: 1 addition & 0 deletions assets/js/min/tools.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions assets/js/normal/tools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.geopattern').forEach(el => {
var pattern = GeoPattern.generate(el.dataset.patternId).toDataUrl();
el.style.backgroundImage = pattern;
});
});
11 changes: 11 additions & 0 deletions tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: page
title: "Online Tools"
css: ["tools.css"]
js: [
"https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js",
"tools.min.js"
]
---

{% include tools.html %}

0 comments on commit 0bb13e7

Please sign in to comment.