调整3D标签云js加载时机,优化鼠标风格文件引入方式

This commit is contained in:
j m 2024-05-30 07:46:43 +08:00
parent 26e17fbb79
commit 53e3a69f51
7 changed files with 33 additions and 35 deletions

View File

@ -64,7 +64,7 @@ spec:
value: false value: false
help: 固定标题栏时不会随着页面滚动而隐藏,始终显示标题栏。 help: 固定标题栏时不会随着页面滚动而隐藏,始终显示标题栏。
options: options:
- label: 不固定 - label: 默认
value: false value: false
- label: 固定 - label: 固定
value: true value: true

View File

@ -578,22 +578,6 @@ const commonContext = {
DreamConfig.effects_universe_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/universe.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_universe_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/universe.min.js?mew=${DreamConfig.theme_version}`)
DreamConfig.effects_circle_magic_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/circleMagic.min.js?mew=${DreamConfig.theme_version}`) DreamConfig.effects_circle_magic_mode && Utils.cachedScript(`${DreamConfig.theme_base}/js/effects/circleMagic.min.js?mew=${DreamConfig.theme_version}`)
}, },
/*初始化标签云滚动样式*/
initTagCloud() {
if (!$('.tagcloud').length || !DreamConfig.show_tagcloud_style) {
return
}
tagcloud({
selector: '.tagcloud .card-content', //元素选择器
fontsize: 18, //基本字体大小, 单位px
radius: 75, //滚动半径, 单位px
mspeed: 'slow', //滚动最大速度, 取值: slow, normal(默认), fast
ispeed: 'slow', //滚动初速度, 取值: slow, normal(默认), fast
direction: 45, //初始滚动方向, 取值角度(顺时针360): 0对应top, 90对应left, 135对应right-bottom(默认)...
keep: false //鼠标移出组件后是否继续随鼠标滚动, 取值: false, true(默认) 对应 减速至初速度滚动, 随鼠标滚动
})
},
/* 显示主题版本信息 */ /* 显示主题版本信息 */
showThemeVersion() { showThemeVersion() {
if (!DreamConfig.enable_console_version_info) { if (!DreamConfig.enable_console_version_info) {

View File

@ -11,4 +11,4 @@
</div> </div>
<div class="progress-percentage">${e.percent}</div> <div class="progress-percentage">${e.percent}</div>
</div> </div>
</div>`}),$(".aside-timelife").html(n)}},initSecurityLink(){DreamConfig.enable_security_link&&DreamConfig.security_link_url&&0!==DreamConfig.security_link_url.length&&$(document).on("click","a[target=_blank]",e=>{e.preventDefault();var t,e=$(e.currentTarget).attr("href"),n=window.location.hostname;window.open("_blank").location=(n=n,t=(t=e).toLowerCase().trim(),n=n.toLowerCase().trim(),t.startsWith("//")?t=window.location.protocol+t:t.startsWith("/")&&(t=window.location.origin+t),(t=t.startsWith("http://")||t.startsWith("https://")?t.replace(/\/$/,""):t).includes(n)?e:DreamConfig.security_link_url+"?target="+encodeURIComponent(e))})},initGrayMode(){var e,t,n;(!0===DreamConfig.gray_mode||"custom"===DreamConfig.gray_mode&&(e=Date.now(),t=new Date(DreamConfig.gray_mode_start_time).getTime(),n=new Date(DreamConfig.gray_mode_end_time).getTime(),t<=e)&&e<=n)&&$("html").addClass("gray-mode")},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},initTagCloud(){$(".tagcloud").length&&DreamConfig.show_tagcloud_style&&tagcloud({selector:".tagcloud .card-content",fontsize:18,radius:75,mspeed:"slow",ispeed:"slow",direction:45,keep:!1})},showThemeVersion(){DreamConfig.enable_console_version_info&&window.logger(`%c页面加载耗时${Math.round(performance.now())}ms | Theme By Dream2 Plus `+DreamConfig.theme_version,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;let o=-1;{const n=["initCarousel","sparkInput","websiteTime"],i=["initEffects","showThemeVersion"];Object.keys(t).forEach(e=>!n.includes(e)&&!i.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),n.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){i.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})(); </div>`}),$(".aside-timelife").html(n)}},initSecurityLink(){DreamConfig.enable_security_link&&DreamConfig.security_link_url&&0!==DreamConfig.security_link_url.length&&$(document).on("click","a[target=_blank]",e=>{e.preventDefault();var t,e=$(e.currentTarget).attr("href"),n=window.location.hostname;window.open("_blank").location=(n=n,t=(t=e).toLowerCase().trim(),n=n.toLowerCase().trim(),t.startsWith("//")?t=window.location.protocol+t:t.startsWith("/")&&(t=window.location.origin+t),(t=t.startsWith("http://")||t.startsWith("https://")?t.replace(/\/$/,""):t).includes(n)?e:DreamConfig.security_link_url+"?target="+encodeURIComponent(e))})},initGrayMode(){var e,t,n;(!0===DreamConfig.gray_mode||"custom"===DreamConfig.gray_mode&&(e=Date.now(),t=new Date(DreamConfig.gray_mode_start_time).getTime(),n=new Date(DreamConfig.gray_mode_end_time).getTime(),t<=e)&&e<=n)&&$("html").addClass("gray-mode")},initEffects(){Utils.isMobile()||(DreamConfig.cursor_move&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/move/${DreamConfig.cursor_move}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.cursor_click&&Utils.cachedScript(`${DreamConfig.theme_base}/js/cursor/click/${DreamConfig.cursor_click}.min.js?mew=`+DreamConfig.theme_version),DreamConfig.enable_live2d&&Utils.cachedScript(DreamConfig.theme_base+"/js/autoload.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_lantern_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/lantern.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_sakura_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/sakura.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_snowflake_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/snowflake.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_universe_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/universe.min.js?mew="+DreamConfig.theme_version),DreamConfig.effects_circle_magic_mode&&Utils.cachedScript(DreamConfig.theme_base+"/js/effects/circleMagic.min.js?mew="+DreamConfig.theme_version))},showThemeVersion(){DreamConfig.enable_console_version_info&&window.logger(`%c页面加载耗时${Math.round(performance.now())}ms | Theme By Dream2 Plus `+DreamConfig.theme_version,"color:#fff; background: linear-gradient(270deg, #986fee, #8695e6, #68b7dd, #18d7d3); padding: 8px 15px; border-radius: 0 15px 0 15px")}};window.commonContext=t;let o=-1;{const n=["initCarousel","sparkInput","websiteTime"],i=["initEffects","showThemeVersion"];Object.keys(t).forEach(e=>!n.includes(e)&&!i.includes(e)&&t[e]()),document.addEventListener("DOMContentLoaded",function(){$("html").addClass("loaded"),n.forEach(e=>t[e]&&t[e]())}),window.addEventListener("load",function(){i.forEach(e=>t[e]&&t[e]()),$("html").addClass("ready")})}})();

