From d10e960a8d6d1b7dd122e713fa53fa190ce8498c Mon Sep 17 00:00:00 2001
From: mayx
Date: Thu, 19 Jun 2025 08:51:38 +0000
Subject: Update 2 files
- /assets/js/main_new.js
- /_layouts/post.html---
_layouts/post.html | 2 +-
assets/js/main_new.js | 44 ++++++++++++++++++++++++--------------------
2 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/_layouts/post.html b/_layouts/post.html
index d598c2f..4769a36 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -102,7 +102,7 @@ $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), fu
var item = searchMap[data[j].id];
if (item) {
var link = $('' + item.title + '');
- var contentPreview = item.content.replace(/<[^>]+>/g, "").substring(0, 100);
+ var contentPreview = item.content.substring(0, 100);
if (item.content.length > 100) {
contentPreview += "……";
}
diff --git a/assets/js/main_new.js b/assets/js/main_new.js
index fbb6926..deb0927 100644
--- a/assets/js/main_new.js
+++ b/assets/js/main_new.js
@@ -43,31 +43,35 @@ $(function () {
});
});
-$(function () {
- var codeBlocks = document.querySelectorAll('div.highlight');
+$(function() {
+ var $codeBlocks = $('div.highlight');
- codeBlocks.forEach(function (codeBlock) {
- var copyButton = document.createElement('button');
- copyButton.className = 'copy';
- copyButton.type = 'button';
- copyButton.innerText = '📋';
+ $codeBlocks.each(function() {
+ var $copyButton = $('