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.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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}`);
            });
        }
    });
})();