优化关闭右键菜单报错

This commit is contained in:
1152958806@qq.com 2023-08-07 00:50:38 +08:00
parent 839531f343
commit 478dfd1594
7 changed files with 51 additions and 16 deletions

View File

@ -544,6 +544,7 @@ spec:
label: 个人卡片
value:
profileStyle: default
helloText: 🤖️ 数码科技爱好者, 🔍 分享与热心帮助, 🏠 智能家居小能手, 🔨 设计开发一条龙, 🤝 专修交互与设计, 🏃 脚踏实地行动派, 🧱 团队小组发动机, 💢 壮汉人狠话不多
children:
- $formkit: select
name: profileStyle
@ -570,7 +571,6 @@ spec:
name: helloText
label: 作者打招呼
placeholder: 请填写作者打招呼
value: 🤖️ 数码科技爱好者, 🔍 分享与热心帮助, 🏠 智能家居小能手, 🔨 设计开发一条龙, 🤝 专修交互与设计, 🏃 脚踏实地行动派, 🧱 团队小组发动机, 💢 壮汉人狠话不多
help: 注意格式 (🤖️ 数码科技爱好者, 🔍 分享与热心帮助 以逗号隔开
- $formkit: text
name: profileName
@ -1047,14 +1047,13 @@ spec:
name: footer_group
label: 页脚友链
value:
enable_footer_group:
num:
enable_footer_group: true
num: 3
children:
- $formkit: radio
name: enable_footer_group
id: enable_footer_group
key: enable_footer_group
value: true
options:
- label: 启用
value: true
@ -1064,7 +1063,6 @@ spec:
if: $get(enable_footer_group).value
name: num
label: 友链数
value: 3
validation: required
- $formkit: group
name: footerContent

View File

@ -294,7 +294,9 @@ var heo = {
btf.snackbarShow("✨ 已开启评论弹幕", false, 2000)
}
}
if(GLOBAL_CONFIG.rightMenuEnable){
rm.hideRightMenu();
}
},
//隐藏cookie窗口
@ -372,20 +374,26 @@ var heo = {
let msgPause = '<i class="haofont hao-icon-pause"></i><span>暂停音乐</span>';
if (heo_musicPlaying) {
navMusicEl.classList.remove("playing");
if(GLOBAL_CONFIG.rightMenuEnable){
document.getElementById("menu-music-toggle").innerHTML = msgPlay;
}
document.getElementById("nav-music-hoverTips").innerHTML = "音乐已暂停";
document.querySelector("#consoleMusic").classList.remove("on");
heo_musicPlaying = false;
navMusicEl.classList.remove("stretch");
} else {
navMusicEl.classList.add("playing");
if(GLOBAL_CONFIG.rightMenuEnable){
document.getElementById("menu-music-toggle").innerHTML = msgPause;
}
document.querySelector("#consoleMusic").classList.add("on");
heo_musicPlaying = true;
navMusicEl.classList.add("stretch");
}
if (changePaly) document.querySelector("#nav-music meting-js").aplayer.toggle();
if(GLOBAL_CONFIG.rightMenuEnable){
rm.hideRightMenu();
}
},
// 音乐绑定事件

View File

@ -324,6 +324,30 @@ var navFn = {
}
}
//引用到评论
function rightMenuCommentText(txt) {
if (GLOBAL_CONFIG.rightMenuEnable) {
rm.hideRightMenu();
}
var input = document.getElementsByClassName('el-textarea__inner')[0];
let evt = document.createEvent('HTMLEvents');
evt.initEvent('input', true, true);
let inputValue = replaceAll(txt, '\n', '\n> ')
input.value = '> ' + inputValue + '\n\n';
input.dispatchEvent(evt);
var domTop = document.querySelector("#post-comment").offsetTop;
window.scrollTo(0, domTop - 80);
input.focus();
input.setSelectionRange(-1, -1);
if (document.getElementById("comment-tips")) {
document.getElementById("comment-tips").classList.add("show");
}
}
//替换所有内容
function replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
// 移除赞赏蒙版
function RemoveRewardMask() {
if (!document.querySelector(".reward-main")) return;
@ -347,11 +371,15 @@ document.addEventListener('touchstart', e => {
//监听ctrl+C
$(document).unbind('keydown').bind('keydown', function (e) {
if (GLOBAL_CONFIG.rightMenuEnable) {
if ((e.ctrlKey || e.metaKey) && (e.keyCode == 67) && (selectTextNow != '')) {
btf.snackbarShow('复制成功,复制和转载请标注本文地址');
rm.rightmenuCopyText(selectTextNow);
return false;
}
} else {
}
})
//判断国内国外

View File

@ -46,7 +46,7 @@
<a class="equipment-item-content-item-link" th:href="${equipment.url}"
target="_blank">[[${equipment.button}]]</a>
<a class="bber-reply"
th:onclick="rm.rightMenuCommentText([['&quot;'+${equipment.name}+' '+${equipment.model}+' '+${equipment.description}+'&quot;']]);"
th:onclick="rightMenuCommentText([['&quot;'+${equipment.name}+' '+${equipment.model}+' '+${equipment.description}+'&quot;']]);"
data-pjax-state="">
<i class="fa-solid fa-message" style="font-size: 18px;"></i>
</a>

View File

@ -209,6 +209,7 @@
helloText: [[${#strings.listSplit(theme.config.sidebar.profile.helloText, ',')}]],
assetsLink: [[${assets_link}]],
profileStyle: [[${theme.config.sidebar.profile.profileStyle}]],
rightMenuEnable: [[${theme.config.tool.rightMenu.rightMenuEnable}]],
source: {
links: {
linksUrl: [[${ theme.config.link.linksUrl }]],

View File

@ -22,7 +22,7 @@
<!-- 切换模式 -->
<div class="nav-button" th:if="${theme.config.nav.right.darkMode}">
<a class="console_switchbutton" href="javascript:void(0);" onclick="rm.switchDarkMode()" rel="external nofollow"
<a class="console_switchbutton" href="javascript:void(0);" onclick="navFn.switchDarkMode();" rel="external nofollow"
title="切换模式 - 日夜交替,黑白互换。">
<i class="haofont hao-icon-circle-half-stroke" style="font-size: 1rem; font-weight: 700;"></i>
</a>

View File

@ -50,7 +50,7 @@
</div>
</div>
<a class="bber-reply"
th:onclick="rm.rightMenuCommentText([[${content.html}]]);"
th:onclick="rightMenuCommentText([[${content.html}]]);"
data-pjax-state=""> <i class="fa-solid fa-message"></i>
</a>
</div>