Greasy Fork

Greasy Fork is available in English.

O页面演示文本编辑器

方便编辑简单的文案查看排版

当前为 2024-07-03 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         O页面演示文本编辑器
// @namespace    your-namespace
// @version      5.4
// @description  方便编辑简单的文案查看排版
// @match        *://*.oppo.com/*
// @grant        GM_addStyle
// @license     GNU GPLv3
// @author        Paul
// ==/UserScript==

(function() {
    'use strict';

    // Enable design mode
    document.designMode = "on";

  // Disable all clicks
    document.addEventListener('click', function(event) {
        event.stopPropagation();
        event.preventDefault();
        event.returnValue = false;
        return false;
    }, true);

    // 获取页面上所有文本元素
    const textElements = document.querySelectorAll("*:not(script):not(style):not(title)");

    // 将文本层的CSS属性z-index设置为一个较大的值,使其位于其他元素之上
    textElements.forEach(element => {
        element.style.zIndex = "9999";
    });

 // 创建提示框元素
    const tooltip = document.createElement('div');
    tooltip.textContent = '演示模式-Demonstration Mode';

    // 设置提示框的样式
    tooltip.style.position = 'fixed';
    tooltip.style.bottom = '10px';
    tooltip.style.left = '10px';
    tooltip.style.zIndex = '9999';
    tooltip.style.padding = '10px';
    tooltip.style.borderRadius = '20px';
    tooltip.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.3)';
    tooltip.style.fontFamily = 'Arial, sans-serif';
    tooltip.style.fontSize = '16px';
    tooltip.style.color = '#fff';
    tooltip.style.textAlign = 'center';
    tooltip.style.animation = 'colorChange 1s ease-in-out infinite alternate';

    // 创建颜色变化的动画
    GM_addStyle(`
        @keyframes colorChange {
            0% {
                background-color: #ff0000;
            }
            50% {
                background-color: #00ff00;
            }
            100% {
                background-color: #0000ff;
            }
        }
    `);

    // 添加提示框到页面
    document.body.appendChild(tooltip);




})();