Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dark mode& back to top button& Aplayer #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ url:
# 添加你的博客的二级域名,一般来说是你的repository名
# 如果你的博客的URL是:(http://yourusername.github.io/repository-name)
# 那么就写成 "/repository-name"
baseurl: /LOFFER
baseurl: /LOFFER_addDarkMode


#
Expand Down
61 changes: 61 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<!--Link modify-->
<script type="text/javascript">
$(document).ready(function() {
//为超链接加上target='_blank'属性
// $('a[href^="http"]').each(function() {
$('a[title^="out"]').each(function() {
$(this).attr('target', '_blank');
});
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
Expand All @@ -25,6 +36,56 @@
});
</script>

<!--APlayerStart-->
<style>
li {margin: 0em 0;}
button {min-height: 0px;}
.aplayer {margin: 0 0 1.75em 0 !important;}
</style>
<!-- require APlayer -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!--APlayerOver-->
<!-- require MetingJS -->
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>
<!-- Created with Jekyll Now - http://github.com/barryclark/jekyll-now -->
<!-- toko -->
<script>
fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
const hitokoto = document.getElementById('hitokoto')
const hitokoto2 = document.getElementById('hitokoto2')
hitokoto.href = 'https://hitokoto.cn/?uuid=' + data.uuid
hitokoto.innerText = data.hitokoto
hitokoto2.href = 'https://hitokoto.cn/?uuid=' + data.uuid
hitokoto2.innerText = data.hitokoto
})
.catch(console.error)

</script>

<script>
function darkMode() {

var body = document.body;
body.classList.toggle("dark-mode");
}

function detectDarkMode() {
// 如果系统的暗色模式已经关闭
if (window.matchMedia && !window.matchMedia('(prefers-color-scheme: dark)').matches) {
var body = document.body;
body.classList.remove("dark-mode");
} else {
var body = document.body;
body.classList.add("dark-mode");

}
}

// window.addEventListener('load', detectDarkMode);
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', detectDarkMode);

</script>
</head>
2 changes: 2 additions & 0 deletions _includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ <h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
<div class="wrapper-footer-desktop">
<footer class="footer">
{% include footer.html %}
<!-- toko -->
<p id="hitokoto">:D 获取中...</p>
</footer>
</div>
</div>
13 changes: 13 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<html>
{% include head.html %}
<body>
<script>
detectDarkMode();
</script>
{% include nav.html %}

{% if page.toc==true %}
Expand All @@ -17,6 +20,14 @@
</div>

{% include analytics.html %}
<!-- dark mode button -->
<button id="dark-mode-button" class="btn-dark" onclick="darkMode()">
<img src="{{ site.url }}{{ site.baseurl }}/images/sun.ico" alt="亮色模式按钮" id="sun-icon">
<img src="{{ site.url }}{{ site.baseurl }}/images/moon.ico" alt="暗色模式按钮" id="moon-icon">
</button>
<!-- back to top button -->
<script src="{{ site.url }}{{ site.baseurl }}/assets/js/back-to-top.js"></script>
<button id="btn-top" class="btn-top" title= "Go to top">&#11165</button>
</body>

{% if page.toc==true %}
Expand All @@ -28,6 +39,8 @@
<div class="wrapper-footer-mobile">
<footer class="footer">
{% include footer.html %}
<!-- toko -->
<p id="hitokoto2">:D 获取中...</p>
</footer>


Expand Down
234 changes: 158 additions & 76 deletions _sass/_highlights.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,163 @@ pre, code {
font-family: $code-font;
}

code.highlighter-rouge {
font-size: 90%;
color: $oc-indigo-9;
background-color: $oc-gray-1;
padding: .1em .2em;
border-radius: 3px;
}
code.highlighter-rouge {
font-size: 90%;
color: $oc-indigo-9;
background-color: $oc-gray-1;
padding: .1em .2em;
border-radius: 3px;
}

pre.highlight {
font-size: $small-font-size;
padding: .45em .45em .45em .625em;
border: 1px solid $oc-gray-3;
border-radius: 3px;
margin: 1em 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
pre.highlight {
font-size: $small-font-size;
padding: .45em .45em .45em .625em;
border: 1px solid $oc-gray-3;
border-radius: 3px;
margin: 1em 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
}

.highlight { background: $oc-gray-0; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

.dark-mode{

code.highlighter-rouge {
font-size: 90%;
color: $oc-indigo-2;
background-color: $oc-gray-8;
padding: .1em .2em;
border-radius: 3px;
}

pre.highlight {
font-size: $small-font-size;
padding: .45em .45em .45em .625em;
border: 1px solid $oc-gray-6;
border-radius: 3px;
margin: 1em 0;
overflow: auto;
-webkit-overflow-scrolling: touch;
}

.highlight { background: $oc-gray-0; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
.highlight { background: $oc-gray-7; }
.highlight .c { color: #9999884f; font-style: italic } /* Comment */
.highlight .err { color: #f3ccccf6; background-color: #675555 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #9999884f; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #9999884f; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #d1d18664; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #969696; background-color: #a38a8a } /* Generic.Deleted */
.highlight .gd .x { color: #ffffff; background-color: #a26c6c } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #470101 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #ffffff; background-color: #88a188 } /* Generic.Inserted */
.highlight .gi .x { color: #ffffff; background-color: #8ddb8d } /* Generic.Inserted.Specific */
.highlight .go { color: #c4c4c4 } /* Generic.Output */
.highlight .gp { color: #888888 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #d7d5d5 } /* Generic.Subheading */
.highlight .gt { color: #6c0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #558ca4; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #7ce3f5a8 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
}
Loading