Skip to content

Commit

Permalink
🎨 Code format optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Feb 25, 2024
1 parent a12206b commit 7b14395
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 188 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Tw93
description: "Hi, I'm Tw93, a Frontend Engineer from China, also dabbling a bit in Swift, Rust, Python, and Sketch. I'm the creator of MiaoYan, Pake, Trendy Weekly, XRender, and WeexUi. Believing in long-termism, I am passionate about open source and enjoy experimenting with new ideas."
url: https://tw93.fun
repo: tw93/tw93.github.io
locale: zh_CN
lang: zh-cmn-Hans
timezone: Africa/El_Aaiun
Expand Down
7 changes: 1 addition & 6 deletions _includes/buy-me-coffee.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{% if site.showBuyCoffee != false %}
<div class="coffee">
<a
class="buy-me-coffee"
href="https://miaoyan.app/cats.html?name=Blog"
target="_blank"
>喜欢文章 → 去喂猫❤️</a
>
<a class="buy-me-coffee" href="https://miaoyan.app/cats.html?name=Blog" target="_blank">喜欢文章 → 去喂猫❤️</a>
</div>
{% endif %}
31 changes: 7 additions & 24 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,36 @@
<div class="footer-wrapper">
<footer role="contentinfo">
&copy; 2015~{{ site.time | date: '%Y' }}&nbsp;
<img
src="https://cdn.fliggy.com/upic/a1THPC.png"
class="github-icon"
alt="github"
/>
<a
href="https://github.com/tw93/tw93.github.io"
rel="nofollow"
target="_blank"
class="need_dotted"
>
tw93/tw93.github.io
<img src="https://cdn.fliggy.com/upic/a1THPC.png" class="github-icon" alt="github" />
<a href="https://github.com/{{site.repo}}" rel="nofollow" target="_blank" class="need_dotted">
{{site.repo}}
</a>
</footer>
</div>

<script type="text/javascript" src="{{ site.url }}/js/index.min.js"></script>
<script
type="text/javascript"
src="https://gw.alipayobjects.com/os/k/h3/heti-addon.min.js"
></script>
<script type="text/javascript" src="https://gw.alipayobjects.com/os/k/h3/heti-addon.min.js"></script>

