This commit is contained in:
杜恒
2021-02-07 17:32:06 +08:00
parent b1ea1cb6d2
commit b511fcd222
8 changed files with 210 additions and 165 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1309,8 +1309,7 @@
}
pre[class*='language-'] {
position: relative;
padding: 15px;
padding-top: 35px;
padding: 30px 15px 12px;
margin: 0 0 15px;
border-radius: var(--radius-inner);
&::after {
@@ -1334,6 +1333,20 @@
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
z-index: 1;
}
.copy {
position: absolute;
top: 9px;
right: 15px;
z-index: 5;
color: #909399;
font-size: 14px;
transition: color 0.35s;
cursor: pointer;
user-select: none;
&:hover {
color: #c0c4cc;
}
}
}
img {
display: block;
@@ -1606,13 +1619,13 @@
}
}
&-anote {
position: relative;
position: relative;
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
transform: translateZ(0);
transition: transform 0.35s;
transition: transform 0.35s;
&:hover {
transform: translateY(-3px);
}
@@ -1688,6 +1701,10 @@
text-overflow: ellipsis;
}
}
&-copy {
cursor: pointer;
user-select: none;
}
}
&__agree {
display: flex;

View File

@@ -47,6 +47,17 @@ document.addEventListener('DOMContentLoaded', () => {
/* 激活代码高亮 */
{
Prism.highlightAll();
$("pre[class*='language-']").each(function (index, item) {
let text = $(item).find("code[class*='language-']").text();
let span = $(`<span class="copy"><i class="fa fa-clone"></i></span>`);
new ClipboardJS(span[0], { text: () => text }).on('success', () => Qmsg.success('复制成功!'));
$(item).append(span);
});
}
/* 激活复制功能 */
{
new ClipboardJS('.joe_detail__article-copy').on('success', () => Qmsg.success('复制成功!'));
}
/* 激活图片预览功能 */
@@ -137,9 +148,7 @@ document.addEventListener('DOMContentLoaded', () => {
/* 密码保护文章,输入密码访问 */
{
$('.joe_detail__article-protected').on('submit', function (e) {
});
$('.joe_detail__article-protected').on('submit', function (e) {});
}
});