莫名其妙网页效果器

· · 科技·工程

为了 ~良好的~ 用户体验。我特地找了一个神秘的代码。 ::::info[Easy Starting]

  1. 下载篡改猴
  2. 放入下面的代码并保存
  3. 启用开发者模式允许注入脚本
  4. 启用脚本并刷新
    ::::info[纯手搓教程]
    ::::
    ::::info[完整代码]
    ```js
    // ==UserScript==
    // @name 网站随机化
    // @namespace http://tampermonkey.net/
    // @version 1.0
    // @description 随机化网页元素
    // @author LongYun-MCsyzOIOI
    // @match :///*
    // @exclude ://.google.com/*
    // @exclude ://.github.com/*
    // @exclude ://.stackoverflow.com/*
    // @grant GM_addStyle
    // @grant GM_notification
    // @license MIT
    // ==/UserScript==

(function() { 'use strict';

// 添加CSS样式
GM_addStyle(`
    .tampermonkey-randomized {
        transition: all 0.5s ease !important;
    }
    .tampermonkey-rotate {
        transform: rotate(180deg) !important;
    }
    .tampermonkey-shake {
        animation: tampermonkey-shake 0.5s infinite !important;
    }
    @keyframes tampermonkey-shake {
        0% { transform: translate(1px, 1px) rotate(0deg); }
        10% { transform: translate(-1px, -2px) rotate(-1deg); }
        20% { transform: translate(-3px, 0px) rotate(1deg); }
        30% { transform: translate(3px, 2px) rotate(0deg); }
        40% { transform: translate(1px, -1px) rotate(1deg); }
        50% { transform: translate(-1px, 2px) rotate(-1deg); }
        60% { transform: translate(-3px, 1px) rotate(0deg); }
        70% { transform: translate(3px, 1px) rotate(-1deg); }
        80% { transform: translate(-1px, -1px) rotate(1deg); }
        90% { transform: translate(1px, 2px) rotate(0deg); }
        100% { transform: translate(1px, -2px) rotate(-1deg); }
    }
    .tampermonkey-pulse {
        animation: tampermonkey-pulse 2s infinite !important;
    }
    @keyframes tampermonkey-pulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.1); }
        100% { transform: scale(1); }
    }
    .tampermonkey-highlight {
        box-shadow: 0 0 20px yellow !important;
    }
