Greasy Fork

Greasy Fork is available in English.

上下翻转文字

上下翻转页面上的文字,一个有趣无用的脚本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         上下翻转文字
// @namespace    dylanzhang
// @version      0.1
// @description  上下翻转页面上的文字,一个有趣无用的脚本
// @author       Dylan_Zhang
// @match        *://*/*
// @icon         none
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    // 创建全局翻转样式
    const style = document.createElement('style');
    style.textContent = `
        body {
            transform: scaleY(-1); /* 垂直翻转 */
            min-height: 100vh; /* 确保高度适应 */
            margin: 0;
        }

        /* 保持视频/图片正常方向(可选) */
        img, video {
            transform: scaleY(-1);
        }
    `;

    // 插入样式到页面头部
    document.head.appendChild(style);

    // 处理 fixed/fixed 定位元素
    [document.body, ...document.querySelectorAll('*')].forEach(el => {
        if(getComputedStyle(el).position === 'fixed') {
            el.style.transform += ' scaleY(-1)';
        }
    });
})();