Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
chem-cat authored Sep 26, 2022
1 parent a8c5005 commit 6f861ba
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _includes/ext-adsense.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Google Adsense -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-5750060815915776"
data-ad-slot="6446850432"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
43 changes: 43 additions & 0 deletions _includes/ext-mathjax.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!-- MathJax数学公式支持 -->
<style>
.has-jax {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: transparent !important;
line-height: normal !important;
word-break: normal !important;
padding: 0 !important;
margin: 0 !important;
}
.has-jax * {
outline: 0;
}
</style>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showProcessingMessages: false,
messageStyle: "none",
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'a']
},
"HTML-CSS": {
showMathMenu: false
}
});
// 父级元素添加类名,便于css控制
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax();
var i = 0;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
></script>
17 changes: 17 additions & 0 deletions _includes/ext-serviceWorker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
;(function () {
// var extServiceWorker = true
var extServiceWorker = '{{ site.extServiceWorker }}' === 'true'
if (!extServiceWorker) return
if (!navigator.serviceWorker) return
if (location.protocol !== 'https:' && location.hostname !== '127.0.0.1') return
window.addEventListener('load', function () {
navigator.serviceWorker.register(blog.baseurl + '/service-worker.js').catch(function (e) {
console.error('serviceWorker register fail', e)
})
navigator.serviceWorker.addEventListener('controllerchange', () => {
window.location.reload()
})
})
})()
</script>
11 changes: 11 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<footer class="footer">
<span>{{ site.footerText }}</span>
<a href="{{ site.baseurl }}/static/xml/rss.xml">RSS订阅</a>
{%- comment %} 感谢本主题作者:https://github.com/TMaize/tmaize-blog 制作的精美主题{% endcomment %}
<span>心之所向,行必将至</span>
<a href="https://gitee.com/chemcat/chemcat-blog"> </a>
</footer>
<div id="to-top">
<span></span>
<span></span>
</div>
62 changes: 62 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{%- assign buildAt = site.time | date: "%Y%m%d%H%M%S" -%}
<head>
<title>{{ page.title }}-{{ site.title }}</title>
<meta charset="utf-8" />
<meta http-equiv="content-language" content="zh-CN" />
<meta name="theme-color" content="#ffffff" />
<meta name="supported-color-schemes" content="light dark">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="applicable-device" content="pc,mobile">
<meta name="author" content="{{ site.author }}" />
{%- if page.categories %}
<meta name="description" content="{{ page.title }}"/>
<meta name="keywords" content="{{ site.author }}{% for category in page.categories %},{{ category }}{% endfor %}"/>
{% else %}
<meta name="description" content="{{ site.description }}"/>
<meta name="keywords" content="{{ site.keywords }}"/>
{% endif -%}
<link rel="icon" href="{{site.baseurl}}/static/img/favicon.ico" />
<link rel="apple-touch-icon" href="{{site.baseurl}}/static/img/logo.png" />
<link rel="stylesheet" href="{{site.baseurl}}/static/css/common.css?t={{buildAt}}">
<link rel="stylesheet" href="{{site.baseurl}}/static/css/theme-dark.css?t={{buildAt}}">
{%- if page.layout == "mypost" %}
<link rel="stylesheet" href="{{site.baseurl}}/static/css/post.css?t={{buildAt}}">
<link rel="stylesheet" href="{{site.baseurl}}/static/css/code-dark.css?t={{buildAt}}">
<link rel="stylesheet" href="{{site.baseurl}}/static/css/code-light.css?t={{buildAt}}">
{%- endif %}
{%- if page.layout == "page" %}
<link rel="stylesheet" href="{{site.baseurl}}/static/css/page.css?t={{buildAt}}">
{%- endif %}
<link rel="prefetch" href="{{site.baseurl}}/static/xml/search.xml?t={{ buildAt }}">
<link rel="prefetch" href="{{site.baseurl}}/static/js/search.js?t={{ buildAt }}">
<script>
window.blog = {
baseurl:"{{site.baseurl}}",
buildAt:"{{buildAt}}",
darkTheme: false,
setDarkTheme: function (dark) {
this.darkTheme = Boolean(dark);
document.documentElement.className = this.darkTheme ? 'dark': '';
document.querySelector('meta[name=theme-color]').setAttribute('content', this.darkTheme ? '#2D2E32': '#FFFFFF');
}
}
// 设置默认夜间模式
// if (sessionStorage.darkTheme !== undefined) {
if (sessionStorage.darkTheme == undefined) {
sessionStorage.darkTheme = 'true';
}
blog.setDarkTheme(sessionStorage.darkTheme === 'true'); // 记忆值,单个窗口内有效
// } else {
// blog.setDarkTheme(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches); // 跟随系统
// }
// if (window.matchMedia) {
// var media = window.matchMedia('(prefers-color-scheme: dark)');
// media.addListener(function (ev) {
// blog.setDarkTheme(ev.currentTarget.matches);
// sessionStorage.removeItem('darkTheme');
// });
// }
</script>
</head>
8 changes: 8 additions & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<header class="header">
<img class="logo" src="https://gcore.jsdelivr.net/gh/chem-cat/image-repo@main//logo.jpg" alt="logo"/>
<nav class="menu">
{% for menu in site.menu -%}
<a href="{{ site.baseurl }}{{ menu.url }}" class="hover-underline">{{ menu.title }}</a>
{% endfor -%}
</nav>
</header>
17 changes: 17 additions & 0 deletions _includes/script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{%- assign buildAt = site.time | date: "%Y%m%d%H%M%S" -%}
<script type="text/javascript" src="{{site.baseurl}}/static/js/blog.js?t={{ buildAt }}"></script>
<script type="text/javascript" src="{{site.baseurl}}/static/js/search.js?t={{ buildAt }}"></script>

{%- if site.extClickEffect %}
<!-- 点击页面文字冒出特效 -->
<script>
;(function(){
var textArr = ['(๑•̀ㅂ•́)و✧', '(づ ̄3 ̄)づ╭❤~', 'Σ( ° △ °|||)︴', 'ヽ(✿゚▽゚)ノ', '♪(^∇^*)', 'o( ̄ヘ ̄o#)', '(○` 3′○)', 'o(≧口≦)o', '(*/ω\*)', '~( TロT)σ', 'ヾ(^▽^*)))', 'ヾ(´・ω・`)ノ']
window.blog.initClickEffect(textArr)
})()
</script>
{% endif %}

{%- if site.extMath and page.layout=="mypost" -%}
{% include ext-mathjax.html %}
{% endif %}

0 comments on commit 6f861ba

Please sign in to comment.