View File

@ -12,12 +12,12 @@
html { html {
--theme: [(${theme.config.basic_style.theme_color})]; --theme: [(${theme.config.basic_style.theme_color})];
[(${theme.config.enhance.cursor_style == 'breeze' ? '--cursor-default:url(/themes/theme-dream2-plus/assets/cursor/breeze/Arrow.cur),auto;--cursor-pointer:url(/themes/theme-dream2-plus/assets/cursor/breeze/Hand.cur),pointer;--cursor-text:url(/themes/theme-dream2-plus/assets/cursor/breeze/IBeam.cur),auto;--cursor-zoom-in:url(/themes/theme-dream2-plus/assets/cursor/breeze/Cross.cur),zoom-in;' [(${theme.config.enhance.cursor_style == 'breeze' ? '--cursor-default:url('+#theme.assets('/')+'/cursor/breeze/Arrow.cur),auto;--cursor-pointer:url('+#theme.assets('/')+'/cursor/breeze/Hand.cur),pointer;--cursor-text:url('+#theme.assets('/')+'/cursor/breeze/IBeam.cur),auto;--cursor-zoom-in:url('+#theme.assets('/')+'/cursor/breeze/Cross.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'black_cat' ? '--cursor-default:url(/themes/theme-dream2-plus/assets/cursor/black_cat/normal.cur),auto;--cursor-pointer:url(/themes/theme-dream2-plus/assets/cursor/black_cat/ayuda.cur),pointer;--cursor-text:url(/themes/theme-dream2-plus/assets/cursor/black_cat/texto.cur),auto;--cursor-zoom-in:url(/themes/theme-dream2-plus/assets/cursor/black_cat/precision.cur),zoom-in;' : theme.config.enhance.cursor_style == 'black_cat' ? '--cursor-default:url('+#theme.assets('/')+'/cursor/black_cat/normal.cur),auto;--cursor-pointer:url('+#theme.assets('/')+'/cursor/black_cat/ayuda.cur),pointer;--cursor-text:url('+#theme.assets('/')+'/cursor/black_cat/texto.cur),auto;--cursor-zoom-in:url('+#theme.assets('/')+'/cursor/black_cat/precision.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'overwatch' ? '--cursor-default:url(/themes/theme-dream2-plus/assets/cursor/overwatch/pointer.cur),auto;--cursor-pointer:url(/themes/theme-dream2-plus/assets/cursor/overwatch/link.cur),pointer;--cursor-text:url(/themes/theme-dream2-plus/assets/cursor/overwatch/text.cur),auto;--cursor-zoom-in:url(/themes/theme-dream2-plus/assets/cursor/overwatch/cross.cur),zoom-in;' : theme.config.enhance.cursor_style == 'overwatch' ? '--cursor-default:url('+#theme.assets('/')+'/cursor/overwatch/pointer.cur),auto;--cursor-pointer:url('+#theme.assets('/')+'/cursor/overwatch/link.cur),pointer;--cursor-text:url('+#theme.assets('/')+'/cursor/overwatch/text.cur),auto;--cursor-zoom-in:url('+#theme.assets('/')+'/cursor/overwatch/cross.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'rainbow_rain' ? '--cursor-default:url(/themes/theme-dream2-plus/assets/cursor/rainbow_rain/normal.cur),auto;--cursor-pointer:url(/themes/theme-dream2-plus/assets/cursor/rainbow_rain/link.cur),pointer;--cursor-text:url(/themes/theme-dream2-plus/assets/cursor/rainbow_rain/texto.cur),auto;--cursor-zoom-in:url(/themes/theme-dream2-plus/assets/cursor/rainbow_rain/precision.cur),zoom-in;' : theme.config.enhance.cursor_style == 'rainbow_rain' ? '--cursor-default:url('+#theme.assets('/')+'/cursor/rainbow_rain/normal.cur),auto;--cursor-pointer:url('+#theme.assets('/')+'/cursor/rainbow_rain/link.cur),pointer;--cursor-text:url('+#theme.assets('/')+'/cursor/rainbow_rain/texto.cur),auto;--cursor-zoom-in:url('+#theme.assets('/')+'/cursor/rainbow_rain/precision.cur),zoom-in;'
: theme.config.enhance.cursor_style == 'marry' ? '--cursor-default:url(/themes/theme-dream2-plus/assets/cursor/marry/arrow.cur),auto;--cursor-pointer:url(/themes/theme-dream2-plus/assets/cursor/marry/arrow.cur),pointer;--cursor-text:url(/themes/theme-dream2-plus/assets/cursor/marry/beam.cur),auto;--cursor-zoom-in:url(/themes/theme-dream2-plus/assets/cursor/marry/move.cur),zoom-in;' : theme.config.enhance.cursor_style == 'marry' ? '--cursor-default:url('+#theme.assets('/')+'/cursor/marry/arrow.cur),auto;--cursor-pointer:url('+#theme.assets('/')+'/cursor/marry/arrow.cur),pointer;--cursor-text:url('+#theme.assets('/')+'/cursor/marry/beam.cur),auto;--cursor-zoom-in:url('+#theme.assets('/')+'/cursor/marry/move.cur),zoom-in;'
: theme.config.enhance.cursor_style != 'none' ? '--cursor-default: url(/themes/theme-dream2-plus/assets/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), auto;--cursor-pointer: url(/themes/theme-dream2-plus/assets/cursor/' + theme.config.enhance.cursor_style + '/hand.cur), pointer;--cursor-text: url(/themes/theme-dream2-plus/assets/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), auto;--cursor-zoom-in: url(/themes/theme-dream2-plus/assets/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), zoom-in;' : theme.config.enhance.cursor_style != 'none' ? '--cursor-default: url('+#theme.assets('/')+'/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), auto;--cursor-pointer: url('+#theme.assets('/')+'/cursor/' + theme.config.enhance.cursor_style + '/hand.cur), pointer;--cursor-text: url('+#theme.assets('/')+'/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), auto;--cursor-zoom-in: url('+#theme.assets('/')+'/cursor/' + theme.config.enhance.cursor_style + '/arrow.cur), zoom-in;'
: ''})] : ''})]
} }
@ -99,8 +99,6 @@
DreamConfig["effects_lantern_left"] = effects_lantern_left; DreamConfig["effects_lantern_left"] = effects_lantern_left;
DreamConfig["effects_lantern_right"] = effects_lantern_right; DreamConfig["effects_lantern_right"] = effects_lantern_right;
/** 启用标签云的风格 */
DreamConfig["show_tagcloud_style"] = [[${theme.config.sidebar.show_tagcloud_style}]];
/** 控制台主题信息 */ /** 控制台主题信息 */
DreamConfig["enable_console_version_info"] = [[${theme.config.enhance.enable_console_version_info}]]; DreamConfig["enable_console_version_info"] = [[${theme.config.enhance.enable_console_version_info}]];
/** 安全链接配置 */ /** 安全链接配置 */