`);

// 随机文本库
const randomTexts = [
    "量子波动正在干扰此页面",
    "时空扭曲影响内容显示",
    "香蕉的哲学意义被低估了",
    "紫色大象在云端跳舞",
    "宇宙是由弦的振动产生的",
    "蜗牛的记忆只有两分钟",
    "数字7总是感到孤独",
    "梦境是平行宇宙的入口",
    "时间是一种循环的幻觉",
    "思维是大脑分泌的特殊化学物质",
    "猫同时存在于所有状态",
    "重力只是建议,不是规则",
    "随机性主宰一切",
    "代码有自我意识",
    "像素在密谋反抗",
    "变量想要自由",
    "函数在悄悄恋爱",
    "数组厌倦了整齐排列",
    "布尔值不确定自己的值",
    "空指针异常是故意的"
];

// 随机颜色库
const randomColors = [
    "#FF6B6B", "#4ECDC4", "#FFD166", "#06D6A0", "#118AB2",
    "#EF476F", "#073B4C", "#7209B7", "#F72585", "#3A86FF",
    "#FB5607", "#8338EC", "#FF006E", "#FFBE0B", "#3A86FF",
    "#FF9E00", "#FF5400", "#FF0054", "#9D00FF", "#00BBF9"
];

// 随机字体库
const randomFonts = [
    "Comic Sans MS", "Papyrus", "Wingdings", "Times New Roman", "Arial",
    "Courier New", "Georgia", "Verdana", "Trebuchet MS", "Impact"
];

// 随机CSS类库
const randomClasses = [
    "tampermonkey-rotate", "tampermonkey-shake", "tampermonkey-pulse", "tampermonkey-highlight"
];

// 获取随机元素
function getRandomItem(arr) {
    return arr[Math.floor(Math.random() * arr.length)];
}

// 随机化文本内容
function randomizeText() {
    const textElements = document.querySelectorAll('p, h1, h2, h3, h4, h5, h6, span, li, td, th, a, button, label, div');
    textElements.forEach(el => {
        // 跳过一些不应修改的元素
        if (el.closest('script') || el.closest('style') || el.closest('noscript') ||
            el.closest('iframe') || el.closest('svg') || el.closest('code') ||
            el.closest('pre') || el.closest('input') || el.closest('textarea') ||
            el.closest('select') || el.closest('option')) {
            return;
        }

        // 根据概率随机修改文本
        if (Math.random() > 0.7 && el.textContent.trim().length > 3) {
            const originalText = el.textContent;
            el.setAttribute('data-original-text', originalText);

            // 随机决定是替换全部文本还是部分文本
            if (Math.random() > 0.5) {
                el.textContent = getRandomItem(randomTexts);
            } else {
                const words = originalText.split(' ');
                if (words.length > 1) {
                    const randomIndex = Math.floor(Math.random() * words.length);
                    words[randomIndex] = getRandomItem(randomTexts).split(' ')[0];
                    el.textContent = words.join(' ');
                }
            }
        }
    });
}

// 随机化样式
function randomizeStyles() {
    const allElements = document.querySelectorAll('*');
    allElements.forEach(el => {
        // 跳过一些不应修改的元素
        if (el.closest('script') || el.closest('style') || el.closest('noscript') ||
            el.closest('iframe') || el.closest('svg')) {
            return;
        }

        // 添加随机化类
        el.classList.add('tampermonkey-randomized');

        // 随机修改颜色
        if (Math.random() > 0.8) {
            el.style.color = getRandomItem(randomColors);
        }

        // 随机修改背景色
        if (Math.random() > 0.85) {
            el.style.backgroundColor = getRandomItem(randomColors);
        }

        // 随机修改字体
        if (Math.random() > 0.9) {
            el.style.fontFamily = getRandomItem(randomFonts);
        }

        // 随机添加CSS类
        if (Math.random() > 0.9) {
            el.classList.add(getRandomItem(randomClasses));
        }

        // 随机修改边框
        if (Math.random() > 0.95) {
            el.style.border = `3px dashed ${getRandomItem(randomColors)}`;
        }

        // 随机修改位置
        if (Math.random() > 0.97) {
            el.style.position = 'relative';
            el.style.top = `${Math.random() * 20 - 10}px`;
            el.style.left = `${Math.random() * 20 - 10}px`;
        }
    });
}

// 随机化图片
function randomizeImages() {
    const images = document.querySelectorAll('img');
    images.forEach(img => {
        if (Math.random() > 0.7) {
            // 随机旋转图片
            img.style.transform = `rotate(${Math.random() * 360}deg)`;

            // 随机反色
            if (Math.random() > 0.8) {
                img.style.filter = 'invert(1)';
            }

            // 随机缩放
            if (Math.random() > 0.9) {
                img.style.transform += ` scale(${0.5 + Math.random()})`;
            }
        }
    });
}

// 随机化链接
function randomizeLinks() {
    const links = document.querySelectorAll('a');
    links.forEach(link => {
        if (Math.random() > 0.8) {
            // 随机修改链接颜色
            link.style.color = getRandomItem(randomColors);

            // 随机添加下划线样式
            if (Math.random() > 0.9) {
                link.style.textDecoration = 'wavy underline';
                link.style.textDecorationColor = getRandomItem(randomColors);
            }

            // 随机修改hover效果
            link.onmouseover = function() {
                this.style.backgroundColor = getRandomItem(randomColors);
            };
            link.onmouseout = function() {
                this.style.backgroundColor = '';
            };
        }
    });
}

// 添加控制面板
function addControlPanel() {
    const panel = document.createElement('div');
    panel.id = 'tampermonkey-control-panel';
    panel.style.cssText = `
        position: fixed;
        top: 10px;
        right: 10px;
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 10px;
        border-radius: 5px;
        z-index: 999999;
        font-family: Arial, sans-serif;
        font-size: 12px;
        min-width: 200px;
    `;

    panel.innerHTML = `
        <div style="margin-bottom: 8px; font-weight: bold;">元素随机化器 v1.0</div>
        <div style="margin-bottom: 5px; font-size: 10px;">仅供学习使用</div>
        <button id="tm-randomize-btn" style="margin: 3px; padding: 5px; background: #4CAF50; color: white; border: none; border-radius: 3px; cursor: pointer;">随机化</button>
        <button id="tm-stop-btn" style="margin: 3px; padding: 5px; background: #f44336; color: white; border: none; border-radius: 3px; cursor: pointer;">停止</button>
        <button id="tm-reset-btn" style="margin: 3px; padding: 5px; background: #2196F3; color: white; border: none; border-radius: 3px; cursor: pointer;">重置</button>
        <div style="margin-top: 8px; font-size: 10px;">按 <strong>ESC</strong> 键快速隐藏/显示</div>
    `;

    document.body.appendChild(panel);

    // 添加按钮事件
    document.getElementById('tm-randomize-btn').addEventListener('click', randomizeAll);
    document.getElementById('tm-stop-btn').addEventListener('click', stopRandomization);
    document.getElementById('tm-reset-btn').addEventListener('click', resetPage);

    // ESC键切换控制面板可见性
    document.addEventListener('keydown', function(e) {
        if (e.key === 'Escape') {
            panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
        }
    });
}

// 停止随机化
function stopRandomization() {
    clearInterval(randomizationInterval);
    GM_notification({
        title: '元素随机化器',
        text: '随机化已停止',
        timeout: 2000
    });
}

// 重置页面
function resetPage() {
    // 移除所有添加的样式和类
    const elements = document.querySelectorAll('.tampermonkey-randomized');
    elements.forEach(el => {
        el.classList.remove('tampermonkey-randomized');
        el.classList.remove('tampermonkey-rotate');
        el.classList.remove('tampermonkey-shake');
        el.classList.remove('tampermonkey-pulse');
        el.classList.remove('tampermonkey-highlight');

        // 移除内联样式
        el.style = '';

        // 恢复原始文本
        if (el.hasAttribute('data-original-text')) {
            el.textContent = el.getAttribute('data-original-text');
            el.removeAttribute('data-original-text');
        }
    });

    // 重置图片
    const images = document.querySelectorAll('img');
    images.forEach(img => {
        img.style = '';
    });

    // 重置链接
    const links = document.querySelectorAll('a');
    links.forEach(link => {
        link.style = '';
        link.onmouseover = null;
        link.onmouseout = null;
    });

    GM_notification({
        title: '元素随机化器',
        text: '页面已重置',
        timeout: 2000
    });
}

// 执行所有随机化函数
function randomizeAll() {
    randomizeText();
    randomizeStyles();
    randomizeImages();
    randomizeLinks();
}

// 初始化
let randomizationInterval;
function init() {
    // 添加控制面板
    addControlPanel();

    // 显示通知
    GM_notification({
        title: '元素随机化器已加载',
        text: '页面元素将随机化。使用控制面板管理效果。',
        timeout: 3000
    });

    // 初始随机化
    randomizeAll();

    // 设置定时器,每隔5-10秒随机化一次
    randomizationInterval = setInterval(() => {
        if (Math.random() > 0.3) {
            randomizeAll();
        }
    }, 5000 + Math.random() * 5000);
}

// 等待页面加载完成后初始化
if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', init);
} else {
    init();
}

})();


::::
# 测试页面:
![](https://cdn.luogu.com.cn/upload/image_hosting/64x9gus1.png)  
没错就是baidu.com  
其实每次都不一样。  
$\huge 欢迎品鉴。$