洛谷反诈中心 2.2.3
手动反诈很麻烦而且还是容易被诈骗,所以我们用脚本来反诈。
2.2 版本更新内容:
-
修复了 2.1.2 的大BUG:每次刷新网页后,鼠标第一次悬停在一个诈骗链接上时,不会提示这是诈骗链接。
-
已知的诈骗链接无需再手动录入了(每次更新版本都得手动录入一遍太烦了!)
-
因为有时候会出现这样的情况:
[真正的链接](诈骗链接),这种情况下我们就无法复制真正的链接。所以当鼠标悬停的链接为诈骗链接时,会有窗口提示这是诈骗链接 \n [真正的链接] \n (诈骗链接) -
将原来的“添加/删除”按钮变为了“添加”和“删除”两个按钮。
-
没了
-
食用方法:按下 Alt+Shift+N 键,就会弹出一个窗口,可以在该窗口里编辑哪些链接是诈骗链接。
-
编辑诈骗链接:首先要现在文本框中输入需要 加入列表中/从列表中删除 的链接,如果需要加入就按“添加”否则按“删除”。
-
具体效果:当鼠标悬浮在一个链接上时,脚本会检测该链接 是否被包含在“诈骗链接”中,如果是,就会弹出一个弹窗
这是诈骗链接,如果你觉得这个链接可以不被算作诈骗链接了,可以直接从弹窗中复制链接,再按照“编辑诈骗链接”的方法将该链接删去即可。 -
注意事项/脚本BUG:暂时没有,之前的BUG给修复了。
-
建议:将以下链接(已确定的诈骗链接)加入到“诈骗链接”中,注意每次输入只能加入一个链接,多个链接需要分多次输入。
https://www.bilibili.com/video/BV1GJ411x7h7/?spm_id_from=333.337.search-card.all.click
https://www.bilibili.com/video/BV1GJ411x7h7
https://noip.d0j1a1701.cc/
https://vdse.bdstatic.com/192d9a98d782d9c74c96f09db9378d93.mp4
https://cdn.luogu.com.cn/upload/image_hosting/216k1isp.png
https://www.ixigua.com/6656671797355741703?logTag=cbc208a92ff1fa10d8f1
https://kugou.com/song-36/2cklx51.html?from_360
https://y.qq.com/n/ryqq/songDetail/002Z6Nqx34XLgt?songtype=0&ADTAG=360ald
https://music.163.com/#/song?id=18520488
https://www.luogu.com.cn/user/677045
https://www.luogu.com.cn/paste/opkra6n0
https://www.luogu.com.cn/paste/t6xq1k38
https://p.qpic.cn/qq_expression/41384847/41384847_0_0_0_9710B2BF57B43E59DC64A5C64407F5B2_0_0/0
https://y.qq.com/n/ryqq/songDetail/0004gbRR1vKpcD
https://www.luogu.com.cn/problem/U334368
https://www.bilibili.com/video/BV1hq4y1s7VH/?spm_id_from=333.337.search-card.all.click
https://b23.tv/rrHrxMt装好脚本以后你可以用一下链接测试(主要也是方便我测试):
代码(在油猴上运行):
// ==UserScript==
// @name 洛谷反诈中心
// @version 2.3
// @description 自动检测诈骗链接
// @match https://www.luogu.com.cn/*
// @match https://www.luogu.com.cn/user/*
// @match https://www.luogu.com.cn/paste/*
// @match https://www.luogu.com.cn/problem/*
// @match https://www.luogu.com.cn/blog/*
// @author GWBailang
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function() {
const LINK = GM_getValue('customLinks', ["https://www.bilibili.com/video/BV1GJ411x7h7/?spm_id_from=333.337.search-card.all.click",
"https://www.bilibili.com/video/BV1GJ411x7h7",
"https://noip.d0j1a1701.cc/",
"https://vdse.bdstatic.com/192d9a98d782d9c74c96f09db9378d93.mp4",
"https://cdn.luogu.com.cn/upload/image_hosting/216k1isp.png",
"https://www.ixigua.com/6656671797355741703?logTag=cbc208a92ff1fa10d8f1",
"https://kugou.com/song-36/2cklx51.html?from_360",
"https://y.qq.com/n/ryqq/songDetail/002Z6Nqx34XLgt?songtype=0&ADTAG=360ald",
"https://music.163.com/#/song?id=18520488",
"https://www.luogu.com.cn/user/677045",
"https://www.luogu.com.cn/paste/opkra6n0",
"https://www.luogu.com.cn/paste/t6xq1k38",
"https://p.qpic.cn/qq_expression/41384847/41384847_0_0_0_9710B2BF57B43E59DC64A5C64407F5B2_0_0/0",
"https://y.qq.com/n/ryqq/songDetail/0004gbRR1vKpcD",
"https://www.luogu.com.cn/problem/U334368",
"https://www.bilibili.com/video/BV1hq4y1s7VH/?spm_id_from=333.337.search-card.all.click",
"https://b23.tv/rrHrxMt"]) || [];
document.addEventListener('keydown', function(e) {
if (e.altKey && e.shiftKey && e.key === 'N') { // Alt+Shift+N
e.preventDefault();
e.stopPropagation();
createManageLinksWindow();
}
});
document.addEventListener('mouseover', function(e) {
if (e.target.tagName === 'A') {
let targetLink = e.target.href;
let linkText = e.target.textContent;
if (LINK.includes(targetLink)) {
alert('这是诈骗链接 \n [' + linkText + '] \n (' + targetLink + ')');
}
}
});
function createManageLinksWindow() {
const windowStyle = `
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 30px;
background-color: #acd;
border-radius: 4px;
z-index: 9999;
`;
const backdropStyle = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9998;
`;
const linksPopup = document.createElement('div');
linksPopup.style.cssText = windowStyle;
linksPopup.innerHTML = `
<h3>管理诈骗链接</h3>
<ul id="custom-links-list">
${LINK.map(link => `<li>${link}</li>`).join('')}
</ul>
<input id="new-link-input" type="text" placeholder="在此输入链接">
<button id="save-link-btn">添加</button>
<button id="del-link-btn">删除</button>
`;
const backdrop = document.createElement('div');
backdrop.style.cssText = backdropStyle;
document.body.appendChild(backdrop);
document.body.appendChild(linksPopup);
const customLinksList = document.getElementById('custom-links-list');
const newLinkInput = document.getElementById('new-link-input');
const saveLinkBtn = document.getElementById('save-link-btn');
const delLinkBtn = document.getElementById('del-link-btn');
saveLinkBtn.addEventListener('click', function() {
const newLink = newLinkInput.value.trim();
if (newLink) {
if (!LINK.includes(newLink)) {
LINK.push(newLink);
GM_setValue('customLinks', LINK); // 保存诈骗链接
customLinksList.innerHTML = LINK.map(link => `<li>${link}</li>`).join('');
newLinkInput.value = '';
}else{
alert('此链接已在列表中了!');
}
}
});
delLinkBtn.addEventListener('click',function() {
const newLink = newLinkInput.value.trim();
if (newLink) {
if(LINK.includes(newLink)) {
LINK.splice(LINK.indexOf(newLink), 1);
GM_setValue('customLinks', LINK); // 保存诈骗链接
customLinksList.innerHTML = LINK.map(link => `<li>${link}</li>`).join('');
newLinkInput.value = '';
}else{
alert('列表中没有这个链接!');
}
}
});
document.addEventListener('click', function(e) {
if (!linksPopup.contains(e.target)) {
linksPopup.remove();
backdrop.remove();
}
});
}
})();