View File

@ -3,7 +3,6 @@
<script th:src="@{/assets/js/btoc.min.js(mew=${theme.spec.version})}"></script> <script th:src="@{/assets/js/btoc.min.js(mew=${theme.spec.version})}"></script>
<script th:if="${isFirstIndex == true && !#lists.isEmpty(theme.config.basic_style.carousel_options)}" data-pjax <script th:if="${isFirstIndex == true && !#lists.isEmpty(theme.config.basic_style.carousel_options)}" data-pjax
th:src="@{/assets/lib/swiper@8.4.6/swiper-bundle.min.js}"></script> th:src="@{/assets/lib/swiper@8.4.6/swiper-bundle.min.js}"></script>
<script th:if="${theme.config.sidebar.show_tagcloud_style}" th:src="@{/assets/js/tagcloud.min.js(mew=${theme.spec.version})}"></script>
<script th:src="@{/assets/js/common.min.js(mew=${theme.spec.version})}"></script> <script th:src="@{/assets/js/common.min.js(mew=${theme.spec.version})}"></script>
<th:block th:if="${isPost}"> <th:block th:if="${isPost}">

View File

@ -7,8 +7,10 @@
enableTagsColor = ${theme.config.sidebar.enable_tagcloud_color}"> enableTagsColor = ${theme.config.sidebar.enable_tagcloud_color}">
<div class="card-title"> <div class="card-title">
<i th:class="${#strings.defaultString(sidebar.icon, 'ri-cloud-line') + ' card-title-label'}"></i><span th:text="${#strings.defaultString(sidebar.title, '标签云')}"></span> <i th:class="${#strings.defaultString(sidebar.icon, 'ri-cloud-line') + ' card-title-label'}"></i><span
<a th:if="${theme.config.sidebar.tagcloud_more}" class="card-more" th:href="@{/tags}">更多<i class="ri-arrow-right-double-line"></i></a> th:text="${#strings.defaultString(sidebar.title, '标签云')}"></span>
<a th:if="${theme.config.sidebar.tagcloud_more}" class="card-more" th:href="@{/tags}">更多<i
class="ri-arrow-right-double-line"></i></a>
</div> </div>
<div th:if="${isEmpty}" class="card-empty">暂无标签</div> <div th:if="${isEmpty}" class="card-empty">暂无标签</div>
<div th:unless="${isEmpty}" class="card-content"> <div th:unless="${isEmpty}" class="card-content">
@ -19,4 +21,19 @@
th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + (tag.postCount != null ? tag.postCount : 0)}" th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + (tag.postCount != null ? tag.postCount : 0)}"
th:style="'font-size: ' + ${size < 14 ? 14 : size > 32 ? 32 : size} + 'px;' + ${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +';' : ''}"></a> th:style="'font-size: ' + ${size < 14 ? 14 : size > 32 ? 32 : size} + 'px;' + ${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +';' : ''}"></a>
</div> </div>
<th:block th:if="${theme.config.sidebar.show_tagcloud_style}">
<script th:src="@{/assets/js/tagcloud.min.js(mew=${theme.spec.version})}"></script>
<script>
$(function(){ tagcloud({
selector: '.tagcloud .card-content',
fontsize: 18,
radius: 75,
mspeed: 'slow',
ispeed: 'slow',
direction: 45,
keep: false
}) })
</script>
</th:block>
</div> </div>

View File

@ -30,7 +30,7 @@ spec:
settingName: theme-dream2-plus-setting settingName: theme-dream2-plus-setting
configMapName: theme-dream2-plus-configMap configMapName: theme-dream2-plus-configMap
# 版本号 # 版本号
version: 1.2.2.1 version: 0.0.0.1
# 最低支持的 Halo 版本 # 最低支持的 Halo 版本
require: ">=2.12.0" require: ">=2.12.0"
# 许可 # 许可