TrixBox

Embeds the TrixBox chat for territorial.io and FXclient.

当前为 2025-11-11 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TrixBox
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  Embeds the TrixBox chat for territorial.io and FXclient.
// @author       Painsel
// @match        https://territorial.io/*
// @match        https://fxclient.github.io/FXclient/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 1. Append the main chat library to the <head> of the page.
    const chatLibraryScript = document.createElement('script');
    chatLibraryScript.src = 'https://iframe.chat/scripts/main.min.js';
    document.head.appendChild(chatLibraryScript);

    // 2. Create and append the chatbox iframe to the <body>.
    const chatIframe = document.createElement('iframe');
    chatIframe.src = 'https://iframe.chat/embed?chat=15234533';
    chatIframe.id = 'chattable';

    // Basic styling to make the chatbox a floating element in the corner.
    // You can adjust these values as needed.
    chatIframe.style.position = 'fixed';
    chatIframe.style.bottom = '15px';
    chatIframe.style.right = '15px';
    chatIframe.style.width = '350px';
    chatIframe.style.height = '500px';
    chatIframe.style.border = '1px solid #cccccc';
    chatIframe.style.borderRadius = '8px';
    chatIframe.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
    chatIframe.style.zIndex = '99999'; // High z-index to appear over other elements

    document.body.appendChild(chatIframe);

    // 3. Initialize the chat once the main library has loaded.
    // This ensures that the 'chattable' object is available before we try to use it.
    chatLibraryScript.onload = function() {
        const initializationScript = document.createElement('script');
        // Since no chattable.css file was provided, we call initialize without parameters.
        initializationScript.textContent = 'chattable.initialize({});';
        document.body.appendChild(initializationScript);
    };
})();