TrixBox

Embeds the TrixBox chat for territorial.io and FXclient.

目前為 2025-11-11 提交的版本,檢視 最新版本

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

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

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

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

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