{% if site.google_analytics %}
<script
async
src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"
></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
function gtag () {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "{{ site.google_analytics }}");
</script>
{% endif %} {% if page.url=="/" %}
<script>
function hereDoc(f) {
function hereDoc (f) {
return f
.toString()
.replace(/^[^\/]+\/\*!?\s?/, "")
.replace(/\*\/[^\/]+$/, "");
}
var string = hereDoc(function () {
/*
_ ___ _____ _ _
| | |_ | / ___| (_) | |
| | ___ __ _ _ __ _ __ | | __ ___ ____ _\ `--. ___ _ __ _ _ __ | |_
Expand Down
2 changes: 1 addition & 1 deletion _includes/giscus.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="giscus-container">
<script
src="https://giscus.app/client.js"
data-repo="tw93/tw93.github.io"
data-repo="{{site.repo}}"
data-repo-id="MDEwOlJlcG9zaXRvcnkzMDE4NDU1NQ=="
data-category="General"
data-category-id="DIC_kwDOAcyUa84CSbZ-"
Expand Down
72 changes: 30 additions & 42 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,67 +1,55 @@
<head>
<meta charset="utf-8">
<title>{% if page.layout =='post' or page.hideHomeActive or page.is404 %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="description"
content="{{ site.description }}{% if page.categories %}{{ page.categories }}{% endif %}{% if page.summary %}{{ page.summary }}{% endif %}">
<title>{% if page.layout == 'post' or page.hideHomeActive or page.is404 %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="description" content="{{ site.description }}{% if page.categories %}{{ page.categories }}{% endif %}{% if page.summary %}{{ page.summary }}{% endif %}">
{% if page.tags %}
<meta name="keywords" content="{{ page.tags | join: ', ' }}">
{% endif %}

<meta name="viewport" content="width=device-width">
<!-- Viewport and Theme Color -->
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#FFFFFF">

<!-- Open Graph -->
<!-- Open Graph Metadata -->
<meta property="og:locale" content="{{ site.locale }}">
<meta property="og:title" content="{% if page.title %}{{ page.title }} - Tw93{% else %}{{ site.title }}{% endif %}">
<meta property="og:description"
content="{% if page.summary %}{{ page.summary }}{% else %}{{ site.description }}{% endif %}">
<meta property="og:description" content="{% if page.summary %}{{ page.summary }}{% else %}{{ site.description }}{% endif %}">
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
<meta property="og:site_name" content="{{ site.title }}">
<link rel="stylesheet" href="https://gw.alipayobjects.com/os/k/font/lxgwwenkaiscreenr.css" async rel="preload" as="font">


{% if page.layout == "post" %}
<meta name="twitter:creator" content="@hiTw93">
<meta name="twitter:site" content="{{ site.url }}" />
<meta name="twitter:url" content="{{ site.url }}{{page.url}}" />
<meta name="twitter:title" content="{{ page.title }} - Tw93" />
<meta name="twitter:description" content="{{page.summary}}" />
{% if page.feature %}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ page.feature }}" />
{% else %}
<meta name="twitter:card" content="summary" />
<meta name="twitter:image" content="https://gw.alicdn.com/imgextra/i3/O1CN01cSkdn72AKKBDPm829_!!6000000008184-2-tps-2664-2664.png" />
{% endif %}
{% endif %}

{% if page.feature %}
<meta property="og:image" content="{{ page.feature }}">
{% else %}
<meta
property="og:image"
content="https://gw.alicdn.com/imgextra/i1/O1CN016ppOn21DVGJ1mVHho_!!6000000000221-0-tps-420-420.jpg"
/>
<meta property="og:image" content="https://gw.alicdn.com/imgextra/i1/O1CN016ppOn21DVGJ1mVHho_!!6000000000221-0-tps-420-420.jpg">
{% endif %}

<!-- Twitter Metadata -->
{% if page.layout == "post" %}
<meta name="twitter:card" content="{% if page.feature %}summary_large_image{% else %}summary{% endif %}">
<meta name="twitter:creator" content="@{{ site.twitter }}">
<meta name="twitter:site" content="{{ site.url }}">
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
<meta name="twitter:title" content="{{ page.title }} - Tw93">
<meta name="twitter:description" content="{{ page.summary }}">
<meta name="twitter:image" content="{% if page.feature %}{{ page.feature }}{% else %}https://gw.alicdn.com/imgextra/i3/O1CN01cSkdn72AKKBDPm829_!!6000000008184-2-tps-2664-2664.png{% endif %}">
{% endif %}

{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url |
remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<!-- Canonical URL -->
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove: 'index.html' | strip_slash }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}">
<link href="{{ site.url }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">

<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover" />

<!-- Styles and Scripts -->
<link rel="stylesheet" href="{{ site.url }}/css/index.css">

<meta http-equiv="cleartype" content="on">

<link rel="shortcut icon" href="https://gw.alipayobjects.com/zos/k/h9/1.png">

<link rel="stylesheet" href="https://gw.alipayobjects.com/os/k/font/lxgwwenkaiscreenr.css" async rel="preload" as="font">
{% if page.layout == "post" %}
<script src="//gw.alipayobjects.com/os/k/tw93/lazysizes.min.js" async></script>
{% endif %}

<!-- Favicon -->
<link rel="shortcut icon" href="https://gw.alipayobjects.com/zos/k/h9/1.png">

<!-- Additional Meta Tags -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<link href="{{ site.url }}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
</head>
30 changes: 8 additions & 22 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
<!--[if lt IE 10]>
<div class="upgrade"><strong><a href="http://whatbrowser.org/" target="_blank">Your browser is quite old!</strong> Why
not upgrade to a different browser to better enjoy this site?</a></div>
<![endif]-->

{% assign homeActive = 'active' %}
{% if page.hideHomeActive %}
{% assign homeActive = nil %}
{% endif %}
{% assign homeActive = page.hideHomeActive | default: false | bool ? nil : 'active' %}
<div class="header-menu" id="J_header">
<ul class="header-item-container">
<li class="header-item-title {{homeActive}}">
<a href="{{site.url}}/" class="title"> {{ site.title }}</a>
<li class="header-item-title {{ homeActive }}">
<a href="{{ site.url }}/" class="title">{{ site.title }}</a>
</li>
{% for menu in site.menu reversed %}

{% assign class = nil %}
{% if (page.url contains menu.url and menu.url != '/') %}
{% assign class = 'active' %}
{% endif %}

{% assign class = page.url contains menu.url and menu.url != '/' ? 'active' : nil %}
{% if menu.url contains 'http://' or menu.url contains 'https://' %}
<li class="header-item {{class}}"><a href="{{menu.url}}" target="_blank">{{ menu.title }}</a></li>
<li class="header-item {{ class }}"><a href="{{ menu.url }}" target="_blank">{{ menu.title }}</a></li>
{% else %}
<li class="header-item {{class}}"><a href="{{site.url}}{{menu.url}}">{{ menu.title }}</a></li>
<li class="header-item {{ class }}"><a href="{{ site.url }}{{ menu.url }}">{{ menu.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
</div>

<div class="entry-header">
<svg width="100%" height="200" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<svg width="100%" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<path id="svg-title-path">
<animate attributeName="d" from="m0,110 h0" to="m0,110 h1600" dur="2s" repeatCount="1" fill="freeze" begin="0s" />
</path>
<text font-size="34" font-weight="bold" fill='#ffffff' x="50%" y="50%" text-anchor="middle" word-spacing="2.0" letter-spacing="0.9">
<text font-size="34" font-weight="bold" fill="#ffffff" x="50%" y="50%" text-anchor="middle" word-spacing="2.0" letter-spacing="0.9">
<textPath xlink:href="#svg-title-path">{{ page.title }}</textPath>
</text>
</svg>
Expand Down
16 changes: 4 additions & 12 deletions _includes/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,9 @@

{% for index in (page_start..page_end) %}
{% if index == paginator.page %}
<li><strong class="current-page">{{index}}</strong></li>
<li><strong class="current-page">{{ index }}</strong></li>
{% else %}
{% comment %} Distance from current page and this link {% endcomment %}
{% assign dist = paginator.page | minus: index %}
{% if dist < 0 %}
{% comment %} Distance must be a positive value {% endcomment %}
{% assign dist = 0 | minus: dist %}
{% endif %}
<li><a href="{{ site.url }}/page{{ index }}/">{{index}}</a></li>
<li><a href="{{ site.url }}/page{{ index }}/">{{ index }}</a></li>
{% endif %}
{% endfor %}

Expand All @@ -50,14 +44,12 @@
{% endif %}

{% if paginator.page == paginator.total_pages %}
<li><strong class="current-page">{{ paginator.page }}</strong></li>
<li><strong class="current-page">{{ paginator.total_pages }}</strong></li>
{% else %}
<li><a href="{{ site.url }}/page{{ paginator.total_pages }}/">{{ paginator.total_pages }}</a></li>
{% endif %}

{% comment %}
Link next page
{% endcomment %}
{% comment %} Link for next page {% endcomment %}
{% if paginator.next_page %}
<li><a href="{{ site.url }}/page{{ paginator.next_page }}/" class="btn-arrow">&gt;</a></li>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion _includes/ppt-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
});

function changeAspect() {
function changeAspect () {
//缩放控制
const defaultAspect = 1536 / 960;
const innerHeight = window.innerHeight;
Expand Down
10 changes: 2 additions & 8 deletions _includes/ppt-head.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<link rel="stylesheet" href="{{ site.url }}/js/ppt/dist/reveal.css"/>
<link rel="stylesheet" href="{{ site.url }}/js/ppt/dist/reveal.css" />
<link rel="stylesheet" href="{{ site.url }}/js/ppt/dist/theme/white.css" id="theme" />
<script src="{{ site.url }}/js/ppt/dist/reveal.js"></script>
<script src="{{ site.url }}/js/ppt/plugin/markdown/markdown.js"></script>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0,
maximum-scale=1.0, minimum-scale=1.0,
viewport-fit=contain"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0,viewport-fit=contain" />
<title>{{ page.title }}</title>

2 changes: 1 addition & 1 deletion _includes/read-more.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if page.previous.url and site.related_posts.size > 0 and page.previous.hide !=true%}
<a class="read-more" href="{{ site.url }}{{ page.previous.url }}" title="{{ page.previous.url.title }}">
<div class="read-more-header">
<div class="read-more-btn">Read More</div>
<div class="read-more-btn">Read More</div>
</div>
<div class="read-more-content">
<h3>{{ page.previous.title}}</h3>
Expand Down
12 changes: 7 additions & 5 deletions _layouts/home.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!doctype html>
<html class="no-js" lang="{{site.lang}}">
{% include head.html %}

<body id="post-index">
{% include header.html %}
<div id="main" role="main">
{{ content }}
</div>
{% include footer.html %}
{% include header.html %}
<div id="main" role="main">
{{ content }}
</div>
{% include footer.html %}
</body>

</html>
22 changes: 12 additions & 10 deletions _layouts/page.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!doctype html>
<html class="no-js" lang="{{site.lang}}">
{% include head.html %}

<body id="page">
{% include header.html %}
<div id="main" role="main">
<article class="hentry">
<div class="entry-content">
{{ content }}
</div>
{% include giscus.html %}
</article>
</div>
{% include footer.html %}
{% include header.html %}
<div id="main" role="main">
<article class="hentry">
<div class="entry-content">
{{ content }}
</div>
{% include giscus.html %}
</article>
</div>
{% include footer.html %}
</body>

</html>
Loading

0 comments on commit 7b14395

Please sign in to comment.