From 17ee88bb3abae262519100e156e79b6f8a9791b2 Mon Sep 17 00:00:00 2001 From: Ataidawa Date: Fri, 22 Nov 2024 03:04:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=A4=8D=E5=85=A5=E4=BA=86?= =?UTF-8?q?=E5=B8=A6API=E8=A7=A3=E6=9E=90=E5=8A=9F=E8=83=BD=E7=9A=84?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=99=A8=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/components/plugins/meting.ejs | 2 + layout/components/plugins/meting_js_only.ejs | 2 + source/build/js/libs/Meting.min.js | 1 + source/build/js/plugins/meting.js | 83 ++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 layout/components/plugins/meting.ejs create mode 100644 layout/components/plugins/meting_js_only.ejs create mode 100644 source/build/js/libs/Meting.min.js create mode 100644 source/build/js/plugins/meting.js diff --git a/layout/components/plugins/meting.ejs b/layout/components/plugins/meting.ejs new file mode 100644 index 00000000..28448a50 --- /dev/null +++ b/layout/components/plugins/meting.ejs @@ -0,0 +1,2 @@ +
+<%- renderJS('js/plugins/meting.js') %> \ No newline at end of file diff --git a/layout/components/plugins/meting_js_only.ejs b/layout/components/plugins/meting_js_only.ejs new file mode 100644 index 00000000..61c563c1 --- /dev/null +++ b/layout/components/plugins/meting_js_only.ejs @@ -0,0 +1,2 @@ +<%- renderJS('js/libs/APlayer.min.js') %> +<%- renderJS('js/libs/Meting.min.js') %> \ No newline at end of file diff --git a/source/build/js/libs/Meting.min.js b/source/build/js/libs/Meting.min.js new file mode 100644 index 00000000..72a23a8f --- /dev/null +++ b/source/build/js/libs/Meting.min.js @@ -0,0 +1 @@ +"use strict";function _objectSpread(a){for(var b=1;bb.toUpperCase())}_init(){let a={};for(let b=0;ba.json()).then(a=>this._loadPlayer(a))}_loadPlayer(a){let b={audio:a,mutex:!0,lrcType:this.meta.lrcType||3,storageName:"metingjs"};if(a.length){let a=_objectSpread({},b,this.config);for(let b in a)("true"===a[b]||"false"===a[b])&&(a[b]="true"===a[b]);let c=document.createElement("div");a.container=c,this.appendChild(c),this.aplayer=new APlayer(a)}}}console.log("\n %c MetingJS v2.0.1 %c https://github.com/metowolf/MetingJS \n","color: #fadfa3; background: #030307; padding:5px 0;","background: #fadfa3; padding:5px 0;"),window.customElements&&!window.customElements.get("meting-js")&&(window.MetingJSElement=MetingJSElement,window.customElements.define("meting-js",MetingJSElement)); diff --git a/source/build/js/plugins/meting.js b/source/build/js/plugins/meting.js new file mode 100644 index 00000000..b3d585c0 --- /dev/null +++ b/source/build/js/plugins/meting.js @@ -0,0 +1,83 @@ +// 从主题配置中获取 meting 配置 +const metingConfig = theme.plugins.meting; +console.log('Meting Config:', metingConfig); + +// 初始化播放器配置的函数 +function initMetingPlayer() { + // 检查必选参数 + if (!metingConfig.id || !metingConfig.server || !metingConfig.type) { + console.error('Missing required parameters:', { + id: metingConfig.id, + server: metingConfig.server, + type: metingConfig.type + }); + return; + } + + // 创建 meting-js 元素 + const metingElement = document.createElement('meting-js'); + + // 设置必选属性 + metingElement.setAttribute('server', metingConfig.server); + metingElement.setAttribute('type', metingConfig.type); + metingElement.setAttribute('id', metingConfig.id); + + // 根据播放器类型设置 fixed 或 mini + if (metingConfig.playerType === 'fixed') { + metingElement.setAttribute('fixed', 'true'); + } else if (metingConfig.playerType === 'mini') { + metingElement.setAttribute('mini', 'true'); + } + + // 设置其他可选属性 + if (metingConfig.autoplay !== undefined) { + metingElement.setAttribute('autoplay', metingConfig.autoplay); + } + if (metingConfig.theme !== undefined) { + metingElement.setAttribute('theme', metingConfig.theme); + } + if (metingConfig.loop !== undefined) { + metingElement.setAttribute('loop', metingConfig.loop); + } + if (metingConfig.order !== undefined) { + metingElement.setAttribute('order', metingConfig.order); + } + if (metingConfig.preload !== undefined) { + metingElement.setAttribute('preload', metingConfig.preload); + } + if (metingConfig.volume !== undefined) { + metingElement.setAttribute('volume', metingConfig.volume); + } + if (metingConfig.mutex !== undefined) { + metingElement.setAttribute('mutex', metingConfig.mutex); + } + if (metingConfig.lrcType !== undefined) { + metingElement.setAttribute('lrc-type', metingConfig.lrcType); + } + if (metingConfig.listFolded !== undefined) { + metingElement.setAttribute('list-folded', metingConfig.listFolded); + } + if (metingConfig.listMaxHeight !== undefined) { + metingElement.setAttribute('list-max-height', metingConfig.listMaxHeight); + } + if (metingConfig.storageName !== undefined) { + metingElement.setAttribute('storage-name', metingConfig.storageName); + } + + // 获取并清空 meting-container 容器 + const apContainer = document.getElementById('meting-container'); + if (apContainer) { + apContainer.innerHTML = ''; + // 将 meting-js 元素添加到容器中 + apContainer.appendChild(metingElement); + } + + console.log('Created meting element:', metingElement.outerHTML); +} + +// 确保 DOM 加载完成后再执行初始化 +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', initMetingPlayer); +} else { + initMetingPlayer(); +} \ No newline at end of file From 41e1f95fcad26f35c0f2d8ca249b5a8eeb8f2884 Mon Sep 17 00:00:00 2001 From: Ataidawa Date: Sun, 24 Nov 2024 18:34:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E5=AE=9E=E7=8E=B0=E7=AC=AC=E4=B8=89=E6=96=B9=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/pages/home/home-banner.ejs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layout/pages/home/home-banner.ejs b/layout/pages/home/home-banner.ejs index 6891a6bc..7d2a7eb0 100755 --- a/layout/pages/home/home-banner.ejs +++ b/layout/pages/home/home-banner.ejs @@ -76,6 +76,12 @@ + <% } else if(key.includes(" ") && key.includes("iconfont")) { %> + + + + <% } else { %> - <% } else if(key.includes(" ") && key.includes("iconfont")) { %> - + <% } else if(key.includes("icon-")) { %> + - <% } else { %> diff --git a/source/css/common/markdown.styl b/source/css/common/markdown.styl index 1915fcf4..a8952cba 100755 --- a/source/css/common/markdown.styl +++ b/source/css/common/markdown.styl @@ -199,6 +199,9 @@ img box-sizing border-box border-radius $usr-img-border-radius + border-width $usr-img-border-width + border-style $usr-img-border-style + border-color $usr-img-border-color max-width 100% cursor zoom-in display block diff --git a/source/css/common/variables.styl b/source/css/common/variables.styl index fec12bb8..9fbc7f85 100755 --- a/source/css/common/variables.styl +++ b/source/css/common/variables.styl @@ -105,9 +105,25 @@ $redefine-border-radius-full = 50% $redefine-border-radius-full-top = 50% 50% 0px 0px $redefine-border-radius-full-bottom = 0px 0px 50% 50% +$redefine-border-width-base = 2px +$redefine-border-style-base = solid + +// 文章内图片圆角 $temp-usr-img-border-radius = hexo-config('articles.style.image_border_radius') $usr-img-border-radius = $temp-usr-img-border-radius ? convert($temp-usr-img-border-radius) : $redefine-border-radius-medium +// 文章内图片描边宽度 +$temp-usr-img-border-width = hexo-config('articles.style.image_border_width') +$usr-img-border-width = $temp-usr-img-border-width ? convert($temp-usr-img-border-width) : $redefine-border-width-base + +// 文章内图片描边样式 +$temp-usr-img-border-style = hexo-config('articles.style.image_border_style') +$usr-img-border-style = $temp-usr-img-border-style ? convert($temp-usr-img-border-style) : $redefine-border-style-base + +// 文章内图片描边颜色 +$temp-color = hexo-config('colors.primary') +$usr-img-border-color = $temp-color ? convert($temp-color) : #000 + // ======================================================================================== // MERMAID THEME // ========================================================================================