【油猴脚本】删除足迹按钮
动机看到@Makima老师编写的【脚本】去访客记录,因为这个脚本在查看主题、回复、记录、资料等时也会自动跳回删除足迹的首页,和我的需求并不完全符合,所以又写了一个在空间左上角添加按钮、点击才会触发的功能类似的脚本。
功能
这个脚本可以在浏览某个用户的空间时,在空间的左上角“返回首页”按钮右侧添加一个新的“删除足迹”按钮。点击这个按钮后就会自动跳转到后缀 &do=index&view=admin&additional=removevlog 的删除足迹页面。
代码
@Name@Match@Icon
// ==UserScript==
// @name 空间:添加删除足迹按钮
// @namespace http://tampermonkey.net/
// @version 0.1
// @description在GameMale用户页面添加删除足迹按钮
// @author You
// @match https://www.gamemale.com/home.php?mod=space&uid=*
// @match https://www.gamemale.com/space-uid-*.html
// @match https://www.gamemale.com/?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 提取当前页面的UID
function getCurrentUID() {
const url = window.location.href;
let uid = null;
// 匹配三种URL格式
const matches1 = url.match(/uid=(\d+)/);
const matches2 = url.match(/space-uid-(\d+)\.html/);
const matches3 = url.match(/[?&](\d+)/);
if (matches1 && matches1) {
uid = matches1;
} else if (matches2 && matches2) {
uid = matches2;
} else if (matches3 && matches3) {
uid = matches3;
}
// 验证UID是否为5-6位数字
if (uid && /^\d{5,6}$/.test(uid)) {
return uid;
}
return null;
}
// 添加删除足迹按钮
function addRemoveFootprintButton(uid) {
const toptb = document.getElementById('toptb');
if (!toptb) return;
const returnHomeLink = toptb.querySelector('a');
if (!returnHomeLink) return;
// 创建分隔符
const pipe = document.createElement('span');
pipe.className = 'pipe';
pipe.textContent = '|';
// 创建删除足迹链接
const removeLink = document.createElement('a');
removeLink.href = `https://www.gamemale.com/home.php?mod=space&uid=${uid}&do=index&view=admin&additional=removevlog`;
removeLink.className = 'remove-footprint';
removeLink.textContent = '删除足迹';
removeLink.style.cursor = 'pointer';
// 插入到返回首页按钮后面
returnHomeLink.parentNode.insertBefore(pipe, returnHomeLink.nextSibling);
returnHomeLink.parentNode.insertBefore(removeLink, pipe.nextSibling);
}
// 主函数
function main() {
const uid = getCurrentUID();
if (uid) {
addRemoveFootprintButton(uid);
}
}
// 等待DOM加载完成
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', main);
} else {
main();
}
})();
星象占卜 可以直接自行选择,不用手动开关脚本,挺方便的哇 这个脚本更方便偷偷视奸其他人了,管理员似乎更有需求 这个功能可以,不用再手动删除了,感谢楼主分享 随时删除足迹更加有一种偷感了;P 又可以悄默默的去视奸别人的空间了:$ 这应该叫防视奸脚本才对(马上去视奸所有人) 这个真的很方便了,可以偷偷地视奸各位宝子了{:6_200:} 这样视奸就很方便噜{:6_200:}偷偷的看着你们 感觉真的是偷窥神器惹这下要成为老实本分的呆呆女了 可以手动删在使用体验上会好很多
现在我们都是偷窥婆.jpg 视奸神器简直,这下可以悄无声息的行动了:$ 这下子感觉方便视奸了 改成按钮不用手动开关脚本用起来真是方便多了 我都不知道原来足迹还可以删掉.真不错,既可以视奸别人又可以防视奸 啊这原来是可以删除的嘛,收藏了收藏了,以防不时之需(不是) 谢谢分享功能这么强大的脚本 这个好耶~可以尽情视奸了(不 看着非常方便,感谢分享了{:6_197:} 利害,复制试试看。楼主真牛