|
进别人空间的时候会自动转到删访客记录的网页(&do=index&view=admin&additional=removevlog
并记录你去了谁的空间
进论坛主页的时候会自动打开删访客记录的网页,然后自动关闭,并清理记录
- // ==UserScript==
- // @name 去访客记录。
- // @version 1.0
- // @author M
- // @match https://www.gamemale.com/space-uid-*.html
- // @match https://www.gamemale.com/home.php?mod=space&uid=*&do=index
- // @match https://www.gamemale.com/home.php?mod=space&uid=*
- // @match https://www.gamemale.com/forum.php
- // @grant GM_openInTab
- // @grant GM_setValue
- // @grant GM_getValue
- // @grant GM_deleteValue
- // @grant GM_listValues
- // @run-at document-end
- // ==/UserScript==
- (function() {
- 'use strict';
- const UID_PREFIX = 'uid_';
- const MAX_STORED_UIDS = 50;
- function storeUid(uid) {
- const uidKey = UID_PREFIX + uid;
- GM_setValue(uidKey, Date.now());
- const allUids = GM_listValues().filter(key => key.startsWith(UID_PREFIX)).sort((a, b) => GM_getValue(a) - GM_getValue(b));
- if (allUids.length > MAX_STORED_UIDS) {
- allUids.slice(0, allUids.length - MAX_STORED_UIDS).forEach(key => GM_deleteValue(key));
- }
- }
- if (window.location.href.includes('space-uid-') || window.location.href.includes('home.php?mod=space&uid=')) {
- let uid = null;
- const spaceUidMatch = window.location.href.match(/space-uid-(\d+)\.html/);
- const homePhpMatch = window.location.href.match(/home\.php\?mod=space&uid=(\d+)/);
- if (spaceUidMatch && spaceUidMatch[1]) {
- uid = spaceUidMatch[1];
- } else if (homePhpMatch && homePhpMatch[1]) {
- uid = homePhpMatch[1];
- }
- if (uid) {
- storeUid(uid);
- const newUrl = `https://www.gamemale.com/home.php?mod=space&uid=${uid}&do=index&view=admin&additional=removevlog`;
- if (window.location.href !== newUrl) {
- window.location.replace(newUrl);
- }
- }
- return;
- }
- if (window.location.href.includes('forum.php')) {
- setTimeout(() => {
- const uidKeys = GM_listValues().filter(key => key.startsWith(UID_PREFIX));
- if (uidKeys.length > 0) {
- uidKeys.forEach(uidKey => {
- const uid = uidKey.replace(UID_PREFIX, '');
- const deleteUrl = `https://www.gamemale.com/home.php?mod=space&uid=${uid}&do=index&view=admin&additional=removevlog`;
- const newTab = window.open(deleteUrl, '_blank');
- setTimeout(() => {
- try {
- if (newTab && !newTab.closed) newTab.close();
- GM_deleteValue(uidKey);
- } catch(e) {}
- }, 4000);
- });
- }
- }, 1000);
- }
- })();
复制代码
|