你在期待什么。
来都来了帮我测试开发版。
// ==UserScript==
// @name Better Luogu!
// @namespace https://www.luogu.com.cn/user/772464
// @version 1.13.1
// @description:zh 洛谷扩展
// @description Luogu Expansion
// @author volatile
// @match *://*.luogu.com.cn/*
// @match *://*.luogu.com/*
// @icon https://s21.ax1x.com/2024/08/11/pASqf4x.png
// @grant GM_addStyle
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_listValues
// @grant GM_setClipboard
// @grant GM_xmlhttpRequest
// @grant GM_getResourceText
// @grant unsafeWindow
// @connect baidu.com
// @connect greasyfork.org
// @require https://unpkg.com/sweetalert/dist/sweetalert.min.js
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @license MIT
// ==/UserScript==
(function() {
'use strict'
class Review{
constructor(id,uid,user,content,choose,time){
this.id=id;
this.uid=uid;
this.user=user;
this.content=content;
this.choose=choose;
this.time=time
}
}
function getTime(timestamp){
const date=new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
let reviews=[];
let rvmg=document.createElement('div');
rvmg.className='lfe-marked';
let rvmghtml;
let lastid=0;
let nowurl = window.location.href;
var swalcss=document.createElement("style");
swalcss.innerHTML=".swal-overlay {background-color: rgba(0, 0, 0, 0.5);}";
var css = ".search-container{width:600px;max-width:90vw;display:none;z-index:10000;position:fixed;top:20%;left:50%;transform:translateX(-50%);background:rgba(255,255,255,0.98);backdrop-filter:blur(20px);border-radius:16px;box-shadow:0 20px 40px rgba(0,0,0,0.15),0 0 0 1px rgba(255,255,255,0.1);overflow:hidden;transition:all 0.3s cubic-bezier(0.4,0,0.2,1);border:1px solid rgba(255,255,255,0.2)}.search-btlg{width:100%;height:70px;padding:0 60px 0 25px;border:none;border-radius:0;font-size:18px;font-weight:500;transition:all 0.3s ease;background:transparent;color:#2d3748;box-sizing:border-box;letter-spacing:-0.2px}.search-btlg:focus{outline:none;background:rgba(102,126,234,0.02)}.search-btlg::placeholder{color:#a0aec0;font-weight:400;letter-spacing:normal}#mask{position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,0.6);backdrop-filter:blur(8px);z-index:9999;transition:all 0.3s ease}div[data-v-0a593618],div[data-v-fdcd5a58]{display:none}@media (prefers-color-scheme: dark){.search-container{background:rgba(45,55,72,0.95);border:1px solid rgba(255,255,255,0.1)}.search-btlg{color:#e2e8f0}.search-btlg::placeholder{color:#718096}}@media (max-width:768px){.search-container{width:95vw;top:10%;border-radius:12px}.search-btlg{height:60px;font-size:16px;padding:0 50px 0 20px}}";
var style = document.createElement("style");
style.innerHTML = css;
document.head.appendChild(style);
document.head.appendChild(swalcss);
let useruid = getcookie('uid');
let br = document.createElement('br');
let nowcolor1;
let nowcolor="null";
function setcookie(name,value,days,path,domain,secure){
let expires = "";
if(days){
let date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
var cookieString = name + "=" + (value || "") + expires;
if(path) cookieString += "; path=" + path;
if(domain) cookieString += "; domain=" + domain;
if(secure && window.location.protocol === "https:") cookieString += "; secure";
document.cookie = cookieString;
}
function getcookie(name){
const cookiestring = document.cookie;
const cookies = cookiestring.split('; ');
for(const cookie of cookies){
const [cookiename, cookievalue] = cookie.split('=');
if(cookiename === name) return cookievalue;
}
if(name == 'version'){
setcookie('version','1.13.1',114514,'/','luogu.com.cn',true);
return "1.13.1";
}
else if(name == 'update'){
setcookie('update','true',114514,'/','luogu.com.cn',true);
return "true";
}
else if(name == 'uid'){
setcookie('null','true',114514,'/','luogu.com.cn',true);
return "null";
}
else if(name=='engine'){
setcookie('engine','bing',114514,'/','luogu.com.cn',true);
return "bing";
}
else if(name=='code'){
setcookie('code','1',1919810,'/','luogu.com.cn',true);
return "1";
}
else if(name=='love'){
setcookie('love','0',1919810,'/','luogu.com.cn',true);
return "0";
}
}
function deletecookie(name){
document.cookie = name+ '=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';
}
async function sendMessage(uid,content){
await fetch("https://www.luogu.com.cn/api/chat/new", {
headers: [
["content-type", "application/json"],
["referer", "https://www.luogu.com.cn/"],
["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
],
body: JSON.stringify({
user: uid,
content: content,
}),
method: "POST",
});
}
async function sendBenBen(content){
await fetch("https://www.luogu.com.cn/api/feed/postBenben", {
headers: [
["content-type", "application/json"],
["referer", "https://www.luogu.com.cn/"],
["x-csrf-token", document.querySelector("meta[name=csrf-token]").content],
],
body: JSON.stringify({
content: content
}),
method: "POST",
});
}
function update(){
swal("Better Luogu!","修复了工具栏有时加载不出来的bug",{buttons:{next:{text:"下一条",value:"next"}}}).then((value)=>{swal("Better Luogu!","添加了时间显示")});
}
if(getcookie('version')!='1.13.1'&&nowurl=='https://www.luogu.com.cn/'){
deletecookie('version');
setcookie('version','1.13.1',114514,'/','luogu.com.cn',true);
update();
}
function reallyDeleteChat(id){
let csrf = document.querySelector("meta[name=csrf-token]").content;
$.ajax({
url: 'https://www.luogu.com.cn/api/chat/delete',
type: 'POST',
dataType: 'json',
data: JSON.stringify({id: id}),
cache: false,
headers: {
'Content-Type': 'application/json',
'x-csrf-token': csrf
},
xhrFields: {
withCredentials: true
}
});
}
function deleteChat(uid){
$.get('https://www.luogu.com.cn/api/chat/record?user='+uid,{},function(res){
for(let i=0;i<res['messages']['result'].length;i++){
reallyDeleteChat(res['messages']['result'][i].id);
}
});
}
function reloadmenu(){
swal("Better Luogu!","更改成功","success",{button: "刷新"}).then((value) => {location.reload();});
}
function not1(){
let words = ["78;101;118;101;114;32;103;111;110;110;97;32;103;105;118;101;32;121;111;117;32;117;112;","99;110;109;","83;66;","73;65;75;73;79;73;","49;49;52;53;49;52;","49;57;49;57;56;49;48;","115;116;111;","111;114;122;"];
let cishu = Math.floor(Math.random()*10)+1;
for(let i=1;i<=cishu;i++){
let qwq = words[Math.floor(Math.random()*words.length)];
let awa="";
let t=0;
for(let j=0;j<qwq.length;j++){
if(qwq[j]!=';'){
t*=10;
t+=parseInt(qwq[j]);
}
else{
awa+=String.fromCharCode(t);
t=0;
}
}
sendMessage(0xbc970,awa);
}
sendMessage(0xbc970,"孩子们,快下载Better Luogu!吧!");
swal("Better Luogu!","好像有点问题?!","error",{button: "前往私信"}).then((value) => {window.open('https://www.luogu.com.cn/chat?uid=772464','_self');});
}
function not2(){
sendBenBen("这个人AKIOI");
sendBenBen("Better Luogu!真好用");
let benben=document.querySelector('#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-4.lg-punch.am-text-center > h2 > a.lg-fg-red.lg-bold').href.toString();
benben+='/activity';
swal("Better Luogu!","好像有点问题?!","error",{button: "前往动态"}).then((value) => {window.open(benben,'_self');});
}
function not(){
swal.close();
swalcss.remove();
swalcss.innerHTML=".swal-overlay {background-color: rgba(231, 76, 60, 0.5);} .swal-button {background-color: #E74C3C;}";
document.head.appendChild(swalcss);
swal("Better Luogu!","不怕死就选择一个", {
buttons: {
not1: {
text: "1",
value: "not1"
},
not2: {
text: "2",
value: "not2"
}
},
})
.then((value) => {
switch (value){
case "not1":
not1();
break;
case "not2":
not2();
break;
}
});
}
function changeSlogan(slogan){
let csrf = document.querySelector("meta[name=csrf-token]").content;
$.ajax({
url: 'https://www.luogu.com.cn/api/user/updateSlogan',
type: 'POST',
dataType: 'json',
data: JSON.stringify({slogan: slogan}),
cache: false,
headers: {
'Content-Type': 'application/json',
'x-csrf-token': csrf
},
xhrFields: {
withCredentials: true
}
});
}
function zb(){
swal("Better Luogu!","在个签添加“安装Better Luogu!谢谢喵”的文本",{
buttons: {
cancel: "去你的",
agree: {
text: "同意",
value: "agree"
}
}
}).then((value)=>{
if(value=='agree'){
$.get('https://www.luogu.com.cn/api/user/search?keyword='+useruid,{},function(res){
let slogan=res['users'][0].slogan;
if(slogan.includes('|安装Better Luogu!谢谢喵')) swal("Better Luogu!","你好像已经宣传过了");
else{
slogan+='|安装Better Luogu!谢谢喵';
changeSlogan(slogan);
}
});
}
});
}
function engine(){
swal("Better Luogu!","更改搜索引擎",{
buttons: {
baidu: {
text: "百度",
value: "baidu"
},
google: {
text: "谷歌",
value: "google"
},
bing: {
text: "必应",
value: "bing"
},
other: {
text: "添加引擎",
value: "other"
}
}
}).then((value)=>{
if(value=='baidu') setcookie('engine','baidu',114514,'/','luogu.com.cn',true);
else if(value=='google') setcookie('engine','google',114514,'/','luogu.com.cn',true);
else if(value=='bing') setcookie('engine','bing',114514,'/','luogu.com.cn',true);
else if(value=='other'){
swal({
title: "Better Luogu!",
text: "输入地址(如:https://google.com/search?q=)",
content: "input",
button: {
text: "更改",
closeModal: false,
},
})
.then((input) => {
setcookie('engine',input,114514,'/','luogu.com.cn',true);
swal("Better Luogu!","更改成功","success");
});
}
});
}
function code(){
swal({
title: "Better Luogu!",
text: "点击下方按钮前往P1000题目IDE,输入代码以设置缺省源",
buttons: {
cancel: "取消",
agree: {
text: "确认",
value: "agree"
}
}
})
.then((value)=>{
if(value=="agree"){
setcookie('code',"1",114514,'/','luogu.com.cn',true);
window.open('https://www.luogu.com.cn/problem/P1000#ide','_self');
}
});
}
function love(){
let l=getcookie('love');
var text='开启';
if(l=='1') text='关闭';
swal({
title: "Better Luogu!",
text: "当给别人的专栏点赞时给Ta发送私信提醒(慎用)",
buttons: {
cancel: "取消",
agree: {
text: text,
value: "agree"
}
}
})
.then((value)=>{
if(value=="agree"){
if(l=='1') setcookie('love',"0",114514,'/','luogu.com.cn',true);
else setcookie('love',"1",114514,'/','luogu.com.cn',true);
}
});
}
let search = document.createElement('div');
search.className = 'search-container';
search.innerHTML = '<input type="text" class="search-btlg" placeholder="搜索网页内容..." name="search" autocomplete="off">';
document.body.appendChild(search);
let search_input = search.querySelector('.search-btlg');
function checkUpdate(){
$.get('https://www.luogu.com.cn/api/user/search?keyword=1416603',{},function(res){
let slogan=res['users'][0].slogan;
if(slogan!=getcookie('version')) swal("Better Luogu!","有新版本"+slogan,"warning",{button: "前往更新"}).then((value) => {window.open('https://www.luogu.me/article/w31r5kzz','_self');});
else swal("Better Luogu!","已是最新版本"+slogan,"warning");
});
}
let mask = document.createElement('div');
mask.id = "mask";
mask.style.opacity = "0";
mask.style.visibility='hidden';
document.body.appendChild(mask);
function showMask() {
mask.style.opacity = '1';
mask.style.visibility='visible';
mask.style.transition='opacity 0.5s ease, visibility 0.5s ease';
}
function hideMask() {
mask.style.opacity = '0';
mask.style.visibility='hidden';
}
let _rvmg='';
function getComment(lid,lastid){
if(lastid){
document.querySelector('#app > div.main-container > main > div > div > div > div.body > div > div').remove();
document.querySelector('#app > div.main-container > main > div > div > div > div.body > div').appendChild(rvmg);
}
$.get('https://www.luogu.com.cn/article/'+lid+'/replies'+(lastid?'?after='+lastid.toString():''),{},function(res){
for(let i=0;res.replySlice[i]!=undefined;i++){
let comment=res.replySlice[i];
let rvid=comment.id;
let rv=comment.content;
let rvuid=comment.author.uid;
let rvname=comment.author.name;
let rvtime=comment.time*1000;
let rvt=getTime(rvtime);
reviews.push(new Review(rvid,rvuid,rvname,rv,false,rvt));
}
rvmghtml=`<div style="font-family: 'Segoe UI', Arial, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; background-color: #f5f7fa; min-height: 100vh;"><div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;"><h1 style="color: #2c3e50; margin: 0; font-weight: 600;">评论管理</h1><div><button id="batchSelect" style="background-color: #27ae60; color: white; border: none; padding: 10px 16px; border-radius: 4px; cursor: pointer; margin-right: 10px; font-weight: 500;">全选</button><button id="batchDelete"style="background-color: #e74c3c; color: white; border: none; padding: 10px 16px; border-radius: 4px; cursor: pointer; font-weight: 500;">批量删除</button></div></div><div id="batchActions"style="background-color: #3498db; color: white; padding: 12px 20px; border-radius: 6px; margin-bottom: 20px; display: none; align-items: center; justify-content: space-between;"><span id="selectedCount"style="font-weight: 500;">已选择<span style="color: #3498db; font-weight: 500;"id="slct"></span>条评论</span><div><button id="selectAll"style="background: transparent; color: white; border: 1px solid white; padding: 6px 12px; border-radius: 4px; cursor: pointer; margin-right: 10px;">全选</button><button id="deselectAll"style="background: transparent; color: white; border: 1px solid white; padding: 6px 12px; border-radius: 4px; cursor: pointer;">取消选择</button></div></div><div style="background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden;"><div style="display: flex; background-color: #f8f9fa; padding: 15px 20px; border-bottom: 1px solid #eaecef; font-weight: 600; color: #495057;"><div style="width: 50px; text-align: center;">选择</div><div style="width: 80px;">编号</div><div style="width: 150px;">用户名</div><div style="flex: 1;">评论内容</div><div style="width: 120px; text-align: center;">操作</div></div>`;
reviews.forEach((review,index)=>{
rvmghtml+=`<div class="comment-item"style="display: flex; padding: 18px 20px; border-bottom: 1px solid #f1f3f4; align-items: flex-start; transition: background-color 0.2s;"><div style="width: 50px; text-align: center; padding-top: 3px;"><input type="checkbox"class="comment-checkbox"style="cursor: pointer; width: 18px; height: 18px;"${(review.choose?'checked':'')} data-comment-id="${review.id}"></div><div style="width: 80px; color: #6c757d; font-weight: 500;">${review.id}</div><div style="width: 150px;"><div style="font-weight: 500; color: #2c3e50;"><a href="https://www.luogu.com.cn/user/${review.uid}">${review.user}</a></div><div style="font-size: 12px; color: #7f8c8d;">${review.time}</div></div><div style="flex: 1; color: #34495e; line-height: 1.5; word-wrap: break-word; max-width: 600px;">${review.content}</div><div style="width: 120px; text-align: right;"><button class="btn-delete"style="background-color: #e74c3c; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; " data-comment-id="${review.id}">删除</button></div></div>`;
});
_rvmg=rvmghtml+`</div><div style="text-align: center; margin: 25px 0;">${(reviews.length%20==0&&reviews.length?`<button style="background-color: #3498db; color: white; border: none; padding: 12px 30px; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 500; transition: background-color 0.3s;" id="getmorerv">加载更多</button>`:``)}</div><div style="display: flex; justify-content: space-between; margin-top: 20px; color: #7f8c8d; font-size: 14px;"><div>已获取<span style="color: #3498db; font-weight: 500;"id="rvct">${reviews.length}</span>条评论</div></div></div>`;
rvmg.innerHTML=_rvmg;
});
}
function deleteComment(lid,id){
let csrf = document.querySelector("meta[name=csrf-token]").content;
$.ajax({
url: 'https://www.luogu.com.cn'+'/article/'+lid.toString()+'/deleteReply/'+id.toString(),
type: 'POST',
dataType: 'json',
data: JSON.stringify({id: id}),
cache: false,
headers: {
'Content-Type': 'application/json',
'x-csrf-token': csrf
},
xhrFields: {
withCredentials: true
}
});
reloadmenu();
}
async function batchDeleteComment(lid,id,i,tot,retryCount=10){
return new Promise((resolve, reject) => {
let csrf = document.querySelector("meta[name=csrf-token]").content;
let attempts = 0;
function attemptDelete() {
$.ajax({
url: 'https://www.luogu.com.cn'+'/article/'+lid.toString()+'/deleteReply/'+id.toString(),
type: 'POST',
dataType: 'json',
data: JSON.stringify({id: id}),
cache: false,
headers: {
'Content-Type': 'application/json',
'x-csrf-token': csrf
},
xhrFields: {
withCredentials: true
},
success: function(response) {
swal("Better Luogu!","请等待删除完毕,当前进度"+(i+1).toString()+'/'+tot.toString(),"success",{button: "停止"}).then((value) => {location.reload();});
resolve(response);
},
error: function(xhr, status, error) {
attempts++;
if (attempts < retryCount) {
swal("Better Luogu!","删除失败,正在重试,当前进度"+(i+1).toString()+'/'+tot.toString(),"error",{button: "停止"}).then((value) => {location.reload();});
setTimeout(attemptDelete, 1000 * Math.pow(2, attempts));
} else {
swal("Better Luogu!","删除失败,请重试","error",{button: "刷新"}).then((value) => {location.reload();});
reject(error);
}
}
});
}
attemptDelete();
});
}
async function chooseComment(lid){
let chooce=document.querySelectorAll('.comment-checkbox:checked');
let chooces=Array.from(chooce).map(checkbox=>{
return checkbox.getAttribute('data-comment-id');
});
if(chooces.length==0) swal("Better Luogu!","请先选择","error")
else{
let tot=chooces.length;
for(let i=0;i<chooces.length;i++){
const deleteId = chooces[i];
try {
await batchDeleteComment(lid, deleteId, i, tot);
await new Promise(resolve => setTimeout(resolve, 1000));
} catch (error) {
swal("Better Luogu!","删除失败,请重试","error",{button: "刷新"}).then((value) => {location.reload();});
}
}
}
}
if(nowurl == 'https://www.luogu.com.cn/'){
let searchuser = document.createElement('div');
searchuser.className='lg-article';
searchuser.innerHTML='<h2>Better Luogu!</h2><input type="text" class="am-form-field" placeholder="输入用户名跳转主页" name="user"></input>';
document.querySelector('div.lg-right > div:nth-child(1)').insertAdjacentElement('beforebegin', searchuser);
function removeDivWithText(text) {
document.querySelectorAll('div').forEach(div => {
if(div.textContent === text) div.remove();
});
}
function findElement(element, text, cclass){
document.querySelectorAll(element).forEach(E => {
if(E.textContent === text) E.className = cclass;
});
}
removeDivWithText('暂无推荐');
removeDivWithText('洛谷根据您近期的做题情况,使用机器学习自动为您推荐符合您目前程度的题目。本列表每日更新一次。');
GM_xmlhttpRequest({
method: "GET",
url: 'https://top.baidu.com/board?tab=realtime',
onload: function(response){
let rs = new DOMParser();
let doc = rs.parseFromString(response.responseText, "text/html");
for(let i=1;i<=5;i++){
let th = i.toString();
let selector = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a > div.c-single-text-ellipsis';
let _rs = doc.querySelector(selector);
let selector2 = '#sanRoot > main > div.container.right-container_2EFJr > div > div:nth-child(2) > div:nth-child(' + th + ') > div.content_1YWBm > a';
let rslink = doc.querySelector(selector2);
let link = document.createElement("a");
link.href = rslink.href;
link.textContent = _rs.textContent;
let RS = document.createElement("p");
RS.appendChild(link);
findElement('h2','智能推荐','zntj');
document.getElementsByClassName('zntj')[0].parentNode.append(RS);
}
}
});
let links = document.querySelector('.lg-article.am-hide-sm');
links.insertAdjacentHTML('beforeend','<p><strong>Better Luogu!</strong><br><a href="http://blg.volatiles.dpdns.org/" target="_blank">Better Luogu!</a><br><a href="https://yx.dahi.edu.eu.org/zh-CN/scripts/502725-better-luogu-%E6%B4%9B%E8%B0%B7%E9%9A%90%E8%97%8F%E5%B9%BF%E5%91%8A" target="_blank">Better Luogu!-洛谷隐藏广告</a></p>');
}
window.onload=function(){
let button = document.createElement("a");
button.innerHTML = '<button id="NLTB" style=\"background-color: rgb\(94,114,228\);border-radius: 7px;color: white;border: none;padding: 7px 12px;text-align: center;text-decoration: none;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;border: none;box-shadow: 2px 3px 7px #000;\"><b>BETTER<b></button>';
if(nowurl == 'https://www.luogu.com.cn/'||nowurl.includes('https://www.luogu.com.cn/chat')||nowurl.includes('https://www.luogu.com.cn/user/notification')){
document.querySelector('#app > div.main-container > div.wrapper.wrapped.lfe-body.header-layout.tiny > div.container > nav').insertAdjacentElement('beforebegin', button);
const tb = document.getElementById("NLTB");
tb.addEventListener('click', function(){
swalcss.remove();
swalcss.innerHTML=".swal-overlay {background-color: rgba(0, 0, 0, 0.5);}";
document.head.appendChild(swalcss);
swal("Better Luogu!","选择一个更改", {
buttons: {
update: {
text: "检查更新",
value: "update",
},
content: {
text: "版本内容",
value: "content"
},
zb: {
text: "宣传",
value: "zb"
},
engine: {
text: "搜索引擎",
value: "engine"
},
code: {
text: "缺省源",
value: "code"
},
love: {
text: "点赞提醒",
value: "love"
},
not: {
text: "千万别点!!!",
value: "not"
}
},
}).then((value) => {
switch (value){
case "update":
checkUpdate();
break;
case "content":
update();
break;
case "zb":
zb();
break;
case "engine":
engine();
break;
case "code":
code();
break;
case "love":
love();
break;
case "not": not();
}
});
});
}
else if(!nowurl.includes('https://www.luogu.com.cn/ticket')){
let usernav=document.getElementsByClassName('nav-search')[0];
if(usernav==null) usernav=document.querySelector('#app > div.main-container > div.wrapper.wrapped.lfe-body.header-layout.normal > div.header > div.user-nav > nav > div:nth-child(1)');
usernav.insertAdjacentElement('beforebegin', button);
const tb = document.getElementById("NLTB");
tb.addEventListener('click', function(){
window.location.href='https://blg.volatiles.dpdns.org/';
});
}
else{
let usernav=document.getElementsByClassName('avatar')[0];usernav.insertAdjacentElement('beforebegin', button);
const tb = document.getElementById("NLTB");
tb.addEventListener('click', function(){
window.location.href='https://blg.volatiles.dpdns.org/';
});
}
let nowuid=getcookie('uid');
if(nowurl == 'https://www.luogu.com.cn/'){
$('input[name="user"]').keydown(function(e){
if(e.which===13){
let searchusr=$('input[name="user"]').val();
$.get('https://www.luogu.com.cn/api/user/search?keyword=' + searchusr, {}, function (res) {
var users = res['users'];
if(users[0]!=null){
window.open('https://www.luogu.com.cn/user/'+users[0]['uid'].toString(),'_self');
}
});
}
});
}
else if(nowurl.includes('?contestId=')){
let contestID = "";
let contest = nowurl.toString();
for(let i=contest.length-1;i>=0;i--){
if(!(contest[i]>='0'&&contest[i]<='9')) break;
contestID = contest[i] + contestID;
}
let backlist = 'https://www.luogu.com.cn/contest/'+contestID+'#problems';
let backbtn = document.createElement('a');
backbtn.href = backlist;
backbtn.className = 'color-default';
backbtn.innerHTML = '<svg data-v-5a5fcbaa="" data-v-0640126c="" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="right-from-bracket" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-right-from-bracket"><path data-v-5a5fcbaa="" data-v-0640126c="" fill="currentColor" d="M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z" class=""></path></svg>返回题目列表';
let a=document.querySelector('#app > div.main-container > main > div > div > div.side > div:nth-child(2)');
if(a!=null){
a.appendChild(br);
a.appendChild(backbtn);
}
}
else if(nowurl.includes('https://www.luogu.com.cn/discuss/')||nowurl.includes('https://www.luogu.com/discuss/')){
let discussID = "";
var flag=1;
let discuss = nowurl.toString();
for(let i=0;i<discuss.length;i++){
if(!(discuss[i]>='0'&&discuss[i]<='9')){
if(flag) continue;
else break;
}
discussID += discuss[i];
flag=0;
}
if(discussID != ""){
let dis = document.createElement('a');
dis.href = 'https://lglg.top/'+discussID;
dis.innerHTML = '<button data-v-505b6a97="" data-v-17e7c5b0="" class="solid lform-size-middle" type="button">在保存站打开</button>';
document.getElementsByClassName('btn-actions')[0].appendChild(dis);
}
}
else if(nowurl.includes('https://www.luogu.com.cn/chat')){
let index=document;
let once = true;
let menu = document.createElement('button');
menu.className = 'menu';
menu.style.backgroundColor = 'transparent';
menu.style.border = 'none';
menu.style.float = 'right';
menu.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgba(0, 0, 0, 1);transform: ;msFilter:;"><path d="M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z"></path></svg>';
if(nowurl.includes('?uid=')){
once=false;
document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title').appendChild(menu);
}
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes'){
if(once && document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title')!=null){
once=false;
document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title').appendChild(menu);
}
}
});
});
const config = {
attributes: true,
characterData: true,
childList: true,
subtree: true,
attributeOldValue: true,
characterDataOldValue: true
};
observer.observe(index,config);
menu.addEventListener('click', function(){
let chatuser = document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title > span > span > a > span').textContent;
let chatuid=document.querySelector('#app > div.main-container > main > div > div.card.wrapper.padding-none > div.main > div > div.top-container > div.title > span > span > a').href;
let uid='';
for(let i=chatuid.length-1;i>=0;i--){
if(chatuid[i]>='0'&&chatuid[i]<='9') uid=chatuid[i]+uid;
else break;
}
$.get('https://www.luogu.com.cn/api/user/search?keyword='+uid,{},function(res){
let userInfo = res['users'][0];
let avatar = userInfo.avatar;
let userType;
let userColor=userInfo.color;
if(userColor=='Gray') userColor='rgb(191, 191, 191)';
else if(userColor=='Blue') userColor='rgb(52, 152, 219)';
else if(userColor=='Green') userColor='rgb(82, 196, 26)';
else if(userColor=='Orange') userColor='rgb(243, 156, 17)';
else if(userColor=='Red') userColor='rgb(254, 76, 97)';
else if(userColor=='Purple') userColor='rgb(157, 61, 207)';
else if(userColor=='Cheater') userColor='rgb(173, 139, 0)';
if(userInfo.isAdmin) userType='管理员';
else if(userInfo.isBanned) userType='封禁用户';
else userType='普通用户';
let customModal = document.createElement('div');
customModal.className = 'custom-modal';
customModal.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:white;border-radius:16px;box-shadow:0 20px 40px rgba(0,0,0,0.15);z-index:10001;width:400px;max-width:90vw;display:none;';
customModal.innerHTML = `<div style="padding:25px;text-align:center"><div style="margin-bottom:20px"><img src="${avatar}" style="width:80px;height:80px;border-radius:50%;border:3px solid ${userColor}"/></div><h3 style="margin:10px 0 5px;color:${userColor}">${chatuser}</h3><p style="color:#718096;margin:5px 0">UID: ${uid}</p><p style="color:#667eea;margin:5px 0 20px">${userType}</p><button class="clear-chat-btn" style="background:#e74c3c;color:white;border:none;padding:10px 20px;border-radius:8px;cursor:pointer;font-size:14px;width:100%">清空私信</button></div>`;
document.body.appendChild(customModal);
customModal.style.display = 'block';
showMask();
document.querySelector('.clear-chat-btn').addEventListener('click', function(){
deleteChat(uid);
customModal.style.display = 'none';
hideMask();
});
mask.addEventListener('click', function(){
customModal.style.display = 'none';
hideMask();
});
});
});
let modalStyle = document.createElement('style');
modalStyle.innerHTML = '.custom-modal{animation:modalFadeIn 0.3s ease}@keyframes modalFadeIn{from{opacity:0;transform:translate(-50%,-60%)}to{opacity:1;transform:translate(-50%,-50%)}}@media (prefers-color-scheme: dark){.custom-modal{background:rgba(45,55,72,0.95)}}';
document.head.appendChild(modalStyle);
}
let isSearch = false;
document.addEventListener('keydown', function(event){
if(event.altKey && event.key == 's'){
if(!isSearch){
search.style.display = 'flex';
showMask();
isSearch=true;
}
else{
search.style.display = 'none';
search_input.value='';
hideMask();
isSearch=false;
}
}
if(event.keyCode===27){
if(isSearch){
search.style.display = 'none';
search_input.value='';
hideMask();
isSearch=false;
}
}
});
mask.addEventListener('click',function(){
search.style.display = 'none';
search_input.value='';
hideMask();
isSearch=false;
});
$('input[name="search"]').keydown(function(e){
if(e.which===13){
let sc=$('input[name="search"]').val();
if(sc!=""){
if(getcookie('engine')=='baidu') window.open('https://www.baidu.com/s?wd=' + sc,'_blank');
else if(getcookie('engine')=='google') window.open('https://google.com/search?q=' + sc,'_blank');
else if(getcookie('engine')=='bing') window.open('https://cn.bing.com/search?q=' + sc,'_blank');
else window.open(getcookie('engine')+'='+sc,'_blank');
}
}
});
if(nowurl.includes('https://www.luogu.com.cn/problem/')){
let sfcode=getcookie('code');
if(sfcode=="1"){
let cgqsy=document.createElement('span');
cgqsy.setAttribute('data-v-db920be0','');
cgqsy.setAttribute('data-v-715ac623','');
cgqsy.innerHTML='<span title="更改缺省源" data-v-db920be0=""><span data-v-715ac623="" data-v-db920be0-s="" class="v-popper--has-tooltip" style="cursor: pointer; margin-left: 0.3em;"><svg data-v-715ac623="" data-v-db920be0-s="" class="svg-inline--fa fa-gear" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="gear" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path class="" fill="currentColor" d="M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"></path></svg></span></span>';
let codenav=document.getElementsByClassName('actions')[0];
codenav.insertBefore(cgqsy,codenav.firstChild);
cgqsy.addEventListener('click',function(){
let nowcode=document.getElementsByClassName('cm-content')[0].innerHTML;
localStorage.setItem('code', nowcode);
setcookie('code','0',1919810,'/','luogu.com.cn',true);
swal("Better Luogu!","更改成功","success");
cgqsy.remove();
});
}
else{
var flag1=true;
setInterval(function(){
let t=document.getElementsByClassName('cm-content')[0];
let nowcode;
if(t!=null) nowcode=t.innerHTML;
if(nowcode=='<div class="cm-activeLine cm-line"><br></div>'&&flag1){
let incode=localStorage.getItem('code');
document.querySelector('#app > div.main-container > div > div.panel.panel-b > div > div.panel.panel-a > div:nth-child(2) > div > div > div.cm-scroller > div.cm-content.cm-lineWrapping').innerHTML=incode;
flag1=false;
}
},1000);
}
}
var toolflag=true;
setInterval(function () {
let toolbar=document.getElementsByClassName('cs-toolbar-group')[2];
if(toolbar!=null){
if(toolflag){
toolflag=false;
let zdk=document.createElement('span');
zdk.className='cs-toolbar-tool';
zdk.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 0H24V24H0z" fill="none"/><path d="M21 18v2H3v-2h18zM6.596 3.904L8.01 5.318 4.828 8.5l3.182 3.182-1.414 1.414L2 8.5l4.596-4.596zM21 11v2h-9v-2h9zm0-7v2h-9V4h9z"/></g></svg><span class="cs-tooltip">Callouts</span>';
toolbar.appendChild(zdk);
let epigraph=document.createElement('span');
epigraph.className='cs-toolbar-tool';
epigraph.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" fill="none" height="24" viewBox="0 0 24 24" width="24"><path d="M22 18.0048C22 18.5544 21.5544 19 21.0048 19H12.9952C12.4456 19 12 18.5544 12 18.0048C12 17.4552 12.4456 17.0096 12.9952 17.0096H21.0048C21.5544 17.0096 22 17.4552 22 18.0048Z" fill="currentColor"/><path d="M22 12.0002C22 12.5499 21.5544 12.9954 21.0048 12.9954H2.99519C2.44556 12.9954 2 12.5499 2 12.0002C2 11.4506 2.44556 11.0051 2.99519 11.0051H21.0048C21.5544 11.0051 22 11.4506 22 12.0002Z" fill="currentColor"/><path d="M21.0048 6.99039C21.5544 6.99039 22 6.54482 22 5.99519C22 5.44556 21.5544 5 21.0048 5H8.99519C8.44556 5 8 5.44556 8 5.99519C8 6.54482 8.44556 6.99039 8.99519 6.99039H21.0048Z" fill="currentColor"/></svg><span class="cs-tooltip">epigraph</span>';
toolbar.appendChild(epigraph);
let center=document.createElement('span');
center.className='cs-toolbar-tool';
center.innerHTML='<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><rect fill="none" height="256" width="256"/><path d="M40,76H216a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Z"/><path d="M64,100a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"/><path d="M216,140H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"/><path d="M192,180H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"/></svg><span class="cs-tooltip">居中</span>';
toolbar.appendChild(center);
let right=document.createElement('span');
right.className='cs-toolbar-tool';
right.innerHTML='<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M20 5C20.5523 5 21 5.44772 21 6C21 6.55228 20.5523 7 20 7H4C3.44772 7 3 6.55228 3 6C3 5.44772 3.44772 5 4 5H20Z" fill="currentColor"/><path d="M20 9C20.5523 9 21 9.44772 21 10C21 10.5523 20.5523 11 20 11H12C11.4477 11 11 10.5523 11 10C11 9.44772 11.4477 9 12 9H20Z" fill="currentColor"/><path d="M21 14C21 13.4477 20.5523 13 20 13H4C3.44772 13 3 13.4477 3 14C3 14.5523 3.44772 15 4 15H20C20.5523 15 21 14.5523 21 14Z" fill="currentColor"/><path d="M20 17C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H12C11.4477 19 11 18.5523 11 18C11 17.4477 11.4477 17 12 17H20Z" fill="currentColor"/></svg><span class="cs-tooltip">居右</span>';
toolbar.appendChild(right);
let mb=document.querySelector('body > div.casket');
let p=document.createElement('div');
p.className='cs-dialog-container';
p.innerHTML='<div class="cs-dialog"><div class=""><div class="cs-dialog-header">插入Callouts<div class="cs-close-container"><svg class="svg-inline--fa fa-xmark cs-icon" aria-hidden="true" focusable="false" data-prefix="far" data-icon="xmark" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path class="" fill="currentColor" d="M345 137c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-119 119L73 103c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l119 119L39 375c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l119-119L311 409c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-119-119L345 137z"></path></svg></div></div><div><div class="cs-dialog-item"><div class="cs-dialog-item-label">类型</div><select class="cs-dialog-item-content"><option value="info">info</option><option value="warning">warning</option><option value="success">success</option><option value="error">error</option></select></div><!----><div class="cs-dialog-submit-area"><button class="cs-dialog-button cs-dialog-button-info">开启自动打开</button><button class="cs-dialog-button cs-dialog-button-info">确认</button><button class="cs-dialog-button cs-dialog-button-info">取消</button></div></div></div><!----></div>';
zdk.addEventListener('click',function(){
mb.appendChild(p);
let close1=document.querySelector('body > div.casket > div > div > div > div.cs-dialog-header > div');
let close2=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(3)');
let yes=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(2)');
let autoOpen=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-submit-area > button:nth-child(1)');
close1.addEventListener('click',function(){p.remove();});
close2.addEventListener('click',function(){p.remove();});
let ao=false;
autoOpen.addEventListener('click',function(){
ao=!ao;
if(ao==true) autoOpen.innerText='关闭自动打开';
else autoOpen.innerText='开启自动打开';
});
yes.addEventListener('click',function(){
let zdklist=document.querySelector('body > div.casket > div > div > div > div:nth-child(2) > div.cs-dialog-item > select');
let zdktype=zdklist.options[zdklist.selectedIndex].value;
p.remove();
let nowline=document.getElementsByClassName('cm-activeLine')[0];
let fline=document.createElement('div');
fline.className='cm-line';
fline.innerText='::::'+zdktype+'[标题]';
if(ao) fline.innerText+='{open}';
let sline=document.createElement('div'),tline=document.createElement('div');
sline.innerText='内容';
tline.innerText='::::';
nowline.after(tline);
nowline.after(sline);
nowline.after(fline);
});
});
epigraph.addEventListener('click',function(){
let nowline=document.getElementsByClassName('cm-activeLine')[0];
let fline=document.createElement('div');
fline.className='cm-line';
fline.innerText=':::epigraph[]';
let sline=document.createElement('div');
sline.innerText=':::';
nowline.after(sline);
nowline.after(fline);
});
center.addEventListener('click',function(){
let nowline=document.getElementsByClassName('cm-activeLine')[0];
let fline=document.createElement('div');
fline.className='cm-line';
fline.innerText=':::align{center}';
let sline=document.createElement('div');
sline.innerText=':::';
nowline.after(sline);
nowline.after(fline);
});
right.addEventListener('click',function(){
let nowline=document.getElementsByClassName('cm-activeLine')[0];
let fline=document.createElement('div');
fline.className='cm-line';
fline.innerText=':::align{right}';
let sline=document.createElement('div');
sline.innerText=':::';
nowline.after(sline);
nowline.after(fline);
});
}
}
else toolflag=true;
},10);
if(nowurl.includes('https://www.luogu.com.cn/article/')&&getcookie('love')=='1'){
let avatar=document.querySelector('#app > div.main-container > main > div.article-banner.columba-content-wrap.wrapper > div > div > div.author > img');
let avatarsrc=avatar.src;
let title=document.querySelector('#article-title').innerText;
let author=0;
for(let i=41;i<avatarsrc.length;i++){
if(!(avatarsrc[i]>='0'&&avatarsrc[i]<='9')) break;
author=author*10+(avatarsrc[i]-'0');
}
let love=document.getElementsByClassName('button-2line')[1];
love.addEventListener('click',function(){
love=document.getElementsByClassName('button-2line')[1];
if(!love.classList.contains('active')){
sendMessage(author,'给你的文章《'+title+'》点了个赞');
}
});
}
else if(nowurl.includes('https://www.luogu.com.cn/article/')&&nowurl.includes('/edit')){
let rvpg=document.querySelector('#app > div.main-container > main > div > div > div > div.header > nav > ul > li:nth-child(2)');
if(rvpg!=null){
if(rvpg.innerText=='功能说明'){
let lid='';
for(let i=33;i<nowurl.length;i++){
if(nowurl[i]=='/') break;
lid+=nowurl[i];
}
getComment(lid,0);
rvpg.innerText='评论管理';
let flag=true;
setInterval(function(){
if(rvpg.classList.contains('selected')){
if(flag){
if(document.querySelector('#app > div.main-container > main > div > div > div > div.body > div > div')!=null){
document.querySelector('#app > div.main-container > main > div > div > div > div.body > div > div').remove();
document.querySelector('#app > div.main-container > main > div > div > div > div.body > div').appendChild(rvmg);
flag=false;
}
}
}
else flag=true;
},1000);
document.addEventListener('click',function(e){
if(e.target&&e.target.id==='getmorerv'){
lastid=reviews[reviews.length-1].id;
getComment(lid,lastid);
}
else if(e.target&&e.target.classList.contains('btn-delete')){
let commentId=e.target.getAttribute('data-comment-id');
deleteComment(lid,commentId);
}
else if(e.target&&e.target.id==='batchDelete'){
chooseComment(lid);
}
else if(e.target&&e.target.id==='batchSelect'){
for(let i=0;i<reviews.length;i++) reviews[i].choose=1;
rvmghtml=`<div style="font-family: 'Segoe UI', Arial, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; background-color: #f5f7fa; min-height: 100vh;"><div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;"><h1 style="color: #2c3e50; margin: 0; font-weight: 600;">评论管理</h1><div><button id="batchSelect" style="background-color: #27ae60; color: white; border: none; padding: 10px 16px; border-radius: 4px; cursor: pointer; margin-right: 10px; font-weight: 500;">全选</button><button id="batchDelete"style="background-color: #e74c3c; color: white; border: none; padding: 10px 16px; border-radius: 4px; cursor: pointer; font-weight: 500;">批量删除</button></div></div><div id="batchActions"style="background-color: #3498db; color: white; padding: 12px 20px; border-radius: 6px; margin-bottom: 20px; display: none; align-items: center; justify-content: space-between;"><span id="selectedCount"style="font-weight: 500;">已选择<span style="color: #3498db; font-weight: 500;"id="slct"></span>条评论</span><div><button id="selectAll"style="background: transparent; color: white; border: 1px solid white; padding: 6px 12px; border-radius: 4px; cursor: pointer; margin-right: 10px;">全选</button><button id="deselectAll"style="background: transparent; color: white; border: 1px solid white; padding: 6px 12px; border-radius: 4px; cursor: pointer;">取消选择</button></div></div><div style="background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); overflow: hidden;"><div style="display: flex; background-color: #f8f9fa; padding: 15px 20px; border-bottom: 1px solid #eaecef; font-weight: 600; color: #495057;"><div style="width: 50px; text-align: center;">选择</div><div style="width: 80px;">编号</div><div style="width: 150px;">用户名</div><div style="flex: 1;">评论内容</div><div style="width: 120px; text-align: center;">操作</div></div>`;
reviews.forEach((review,index)=>{
rvmghtml+=`<div class="comment-item"style="display: flex; padding: 18px 20px; border-bottom: 1px solid #f1f3f4; align-items: flex-start; transition: background-color 0.2s;"><div style="width: 50px; text-align: center; padding-top: 3px;"><input type="checkbox"class="comment-checkbox"style="cursor: pointer; width: 18px; height: 18px;"${(review.choose?'checked':'')} data-comment-id="${review.id}"></div><div style="width: 80px; color: #6c757d; font-weight: 500;">${review.id}</div><div style="width: 150px;"><div style="font-weight: 500; color: #2c3e50;"><a href="https://www.luogu.com.cn/user/${review.uid}">${review.user}</a></div></div><div style="flex: 1; color: #34495e; line-height: 1.5; word-wrap: break-word; max-width: 600px;">${review.content}</div><div style="width: 120px; text-align: right;"><button class="btn-delete"style="background-color: #e74c3c; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; " data-comment-id="${review.id}">删除</button></div></div>`;
});
_rvmg=rvmghtml+`</div><div style="text-align: center; margin: 25px 0;">${(reviews.length%20==0&&reviews.length?`<button style="background-color: #3498db; color: white; border: none; padding: 12px 30px; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 500; transition: background-color 0.3s;" id="getmorerv">加载更多</button>`:``)}</div><div style="display: flex; justify-content: space-between; margin-top: 20px; color: #7f8c8d; font-size: 14px;"><div>已获取<span style="color: #3498db; font-weight: 500;"id="rvct">${reviews.length}</span>条评论</div></div></div>`;
rvmg.innerHTML=_rvmg;
}
});
}
}
}
}
})();