元素
var divElement = document.createElement("div");
divElement.textContent = h3Element.textContent; // 将文本内容复制到新的
元素
// 用新的
元素替换掉
元素
h3Element.parentNode.replaceChild(divElement, h3Element);
const controlPanelLinks = document.querySelectorAll("#user-control-panel li a");
controlPanelLinks.forEach(link => {
const originalText = link.textContent.trim();
const newText = userMenuTextMapping[originalText];
if (newText) {
link.textContent = newText;
}
});
const aboutUserSection = document.getElementById("about-user");
const reportLink = aboutUserSection.querySelector(".report-link");
const h2Element = aboutUserSection.querySelector("h2");
const right = document.querySelector('.sidebar.collapsed');
const elementToRemove = right.querySelector('.close-sidebar');
// 获取带有 open-sidebar 类的元素
var colltag = document.querySelector(".open-sidebar");
// 检查元素是否存在
if (colltag) {
// 使用 remove 方法移除元素
colltag.remove();
}
// 检查元素是否存在,然后将其删除
if (elementToRemove) {
elementToRemove.remove(); // 删除元素
}
if (reportLink) {
reportLink.remove();
}
if (h2Element) {
h2Element.remove();
}
}
// 添加 CSS 样式
function AddCustomStyles() {
const style_css = document.createElement('style');
style_css.textContent = `
/* CSS 样式内容 */
/* 隐藏浏览器默认的滚动条 */
::-webkit-scrollbar {
width: 0px; /* 设置滚动条宽度 */
}
/* 滚动条轨道 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置滚动条轨道背景颜色 */
}
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
background-color: #888; /* 设置滚动条滑块颜色 */
border-radius: 6px; /* 设置滑块边角的圆角 */
}
/* 当鼠标悬停在滑块上时 */
::-webkit-scrollbar-thumb:hover {
background-color: #555; /* 设置滚动条滑块的悬停颜色 */
}
html, body{
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
body {
display: flex;
flex-direction: column;
}
ul, ol{
list-style-type: none;
margin:0;
}
p {
margin-top:0;
margin-left:20px;
}
.width-constraint {
margin: 0;
height: 100%;
max-width: 100%;
}
#main-header {
background-color: #545c64;
box-shadow: none;
}
#main-header a {
text-decoration: none;
}
#site-name img {
display: none;
}
.sidebarred {
display:flex;
height: 100%;
max-height:88vh;
}
.sidebar.collapsed, .sidebarred-main-content {
margin: 0;
padding: 0;
}
.sidebar {
width: 200px;
min-width:200px;
max-width:200px;
background-color: #6e767d;
flex:1;
margin:0;
}
.sidebarred-main-content {
border: none;
max-width: 100%;
background-color: #e9e9eb;
margin-left: auto;
height:100%;
}
.sidebarred-main-content a {
white-space:normal;
}
#about-user, .text-content {
margin: 0;
border: none;
border-radius: 0;
box-shadow: none;
padding:0;
}
#user-control-panel {
background-color: #dcdfe6;
}
a {
text-decoration: none;
}
#left-menu {
width:160px;
min-width:160px;
max-width:160px;
background-color:#6e767d;
flex:1;
}
.user-menus ul {
background-color:#dcdfe6;
padding:0;
align-items:center;
}
.user-menus li{
display: flex;
color:#a42121;
width:100%;
cursor: pointer;
height:28px;
width:100%;
align-items: center;
justify-content: space-around;
text-align: center;
}
.user-menus li:hover {
background-color:white;
}
/* 搜索选项 */
.close-sidebar, .list-option-title, #control-panel div {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
background-color: #545c64;
color: #fff;
height:21px;
}
.list-option {
cursor: pointer;
}
/* 设置字体颜色为 #e7bf4b 并加粗 */
.close-sidebar div {
color: #e7bf4b;
font-weight: bold;
font-family: "黑体", sans-serif;
}
.close-sidebar .sidebar-title,
.close-sidebar div:nth-child(2) {
visibility: hidden;
}
/* 搜索选项 - 选项菜单 */
.list-option-groups {
justify-content: space-between;
align-items: center;
padding: 0px;
cursor: pointer;
background-color: #e9eef3;
}
.list-option-groups div {
cursor:default;
}
.list-option-group {
padding: 0;
margin: 0;
}
.list-option-title, #control-panel div {
background-color: #6e767d;
font-weight: bold;
font-size: 16px;
}
.list-option-group ul {
box-shadow: none;
border: none;
border-radius: 0;
margin-top: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
background-color: #DCDFE6;
}
.list-option-group a {
text-decoration: none;
}
.list-option-group .list-current {
border-left: none;
box-shadow: none;
margin: 0;
padding: .4em 1em .4em calc(1em - 3px);
background: #F2F6FC;
}
/* 脚本列表 - 脚本list */
#user-script-list {
border: none;
padding-top: 0;
margin-top: 0;
background: none;
box-shadow: none;
overflow-y: auto;
max-height: 82vh;
}
#user-script-list-section {
margin: 0;
padding: 0;
}
#user-script-list-section li,
.discussion-list-item{
border-bottom: 1px solid #ccc;
border-radius: 2px;
margin-bottom: 2px;
list-style: none;
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-radius: 4px;
margin: 5px;
padding: 15px;
display: flex;
flex-direction: column;
transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
#user-script-list-section li:hover {
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
background-color: #f0f0f0;
}
/* 脚本列表 - 脚本title */
#user-script-list-view-all {
background-color: #545c64;
color: #fff;
padding: 0;
height: 41px;
display: flex;
justify-content: center;
cursor:pointer;
}
#user-script-list-section header div {
display: flex;
align-items: center;
justify-content: space-around;
text-align: center;
width: 100%;
height: 41px;
color: #e7bf4b;
font-weight: bold;
font-family: "黑体", sans-serif;
}
#user-script-list-section header h3{
margin-left:12px;
}
#user-discussions ul, #user-script-sets-section ul{
padding:0;
}
#user-discussions .text-content,
#user-script-sets-section .text-content,
#user-discussions-on-scripts-written .text-content,
#user-conversations .text-content{
background-color: transparent;
}
/* ... */
`;
document.head.appendChild(style_css);
}
menuItems.forEach(menuItem => {
ModifyScriptListTitle(menuItem.className, menuItem.title);
});
SetScriptListTitle();
MoveMenu();
ModifyUserMenu();
AddMenu();
BindEvent();
AddCustomStyles();
})();