如果你不希望自己的私信背偷窥的话
加入这个篡改猴代码就可以了
初始密码:123456
有bug欢迎指出
// ==UserScript== // @name 洛谷私信密码锁-修复校验版 // @namespace http://tampermonkey.net/ // @version 4.1 // @description 私信上锁,忘记密码弹窗自定义设置洛谷验证密码,初始解锁密码123456,底部添加作者信息跳转链接 // @author William // @match https://www.luogu.com.cn/chat* // @grant GM_setValue // @grant GM_getValue // @run-at document-start // ==/UserScript== (function(){ 'use strict'; const DEFAULT_UNLOCK_PWD = "123456"; let unlockPwd = GM_getValue("luoguChatLockPwd", DEFAULT_UNLOCK_PWD); let luoguVerifyPwd = GM_getValue("luoguAccountPwd", ""); const mask=document.createElement('div'); mask.style=`position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0a0a0a;z-index:9999999;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;color:#fff;font-size:18px;`; const title=document.createElement('div'); title.textContent="私信已加密锁定,请输入解锁密码"; const fakePwd=document.createElement('input'); fakePwd.type="password"; fakePwd.style="position:absolute;opacity:0;width:1px;height:1px;"; const input=document.createElement('input'); input.type="password"; input.autocomplete="new-password"; input.dataset["1pIgnore"]="1"; input.style=`padding:11px 15px;width:290px;font-size:16px;border:none;border-radius:7px;outline:0;background:#222;color:#fff;`; const btnRow=document.createElement('div'); btnRow.style="display:flex;gap:12px;"; const unlockBtn=document.createElement('button'); unlockBtn.textContent="解锁查看"; unlockBtn.style=`padding:11px 20px;background:#0077ff;color:#fff;border:none;border-radius:7px;font-size:16px;cursor:pointer;`; const forgetBtn=document.createElement('button'); forgetBtn.textContent="忘记密码"; forgetBtn.style=`padding:11px 20px;background:#444;color:#fff;border:none;border-radius:7px;font-size:16px;cursor:pointer;`; const tip=document.createElement('div'); tip.style.color="#ff5555;height:22px"; btnRow.append(unlockBtn,forgetBtn); mask.append(fakePwd,title,input,btnRow,tip); // 底部作者信息栏 const footer=document.createElement('div'); footer.style=`position:absolute;bottom:30px;left:0;width:100%;text-align:center;font-size:15px;color:#ffffff;`; const link=document.createElement('a'); link.href="https://www.luogu.com.cn/user/1223232"; link.target="_blank"; link.style="color:#88ccff;text-decoration:none;"; link.textContent="作者WILLIAM 洛谷账号:https://www.luogu.com.cn/user/1223232"; footer.appendChild(link); mask.appendChild(footer); document.documentElement.appendChild(mask); window.addEventListener('load',()=>input.value=""); function checkUnlock(){ if(input.value===unlockPwd){ mask.remove(); }else{ tip.textContent="密码错误,请重新输入"; input.value=""; } } unlockBtn.onclick=checkUnlock; input.onkeydown=e=>{if(e.key==="Enter")checkUnlock();}; forgetBtn.onclick=()=>{ const box=document.createElement('div'); box.style=`position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#181818;padding:24px;border-radius:8px;z-index:10000000;display:flex;flex-direction:column;gap:15px;color:#fff;min-width:320px;`; const t1=document.createElement('div'); t1.textContent="输入你的洛谷登录密码(用于验证重置)"; const luoPwdIn=document.createElement('input'); luoPwdIn.type="password"; luoPwdIn.placeholder="输入洛谷登录密码"; luoPwdIn.style=`padding:10px;width:100%;background:#222;color:#fff;border:none;border-radius:6px;outline:none;`; luoPwdIn.value=luoguVerifyPwd; const t2=document.createElement('div'); t2.textContent="设置新的私信解锁密码"; const newPwdIn=document.createElement('input'); newPwdIn.type="password"; newPwdIn.placeholder="新解锁密码"; newPwdIn.style=`padding:10px;width:100%;background:#222;color:#fff;border:none;border-radius:6px;outline:none;`; const btns=document.createElement('div'); btns.style="display:flex;gap:10px;justify-content:flex-end;"; const confirmBtn=document.createElement('button'); confirmBtn.textContent="确认修改"; confirmBtn.style="padding:8px 16px;background:#0077ff;border:none;border-radius:6px;color:#fff;cursor:pointer;"; const closeBtn=document.createElement('button'); closeBtn.textContent="取消"; closeBtn.style="padding:8px 16px;background:#444;border:none;border-radius:6px;color:#fff;cursor:pointer;"; const warn=document.createElement('div'); warn.style.color="#ff5555;font-size:14px;height:18px;"; btns.append(confirmBtn,closeBtn); box.append(t1,luoPwdIn,t2,newPwdIn,warn,btns); document.body.appendChild(box); closeBtn.onclick=()=>box.remove(); confirmBtn.onclick=()=>{ const lp=luoPwdIn.value.trim(); const np=newPwdIn.value.trim(); if(lp===""){ warn.textContent="请填写洛谷登录密码"; return; } if(np===""){ warn.textContent="新密码不能为空"; return; } if(lp!==luoguVerifyPwd){ if(luoguVerifyPwd===""){ luoguVerifyPwd=lp; GM_setValue("luoguAccountPwd",luoguVerifyPwd); }else{ warn.textContent="洛谷密码验证失败"; return; } } unlockPwd=np; GM_setValue("luoguChatLockPwd",unlockPwd); warn.style.color="#66ff66"; warn.textContent="修改成功!"; setTimeout(()=>box.remove(),1200); }; luoPwdIn.onkeydown=e=>{if(e.key==="Enter")confirmBtn.click();}; newPwdIn.onkeydown=e=>{if(e.key==="Enter")confirmBtn.click();}; }; })();