Mobile Character.AI Full-Screen Toggle

Adds a full-screen toggle button with an icon to the Character.AI website for Firefox mobile users, with further adjusted position and size.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Mobile Character.AI Full-Screen Toggle
// @namespace    https://github.com/LuxTallis
// @version      1.0.4
// @description  Adds a full-screen toggle button with an icon to the Character.AI website for Firefox mobile users, with further adjusted position and size.
// @author       LuxTallis
// @license      MIT
// @match        https://character.ai/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Create the button
    const fullScreenButton = document.createElement('button');
    fullScreenButton.innerHTML = '⛶'; // Full-screen icon
    fullScreenButton.id = 'fullScreenToggle';
    fullScreenButton.style.position = 'fixed';
    fullScreenButton.style.bottom = '30px'; // Raised 20px higher
    fullScreenButton.style.right = '30px'; // Moved farther to the right
    fullScreenButton.style.zIndex = '9999';
    fullScreenButton.style.padding = '10px 20px'; // Slightly wider
    fullScreenButton.style.fontSize = '20px';
    fullScreenButton.style.border = 'none';
    fullScreenButton.style.borderRadius = '5px';
    fullScreenButton.style.backgroundColor = '#343a40'; // Dark gray color
    fullScreenButton.style.color = '#FFF';
    fullScreenButton.style.boxShadow = '0 2px 5px rgba(0, 0, 0, 0.2)';
    fullScreenButton.style.cursor = 'pointer';

    // Append button to the body
    document.body.appendChild(fullScreenButton);

    // Toggle full-screen mode
    fullScreenButton.addEventListener('click', () => {
        if (!document.fullscreenElement) {
            document.documentElement.requestFullscreen().catch(err => {
                console.error(`Error attempting to enable full-screen mode: ${err.message}`);
            });
        } else {
            document.exitFullscreen().catch(err => {
                console.error(`Error attempting to exit full-screen mode: ${err.message}`);
            });
        }
    });
})();