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

update to original 2.8.2 #488

Open
wants to merge 4 commits into
base: main
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: 2 additions & 0 deletions layout/components/plugins/meting.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div id="meting-container"></div>
<%- renderJS('js/plugins/meting.js') %>
2 changes: 2 additions & 0 deletions layout/components/plugins/meting_js_only.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%- renderJS('js/libs/APlayer.min.js') %>
<%- renderJS('js/libs/Meting.min.js') %>
6 changes: 6 additions & 0 deletions layout/pages/home/home-banner.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<i class="<%= key %> fa-fw fa-lg"></i>
</a>
</span>
<% } else if(key.includes("icon-")) { %>
<!-- 次格式可能会引起两种嵌套存在,如icon的css中写了content后可能会存在!important,建议修改 -->
<a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
<span class="social-contact-item iconfont <%= key %>">
</span>
</a>
Comment on lines +79 to +84
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor icon implementation to avoid CSS specificity issues.

The current implementation could lead to CSS specificity conflicts as noted in the comment. Consider a more robust approach:

-<!-- 次格式可能会引起两种嵌套存在,如icon的css中写了content后可能会存在!important,建议修改 -->
-<a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
-    <span class="social-contact-item iconfont <%= key %>">
-    </span>
-</a>
+<span class="social-contact-item">
+    <a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
+        <i class="social-icon iconfont <%= key.replace('icon-', '') %>"></i>
+    </a>
+</span>

This refactoring:

  1. Maintains consistent structure with other social links
  2. Avoids nested specificity issues
  3. Separates icon classes for better CSS control
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<% } else if(key.includes("icon-")) { %>
<!-- 次格式可能会引起两种嵌套存在,如icon的css中写了content后可能会存在!important,建议修改 -->
<a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
<span class="social-contact-item iconfont <%= key %>">
</span>
</a>
<% } else if(key.includes("icon-")) { %>
<span class="social-contact-item">
<a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
<i class="social-icon iconfont <%= key.replace('icon-', '') %>"></i>
</a>
</span>

<% } else { %>
<span class="social-contact-item <%= key %>">
<a target="_blank" href="<%- theme.home_banner.social_links.links[key] %>">
Expand Down
1 change: 1 addition & 0 deletions source/build/js/libs/Meting.min.js

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

83 changes: 83 additions & 0 deletions source/build/js/plugins/meting.js
Original file line number Diff line number Diff line change
@@ -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();
}
3 changes: 3 additions & 0 deletions source/css/common/markdown.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions source/css/common/variables.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ========================================================================================
Expand Down
Loading