TrixBox

Embeds the TrixBox chat for territorial.io and FXclient.

Tính đến 11-11-2025. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    };
})();