Skip to content

Commit

Permalink
移动端增加主题切换功能。 完善 2.0 相关代码
Browse files Browse the repository at this point in the history
fix #295
  • Loading branch information
LIlGG committed Dec 8, 2022
1 parent d284fc3 commit 9bc7723
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 36 deletions.
10 changes: 5 additions & 5 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -960,31 +960,31 @@ spec:
bg_night: false
bg_isdefault: true
- bg_name: sakura
bg_url: https://view.lixingyong.com/images/2020/07/23/695cc3a80b21ee7f18bd731824ab9638.png
bg_url: /themes/theme-sakura/assets/images/themes/sakura.png
bg_img_strategy: none
bg_icon: iconfont icon-sakura
bg_night: false
bg_isdefault: false
- bg_name: gribs
bg_url: https://view.lixingyong.com/images/2020/07/23/defc1b6783cd16774900517d3b38ded7.jpg
bg_url: /themes/theme-sakura/assets/images/themes/gribs.jpg
bg_img_strategy: none
bg_icon: fa fa-slack
bg_night: false
bg_isdefault: false
- bg_name: KAdots
bg_url: https://view.lixingyong.com/images/2020/07/23/kyotoanimation.png
bg_url: /themes/theme-sakura/assets/images/themes/kyotoanimation.png
bg_img_strategy: none
bg_icon: iconfont icon-dots
bg_night: false
bg_isdefault: false
- bg_name: totem
bg_url: https://view.lixingyong.com/images/2020/07/23/little-monster.png
bg_url: /themes/theme-sakura/assets/images/themes/little-monster.png
bg_img_strategy: none
bg_icon: fa fa-optin-monster
bg_night: false
bg_isdefault: false
- bg_name: pixiv
bg_url: https://view.lixingyong.com/images/2020/07/23/star02.png
bg_url: /themes/theme-sakura/assets/images/themes/star02.png
bg_img_strategy: none
bg_icon: iconfont icon-pixiv
bg_night: false
Expand Down
Binary file added templates/assets/images/themes/gribs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/assets/images/themes/kyotoanimation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/assets/images/themes/sakura.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/assets/images/themes/star02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 16 additions & 8 deletions templates/assets/script/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,6 @@ var LIlGGAttachContext = {
* 切换主题开关
*/
var changeSkinGear = function () {
// 这里使用off来解决匿名空间的问题
$(".changeSkin-gear")
.off("click")
.on("click", function () {
$(".skin-menu").toggleClass("show");
});

//绑定主题子项点击事件
Object.keys(bgConfig).forEach(function (currBg) {
$(".skin-menu " + "#" + currBg).on("click", function () {
Expand Down Expand Up @@ -535,6 +528,18 @@ var LIlGGAttachContext = {
changeSkinGear();
}

$(".changeSkin-gear")
.off("click")
.on("click", function () {
$(".skin-menu").toggleClass("show");
});

$("#m-changskin")
.off("click")
.on("click", function () {
$(".skin-menu").toggleClass("show");
});

return {
changeSkinSecter: changeSkinSecter,
};
Expand All @@ -543,12 +548,15 @@ var LIlGGAttachContext = {
MGT: function () {
var offset = 20,
scroll_top_duration = 700,
$m_back_to_top = $(".m-cd-top");
$m_back_to_top = $(".m-cd-top"),
$m_changskin = $("#m-changskin");
$(window).scroll(function () {
if ($(this).scrollTop() > offset) {
$m_back_to_top.addClass("cd-is-visible");
$m_changskin.addClass("cd-is-visible");
} else {
$m_back_to_top.removeClass("cd-is-visible");
$m_changskin.removeClass("cd-is-visible");
}
});
$m_back_to_top.on("click", function (event) {
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/script/app.min.js

Large diffs are not rendered by default.

79 changes: 62 additions & 17 deletions templates/assets/styles/style.css

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

2 changes: 1 addition & 1 deletion templates/assets/styles/style.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/assets/styles/style.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions templates/inc/decorate.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
}
body.dark #archives-temp h3,
body.dark #moblieGoTop,
body.dark #changskin,
body.dark #m-changskin,
body.dark .the-feature.from_left_and_right a:hover .info p,
body.dark .the-feature.from_left_and_right .info,
body.dark .ins-section .ins-search-item:hover,
Expand All @@ -249,7 +249,7 @@
}

body.dark #moblieGoTop:hover,
body.dark #changskin:hover {
body.dark #m-changskin:hover {
color: /*[(${theme.config.theme.theme_dark})]*/ ;
opacity: 0.8;
}
Expand Down
2 changes: 2 additions & 0 deletions templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ <h1 th:unless="${#strings.isEmpty(site.logo)}" class="site-title">
></span>
</div>
</div>
<!-- mobile changeskin -->
<button id="m-changskin"><i class="iconfont icon-gear inline-block rotating"></i></button>
<div class="skin-menu no-select">
<div class="theme-controls row-container">
<ul class="menu-list">
Expand Down
2 changes: 1 addition & 1 deletion theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
name: LIlGG
website: https://lixingyong.com
description: Halo 2.x 版本樱花🌸主题
logo:
logo: /themes/theme-sakura/assets/images/other/iloli.gif
website: https://github.com/LIlGG/halo-theme-sakura
repo: https://github.com/LIlGG/halo-theme-sakura.git
settingName: theme-sakura-setting
Expand Down

0 comments on commit 9bc7723

Please sign in to comment.